var newAjax;function UrlEncode(str)
{var str1=str.replace(/\%/g,"%25").replace(/&/g,"%26").replace(/\=/g,"%3D").replace(/\'/g,"%27").replace(/\"/g,"%22").replace(/\+/g,"%2b").replace(/ /g,"%20");return str1;}
String.prototype.isEmpty=function(){return/^\s*$/.test(this);}
String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
function Ajax(){var _xmlHttp=null;this.createXMLHttpRequest=function(){try{if(window.ActiveXObject){_xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}else if(window.XMLHttpRequest){_xmlHttp=new XMLHttpRequest();}}catch(e){alert(e.name+" : "+e.message);}}
this.backFunction=function(_backFunction){if(_xmlHttp.readyState==4){if(_xmlHttp.status==200){_backFunction(_xmlHttp.responseText);}}
_xmlHttp.onreadystatechange=null;}
this.doPost=function(_url,_parameter,_backFunction){try{_xmlHttp.open("POST",_url,false);_xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");_xmlHttp.send(_parameter);}catch(e){alert(e.name+" : "+e.message);}}
this.doGet=function(_url,_parameter,_backFunction){try{var _random=Math.round(Math.random()*10000);_xmlHttp.open("GET",(_url+"?random="+_random+"&"+_parameter),false);_xmlHttp.send(null);}catch(e){alert(e.name+" : "+e.message);}}
this.ajaxRequest=function(_url,_parameter,_method,_backFunction){try{this.createXMLHttpRequest();if(_method.toLowerCase()=="post"){this.doPost(_url,_parameter,_backFunction);}else{this.doGet(_url,_parameter,_backFunction);}
try{_xmlHttp.onreadystatechange=this.backFunction(_backFunction);}catch(err){}}catch(e){alert(e.name+" : "+e.message);}}}
var HTTPrequest=function(){var obj_xmlHttp=null;try{obj_xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(err_1){try{obj_xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(err_2){obj_xmlHttp=false;}}
if(!obj_xmlHttp&&typeof XMLHttpRequest!='undefined'){try{obj_xmlHttp=new XMLHttpRequest();}catch(err_3){obj_xmlHttp=false;}}
return obj_xmlHttp;}
var next=function(el){do{el=el.nextSibling;}while(el&&el.nodeType!=1);return el;}
var showContent=function(el){var left=0,top=0;var tz=document.getElementById("brandLogoPanel");tz.style.display="block";tz.style.zIndex="999";tz.style.position="absolute";tz.onmouseout=function(){this.style.display="none";}
tz.onmouseover=tz.onmousemove=function(){this.style.display="block";}}
var hideContent=function(el){var tz=document.getElementById("brandLogoPanel");tz.style.display="none";}
var xmlHttp
function CheckPayment(OrderNumber,PaymentWeb)
{xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{alert("涓嶆敮鎸丄JAX");}
url="CheckPayment.asp?OrderNumber="+OrderNumber+"&PaymentWeb="+PaymentWeb;xmlHttp.onreadystatechange=function()
{if(xmlHttp.readyState==4&&xmlHttp.status==200)
{var bool=xmlHttp.responseText;}}
xmlHttp.open("GET",url,true);xmlHttp.send(null);}
function GetXmlHttpObject()
{var xmlHttp=null;try
{xmlHttp=new XMLHttpRequest();}
catch(e)
{try
{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}
return xmlHttp;}
function DrawImage(ImgD,FitWidth,FitHeight){var image=new Image();image.src=ImgD.src;var w,h;if(image.width>0&&image.height>0){if(image.width/image.height>=FitWidth/FitHeight){ImgD.width=FitWidth;h=(image.height*FitWidth)/image.width;ImgD.height=h;}else{ImgD.height=FitHeight;w=(image.width*FitHeight)/image.height;ImgD.width=w;}}}
function $(element)
{if(arguments.length>1)
{for(var i=0,elements=[],length=arguments.length;i<length;i++)
elements.push($(arguments[i]));return elements;}
if(typeof element=="string")
return document.getElementById(element);else
return element;}
var Class={create:function()
{return function()
{this.initialize.apply(this,arguments);}}}
Object.extend=function(destination,source)
{for(var property in source)
{destination[property]=source[property];}
return destination;}
var tabMenu=Class.create();tabMenu.prototype={initialize:function(container,selfOpt,otherOpt,ccolor,ocolor)
{this.container=$(container);var selfOptions=Object.extend({fontWeight:"600",fontSize:"14px",BackgroundColor:"#F7F3EC"},selfOpt||{});var otherOptions=Object.extend({fontWeight:"600",fontSize:"14px",color:"#373737"},otherOpt||{});for(var i=0,length=this.container.childNodes.length,objs=[];i<length;i++){if(this.container.childNodes[i].nodeType==1)
objs.push(this.container.childNodes[i]);}
var tabArray=objs[0].getElementsByTagName("li");var divArray=new Array();for(i=0,length=objs[1].childNodes.length;i<length;i++)
{if(objs[1].childNodes[i].nodeType==1)
divArray.push(objs[1].childNodes[i]);}
for(i=0,length=tabArray.length;i<length;i++)
{tabArray[i].length=length;tabArray[i].index=i;tabArray[i].onmouseover=function()
{for(var j=0;j<this.length;j++){tabArray[j].style.background="url(../style/img/normal_03.jpg) no-repeat right";for(var property in selfOptions){tabArray[j].firstChild.style[property]=otherOptions[property];}}
this.style.backgroundPosition="0 0";this.style.background="url(../style/img/normal_04.jpg) no-repeat right";for(var property in selfOptions){this.firstChild.style[property]=selfOptions[property];}
for(j=0;j<this.length;j++){divArray[j].style.display="none";}
divArray[this.index].style["display"]="block";}}}}
var ReadCart=function()
{var htp_userName=new HTTPrequest();htp_userName.open("Get","/include/receive.asp?run=cart",true);htp_userName.onreadystatechange=function(){ReadCartResponse(htp_userName)};htp_userName.send(null);}
var ReadCartResponse=function(htp_userName)
{var str_dopeResult="";if(htp_userName.readyState==4)
{str_dopeResult=htp_userName.responseText;if(/[^\d]/.test(str_dopeResult)){}
else
{document.getElementById("shoppingcart").innerHTML="Shopping Cart: <span>"+str_dopeResult+"</span> pcs";}}}
var ReadNews=function(type,bid,cid,pid)
{var htp_userName=new HTTPrequest();htp_userName.open("Get","/include/receive.asp?run=news&type="+type,true);htp_userName.onreadystatechange=function(){ReadNewsResponse(htp_userName)};htp_userName.send(null);}
var ReadNewsResponse=function(htp_userName)
{var str_dopeResult="";if(htp_userName.readyState==4)
{str_dopeResult=htp_userName.responseText;document.getElementById("newspanel").innerHTML=str_dopeResult;}}
var ReadComment=function(type,id)
{var htp_userName=new HTTPrequest();htp_userName.open("Get","/include/receive.asp?run=news&type="+type,true);htp_userName.onreadystatechange=function(){ReadCommentResponse(htp_userName)};htp_userName.send(null);}
var ReadCommentResponse=function(htp_userName)
{var str_dopeResult="";if(htp_userName.readyState==4)
{str_dopeResult=htp_userName.responseText;document.getElementById("commentpanel").innerHTML=str_dopeResult;}}
function checkMaxLen(obj,maxlength,num){if(obj.value.length>maxlength){obj.value=obj.value.substr(0,maxlength);}}
function AddCommentCheck()
{var itemid=document.getElementById("authorItemid").value.trim();var author=UrlEncode(document.getElementById("authorname").value.trim());var t=document.getElementById("authorState");var state=t.options[t.selectedIndex].value;var content=document.getElementById("authorComment").value.trim();if(author.isEmpty())
{document.getElementById("receiveInfo").innerHTML="<span style='color:red'>Please enter your name or your email!</span>";return;}
if(content.isEmpty())
{document.getElementById("receiveInfo").innerHTML="<span style='color:red'>Please enter your comment!</span>";return;}
if(content.length<6)
{document.getElementById("receiveInfo").innerHTML="<span style='color:red'>Your comment must be more than six characters!</span>";return;}
if(state=="No Selected"||state=="")
{document.getElementById("receiveInfo").innerHTML="<span style='color:red'>Please select country!</span>";return;}
content=UrlEncode(content.substr(0,255));var url="include/receive.asp"
var parameter="run=addcomment&itemid="+itemid+"&author="+author+"&state="+state+"&content="+content;var method="get";newAjax=new Ajax();newAjax.ajaxRequest(url,parameter,method,AddCommentResponse);}
function AddCommentResponse(htp_userName)
{if(htp_userName=="ok")
{document.getElementById("receiveInfo").innerHTML="<span style='color:blue'>Your comment has been submitted. Avoid of advertisement your comment will be checked by us firstly!</span>";document.getElementById("authorname").value="";var t=document.getElementById("authorState");t.selectedIndex=-1;document.getElementById("authorComment").value="";}
else
{document.getElementById("receiveInfo").innerHTML="<span style='color:red'>"+htp_userName+"</span>";}
countDown(5);}
function countDown(secs){if(--secs>0){setTimeout("countDown("+secs+")",1000);}
else{document.getElementById("receiveInfo").innerHTML="Ask questions, Share opinions, Gain insight!";}}
