
/*显示联系方式*/
function linkinfo(id)
{
document.getElementById('link_id').style.display="";
document.getElementById('link_id').src='/admin/inc/showlink.shtml?id='+id;
}

function DrawImage(ImgD){
   var flag=false;
   var image=new Image();
   image.src=ImgD.src;
   if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= 200/200){
     if(image.width>200){  
     ImgD.width=500;
	 ImgD.height=(image.height*500)/image.width;
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }

     }
    else{
     if(image.height>200){  
     ImgD.height=500;
     ImgD.width=(image.width*500)/image.height;     
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }

     }
    }
   }

function changeImg(ImgD,width,height) {
   var flag=false;
   var image=new Image();
   image.src=ImgD.src;
   if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= 1){
     if(image.width>width){ 
		  if ((image.height*width/image.width)<height)
		  {
             ImgD.width=width;
	         ImgD.height=(image.height*width)/image.width;

		  }
          else{
			 ImgD.height=height;
			 ImgD.width=(image.width*height)/image.height;     
		  }
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }

     }
    else{
     if(image.height>height)
	 {  
         if ((image.width*height/image.height)<width)
         {
            ImgD.height=height;
            ImgD.width=(image.width*height)/image.height;     
         }
		 else{
             ImgD.width=width;
	         ImgD.height=(image.height*width)/image.width;
		 }
     }
	 else
	 {
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }
     }
    }
   }

function Logger(logname)
{
	if(logname == null || logname == "")
		return;
	try {
	  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	  try {
	    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (e2) {
	    xmlHttp = false;
	  }
	}
	
	if (!xmlHttp && typeof(XMLHttpRequest) != 'undefined') {
	  xmlHttp = new XMLHttpRequest();
	}


	if(xmlHttp){
		var bust = Math.random()* 1000000000000000000;
		var url = "/search/log.html?type="+logname + "&rnd=" + bust;
		try {
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
		} catch (e3) {
		
		}
	}
	
}

$=function(id){return document.getElementById(id)}

function chbg_1(_this,ev){
	if(ev==2) {
		_this.className="current";
		for(i=1;i<=10;i++){
			tag_1Obj = eval("$('tag" + i +"_1')");
			//sContent = eval("$('searchcontent_1" + i + "')");
			if(tag_1Obj==_this) {
				tag_1Obj.style.backgroundPosition="0 -46px";
				tag_1Obj.style.color="#fff";
				tag_1Obj.style.fontWeight="bold";  
				//tag_1Obj.className="fontb";
				//$("searchkeywords").innerHTML=sContent.innerHTML;
			}else{
				tag_1Obj.style.backgroundPosition="0 0";
				tag_1Obj.style.color="#333";
				tag_1Obj.style.fontWeight="normal";  
				tag_1Obj.className="";
			}
		}		
	}
	if(_this.className!="current"){
		if(ev==1) _this.style.backgroundPosition="0 -46px";
	}
}


function getObj(objName){return(document.hyformnew.elements[objName]);}
function tag_1(id){
	
	var k = document.getElementById("hyformnew").k.value;
	if(k == "" || k == "输入关键字" || k=="请输入您感兴趣的产品"||k=="请输入产品名的关键字"||k=="请输入公司名的关键字"||k=="请输入您感兴趣的关键字")
	{
		switch(id){
		case 1:
		getObj('k').value="请输入您感兴趣的关键字"; getObj('c').value="supply"; break;
		case 2:
		getObj('k').value="请输入您感兴趣的关键字"; getObj('c').value="need"; break;
		case 3:
		getObj('k').value="请输入您感兴趣的关键字"; getObj('c').value="product"; break;
		case 4:
		getObj('k').value="请输入您感兴趣的关键字"; getObj('c').value="company";break;
		case 5:
		getObj('k').value="请输入您感兴趣的关键字"; getObj('c').value="brand"; break;
		case 6:
		getObj('k').value="请输入您感兴趣的关键字"; getObj('c').value="site"; break;
		case 7:
		getObj('k').value="请输入您感兴趣的关键字"; getObj('c').value="news";break;
		case 8:
		getObj('k').value="请输入您感兴趣的关键字"; getObj('c').value="job";break;
		case 9:
		getObj('k').value="请输入您感兴趣的关键词"; getObj('c').value="bbs";break;
		case 10:
		getObj('k').value="请输入您感兴趣的关键词"; getObj('c').value="blog";break;
		}
	}
	else {
		document.getElementById("hyformnew").k.value = k;
		switch(id) {
		case 1:
			getObj('c').value="supply";  break;
		case 2:
		 	getObj('c').value="need"; break;
		case 3:
		 	getObj('c').value="product";  break;
		case 4:
		 	getObj('c').value="company"; break;
		case 5:
		 	getObj('c').value="brand"; break;
		case 6:
		 	getObj('c').value="site"; break;
		case 7:
		 	getObj('c').value="news";break;
 		case 8:
		 	getObj('c').value="job";break;
 		case 9:
		 	getObj('c').value="bbs";break;
		case 10:
			getObj('c').value="blog";break;

		}
	}
}



function check(theForm)
{
	k=theForm.k.value;
	
	if (k.substring(0,3) =="请输入" || k == "")
	{
		alert("请输入查询内容！");
		theForm.k.focus();
		return false;
	}
	if (theForm.c.value=="supply")
	{
		theForm.action="http://i.wenzhouglasses.com/Trade.shtml?L=1&K=" + k;
	}
	else if (theForm.c.value=="need")
	{
		theForm.action="http://i.wenzhouglasses.com/Trade.shtml?L=2&K=" + k;
	}
	else if (theForm.c.value=="product")
	{
		theForm.action="http://i.wenzhouglasses.com/Pro.shtml?K=" + k;
	}
	else if (theForm.c.value=="company")
	{
		theForm.action="http://i.wenzhouglasses.com/Company.shtml?K=" + k;
	}
	else if (theForm.c.value=="brand")
	{
		theForm.action="http://i.wenzhouglasses.com/brand.shtml?K=" + k;
	}

	else if (theForm.c.value=="site")
	{
		theForm.action="http://i.wenzhouglasses.com/site.shtml?K=" + k;
	}
	else if (theForm.c.value=="news")
	{
		theForm.action="http://i.wenzhouglasses.com/News.shtml?K=" + k;
	}
	else if (theForm.c.value=="job")
	{
		theForm.action="http://i.wenzhouglasses.com/Job.shtml?K=" + k;
	}
	else if (theForm.c.value=="bbs")
	{
		theForm.action="http://bbs.wenzhouglasses.com/query.asp?boardid=0&keyword=" + k;
	}
	else if (theForm.c.value=="blog")
	{
		theForm.action="http://blog.wenzhouglasses.com/listLog.shtml?keyword=" + k;
	}
	return true;
}

