document.ondragstart = del_xunc;
document.onselectstart = del_xunc;
document.oncontextmenu = del_xunc;
function del_xunc() {
return false
}

$(window).load(function(){
	update();
	$("#tabs li").click(function(){
		//$("#tabs .current").liquidCanvas("[fill{color:#fff} border{color:#fff; width:1}] => roundedTConers{radius:5}");
		$("#tabs li").removeClass('current');
		
		//$("#tabs").find('.current').removeClass('current');
		$(this).addClass('current');
		GetPage($(this).index('#tabs li'),pid);
	});
	
});

$(document).ready(function(){
	/*Скрывающееся подменю слайдера*/
    if(typeof current_subcat === "undefined") {current_subcat=0;}
	$(".sub_nav").hide();
	$("#sub_nav_"+current_subcat).show();
	$("#sliderMenu li a").mouseover(function(){
			var index=$(this).index('#sliderMenu li a');
			$(".sub_nav").hide();
			$("#sub_nav_"+index).show();
		});
	
	/*превью на странице товара*/
	$(".imgBox").click(function(){
		//alert($(this).index('.imgBox'));
		$("#big_photo img").attr('src','img/tov'+$(this).index('.imgBox')+'.jpg');
		});	
	});

function GetPage(id,pid)
{
	$.get("ajax/index.php", {getpage:id, id:pid},
   function(data){
     //alert("Data Loaded: " + data);
	 document.getElementById("TX").innerHTML = data;
	 update();
   })
   dataType: ($.browser.msie) ? "text" : "xml";

}

function update(){
$("#filter_form, #pageSwitcher1, .attantion")
	.css({border:"none"})
	.css({background:"none"});

	$("#filter_form, #pageSwitcher1, .attantion").liquidCanvas("[fill{color:#f0f0f0} border{color:#dfdfdf; width:1}] => roundedRect{radius:5}");

	$("#add_comment .bordered, #add_comment textarea, #add_question textarea,  .FAQ ").css({border:"none"});
	$("#add_comment .bordered, #add_comment textarea, #add_question textarea").liquidCanvas("[fill{color:#fff} border{color:#dfdfdf; width:1}] => roundedRect{radius:5}");
	
	$(".FAQ").liquidCanvas("[border{color:#dfdfdf; width:1}] => roundedRect{radius:5}");
	
	
	var ua = navigator.userAgent.toLowerCase();
 	// Gecko = Mozilla + Firefox + Netscape
 	if (ua.indexOf("firefox") != -1) {
  		$("#tabs .current").css({marginBottom:"-2px"});
 	} else {$("#tabs .current").css({marginBottom:"-0px"});}
	
	//$("#tabs .current").css({border:"none"});
	//$("#tabs .current").liquidCanvas("[fill{color:#fff} border{color:#dfdfdf; width:1}] => roundedTConers{radius:5}");
	//$("#tabs .current").liquidCanvas("[border{color:#dfdfdf; width:1}] => roundedTConers{radius:5}");
	
	$('#setRatStar').mousemove(function(e){
		setRating(e);
	});
	$('#setRatStar img').click(function(){
		document.getElementById('rating').value=document.getElementById('tmp_rating').value;
		//alert(document.getElementById('rating').value);
	});
}

function setRating(e){
	//координаты мыши
	e = e || window.event ;
	if (e.pageX == null && e.clientX != null ) {  
	    var html = document.documentElement 
       	var body = document.body 
      
        e.pageX = e.clientX + (html && html.scrollLeft || body && body.scrollLeft || 0) - (html.clientLeft || 0) ;
	    e.pageY = e.clientY + (html && html.scrollTop || body && body.scrollTop || 0) - (html.clientTop || 0) ;
	} 
  
  
		/*Пояснения к шкале*/
		var setRatingDesc=new Array('отвратительно', 'неудовлетворительно', 'можно и лучше', 'хорошо', 'очень хорошо');
		
		/*размер шкалы*/
		var starsW=document.getElementById('setRatStar').offsetWidth;
		
		//размер (ширина) одного делени (звезды и т.п.) шкалы (определяем по рисунку)
      	var step=Math.round(starsW/(setRatingDesc.length-1));
		
		/*Начальная позиция шкалы от левой стороны экрана*/
		var starsWpos = document.getElementById('setRatStar').offsetLeft;
		
		//Рассчёт процента смещения
		var maxPos=starsWpos+starsW;
		var percent=Math.round((e.pageX-starsWpos)*100/starsW);
			if (percent<=5){
			document.getElementById('setRatingDesc').innerHTML=setRatingDesc[0];
			document.getElementById('setRatStar').style.backgroundPosition=(100-0)+'% '+'center';
			document.getElementById('tmp_rating').value=0;
			}
		if  ((percent>5) &&(percent<=20)){
			document.getElementById('setRatingDesc').innerHTML=setRatingDesc[1];
			document.getElementById('setRatStar').style.backgroundPosition=(100-20)+'% '+'center';
			document.getElementById('tmp_rating').value=1;
			}
		if  ((percent>20) &&(percent<=40)){
			document.getElementById('setRatingDesc').innerHTML=setRatingDesc[2];
			document.getElementById('setRatStar').style.backgroundPosition=(100-40)+'% '+'center';
			document.getElementById('tmp_rating').value=2;
			}
		if  ((percent>40) &&(percent<=60)){
			document.getElementById('setRatingDesc').innerHTML=setRatingDesc[2];
			document.getElementById('setRatStar').style.backgroundPosition=(100-60)+'% '+'center';
			document.getElementById('tmp_rating').value=3;
			}
		if  ((percent>60) &&(percent<=80)){
			document.getElementById('setRatingDesc').innerHTML=setRatingDesc[3];
			document.getElementById('setRatStar').style.backgroundPosition=(100-80)+'% '+'center';
			document.getElementById('tmp_rating').value=4;
			}
		if  (percent>80){
			document.getElementById('setRatingDesc').innerHTML=setRatingDesc[4];
			document.getElementById('setRatStar').style.backgroundPosition=(100-100)+'% '+'center';
			document.getElementById('tmp_rating').value=5;
			}
		//document.getElementById('min').innerHTML=percent;
		//document.getElementById('pl').innerHTML=e.pageX;
}
