var ismenuopen=false;var menuTimer;function hideinnermenus(){	$(".innermenu").hide();	//$(".topmenuelement").css("background-image","url(/images/top_menu_item_bg.gif)");ismenuopen=false;}function showinnermenus(jqThis){	$(".innermenu").hide();	//$(".topmenuelement").css("background-image","url(/images/top_menu_item_bg.gif)");	//$(jqThis).css("background-image","url(/images/top_menu_item_bg2.gif)");	var left=$(jqThis).offset().left;	var mleft = left;	var mright = left+$(jqThis).width();	var id=$(jqThis).attr("id").substr(1);	var screenWidth = $(document).width();	var width=$("#innermenu"+id).width();	left = screenWidth / 2 - width/2;	var right = left + width;	if(right<mright)	{		left +=mright-right-5;	}	if(left>mleft)	{		left =mleft+1;	}	$("#innermenu"+id).css("left",left+"px").show();	ismenuopen=true;}$(document).ready(function() {	//$(".innermenu").css("left",$("#topmenuitems").offset().left);	$(".innermenu").hover(function(){clearInterval(menuTimer);},function(){menuTimer = setTimeout(hideinnermenus,500);});	$("#showallaccessories").click(function(){ $("#accessories").removeClass("OneLineShow");$(this).hide();return false;});	$(".topmenuelement").hover(			function(){				jqThis = this;				if(ismenuopen)				{					clearInterval(menuTimer);					showinnermenus(jqThis);				}				else				{					clearInterval(menuTimer);					menuTimer = setTimeout(function(){showinnermenus(jqThis);},400);				}			},			function(){				clearInterval(menuTimer);				menuTimer = setTimeout(hideinnermenus,500);				//$(".innermenu").hide();			}		);	$("#fulllist span").click(function(){		$(".subList").slideDown(500);		$(".mainCat").addClass("open");	});	$(".mainCat a").click(function(){		$(".submenu"+$(this).attr("href").substr(1)).slideToggle(500);		$(this).parent().toggleClass("open");		return false;	});	$("#showList").click(function(){		$("img",this).attr("src","/images/style_list.gif");		$("#showCells img").attr("src","/images/style_cells1.gif");		$("#itemsBlock").removeClass("itemCells").addClass("itemList");		$.cookie("showStyle", "list", {path: "/"});		//$("div[id^='desc']").css({"height": "100%"});		return false;	});	$("#showCells").click(function(){		$("img",this).attr("src","/images/style_cells.gif");		$("#showList img").attr("src","/images/style_list1.gif");		$("#itemsBlock").removeClass("itemList").addClass("itemCells");		$.cookie("showStyle", "cells", {path: "/"});		height = $.cookie("text_height");		$("div[id^='desc']").css({"height": height+"px"});		return false;	});	$("#searchfield").autocomplete({		source: "/scripts/searchavto.php",		minLength: 2,		select: function(event, ui) {			document.location.href=ui.item.id;		}	});	$("#login").click(function(){		$(this).hide();		$("#loginform").fadeIn("slow");		return false;	});	$(".productmenu a").click(function(){		$(".productmenu a").removeClass("sel");		$(this).addClass("sel");		$(".product_block").hide();		$($(this).attr("href")).show();		return false;	});	$("#showcart").click(function(){		if($("#cartDiv").css("display")=="none")		{			openCart();		}		else		{			closeCart();		}	});	$("#courseSelect").change(function(){		var course = $(this).val().split("|");		var newcourse = parseFloat(course[0]);		currentCourse = parseFloat(course[0]);		currentCourseSign = course[1];		var price = cartSumm * newcourse;		price = Math.ceil(Math.round(price*100)/100);		/*if(price>100)			price = Math.ceil(Math.round(price*100)/100);		else			price = Math.round(price*100)/100;*/		//$.cookie("payment", course[2]);		$.cookie("payment", course[2], {path: "/"});		$("#cartSumm").html(price);		$("#courseSign").html(course[1]);		$(".cSign").html(currentCourseSign);		$("#selection .items").change();	});	$("#courseSelect").change();	$("#cartDiv").hover(		      function () {		    	  	clearTimeout(hideTimerId);		        },		        function () {		        	hideTimerId = setTimeout('closeCart()', hiteTimeOut);		        }		      );	$("#arrow_right").hover(	      	function () {	      		scrollSpeed=4;	      		scrollTimerId = setInterval('$("#orderlist").scrollLeft($("#orderlist").scrollLeft()+scrollSpeed)',scrollTimeOut);	        },	        function () {	        	clearTimeout(scrollTimerId);	        }	      );	$("#arrow_left").hover(	      	function () {	      		scrollSpeed=-4;	      		scrollTimerId = setInterval('$("#orderlist").scrollLeft($("#orderlist").scrollLeft()+scrollSpeed)',scrollTimeOut);	        },	        function () {	        	clearTimeout(scrollTimerId);	        }	      );	var ind = location.href.indexOf("#");	if(ind)	{		blockid = location.href.substr(ind);		$(".productmenu a[href="+blockid+"]").click();	}	//$('div.gallery a').click(function(){alert('s'); return false});	$(".gallery img").hover(		      function () {		          $(this).css("border-color","#cd221b");		        },		        function () {		          $(this).css("border-color","#bfbebe");		        }		      );	$("#recall").click(function(){		$("#recall_form").toggle();		$("#uplayer").toggle();		$("#uplayer").height($(document).height());		return false;	});	$("#uplayer, #close_recall").click(function(){		$("#recall_form").toggle();		$("#uplayer").toggle();		$("#uplayer").height(0);		return false;	});	$("#notice").click(function(){		item_id = $(this).attr('rel');		user_id = $(this).attr('rel2');		$.get("/scripts/notice.php?item_id="+item_id+"&user_id="+user_id,{}, function(data){            	//	        }, 'text');		$(this).fadeOut();		return false;	});	$("a[id^='comparsion_']").click(function(){		item_id= $(this).attr('rel');		cat_id= $(this).attr('rel2');		$(this).hide();		$.get("/scripts/comparsion.php?item_id="+item_id+"&cat_id="+cat_id,{}, function(data){			  $("#num_comparsion").html('('+data+')');             if(parseInt(data)>0)             	$("#link_comparsion").show();             else             	$("#link_comparsion").hide();	        }, 'text');        $("#comparsionspan_"+item_id).show();		return false;	});	$("a[id^='comparsiondel_']").click(function(){		item_id= $(this).attr('rel');		 $("#comparsionspan_"+item_id).hide();		$.get("/scripts/comparsion.php?item_id="+item_id+"&delete=1&ajax=1",{}, function(data){			 $("#num_comparsion").html('('+data+')');             if(parseInt(data)>0)             	$("#link_comparsion").show();             else             	$("#link_comparsion").hide();	        }, 'text');        $("#comparsion_"+item_id).show();		return false;	});    $("#searchfield").focus();    $("#show_inspector").click(function(){    	 $("#inspector").slideToggle();    	 return false;    });    /*$('#registUserForm').submit(function(){    	if(!$("#is_confirm").attr('checked')){    		alert('Согласитесь с правилами использования магазина');    		return false;    	}    	else if(!$("input[name='email']")){    		alert('Введите email');    		return false;    	}    	else    		$('#registUserForm').submit();    });*/});var hideTimerId;var hiteTimeOut = 1500;var scrollTimerId;var scrollTimeOut = 10;var scrollSpeed= 1;function openCart(){	if($("#cartDiv").css("display")=="none")	{		var cartOff = $("#cart").offset();		$("#cartDiv").css("top",cartOff.top).css("left",cartOff.left-$("#cartDiv").width()-25).fadeIn(500);	}}function closeCart(){	$("#cartDiv").fadeOut(400);}function openCat(id){	//$(".subCat"+id).parents(".subList").show().get(0).attr("id").substr(7);	$(".submenu"+id).show();	$(".subCat"+id).parents(".subList").show();	$(".subCat"+id).parents(".subList").each(function(){		$(".mainCat"+$(this).attr("id").substr(7)).addClass("open");	});}function addToCart(item, is_action){	clearTimeout(hideTimerId);	itemcount = parseInt($("#count"+item+" input[name='count']").val());	$("#cart").show();	if(isNaN(itemcount)&&(itemcount>0))	{		$("#count"+item+" input[name='count']").val("").focus();	}	else	{		$("#count"+item+" input").attr("disabled",true);		if (typeof is_action == "undefined") is_action = 0;		$.getJSON("/scripts/cart.php?act=add&item="+item+"&count="+itemcount+"&is_action="+is_action,	        function(data){				if(data.status==1)				{					cartItemCount+=data.count;					var n = data.count;					var cartOff = $("#cart").offset();					$("#cartDiv").css("top",cartOff.top)									.css("left",cartOff.left-$("#cartDiv").width()-25)									//.fadeIn(500,function(){												while(n--)												{													$("#orderlistinner").prepend('<td><div class="cartItem cartItem'+data.item.id+'_'+cartItemCount+'">'+														(data.item.img?'<img src="/images/items/small/'+data.item.img+'" width="50" height="50" vspace="10" hspace="4" align="left">':'<img src="/images/noimage.jpg" width="50" height="50" vspace="10" hspace="4" align="left">')+														'<div class="title"><a href="/product/'+data.item.id+'/">'+data.item.title+'</a></div>'+														'<div class="price">'+data.item.price+' $</div>'+														'<div onClick="deleteFromCart('+data.item.id+','+cartItemCount+')" class="delete"><img src="/images/del.jpg" border="0"></div>'+													'</div></td>');												}												hideTimerId = setTimeout('closeCart()', hiteTimeOut);												cartSumm=data.summ;												$("#cartSumm").html(data.summ);												$("#courseSelect").change();												//$("#courseSelect option[value$='грн|2']:first").attr("selected",true);									//});					$("#count"+item+" input").removeAttr("disabled");					$("#button"+item).show();					$("#count"+item).hide();					$("#count_basket").html(cartItemCount); //data.counti				}	        });	}	return false;}function showCount(item){	$("#button"+item).hide();	$("#count"+item).show().children("[name=count]").focus().select();}function deleteFromCart(item,index){	$.getJSON("/scripts/cart.php?act=del&item="+item,	        function(data){				if(data.status==1)				{					$(".cartItem"+item+"_"+index).fadeOut(400,function(){$(".cartItem"+item+"_"+index).remove();});					$("#cartSumm").html(data.summ);					cartSumm=data.summ;					$("#courseSelect").change();					if(data.summ==0)						$("#cart").hide();				}	        });	return false;}function changeNumbers(newnum){	$.cookie("num", newnum, {path: "/"});	/*$.cookie("num", newnum, {		expires: 500,		path: "/",		domain: "net-shop.com.ua"		});*/	window.location.reload();	return false;}function changeSort(newsort){	$.cookie("sort", newsort, {path: "/"});	window.location.reload();	return false;}function changeStore(newsort){	$.cookie("store", newsort, {path: "/"});	window.location.reload();	return false;}function Stars(mark){	for(var i=1;i<11;i++){		if(i<=mark)			$("#"+i).attr('class', 'star_full');		else			$("#"+i).attr('class', 'star_empty');	}}function Refresh_stars(rating){	for(var i=1;i<11;i++){		if(i<=rating)			$("#"+i).attr('class', 'star_full');		else			$("#"+i).attr('class', 'star_empty');	}}function SendRate(mark, item_id, user_id){	$("#mark").val(mark);	document.voting_form.submit();}function hidePhoto(flag){	$.cookie("images", flag, {path: "/"});	window.location.reload();	return false;}function showKey(e){        var key;        if (window.event){            key=window.event.keyCode;            if(window.event.ctrlKey && key==88){        			$("#error_form").show();					$("#uplayer").show();					$("#uplayer").height($(document).height());					txt = getSelText();					$("#error").html(""+txt+"");					$("#error_input").val(""+txt+"")        	}        }        else{              key=e.keyCode;              if(e.ctrlKey && key==88){        			$("#error_form").show();					$("#uplayer").show();					$("#uplayer").height($(document).height());					txt = getSelText();					$("#error").html(""+txt+"");					$("#error_input").val(""+txt+"")        	}        } }window.onload=function(){       document.onkeydown=showKey;}function getSelText(){        var txt = '';        if (window.getSelection){                txt = window.getSelection();        }else if (document.getSelection){                txt = document.getSelection();        }else if (document.selection){                txt = document.selection.createRange().text;        }        return txt;}
