var curl = "";$(document).ready(function() {	curl = new String(window.location);	curl = decodeURI(curl).split("+").join(" ");	//Для разных страниц разные настройки	if (inURL("services")) {		activeTop(0);		$("div.titlePage").hide();	} else if (inURL("about")) {		activeTop(2);		$("div.titlePage").hide();	} else if (inURL("contacts")) {		activeTop(3);		$("div.titlePage").hide();	} else if (inURL("catalog")) {		$("#cat_path").hide();		$("#cat_advproduct_search").hide();	} else if (inURL("articles") && (level() > 1)) {		$("#subcat").html("<a href='/articles/'>Статьи и публикации</a>");		if (inURL("info") && (level() > 2)) {			$("#subcat a").append("<img src='/published/publicdata/PROJECTSFLORK/attachments/SC/themes/shopping/images/title_devider.gif'><a href='/articles/info/'>Разное</a>");		} else if (inURL("useful") && (level() > 2)) {			$("#subcat a").append("<img src='/published/publicdata/PROJECTSFLORK/attachments/SC/themes/shopping/images/title_devider.gif'><a href='/articles/useful/'>Полезные советы</a>");		} else if (inURL("biography") && (level() > 2)) {			$("#subcat a").append("<img src='/published/publicdata/PROJECTSFLORK/attachments/SC/themes/shopping/images/title_devider.gif'><a href='/articles/biography/'>Биография цветов</a>");		} else if (inURL("wedding") && (level() > 2)) {			$("#subcat a").append("<img src='/published/publicdata/PROJECTSFLORK/attachments/SC/themes/shopping/images/title_devider.gif'><a href='/articles/wedding/'>Свадьба</a>");		} else if (inURL("holidays") && (level() > 2)) {			$("#subcat a").append("<img src='/published/publicdata/PROJECTSFLORK/attachments/SC/themes/shopping/images/title_devider.gif'><a href='/articles/holidays/'>Праздники</a>");		} else if (inURL("floristic") && (level() > 2)) {			$("#subcat a").append("<img src='/published/publicdata/PROJECTSFLORK/attachments/SC/themes/shopping/images/title_devider.gif'><a href='/articles/floristic/'>Флористика</a>");		} else if (inURL("pot_plants") && (level() > 2)) {			$("#subcat a").append("<img src='/published/publicdata/PROJECTSFLORK/attachments/SC/themes/shopping/images/title_devider.gif'><a href='/articles/pot_plants/'>Комнатные растения</a>");		} else if (inURL("delivery_flowers") && (level() > 2)) {			$("#subcat a").append("<img src='/published/publicdata/PROJECTSFLORK/attachments/SC/themes/shopping/images/title_devider.gif'><a href='/articles/delivery_flowers/'>Доставка цветов</a>");		}	}	if (inURL("items")) {		createNavigation();		if (inURL("#")) {			var page = window.location.hash.split("#")[1];			eval($("#page_"+page).attr("href"));		}	}	formBreadcrumbs();});function createNavigation() {	var count = 0;	var pages = 1;	var tmp = "";	var total_prods = 0;	$(".product_list li").each(function(index) {		total_prods++;	});	$(".product_list li").each(function(index) {		if (index >= 30) {			$(this).hide();		}		if ((index % 30 == 0) && (index != 0)) {			pages++;			tmp += '<a id="page_' + pages + '" class="off no_underline" href="javascript: setPage(' + ((pages-1)*30) + ','+ pages +',' + total_prods + ')">' + pages + '</a>';			//tmp += '<a id="page_' + pages + '" class="off no_underline" href="javascript: addHash(' + pages +')">' + pages + '</a>';		}		count++;	});	if (pages > 1) {	tmp = '<font id="page_1" class="on faq">1</font>' + tmp + '<a id="page_-1" class="off no_underline" href="javascript: showAll(' + total_prods +');">все</a>';	//alert(count + " " + pages);	$("#list_text").append('<table style="width: 100%; height: 50px; margin-top:10px; border-top: solid 1px #ebdbe1;" class="pager"><tbody><tr><td style=""><div><span style="float: left; padding-right: 4px; font-size:14px;">Страницы:</span><span id="sps"></span></div></td></tr></tbody></table>');	$("#sps").html(tmp);	$("#list_text_2").append('<table style="width: 100%; height: 50px; margin-top:10px; border-top: solid 1px #ebdbe1;" class="pager"><tbody><tr><td style=""><div><span style="float: left; padding-right: 4px; font-size:14px;">Страницы:</span><span id="sps_2"></span></div></td></tr></tbody></table>');	$("#sps_2").html(tmp);	}}function addHash(page) {	location.href = curl.split("#")[0] + "#" + page;}function showAll(prods) {	//$('.product_list li').show();	setPage(-1,-1,prods);}function setPage(offset,page,prods) {	addHash(page);	if (page == "-1")		$('.product_list li').show();	$(".product_list li").each(function(index) {		if ((index >= offset) && (index < (offset+30)) || (offset == -1)) {			$(this).show();		} else {			$(this).hide();		}	});	$("span#sps").html("");	var tmp = '';	for (var i=1; i <= Math.ceil(prods/30); i++) {		console.log(i + " " + page);		if (page != i) {			tmp += '<a id="page_' + i + '" class="off no_underline" href="javascript: setPage(' + ((i-1)*30) + ',' + i + ',' + prods + ')">' + i + '</a>';		} else {			tmp += '<font id="page_' + i + '" class="on faq">' + i + '</font>';		}	}	if (offset != -1) {		tmp += '<a id="page_-1" class="off no_underline" href="javascript: showAll('+ prods +');">все</a>';	} else {		tmp += '<font id="page_-1" class="on faq">все</font>';	}	$("span#sps").html(tmp);	$("span#sps_2").html(tmp);	window.scrollTo(0,0);}function mainMenu(path,ident) {	if(ident==0) 		path.src='/published/publicdata/PROJECTSFLORK/attachments/SC/images/mmenu/'+path.id+'a.gif';	else 		path.src='/published/publicdata/PROJECTSFLORK/attachments/SC/images/mmenu/'+path.id+'b.gif';} function activeTop(num) {	$("#top_menu li").each(function(index) {		if (index == num) {			$("img",this).attr("src","/published/publicdata/PROJECTSFLORK/attachments/SC/images/mmenu/"+(num+1)+"b.gif");			$("img",this).attr("onmouseover","");			$("img",this).attr("onmouseout","");		}	});}function formBreadcrumbs() {	if (level() == 1)		$("#first_divider").hide();		if ($("#subcat").length) {	if ($("#subcat").html().length > 0) {		var id = $("#subcat").html();		$("#container_left_sidebar ul li").each(function(index) {			if ($("a",this).attr("href").split("category=")[1] == id) {				$("#subcat").html($(this).html());				$(this).addClass("active");			}		});				$("#subcat").html();	}	}}function level() {	var arr = new Array();	var link = curl.split("//")[1] + "end";	arr = link.split("/");	var lev = arr.length-1;	if (arr[lev] == "end")		lev--;	return lev;}function inURL(part) {	if (curl.indexOf(part) > -1)		return true;	else		return false;}var sW,sH,cH;var reloadPage=true;/* Overlay layer PNG */function overlayClose() {	//Пряем таблицу с PNG	document.getElementById('overlay').style.display = 'none';	document.getElementById('overlayTable').style.display = 'none';	preloader(false); //Активизруем прелоадер снова и выгружаем iframe...	reloadPage=true;	return false;}function overlayLoad(source) {	sW = document.body.scrollWidth; //Ширина скролинга	sH = document.body.scrollHeight; //Высота скролинга	cH = document.body.clientHeight; //Высота окна (не страницы!)	//alert(sH);	//Растягиваем и показываем слой PNG	document.getElementById('overlay').style.width = '100%';	$("#overlay").css("height", sH + "px");	document.getElementById('overlay').style.display = 'block';	//Показываем таблицу	document.getElementById('preloader').style.display = 'block';	//Ставим временные отступы для прелоадера	document.getElementById('preloader').style.top = ((cH-50)/2)+(document.body.scrollTop);	document.getElementById('preloader').style.left = (sW-150)/2;	document.getElementById('overlayIframe').src=source;	document.getElementById('overlayTable').style.width = 150;	preloader(true,500,410);	return false;}/* Iframe preloader */function preloader(what,iframeW,iframeH) {	if(reloadPage==true) {	resizeTrue=false;//Разрешаем выполнение функции resize	document.getElementById('resize').style.display='block'; //Показываем линк на resize;		if(what==true) {		//Выставляем ширину и высоту для iframe переданные из загруженного iframe;		document.getElementById('overlayIframe').style.width = iframeW + "px";		document.getElementById('overlayIframe').style.height = iframeH + "px";		//Центруем таблицу с iframe		var iframeWs=(sW-iframeW)/2;		var iframeHs=(($(window).height()-iframeH)/2)+(document.body.scrollTop-20);				document.getElementById('overlayTable').style.left = ((iframeWs<=0) ? 0 : iframeWs) + "px";		document.getElementById('overlayTable').style.top = ((iframeHs<=0) ? 0 : iframeHs) + "px";		document.getElementById('preloader').style.display='none'; //Прячем картинку прелоадера		document.getElementById('overlayTable').style.display='block';		document.getElementById('overlayIframe').style.display = 'block'; //Загружаем iframe...		reloadPage=false;	} else {		document.getElementById('preloader').style.display='block';		document.getElementById('overlayIframe').style.display = 'none'; //Прячем iframe...		document.getElementById('overlayIframe').src = ''; //Выгружаем iframe...	}}	return false;}var resizeTrue=true;var iframeHeight;var iframeTop;function overlayResize() {	setTimeout("beginResize()",100);	document.getElementById('resize').style.display='none';//Прячем линк на resize;}function beginResize() {	iframeHeight=parseInt(document.getElementById('overlayIframe').style.height)+35;//Переводим в цифры	iframeTop=parseInt(document.getElementById('overlayTable').style.top);//Переводим в цифры	if(iframeHeight<=document.body.clientHeight-80 && resizeTrue==true) {	  iframeTop=((document.body.clientHeight-iframeHeight)/2)+(document.body.scrollTop-25);	  document.getElementById('overlayIframe').style.height= iframeHeight+'px';	  document.getElementById('overlayTable').style.top=iframeTop + "px";	  overlayResize();	}	}function sendMessageMail(){	$("#errorAE").hide();	$("#err01").hide();	$("#err02").hide();	$("#err03").hide();	if ($("#iae1").val() == "") {		$("#errorAE").show();		$("#err01").show();	} else if (($("#iae2").val() == "") || ($("#iae2").val().indexOf('@') == -1) || ($("#iae2").val().split(".").length != 2)) {		$("#errorAE").show();		$("#err02").show();	} else if ($("#iae3").val() == "") {		$("#errorAE").show();		$("#err03").show();	} else {		keys = "name=" + encodeURIComponent($("#iae1").val()) + "&mail=" + $("#iae2").val() + "&message=" +  encodeURIComponent($("#iae3").val());		$.ajax({			url: '/send.php',			type: "GET",			data: keys,			cache: false,			success: function(result) {				$("#myForm").hide();				$("#success").show();			}		});	}}
