// JavaScript Document
function add_favorite(){
	var title = document.title;
	var url = document.URL;
	if (document.all) window.external.AddFavorite(url,title);
	else if (window.sidebar) window.sidebar.addPanel(title,url,"");
}

function set_first(obj){
	vrl="http://www.lightertrade.com/";
    obj.style.behavior='url(#default#homepage)';
    obj.setHomePage(vrl);
}
function checklogin(){
   if(document.loginform.username.value==""){
     alert("对不起用户名不能为空!");
	 document.loginform.username.focus();
	 return false;
   }
   if(document.loginform.username.value.length<4){
     alert("对不起用户名不能小于4个字符!");
	 document.loginform.username.focus();
	 return false;
   }
      	  if (document.loginform.username.value!="" )
     {
        var i,bHZ,nLen,name,tempValue;
        name = document.loginform.username.value;
        nLen = name.length;
        bHZ = false;
        tempValue="";
		 for(i=0;i<nLen;i++)
 {
	var ch,j,ch1;
	ch1 = document.loginform.username.value.charCodeAt(i);
	ch = document.loginform.username.value.charAt(i);
	
	if(eval(ch1 - 0x80) >= 0) 
		{   
		alert("对不起你输入了非法字符,用户名不能用汉字！");
	    document.loginform.username.focus();
	    return false;	
		}
		else
		{
		if ( (ch < '0' || ch > '9') && ch!= '-' && ch!='_' &&(ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') )
			{
			alert("对不起用户名中有非法字符存在！");
	        document.loginform.username.focus();
	        return false;
			}
			else
			{
			}
		}
  }      
	   }
   if(document.loginform.password.value==""){
     alert("对不起密码不能为空!");
	 document.loginform.password.focus();
	 return false;
   }
   return true;
   }

var flag=false;
function DrawImage(ImgD){
var image=new Image();
var iwidth = 110; //定义允许图片宽度，当宽度大于这个值时等比例缩小
var iheight = 110; //定义允许图片高度，当宽度大于这个值时等比例缩小
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= iwidth/iheight){
if(image.width>iwidth){ 
ImgD.width=iwidth;
ImgD.height=(image.height*iwidth)/image.width;
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
//ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>iheight){ 
ImgD.height=iheight;
ImgD.width=(image.width*iheight)/image.height; 
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
//ImgD.alt=image.width+"×"+image.height;
}
}
return image.width+"×"+image.height;
}