﻿function preLoadImage(imgObjName,imgSrc){
	eval(imgObjName+"=new Image()");
	eval(imgObjName+".src='"+imgSrc+"'");
}
preLoadImage("bover","images/_topbg.gif");
preLoadImage("bout","images/topbg.gif");

function menuover(obj){
	obj.parentElement.background=bover.src;
	obj.style.color="#ffffee";
	obj.style.textDecoration="none";
}
function menuout(obj){
	obj.parentElement.background=bout.src;
	obj.style.color="#ffffee";
}
document.onmouseover=function(){
	if(event.srcElement==mainmenu){
		showmenu( (event.x-event.offsetX-2),(event.y-event.offsetY+28+document.body.scrollTop));
	}
}
document.onclick=function(){
	if(event.srcElement==menu||event.srcElement.parentElement==menu){
		return;
	}
	hiddenmenu();
}
document.onmousemove=function(){
	if(event.srcElement==menu||event.srcElement.parentElement==menu||event.srcElement==mainmenu||event.srcElement.parentElement==mainmenu){
		return;
	}
	hiddenmenu();
}
//显示菜单
function showmenu(x,y){
	menu.style.left=x;
	menu.style.top=y;
	menu.style.visibility="visible";
}
//隐藏菜单
function hiddenmenu(){
	menu.style.visibility="hidden";
}
document.write('<div id="menu" style="position:absolute;border:1px solid #4d5c89;background-color:#8e90bf;width:98;height:70;left:0;top:0;visibility:hidden;padding-top:5px;padding-left:18px;padding-bottom:3px;line-height:20px;FILTER:progid:DXImageTransform.Microsoft.Shadow(direction=135,color=#d9d9fe,strength=5);"><a href="homepage.htm" style="color:#ffffff;">主页</a><br><a href="framework.aspx" style="color:#ffffff;">企业架构</a><br><a href="rz.aspx" style="color:#ffffff">荣誉认证</a><br><a href="kultur.aspx" style="color:#ffffff;">企业理念</a><br><a href="aboutus.htm" style="color:#ffffff">关于我们</a></div>');
document.write('<table width="780" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td background="images/top.jpg" height="62"><embed src="swf/top.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="780" height="62" wmode="transparent" menu="0"></embed></td></tr><tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0" style="text-align:center;color:#ffffff;cursor:default;font-size:12px;"><tr><td background="images/topbg.gif"></td><td id="mainmenu" background="images/topbg.gif" height="30"><a href="index.aspx" onmouseover="menuover(this)" onmouseout="menuout(this)" style="color:#ffffee">中文首页</a></td><td background="images/topbg.gif">||</td><td background="images/topbg.gif"><a href="http://www.kenlong.com/viewProducts.aspx" onmouseover="menuover(this)" onmouseout="menuout(this)" style="color:#ffffee">产品简介</a></td><td background="images/topbg.gif">||</td><td background="images/topbg.gif"><a href="salesNetwork.aspx" onmouseover="menuover(this)" onmouseout="menuout(this)" style="color:#ffffee">销售网络</a></td><td background="images/topbg.gif">||</td><td background="images/topbg.gif"><a href="dealer.aspx" onmouseover="menuover(this)" onmouseout="menuout(this)" style="color:#ffffee">我们的代理商</a></td><td background="images/topbg.gif">||</td><td background="images/topbg.gif"><a href="msg_board.aspx" onmouseover="menuover(this)" onmouseout="menuout(this)" style="color:#ffffee">客户留言</a></td><td background="images/topbg.gif">||</td><td background="images/topbg.gif"><a href="contact.aspx" onmouseover="menuover(this)" onmouseout="menuout(this)" style="color:#ffffee">联系我们</a></td><td background="images/topbg.gif">||</td><td background="images/topbg.gif"><a href="enindex.aspx" onmouseover="menuover(this)" onmouseout="menuout(this)" style="FONT-FAMILY:Arial Black;color:#ffffee">English</a></td><td background="images/topbg.gif" width="30%">&nbsp;&nbsp;</td></tr></table></td></tr></table><hr width="780" size="1" color="#a1a1d9" align="center" style="margin-top:-6;"><table width="780" border="0" cellpadding="0" cellspacing="0" align="center" style="background-color:#ffffff;margin-top:-8;"></table>');
//判断字符串是否为空
function isEmpty(str){
	var s=new String(str);
	var empty=true;
	for(i=0;i<s.length;i++){
		if(s.charAt(i)!=" "){
			return !empty;
		}
	}
	return empty;
}
//搜索
function dosearch(){
	var keyword="",ppref="",xhref="";
	if(!isEmpty(document.all("keyword").value)&&document.all("keyword").value!="关键字"){
		keyword=document.all("keyword").value;
	}
	ppref=document.all("pp").options[document.all("pp").selectedIndex].value;
	xhref=document.all("xh").options[document.all("xh").selectedIndex].value;
	if(ppref==0){
		ppref="";
	}
	if(xhref==0){
		xhref="";
	}
	if(keyword.replace(/'/g,"")==""&&ppref==0&&xhref==0){
		document.all("keyword").value=""
		document.all("keyword").focus();
		alert("请至少选择一个搜索条件");
	}else{
		location.href="viewProducts.aspx?keyword="+keyword+"&ppref="+ppref+"&xhref="+xhref;
	}
}
//得到品牌
function getpp(){
	var xmlobj=new ActiveXObject("Microsoft.XMLHTTP");
	xmlobj.onreadystatechange=function(){
		if(xmlobj.readyState==4){
			if(xmlobj.status==200){
				//alert(xmlobj.responseText);
				document.all("ppdiv").innerHTML="<select id=pp size=1 onchange='getxh(pp.options[pp.selectedIndex].value);'>"+xmlobj.responseText.split("^")[0]+"</select>";
				if(typeof(pplist)!=undefined){
					document.all("pplist").innerHTML="<table width=180 cellSpacing=0 cellPadding=0 style='font-size:12px;color:#000120;cursor:default;'>"+xmlobj.responseText.split("^")[1]+"</table>";
				}
			}
		}
	}
	xmlobj.Open("GET","index.aspx?pp=true",true);
	xmlobj.SetRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlobj.Send();
}
//得到系列
function getxh(ppref){
	var xmlobj=new ActiveXObject("Microsoft.XMLHTTP");
	xmlobj.onreadystatechange=function(){
		if(xmlobj.readyState==4){
			if(xmlobj.status==200){
				xhdiv.innerHTML="<select id=xh size=1>"+xmlobj.responseText+"</select>";	
			}
		}
	}
	xmlobj.Open("GET","index.aspx?ppref="+ppref,true);
	xmlobj.SetRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlobj.Send();
}

//得到新品
function getnp(){
	var xmlobj=new ActiveXObject("Microsoft.XMLHTTP");
	xmlobj.onreadystatechange=function(){
		if(xmlobj.readyState==4){
			if(xmlobj.status==200){
				np.innerHTML=xmlobj.responseText;	
			}
		}
	}
	xmlobj.Open("GET","index.aspx?cn_newproduct=true",true);
	xmlobj.SetRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlobj.Send();
}
