// Dummy JS object to hold language strings.
var lang = {
};

// country drop_nav
$(document).ready(function() {
	$(".top_ifo > ul > li[class='change_menu']").hover(function() {
		$(this).addClass("active").find("ul").show();
	},function() {
		$(this).removeClass("active").find("ul").hide();
	});

});

// menu drop_nav
$(document).ready(function() {
	$(".menu > ul > li[class='menu_sub']").hover(function() {
		$(this).addClass("nav_active").find(".drop_div").show();
	},function() {
		$(this).removeClass("nav_active").find(".drop_div").hide();
	});

});

// index Feature Products_scrool
$(document).ready(function() {
    var page = 1;
    var i = 4;
    $("span.next").click(function(){ 
	     var $parent = $(this).parents("div.fp_div");
		 var $v_show = $parent.find("div.content_list");
		 var $v_content = $parent.find("div.fp_content"); 
		 var v_width = $v_content.width() ;
		 var len = $v_show.find("li").length;
		 var page_count = Math.ceil(len / i) ; 
		 if( !$v_show.is(":animated") ){ 
			  if( page == page_count ){  
				$v_show.animate({ left : '0px'}, "slow"); 
				page = 1;
				}else{
				$v_show.animate({ left : '-='+v_width }, "slow"); 
				page++;
			 }
		 }
		 $parent.find("span").eq((page-1)).addClass("current").siblings().removeClass("current");
   });

    $("span.prev").click(function(){
	     var $parent = $(this).parents("div.fp_div");
		 var $v_show = $parent.find("div.content_list");
		 var $v_content = $parent.find("div.fp_content"); 
		 var v_width = $v_content.width();
		 var len = $v_show.find("li").length;
		 var page_count = Math.ceil(len / i) ; 
		 if( !$v_show.is(":animated") ){
		 	 if( page == 1 ){ 
				$v_show.animate({ left : '-='+v_width*(page_count-1) }, "slow");
				page = page_count;
			}else{
				$v_show.animate({ left : '+='+v_width }, "slow");
				page--;
			}
		}
		$parent.find("span").eq((page-1)).addClass("current").siblings().removeClass("current");
    });
});

function remomeclass(){
var ul_name=document.getElementById("fp_list").getElementsByTagName('ul');
for (var i=0;i<ul_name.length;i++){
  var v=document.getElementsByTagName('li');
  var ii=1;
  for (var j=0;j<v.length;j++){
    if (v[j].parentNode==ul_name[i]){
      if (ii++%4==0){
        v[j].className="nomar_linst";
      }
      else{
        v[j].className="";
      }
    }
  }
}
}

// sub left_nav
$(document).ready(function(){
	$("#drop_left_id h3").click(function(){
		$(this).toggleClass("bottomIco_id")
			   .next().slideToggle(300).siblings("ul").slideUp("slow");
;
		$(this).siblings("h3").removeClass("bottomIco_id");
	});
});

$(document).ready(function(){
	$("#drop_left h3").click(function(){
		$(this).toggleClass("bottomIco")
			   .next().slideToggle(300)
			   .siblings("ul").slideUp("slow");
		$(this).siblings("h3").removeClass("bottomIco");
	});
});

// Return Top
var scrolltotop={
	setting: {startline:100, scrollto: 0, scrollduration:0, fadeduration:[500, 100]},
	controlHTML: '<img src="/images/top.gif" />', // HTML for control, which
													// is auto wrapped in DIV w/
													// ID="topcontrol"
	controlattrs: {offsetx:5, offsety:5}, // offset of control relative to
											// right/ bottom of window corner
	anchorkeyword: '#top', // Enter href value of HTML anchors on the page that
							// should also act as "Scroll Up" links

	state: {isvisible:false, shouldvisible:false},

	scrollup:function(){
		if (!this.cssfixedsupport) // if control is positioned using JavaScript
			this.$control.css({opacity:0}) // hide control immediately after
											// clicking it
		var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
		if (typeof dest=="string" && jQuery('#'+dest).length==1) // check
																	// element
																	// set by
																	// string
																	// exists
			dest=jQuery('#'+dest).offset().top
		else
			dest=0
		this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
	},

	keepfixed:function(){
		var $window=jQuery(window)
		var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
		var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
		this.$control.css({left:controlx+'px', top:controly+'px'})
	},

	togglecontrol:function(){
		var scrolltop=jQuery(window).scrollTop()
		if (!this.cssfixedsupport)
			this.keepfixed()
		this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
		if (this.state.shouldvisible && !this.state.isvisible){
			this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
			this.state.isvisible=true
		}
		else if (this.state.shouldvisible==false && this.state.isvisible){
			this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
			this.state.isvisible=false
		}
	},
	
	init:function(){
		jQuery(document).ready(function($){
			var mainobj=scrolltotop
			var iebrws=document.all
			mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest // not
																													// IE
																													// or
																													// IE7+
																													// browsers
																													// in
																													// standards
																													// mode
			mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
			mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
				.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety+300, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
				.attr({title:'Scroll Back to Top'})
				.click(function(){mainobj.scrollup(); return false})
				.appendTo('body')
			if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') // loose
																						// check
																						// for
																						// IE6
																						// and
																						// below,
																						// plus
																						// whether
																						// control
																						// contains
																						// any
																						// text
				mainobj.$control.css({width:mainobj.$control.width()}) // IE6-
																		// seems
																		// to
																		// require
																		// an
																		// explicit
																		// width
																		// on a
																		// DIV
																		// containing
																		// text
			mainobj.togglecontrol()
			$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
				mainobj.scrollup()
				return false
			})
			$(window).bind('scroll resize', function(e){
				mainobj.togglecontrol()
			})
		})
	}
}
scrolltotop.init()

// Left time
var EndDate = new Date(2011,3-1,30,00,00,00);

setInterval("ShowTime();",100);
function TimeCom(dateValue)
{
  var newCom;
  if (dateValue=="")
  {
   newCom = new Date();
  }else{
   newCom = new Date(dateValue);
  }
        this.year = newCom.getYear();
        this.month = newCom.getMonth()+1;
        this.day = newCom.getDate();
        this.hour = newCom.getHours();
        this.minute = newCom.getMinutes();
        this.second = newCom.getSeconds();
        this.msecond = newCom.getMilliseconds();
        this.week = newCom.getDay();
}
    
  function ShowTime()
  {
   var difSec=DateDiff('s',EndDate,new Date());
   var strHour=(difSec%(60*60*24)-difSec%(60*60))/(60*60);
   if(strHour<0)
   {
     strHour="00";
   }
   else if(strHour<10)
   {
    strHour="0"+strHour;
   }
   
   var strMin=(difSec%(60*60)-difSec%60)/60;
   
   if(strMin<0)
   {
     strMin="00";
   }
   else if(strMin<10)
   {
    strMin="0"+strMin;
   }
   var strSec=difSec%60;
   
   if(strSec<0)
   {
     strSec="00";
   }
   else if(strSec<10)
   {
      strSec="0"+strSec;
   }
   var strDay=(difSec-strSec-strMin*60-strHour*60*60)/(60*60*24);
   
   if(strDay<0)
   {
     strDay="00";
   }
   else if(strDay<10)
   {
      strDay="0"+strDay;
   }
   $("#divDay").html(strDay);
   $("#divHour").html(strHour);
   $("#divMin").html(strMin);
   $("#divSec").html(strSec);
  }
   
  function DateDiff(interval,date1,date2)
    {
        var TimeCom1 = new TimeCom(date1);
        var TimeCom2 = new TimeCom(date2);
        var result;
        switch(String(interval).toLowerCase())
        {
            case "y":
            case "year":
            result = TimeCom1.year-TimeCom2.year;
            break;
            case "m":
            case "month":
            result = (TimeCom1.year-TimeCom2.year)*12+(TimeCom1.month-TimeCom2.month);
            break;
            case "d":
            case "day":
            result = Math.round((Date.UTC(TimeCom1.year,TimeCom1.month-1,TimeCom1.day)-Date.UTC(TimeCom2.year,TimeCom2.month-1,TimeCom2.day))/(1000*60*60*24));
            break;
            case "h":
            case "hour":
            result = Math.round((Date.UTC(TimeCom1.year,TimeCom1.month-1,TimeCom1.day,TimeCom1.hour)-Date.UTC(TimeCom2.year,TimeCom2.month-1,TimeCom2.day,TimeCom2.hour))/(1000*60*60));
            break;
            case "min":
            case "minute":
            result = Math.round((Date.UTC(TimeCom1.year,TimeCom1.month-1,TimeCom1.day,TimeCom1.hour,TimeCom1.minute)-Date.UTC(TimeCom2.year,TimeCom2.month-1,TimeCom2.day,TimeCom2.hour,TimeCom2.minute))/(1000*60));
            break;
            case "s":
            case "second":
            result = Math.round((Date.UTC(TimeCom1.year,TimeCom1.month-1,TimeCom1.day,TimeCom1.hour,TimeCom1.minute,TimeCom1.second)-Date.UTC(TimeCom2.year,TimeCom2.month-1,TimeCom2.day,TimeCom2.hour,TimeCom2.minute,TimeCom2.second))/1000);
            break;
            case "ms":
            case "msecond":
            result = Date.UTC(TimeCom1.year,TimeCom1.month-1,TimeCom1.day,TimeCom1.hour,TimeCom1.minute,TimeCom1.second,TimeCom1.msecond)-Date.UTC(TimeCom2.year,TimeCom2.month-1,TimeCom2.day,TimeCom2.hour,TimeCom2.minute,TimeCom2.second,TimeCom1.msecond);
            break;
            case "w":
            case "week":
            result = Math.round((Date.UTC(TimeCom1.year,TimeCom1.month-1,TimeCom1.day)-Date.UTC(TimeCom2.year,TimeCom2.month-1,TimeCom2.day))/(1000*60*60*24)) % 7;
            break;
            default:
            result = "invalid";
        }
        return(result);
    }

// vote
$(function(){
    $("ul.rating li a").click(function(){
	     var title = $(this).attr("title");
		 var cl = $(this).parent().attr("class");
		 $(this).parent().parent().removeClass().addClass("rating "+cl+"star");
		 $(this).blur();
		 return false;
	}); 
}); 

$(function(){
    $(".write_btn").bind("click",function(){
		$("#writebox").show();
	}); 
}); 

// JQuery
$(document).ready(function () {
    $('#catedirectory').css({'height':'87px','overflow':'hidden'});
	$('#eventtip').click(function() {
	if($('#catedirectory').css('height')=='auto') {
	$('#catedirectory').css('height','87px');
	$('#eventtip').html('More');
	}
	else
	{
	$('#catedirectory').css('height','auto');
	$('#eventtip').html('Less');
	}
	});
});

// JQuery
$(function(){
    var page = 1;
    var i = 4; 
	var len = $(".dis_ind_tab ul li").length;
	var page_count = Math.ceil(len / i) ; 
	var none_unit_width = $(".dis_out_width").width();
	var $parent = $(".dis_ind_tab"); 

    $(".right_btn").click(function(){ 
		if( !$parent.is(":animated") ){
			if( page == page_count ){  
				$parent.animate({ left : 0}, 800);
				page = 1;
			}else{
				$parent.animate({ left : '-='+none_unit_width}, 800);
				page++;
			}
		}
   });

    $(".left_btn").click(function(){
	    if( !$parent.is(":animated") ){
			if( page == 1 ){ 
				$parent.animate({ left : '-='+none_unit_width*(page_count-1)}, 800);
				page = page_count;
			}else{
				$parent.animate({ left : '+='+none_unit_width }, 800);
				page--;
			}
		}
    });
});

// JQuery
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(5($){$.J.L=5(r){8 1={d:0,A:0,b:"h",v:"N",3:4};6(r){$.D(1,r)}8 m=9;6("h"==1.b){$(1.3).p("h",5(b){8 C=0;m.t(5(){6(!$.k(9,1)&&!$.l(9,1)){$(9).z("o")}j{6(C++>1.A){g B}}});8 w=$.M(m,5(f){g!f.e});m=$(w)})}g 9.t(5(){8 2=9;$(2).c("s",$(2).c("i"));6("h"!=1.b||$.k(2,1)||$.l(2,1)){6(1.u){$(2).c("i",1.u)}j{$(2).K("i")}2.e=B}j{2.e=x}$(2).T("o",5(){6(!9.e){$("<V />").p("X",5(){$(2).Y().c("i",$(2).c("s"))[1.v](1.Z);2.e=x}).c("i",$(2).c("s"))}});6("h"!=1.b){$(2).p(1.b,5(b){6(!2.e){$(2).z("o")}})}})};$.k=5(f,1){6(1.3===E||1.3===4){8 7=$(4).F()+$(4).O()}j{8 7=$(1.3).n().G+$(1.3).F()}g 7<=$(f).n().G-1.d};$.l=5(f,1){6(1.3===E||1.3===4){8 7=$(4).I()+$(4).U()}j{8 7=$(1.3).n().q+$(1.3).I()}g 7<=$(f).n().q-1.d};$.D($.P[\':\'],{"Q-H-7":"$.k(a, {d : 0, 3: 4})","R-H-7":"!$.k(a, {d : 0, 3: 4})","S-y-7":"$.l(a, {d : 0, 3: 4})","q-y-7":"!$.l(a, {d : 0, 3: 4})"})})(W);',62,62,'|settings|self|container|window|function|if|fold|var|this||event|attr|threshold|loaded|element|return|scroll|src|else|belowthefold|rightoffold|elements|offset|appear|bind|left|options|original|each|placeholder|effect|temp|true|of|trigger|failurelimit|false|counter|extend|undefined|height|top|the|width|fn|removeAttr|lazyload|grep|show|scrollTop|expr|below|above|right|one|scrollLeft|img|jQuery|load|hide|effectspeed'.split('|'),0,{}))

// JQuery
$(document).ready(function() {
	$("span[class='dis_drop']").hover(function() {
		$(this).addClass("dis_active").find("ul").show();
	},function() {
		$(this).removeClass("is_active").find("ul").hide();
	});

});

// JQuery
$(function(){
	$(".sizechat_con li").click(function(){
		$(this).parents("ul").siblings("strong").text( $(this).text() );
		$(this).addClass("havees");
		$(this).siblings("li").removeClass("havees"); 
	})
})

$(function(){
$(".color_outer span.color_title").hover(function(){
    $("#flag_time").val(0);
	$(this).children("ul").show();
	$(this).addClass("hover");	
}, function(){
	$("#flag_time").val(1);									 
	$(this).children("ul").hide();
	$(this).removeClass("hover");	
});

});

$(function(){
	$(".color_outer ul li").click(function(){ 
	    var imgSrc = $(this).attr("class");    
		$("#variantions_color").val( $(this).text() );
		$(this).parents("span").find("a").text($(this).text() );
		$(this).parents("span").find("a").attr("class",imgSrc);
		  
	});
});

$(function(){  
	$(".VariationSelect").attr("disabled",false);
    $(".custom_size").toggle(function(){
			$(this).addClass("custom_size_up");
			$(this).next().show();
	},function(){
			$(this).removeClass("custom_size_up");
			$(this).next().hide();

	});
})

function DisplayLogin(){
	if($("#dress-box").css("display")=="block"){
		$("#dress-box").hide("");
	}
	else{
		$("#dress-box").show("");
	}
}

$(function(){
     $("#checkbox_choice").click(function(){
			if(this.checked){			
				$("#textarea_one").hide(); 
				$("#textarea_two").show(); 
			}else{								
			    $("#textarea_one").show(); 
				$("#textarea_two").hide();  
			}
	 });
})

// Popup dialog
$(document).ready(function () {

	$('a.large_close,#dialog-overlay').click(function () {		
		$('#dialog-overlay, #dialog-box').hide();		
		return false;
	});
	$('a.submit_cancel,#dialog-overlay').click(function () {		
		$('#dialog-overlay, #dialog-box').hide();		
		return false;
	});
	$(window).resize(function () {

		if (!$('#dialog-box').is(':hidden')) popup();		
	});	
});


function popup(message) {
	var maskHeight = $(document).height();  
	var winpop_height = 650;  
	var maskWidth = $(window).width();

	var dialogTop =  (winpop_height) - ($('#dialog-box').height());  
	var dialogLeft = (maskWidth/2) - ($('#dialog-box').width()/2); 
	
	$('#dialog-overlay').css({height:maskHeight, width:maskWidth}).show();
	$('#dialog-box').css({top:dialogTop, left:dialogLeft}).show();
	
	$('#dialog-message').html(message);
			
}
// Set num
var setAmount={
	min:1,
	max:30,
	reg:function(x){
		return new RegExp("^[1-9]\\d*$").test(x);
	},
	amount:function(obj,mode){
		var x=$(obj).val();
		if (this.reg(x)){
			if (mode){
				x++;
			}else{
				x--;
			}
		}else{
			alert("Please input the correct number!");
			$(obj).val(1);
			$(obj).focus();
		}
		return x;		
	},
	//减
	reduce:function(obj){
		var x=this.amount(obj,false);
		if (x>=this.min){
			$(obj).val(x);
			setAmount_subtotal(x);
		}else{
			alert("The quantity of a commodity at least for"+this.min);
			$(obj).val(1);
			$(obj).focus();
		}
	},
	//增加
	add:function(obj){
		var x=this.amount(obj,true);
		if (x<=this.max){
			$(obj).val(x);
			setAmount_subtotal(x);
		}else{
			alert("The quantity of a commodity for most"+this.max);
			$(obj).val(30);
			$(obj).focus();
		}
	},
	//修改
	modify:function(obj){
		var x=$(obj).val();
		if (x<this.min||x>this.max||!this.reg(x)){
			alert("Please input the correct number!");
			$(obj).val(1);
			$(obj).focus();
		}else{
			setAmount_subtotal(x);
		}
	}
}

//修改数量 json改变总价格
function setAmount_subtotal(x){
	var productId = $('#product_id').val();
	var shippingZoneCountry = $('#js_countryId').val();
	var shippingZoneState = $('#js_shipstateid').val();
	var shippingZoneZip = $('#js_shippingZoneZip').val();
	var ShippingQuoteId = $('#js_selected_ShippingQuoteId').val();
	
	
	$.getJSON(
			//?ShippingQuoteId=2&qty=2&shippingZoneCountry=0&shippingZoneState=0
			//+ '&CartVariationId=' + CartVariationId + '&extprice=' + extprice + '&setCurrencyId=' + currency_id
			
			config.AppPath + '/products.php?action=ajaxamount&productid=' + productId +	'&qty=' + x + '&shippingZoneCountry=' + shippingZoneCountry + '&shippingZoneState=' + shippingZoneState + '&shippingZoneZip=' + shippingZoneZip + '&ShippingQuoteId=' + ShippingQuoteId,
			function(data) {
				// were options returned?
				if (data.error=='1') 
				{
					//alert(data.subtotal);
					$("#pro_Subtatol").html( data.subtotal );
					$("#pro_TotalSalePrice").html( data.price );
					$("#pro_ShippingPrice").html( data.shippingPrice );
					// load options into the next select, disable and focus it
				}
				else
				{ // was a combination found instead?
					// display price, image etc
				}
			}
		);
	//ajaxamount
}



function BuyUrl(wid)
	{
	var pcounts = $("#pamount").val();
	 var patrn=/^[0-9]{1,4}$/;
      if (!patrn.exec(pcounts))
       {
         pcounts = 1;
         }
           else
          { 
			if(pcounts<=0) 
				pcounts = 1;
				if(pcounts>=30)
		 pcounts = 30;
 }   
				    
 }
var config = {};

function SendLargeOrderInquiry()

{
	 var productname = $('#inquiryproductname').val();
	 
	 var productsku = $('#inquiryproductsku').val();
	
	 var inquiryname = $('#inquiryname').val();
	
	 var inquiryemail = $('#inquiryemail').val();
	
	 var inquiryphone = $('#inquiryphone').val();
	
	 var inquiryquantity = $('#inquiryquantity').val();
	
	 var inquirycontent = $('#inquirycontent').val();
	 
	 if(inquiryname=='')
	
	 {   
		 $('#sendresult').css('color','red');
	
		 $('#sendresult').html('Inquiry name is required'); 
	
		 $('#inquiryname').css('border','1px solid red');
		 
		 return false;
	 }

 if(inquiryemail=='')

 {   $('#sendresult').css('color','red');

	 $('#sendresult').html('Inquiry email address is required');

	 $('#inquiryemail').css('border','1px solid red');

	 return false;

 }

 else if(!isEmail(inquiryemail))

	{

     $('#sendresult').css('color','red');

	 $('#sendresult').html('Email address is invalid');

	 $('#inquiryemail').css('border','1px solid red');

	 return false;

	}

 if(inquiryphone=='')

 {   $('#sendresult').css('color','red');

	 $('#sendresult').html('Inquiry phone number is required');

	 $('#inquiryphone').css('border','1px solid red');

	 return false;

 }

 else if(!isphone(inquiryphone))

	{

     $('#sendresult').css('color','red');

	 $('#sendresult').html('Phone number is invalid');

	 $('#inquiryphone').css('border','1px solid red');

	 return false;

	}

 if(inquiryquantity=='')

 {   $('#sendresult').css('color','red');

	 $('#sendresult').html('Inquiry quantity is required');

	 $('#inquiryquantity').css('border','1px solid red');

	 return false;

 }

 else if(!isdigital(inquiryquantity))

	{

     $('#sendresult').css('color','red');

	 $('#sendresult').html('Quantity is invalid');

	 $('#inquiryquantity').css('border','1px solid red');

	 return false;

	}

 if(inquirycontent=='')

 {   $('#sendresult').css('color','red');

	 $('#sendresult').html('Inquiry content is required');

	 $('#inquirycontent').css('border','1px solid red');

	 return false;

 }


 $.ajax({

   type: "POST",

   url: config.ShopPath+"/remote.php",

   data: "w=sendInquiry&prodname="+productname+"&prodsku="+productsku+"&inquiryname="+inquiryname+"&inquiryemail="+inquiryemail+"&inquiryphone="+inquiryphone+"&inquiryquantity="+inquiryquantity+"&inquirycontent="+inquirycontent,

   success: function(data){

	 if(data==1)

	   {

       $('#sendresult').css('color','green');

	   alert('Your Inquiry has been send to our system, thank you!');

	   $("#cboxClose").click();

	   }

	   else

	   {

       $('#sendresult').css('color','red');

	   $('#sendresult').html('Something went wrong while you sending your inquiry, please try again');

	   }

   }

 });



}


function isEmail (theStr) {

var atIndex = theStr.indexOf('@');

var dotIndex = theStr.indexOf('.', atIndex);

var flag = true;

theSub = theStr.substring(0, dotIndex+1)

if ((atIndex < 1)||(atIndex != theStr.lastIndexOf('@'))||(dotIndex < atIndex + 2)||(theStr.length <= theSub.length)) 

{ return(false); }

else { return(true); }

}



function isphone(thestr)

{

var pater = /(([0-9]{2,}[-]?[0-9]{1,}){1,})/;

if(!pater.test(thestr))

	{

	return false;

	}

	return true;

}



function isdigital(thestr)

{

var pater = /([0-9]{1,})/;

if(!pater.test(thestr))

	{

	return false;

	}

	return true;

}

function check_product_review_form() {

	var revrating = g("revrating");

	var revtitle = g("revtitle");

	var revtext = g("revtext");

	var revfromname = g("revfromname");

	var captcha = g("captcha");

	if(revrating.value == 0) {

		alert(lang.ReviewNoRating);

		revrating.focus();

		return false;

	}



	if(revtitle.value == "") {

		alert(lang.ReviewNoTitle);

		revtitle.focus();

		return false;

	}

	if(revtext.value == "") {

		alert(lang.ReviewNoText);

		revtext.focus();

		return false;

	}

	if(captcha.value == "" && HideReviewCaptcha != "none") {

		alert(lang.ReviewNoCaptcha);

		captcha.focus();

		return false;

	}

	return true;

}

function g(id) {

	return document.getElementById(id);

}

$(function(){

	

    $("ul.rating li a").click(function(){

	     var title = $(this).attr("title");

		 var cl = $(this).parent().attr("class");

		 switch(cl) {

         case 'one':

			 num = 1;

		     break;

		 case 'two':

			 num = 2;

		     break;

		 case 'three':

			 num = 3;

		     break;

		 case 'four':

			 num = 4;

		     break;

		 case 'five':

			 num = 5;

		     break;

		 default:

			 num = '';

		 }

		 $('#revrating').val(num);

		 $(this).parent().parent().removeClass().addClass("rating "+cl+"star");

		 $(this).blur();

		 return false;

	})

})
