function searchAth()
{
  var ath = document.getElementById("words").value;
  if(ath!=null&&ath!=""&&ath!="产品搜索")
  {
					 
		document.searchBox.action='/searchResults.asp';  
		document.searchBox.submit();


  }

}
function searchAth_e()
{
  var ath = document.getElementById("words").value;
  if(ath!=null&&ath!=""&&ath!="product search")
  {
					 
		document.searchBox.action='/searchResults_e.asp';  
		document.searchBox.submit();


  }

}
function checkmyform()
{
   if(checkspace(document.myform.linkname.value)) {
	document.myform.linkname.focus();
    alert("对不起，网站名称不能为空！");
	return false;
  }

     if(checkspace(document.myform.linkurl.value)) {
	document.myform.linkurl.focus();
    alert("对不起，网站地址不能为空！");
	return false;
  }
   if(checkspace(document.myform.linkdesc.value)) {
	document.myform.linkdesc.focus();
    alert("对不起，网站简介不能为空！");
	return false;
  }

}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}

function show_s(id)
{

	if (document.getElementById('u'+id).style.display == 'none')
		{
			document.getElementById('u'+id).style.display="block";
		}
		else
		{
			document.getElementById('u'+id).style.display="none";
		}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function checkMessage()
{
   if(checkspace(document.myform.username.value)) {
	document.myform.username.focus();
    alert("对不起，请填写联系人！");
	return false;
  }

 if(document.myform.email.value.length!=0)
  {
    if (document.myform.email.value.charAt(0)=="." ||        
         document.myform.email.value.charAt(0)=="@"||       
         document.myform.email.value.indexOf('@', 0) == -1 || 
         document.myform.email.value.indexOf('.', 0) == -1 || 
         document.myform.email.value.lastIndexOf("@")==document.myform.email.value.length-1 || 
         document.myform.email.value.lastIndexOf(".")==document.myform.email.value.length-1)
     {
      alert("Email地址格式不正确！");
      document.myform.email.focus();
      return false;
      }
   }
 else
  {
   alert("Email不能为空！");
   document.myform.email.focus();
   return false;
   }
  if(checkspace(document.myform.titles.value)) {
	document.myform.titles.focus();
    alert("对不起，主题不能为空！");
	return false;
  }
  if(document.myform.titles.value.length < 3 ) {
	document.myform.titles.focus();
    alert("对不起，主题太短！");
	return false;
  }
   if(checkspace(document.getElementById("contents").value)) {
	document.myform.contents.focus();
    alert("对不起，内容不能为空！");
	return false;
  }
	if(document.getElementById("contents").value.length < 3 ) {
	document.myform.contents.focus();
    alert("对不起，内容不能为空太短！");
	return false;
  }
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
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>= 118/118){ 
   if(image.width>118){
    ImgD.width=118; 
    ImgD.height=(image.height*118)/image.width; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
   
  } 
  else{ 
   if(image.height>118){
    ImgD.height=118; 
    ImgD.width=(image.width*118)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
   
  } 
 }
}

function AddFavorite(sURL, sTitle)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("unsuccessed.");
        }
    }
}
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");
								var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
								prefs.setCharPref('browser.startup.homepage',vrl);
                        }
                        catch (e) {
                                alert("unsuccessed\nplease reset safe.");
                        }
                 }
        }
}
