

function setImg(img,width,height){ 
var scale_w=img.width/width; 
var scale_h=img.height/height; 
var scale=scale_w>scale_h?scale_w:scale_h; 
img.width=img.width/scale; 
return false; 
} 

var flag=false;  
function DrawImage(ImgD){  
var image=new Image();  
image.src=ImgD.src;  
if(image.width>0 && image.height>0){  
flag=true;  
if(image.width/image.height>= 190/102){  
if(image.width>190){  
ImgD.width=190;  
ImgD.height=(image.height*190)/image.width;  
}else{  
ImgD.width=image.width;  
ImgD.height=image.height;  
}  
ImgD.alt=image.width+"x"+image.height;  
}  
else{  
if(image.height>102){  
ImgD.height=102;  
ImgD.width=(image.width*102)/image.height;  
}else{  
ImgD.width=image.width;  
ImgD.height=image.height;  
}  
ImgD.alt=image.width+"x"+image.height;  
}  
}  
} 

var flag=false;  
function DrawImage2(ImgD){  
var image=new Image();  
image.src=ImgD.src;  
if(image.width>0 && image.height>0){  
flag=true;  
if(image.width/image.height>= 180/180){  
if(image.width>180){  
ImgD.width=180;  
ImgD.height=(image.height*180)/image.width;  
}else{  
ImgD.width=image.width;  
ImgD.height=image.height;  
}  
ImgD.alt=image.width+"x"+image.height;  
}  
else{  
if(image.height>180){  
ImgD.height=180;  
ImgD.width=(image.width*180)/image.height;  
}else{  
ImgD.width=image.width;  
ImgD.height=image.height;  
}  
ImgD.alt=image.width+"x"+image.height;  
}  
}  
} 








function checkinput()
 {
if (document.input.FirstName.value=="")
	{
    alert("Please enter a value for the \"First Name\" field.");
	  document.input.FirstName.focus();
	  return false;
	 }
if (document.input.LastName.value=="")
	{
    alert("Please enter a value for the \"Last Name\" field.");
	  document.input.LastName.focus();
	  return false;
	 }
if(document.input.Email.value == "")
  {
    alert("Please enter a value for the \"Email\" field.");
	document.input.Email.focus();
	return (false);
  }   
  if(document.input.Email.value.length!=0)
  {
    if (document.input.Email.value.charAt(0)=="." ||        
         document.input.Email.value.charAt(0)=="@"||       
         document.input.Email.value.indexOf('@', 0) == -1 || 
         document.input.Email.value.indexOf('.', 0) == -1 || 
         document.input.Email.value.lastIndexOf("@")==document.input.Email.value.length-1 || 
         document.input.Email.value.lastIndexOf(".")==document.input.Email.value.length-1)
     {
      alert("Email format is incorrect.")
       document.input.Email.focus();
      return false;
      }
   }
 if (document.input.Company.value=="")
	{
    alert("Please enter a value for the \"Company\" field.");
	  document.input.Company.focus();
	  return false;
	 }
if (document.input.WorkPhone.value=="")
	{
    alert("Please enter a value for the \"Work Phone\" field.");
	  document.input.WorkPhone.focus();
	  return false;
	 }
if (document.input.UserId.value=="")
	{
    alert("Please enter a value for the \"User Id\" field.");
	  document.input.UserId.focus();
	  return false;
	 }
if (document.input.Password1.value=="")
  		{
    alert("Please enter a value for the \"Password\" field.");
	  document.input.Password1.focus();
	  return false;
  		}
if (document.input.Password2.value=="")
  		{
    alert("Please enter a value for the \"Re Enter Password\" field.");
	  document.input.Password2.focus();
	  return false;
  		}

if(document.input.Password1.value != document.input.Password2.value){
    alert('Twice input password value is not identical.');
	document.input.Password1.focus();
	return false;
}


if (document.input.CheckBox1.value!="on")
	{
    alert("Did not agree with selection.")
	  document.input.CheckBox1.focus();
	  return false;
	 }
return true;
 }

function checkinput2()
 {
if (document.input2.title.value=="")
	{
    alert("Please enter a value for the \"Title\" field.");
	  document.input2.title.focus();
	  return false;
	 }
if (document.input2.CheckCode.value=="")
	{
	  alert("Please enter a value for the \" Security Check\" field.")
	  document.input2.CheckCode.focus()
	  return false;
	 }

return true;
 }


function checklogin()
 {
if (document.login.username.value=="")
	{
    alert("Please enter a value for the \"Username\" field.");
	  document.login.username.focus()
	  return false;
	 }
if (document.login.password.value=="")
	{
    alert("Please enter a value for the \"password\" field.");
	  document.login.password.focus()
	  return false;
	 }
return true;
 }
 function RegRepeatCheck()
{
if(document.regsiter.username.value == "")
  {
	alert("请输入您的用户名！");
	document.regsiter.username.focus();
	return (false);
  } 
if(document.regsiter.username.value.length<4 || document.regsiter.username.value.length>20 )
  {
	alert("用户名小于4位或大于20位！");
	document.regsiter.username.focus();
	return (false);
  }
if(document.regsiter.password.value=="" )
  {
	alert("密码不能为空！");
	document.regsiter.password.focus();
	return (false);
  }
if(document.regsiter.confirmpassword.value=="" )
  {
	alert("确诊密码不能为空！");
	document.regsiter.confirmpassword.focus();
	return (false);
  }
if(document.regsiter.password.value != document.regsiter.confirmpassword.value)
{
            alert('两次密码输入不一样');
           document.regsiter.password.focus();
            return (false);
}
return true;
	}
function checkpass(){
if (document.memberadd.oldpassword.value == "")
  		{
    alert("Please enter a value for the \"oldpassword\" field.");
	    document.memberadd.oldpassword.focus();
	    return (false);
  		}
if (document.memberadd.password.value == "")
  		{
    alert("Please enter a value for the \"password\" field.");
	    document.memberadd.password.focus();
	    return (false);
  		}
if (document.memberadd.password2.value == "")
  		{
    alert("Please enter a value for the \"Re Enter Password\" field.");
	     document.memberadd.password2.focus();
	    return (false);
  		}
if(document.memberadd.password.value != document.memberadd.password2.value)
{
         alert('Two password the importation is not the same as.');
         document.memberadd.password.focus();
         return (false);
}
return true;
	}

function checkorder(){
	if(document.order.FirstName.value==""){
    alert("Please enter a value for the \"First Name\" field.");
	document.order.FirstName.focus();
	return (false);
	}
	
	if(document.order.LastName.value==""){
    alert("Please enter a value for the \"Last Name\" field.");
	document.order.LastName.focus();
	return (false);
	}
	if(document.order.Email.value==""){
    alert("Please enter a value for the \"Email\" field.");
	document.order.Email.focus();
	return (false);
	}
	if(document.order.WorkPhone.value==""){
    alert("Please enter a value for the \"Work Phone\" field.");
	document.order.WorkPhone.focus();
	return (false);
	}
	if(document.order.ShippingAddress.value==""){
    alert("Please enter a value for the \"Shipping Address\" field.");
	document.order.ShippingAddress.focus();
	return (false);
	}
	if(document.order.ShippingZip.value==""){
    alert("Please enter a value for the \"Shipping Zip\" field.");
	document.order.ShippingZip.focus();
	return (false);
	}
	if(document.order.ShippingCountry.value==""){
    alert("Please enter a value for the \"Shipping Country\" field.");
	document.order.ShippingCountry.focus();
	return (false);
	}
	




return true;
	}












