<!--  
var  flag=false;  
var  w_num=97,h_num=111;

function  DrawImage(ImgD,ww,hh){  
var  image=new  Image();  
image.src=ImgD.src;  

if(image.width>0  &&  image.height>0)
{ 
  if (image.width>ww && image.height<=hh){
     ImgD.width=ww; 	 	 
    }
  if (image.height>hh && image.width<=ww){
     ImgD.height=hh;
    }
  if (image.height>hh && image.width>ww){
     num=ww/image.width;
	
	 height_num=image.height*num;
	 
	 if (height_num>hh){
	     num=hh/image.height;
		 ImgD.width=image.width*num;
		 ImgD.height=hh;
		 
		 w_num=image.width*num;
		 h_num=hh;
	 }
	 else{
	     ImgD.width=ww;
		 ImgD.height=image.height*num;
		 
		 w_num=ww;
		 h_num=image.height*num;
	 }
	 
    }	
	//ImgD.alt=image.width+"×"+image.height;
	}
}
//--> 


function AddFavorite(sURL, sTitle)
{    
	try    
	{
		window.external.addFavorite(sURL, sTitle);
	}
	catch (e)
	{
		try
		{
			window.sidebar.addPanel(sTitle, sURL, "");
		}
		catch (e)
		{
			alert("加入收藏失败，请使用Ctrl+D进行添加");
		}
	}
}


function SetHome(obj,vrl)
{
	try{
		obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
	}
	catch(e)
	{ 
		if(window.netscape)
		{
			try { 
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}
			catch (e) 
			{
				alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。"); 
			}
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref('browser.startup.homepage',vrl);
		}
	}
}


//弹出窗口
function openwin(id)
    {
     window.open("pic.asp?id="+id,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=yes,top=5,left=5,width=500,height=450");
    }
	
function reg(e)
 {
   if (e.user_name.value.length==0)
    {
		   alert("用户名必须填写!");
		   e.user_name.focus();
		   return false;
	}
  if (e.user_password.value.length==0)
   {
		  alert("密码必须填写!");
		  e.user_password.focus();
		  return false;
   }
 //if (e.pwds.value.length==0)
//  {
//	alert("验证码必须填写!");
//    e.pwds.focus();
//	return false;
//  }

}

function sub1(e)
{
  if (e.s_name.value.length==0)
  {
	alert("姓名必须填写！");
	e.s_name.focus();
	return false;
  }
  if (e.lxdz.value.length==0)
  {
	alert("联系地址必须填写！");
	e.lxdz.focus();
	return false;
  }
 if (e.lxdh.value.length==0)
 {
	alert("联系电话必须填写！");
	e.lxdh.focus();
	return false;
  }
  
 if (e.zxdg_yzm.value.length==0)
 {
	alert("验证码必须填写！");
	e.zxdg_yzm.focus();
	return false;
  }

 if (e.dgly.value.length==0)
 {
	alert("订购留言必须填写！");
	e.dgly.focus();
	return false;
 }
		   
	var n=0;
	var i;
    for (i=0;i<e.dgly.value.length;i++)
    {
      if (e.dgly.value.charCodeAt(i)>255)
		{
         //s.charCodeAt(i)为非ascii字符
          n=n+2;
        }
		else{
          //s.charCodeAt(i)为ascii字符
          n=n+1;
        }
       }
		//alert(n);
      if(n>450){
        alert("您填写的订购留言的字数太多 请酌情处理 ");
		e.dgly.focus();
		return false;
    }
}


function sub2(e)
 {
   if (e.txt_user.value.length==0)
    {
		   alert("请填写姓名!");
		   e.txt_user.focus();
		   return false;
	}
  if (e.txt_mail.value.length==0)
   {
		  alert("请填写信箱!");
		  e.txt_mail.focus();
		  return false;
   }
  var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/; 
  if(pattern.test(e.txt_mail.value)==false){
	alert("Email格式不正确!");
	e.txt_mail.focus();
    return false;
  } 
   
   if (e.txt_jy.value.length==0)
   {
		  alert("请填写留言内容!");
		  e.txt_jy.focus();
		  return false;
   }
   
   var n=0;
   var i;
   for (i=0;i<e.txt_jy.value.length;i++)
   {
      if (e.txt_jy.value.charCodeAt(i)>255)
      {
         //s.charCodeAt(i)为非ascii字符
          n=n+2;
      }
	  else{
             //s.charCodeAt(i)为ascii字符
             n=n+1;
           }
   }
			//alert(n);
   if(n>400){
               alert("留言内容的字数太多 请酌情处理 ");
			   e.txt_jy.focus();
			   return false;
             }
   
 if (e.lyb_yzm.value.length==0)
  {
	alert("验证码必须填写!");
    e.lyb_yzm.focus();
	return false;
  }

}

function log(e){
           if (e.user_name.value.length==0){
		            alert("用户名必须填写！");
					e.user_name.focus()
					return false;
		   }
		   if (e.user_password.value.length==0){
		            alert("密码必须填写！");
					e.user_password.focus()
					return false;
		   }
		
}

