

function mss_ajax_load_photo(id,url)
{
	window.location.hash = "#"+id;

	var url = "/index_ajax_photo_content.php?mode=photos&" + url;

	mss_ajax({url:url,params:{mss_ajax_photo_content:1},printstatus_mode:2,statuscontainer:"mss_ajax_status_container",callback:mss_ajax_load_photo_done});
}


function mss_ajax_load_photo_done(data)
{
	var error = null;
	var success = null;
	var response = null;
	var bigphoto_url = "";

	eval(data);

	if (response) response = response.replace(/&bs;n/g,"\n").replace(/&bs;t/g,"\t").replace(/&bs;r/g,"\r");

	if (bigphoto_url.length > 0)
	{
		var status = document.getElementById("mss_ajax_status_container");
		status.innerHTML = "<span class='mss_ajax_status_short'><span class='loading'></span></span>";

		var img = new Image();

		img.onload = function()
		{
			var div = document.getElementById("mss_ajax_photo_content");
			div.innerHTML = response;
			status.innerHTML = "<span class='mss_ajax_status_short'><span class='success'></span></span>";

			if (typeof mss_basket_init == "function") { mss_basket_init() };
			if (typeof slideshow_initialize == "function") { slideshow_initialize() };
			if (typeof VK_make_like == "function") { VK_make_like(); };
		}

		img.src = bigphoto_url;
	}
	else
	{
		var div = document.getElementById("mss_ajax_photo_content");
		div.innerHTML = response;
		
		if (typeof mss_basket_init == "function") { mss_basket_init() };
		if (typeof slideshow_initialize == "function") { slideshow_initialize() };
		if (typeof VK_make_like == "function") { VK_make_like(); };
	}
}


function mss_ajax_load_photo_initialize()
{
	var id = parseInt(window.location.hash.substr(1));
	if (id > 0)
	{   
		var url = window.location.toString();
		if (url.indexOf("sphoto") != -1 || url.indexOf("sph") != -1 || url.indexOf("slideshow") != -1 || url.indexOf("slph") != -1)
		{
			mss_ajax_load_photo(id,"sph="+id);
		}
		else
		{
			mss_ajax_load_photo(id,"ph="+id);
		}
	}
}



