document.write("<script src='js/yahoo.js' type='text/javascript' language='javascript'></script>");
document.write("<script src='js/common.js' type='text/javascript' language='javascript'></script>");
var offset=(window.screen.width-1024)/2;

var flag=false; 

function DrawImage(ImgD,awidth,aheight){ 

var image=new Image(); 

image.src=ImgD.src; 

if(image.width>0 && image.height>0){ 

  flag=true; 

  if(image.width/image.height>= awidth/aheight){ 

   if(image.width>awidth){

    ImgD.width=awidth; 

    ImgD.height=(image.height*aheight)/image.width; 

   }else{ 

    ImgD.width=image.width;

    ImgD.height=image.height; 

   }

   /*ImgD.alt="bigpic"  */

  } 

  else{ 

   if(image.height>aheight){

    ImgD.height=aheight; 

    ImgD.width=(image.width*awidth)/image.height; 

   }else{ 

    ImgD.width=image.width;

    ImgD.height=image.height; 

   } 

    /*ImgD.alt="bigpic"  */ 

  } 

}

}


  function check() {
	if (login.username.value=="")
		{   alert("Please fill your username");
			login.username.focus();	    
			return false;
		}
	if (login.password.value=="")
		{   alert("Please fill your password");
			login.password.focus();	    
			return false;
		}
}


function checkRegForm() {
	if (reg.username.value=="") {
	    alert("Fill your username");
		reg.username.focus();	    
		return false;
	}
	if (reg.username.value.length<2 || reg.username.value.length>16)  {
		alert("Username at least 6 characters");
		reg.username.focus();
		return false;
	}
	if (reg.password.value==""){
	    alert("Fill your password");
		reg.password.focus();	    
		return false;
	}
	if (reg.password.value.length<6 || reg.password.value.length>32)  {
		alert("Password at least 6 characters");
		reg.password.focus();
		return false;
	}
	if (reg.email.value==""){ 
	  	alert("Fill your E-mail");
		reg.email.focus();	    
		return false;
	}		
	var filter=/^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
    if (!filter.test(document.reg.email.value)) { 
    	alert("E-mail is incorrect,please try again"); 
        document.reg.email.focus();
        document.reg.email.select();
        return (false); 
    }    
}

function check_s(){
		if (scheck.keyword.value==""){ 
	  	alert("Fill keyword!!");
		scheck.keyword.focus();	    
		return false;
	}		

}
function check(obj) {
	if (obj.username.value=="") { 
		alert("Fill your full name,please");
		order.username.focus();	    
		return false;
	}
	if (obj.phone.value==""){
		alert("Fill your telephone");
		order.phone.focus();	    
		return false;
	}
	if (obj.email.value==""){
		alert("Fill your E-mail");
		order.email.focus();	    
		return false;
	}	
}

function makeup(r){
				var url=r;
				var img=document.getElementById("pushimg");
				img.src=url;
				}
							
							
function cswitch(tid,box,num,tag){
if(tid==null || box==null || num==null) return;
var tabs=document.getElementById(tid);
if(tabs==null) return;
if(tag=="") tag="LI";
tabs=tabs.getElementsByTagName(tag);
for(n=0;n<tabs.length;n++){
	 if(num==n){
		tabs[n].id="current";
		document.getElementById(box+n).className="sw";
	 }else{
		tabs[n].id="";
		document.getElementById(box+n).className="hd";
	 }	
}	
}							
