//¿ØÖÆÍ¼Æ¬´óÐ¡
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 lit_pic(xImgD,bwidth){
var image=new Image(); 
image.src=xImgD.src; 
if(image.width>0 && image.height>0){ 
 if(image.width>bwidth){
	 xImgD.width=bwidth;	 
	 xImgD.height=image.height/image.width*bwidth
 }
}
}


function check() {
	if (login.username.value=="")
		{   alert("Fill username please!");
			login.username.focus();	    
			return false;
		}
	if (login.password.value=="")
		{   alert("Fill password please");
			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 lit_pic(xImgD,bwidth){
var image=new Image(); 
image.src=xImgD.src; 
if(image.width>0 && image.height>0){ 
 if(image.width>bwidth){
	 xImgD.width=bwidth;	 
	 xImgD.height=image.height/image.width*bwidth
 }
}
}



function check() {
	if (order.username.value=="") { 
		alert("Fill your full name,please");
		order.username.focus();	    
		return false;
	}
	if (order.phone.value==""){
		alert("Fill your telephone");
		order.phone.focus();	    
		return false;
	}
}
