
jQuery(function(){jQuery("#keywords").val('Type the Model No. or Product Name');jQuery("#keywords").focus(function(){if(this.value=='Type the Model No. or Product Name'){this.value='';}})
jQuery("input[name='keywords']").blur(function(){if(this.value==''){this.value='Type the Model No. or Product Name';}})
var mail_string='';mail_string="<h2 class=\"right_title heading\">NEWSLETTER</h2><div class=\"container\" style=\"height:81px;\"> <form name=\"formmy\" onsubmit=\"return mail_sub(window.document.formmy.email.value,window.document.formmy.firstname.value);\" action=\"mail_subscibe.php\" method=\"GET\" id=\"formmy\"\"><div class=\'textstyle\'><input name=\"firstname\" type=\"text\" class=\"search1 input_bg\" id=\"firstname\" size=\'30\' onfocus=\"if (this.value == \'First Name\') {this.value = \'\';}\" onblur=\"if (this.value == \'\') {this.value = \'First Name\';}\" value=\"First Name\" /></div><div class=\'textstyle\'><input name=\"email\" type=\"text\" class=\"search1 input_bg\" id=\"email\" size=\'30\' onfocus=\"if (this.value == \'Email Address\') {this.value = \'\';}\" onblur=\"if (this.value == \'\') {this.value = \'Email Address\';}\" value=\"Email Address\" /></div>";mail_string+="<div class=\'send ff\'><input name=\"image\" type=\"image\" src=\"images/send-new.jpg\" /></div><div class=\"clear\">&nbsp;</div></form></div><h2 class=\"right_title heading\">Recommend to a friend</h2><div class=\"container\" style='clear:both;height:61px;'><form name=\"formmy3\" action=\"recommend_a_friend_post.php\" method=\"post\" id=\"formmy3\" onsubmit=\"return sendmail(window.document.formmy3.emails.value);\"><div class=\'textstyle\'><input name=\"email2\" size=\"30\" type=\"text\" class=\"search1 input_bg\" onfocus=\"if (this.value == \'Email Address\') {this.value = \'\';}\" onblur=\"checkemail(this.value)\" value=\"Email Address\" id=\"emails\" /></div><div style='width:auto;float:right;' class=\'send\'><a href=\"javascript:;\" onclick=\"sendmail(window.document.formmy3.emails.value);\"><img src=\"images/send-new.jpg\"  /></a></div> <div style='float:left;padding-top:5px;padding-left:10px;' id='emailerr'></div> <input name=\"name\" type=\"hidden\" id=\"thispagename\" value=\"Introduce the website to my friends\" /></form></div>";jQuery("#mail_box").html(mail_string);})
function sub_carting_list(id){var products_id=id;var cart_quantity2=1;/*var currency=$("#autocurrency option:selected").get(0).value;*/$.ajax({url:"shopping_cart_add_items.php?action=add_product&products_id="+products_id,success:function(data){jQuery("#myOnPageContent").html(data);tb_show(null,"#TB_inline?height=295&width=460&inlineId=myOnPageContent&modal=true",false);},error:function(){alert("err");}});}
function addtowishlist(id){var products_id=id;$.ajax({url:"addtowishlist.php?action=add_product&products_id="+products_id,success:function(data){jQuery("#myOnPageContent").html(data);tb_show(null,"#TB_inline?height=172&width=460&inlineId=myOnPageContent&modal=true",false);},error:function(){alert("err");}});}
function showcontactpricePopup(skumodel){$.ajax({url:"contactusforprice.php?skumodel="+skumodel,success:function(data){jQuery("#myOnPageContent").html(data);tb_show(null,"#TB_inline?height=510&width=660&inlineId=myOnPageContent&modal=true",false);},error:function(){alert("err");}});}
function close_popup_add_shopping(){jQuery.get("items.php",function(data){jQuery("#items").html(data);if($("input[name='cart_quantity2']").length >0){$("input[name='cart_quantity2']").removeAttr("disabled");}tb_remove();})}
function ValidateEmail(j)
{var emailReg=/^([a-zA-Z0-9_\-\.\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;return emailReg.test(j);}
function checkemail(email){if(email!=''){if(ValidateEmail(email)){return true;}else{alert("Enter Valid Email Address");return false;}}else{return true;}}
function sendmail(email){if(email!=''){if(ValidateEmail(email)){var pagename=document.location.href;jQuery.ajax({type:"GET",url:"recommend_a_friend_post.php?action=sendmail&this_pagename="+pagename+"&email="+email+"",error:function(){alert('send email failed!');},success:function(msg){tb_show('title','/html/recommend_a_friend.html?keepThis=true&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=130&width=280&modal=true','');$("#emails").val('');}});return false;}else{alert("Enter Valid Email Address");return false;}}else{return false;}}
function mail_sub(email,firstname)
{
	var cate=firstname;
	if(cate==""||cate=="First Name")
	{
		$("#firstname").val('');
		alert("please enter first name");
		return false;
	}
	if(email!='')
	{
		if(ValidateEmail(email))
		{
			jQuery.ajax(
						{type:"GET",
						url:"mail_subscibe.php?action=sendmail&cate="+cate+"&email="+email+"",
						error:function(){alert('Sorry,Please try again!');},
						success:function(msg){tb_show('title','/html/mail_sub.php?&cate='+cate+'keepThis=true&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=130&width=280&modal=true','');$("#email").val('');$("#firstname").val('');}});
			return false;
		}
		else		
		{
			alert("Enter Valid Email Address");
			return false;
		}
	}
	else
	{return false;}
}
function isThousands(a){if(Math.floor(a/3)*3==a){return true}return false}
function formatMoney(d,f,c,e){
	var b=Math.round((d*100)-(Math.floor(d)*100));if(b<10){b="0"+b}b=""+(b+"0").substring(0,2);d=""+Math.floor(d);
	var a="";
	if(f=="USD"){a+="$"}
	for(x=0;x<d.length;x++){
		a+=d.substring(x,x+1);
		if(isThousands(d.length-x-1)&&(d.length-x-1!=0))
		{
			a+=c			
		}
	}
	if(f=="USD")
	{
		a+=e+b
	}else{
		a+=e+b+" "+f
	}
	return a
}
function wopen(url,w,h){
      var   top=((window.screen.availHeight-h)/2);   
      var   left=((window.screen.availWidth-w)/3); 
　　window.open (url, 'newwindow', 'height='+w+', width='+h+', top=0, left='+left+', toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no');
}

jQuery(document).ready(function(){

	jQuery('dl.submenu').each(function(){
		var el = jQuery(this),subarea = el.children('dd');
		if(subarea[0]){              
				var t;
				el.hover(function(){
					clearTimeout(t);
					t = setTimeout(function(){el.addClass('over').css('z-index','1000');subarea.show()}, 250);
				},function(){
					clearTimeout(t);
					t = setTimeout(function(){el.removeClass('over').css('z-index','1');subarea.hide()}, 250);
				});        
		}
	});
});

/*announcement*/
/*
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=")
if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
}
return ""
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function announcement_close(){
	$("body").css("background-position","left -2px");
	$("#holiday-announcement").slideUp("3500"); 
	setCookie("announcement","2",1);
}
if(getCookie("announcement")!=2){
	setCookie("announcement","0",1);
	var top_message = '<div id="holiday-announcement" style="padding-top:2px;font-size:11px;height:58px;padding-bottom:5px;text-align:center;line-height:25px;background:url(https://www.chinazrh.com/img/holiday-announcement_bg.jpg) repeat-x center bottom;background-color:#FEFF81;">ChinaZRH will be closed from <b>1st Oct. 2011</b> to <b>7th Oct. 2011</b> due to <b>Chinese National Day Holidays</b><br /><span style="padding:5px 10px;color:#fff;background-color:#000;"><b>The Online service never stop, you can still place order.</b> Any questions, pls contact <b>admin@chinazrh.com</b> or <b>Online Support</b></span><span id="announcement_close" onclick="announcement_close()" style="float:right;cursor:pointer;margin-left:30px;margin-top:-15px;margin-right:25px;"><img src="https://www.chinazrh.com/img/holiday-announcement_close.jpg"></span></div>';
	$("#topbox").before(top_message); 
	$("#holiday-announcement").hide();
	//$("#holiday-announcement").show("slow");
	$("#holiday-announcement").slideDown("3500",function(){$("body").css("background-position","left 62px");}); 
	
}
*/