// JavaScript Document
/*
自动变图片长高
<img src="images/smallshoeswen_2094.jpg" width="150" height="150" onload="javascript:DrawImage(this,150,160);">
*/
function DrawImage(ImgD,FitWidth,FitHeight){
var image=new Image();    
image.src=ImgD.src;    
if(image.width>0 && image.height>0){       
   if(image.width/image.height>= FitWidth/FitHeight){            
    if(image.width>FitWidth){               
     ImgD.width=FitWidth;                
     ImgD.height=(image.height*FitWidth)/image.width;            
    }else{                
     ImgD.width=image.width;               
     ImgD.height=image.height;           
    }
   }else{            
    if(image.height>FitHeight){                
     ImgD.height=FitHeight;                
     ImgD.width=(image.width*FitHeight)/image.height;           
    }else{                
     ImgD.width=image.width;                
     ImgD.height=image.height;            
    }
   }
}
}

/*
搜索验证
*/
function ChksearchForm(){
	if ((document.searchForm.keyword.value=="") ||(document.searchForm.keyword.value=="请输入关键字")){
		alert("请输入关键字搜索！");
		document.searchForm.keyword.focus();
		return false;
	}
	return true;
}
/*
分级菜单
*/
function menu(oblog){
if(oblog.style.display=='block'){
	oblog.style.display='none';
	}else{
	oblog.style.display='block';
	}
}

/* *
 * 会员登录
 */
function userLogin()
{
  var frm      = document.forms['formLogin'];
  var username = frm.elements['username'].value;
  var password = frm.elements['password'].value;
  var msg = '';

  if (username.length == 0)
  {
    msg += '用户名不能为空。' + '\n';
  }

  if (password.length == 0)
  {
    msg += '登录密码不能为空。' + '\n';
  }

  if (msg.length > 0)
  {
    alert(msg);
    return false;
  }
  else
  {
    return true;
  }
}
