var searchActivedItem=1;
var tracelogStr="";
var otherParamStr="";
var searchFormObj = null;
var tracelogInput = null;
var searchinputbox = null;
//结构化搜索
function searchInit(num,tracelog,otherParam){
	tracelogStr = tracelog;
	otherParamStr = otherParam;
	if(document.getElementById("sform_"+num)!=null){
		searchFormObj = document.getElementById("sform_01");
	}else{
		if(document.getElementsByName("sform_"+num).length!=0){
			searchFormObj = document.getElementById("sform_"+num);
		}
	}
	doclick(document.getElementById("node"+num),num);
}
function doclick(srcObj,searchID){
	var tabList = srcObj.parentNode.getElementsByTagName("li");
	if(srcObj.className.indexOf("activedtab")!=-1)return;
	for(var i=0;i<tabList.length;i++){
		if(tabList[i].className.indexOf("activedtab")!=-1)
		{
			tabList[i].className="ntab"+(tabList[i].className).replace("activedtab","");
		}
		if(tabList[i]==srcObj){
			var searchdivobj = document.getElementById("sform_"+searchID);
			var activedivobj = document.getElementById("sform_"+searchActivedItem);
			activedivobj.style.display="none";
			searchdivobj.style.display="block";
			var v = document.getElementById("sform_"+searchActivedItem).getElementsByTagName("form")[0].Cls.value;
			if(trim(v) == "" || v.substring(0,3) =="请输入"){
				searchdivobj.getElementsByTagName("form")[0].Cls.value = searchdivobj.getElementsByTagName("form")[0].Cls.title;
			}else{
				searchdivobj.getElementsByTagName("form")[0].Cls.value = activedivobj.getElementsByTagName("form")[0].Cls.value;
			}
			if(srcObj.offsetWidth==67){
				document.getElementById("searchbox").style.backgroundImage="url(/Images/activebg2.gif)";
			}else{
				document.getElementById("searchbox").style.backgroundImage="url(/Images/activebg4.gif)";
			}
			if(document.all)document.getElementById("searchbox").style.backgroundPosition=srcObj.offsetLeft+"px";
					}
	}
	if(searchID==1||searchID==2||searchID==3)
		document.getElementById("howtosearch").style.display="block";
	else
		document.getElementById("howtosearch").style.display="none";

	searchActivedItem = searchID;
	srcObj.className = "activedtab"+(srcObj.className).replace("otab","").replace("ntab","");//TAB切换
}
function checkform(frmObj){
	var Keywords = trim(frmObj.Keywords.value);
	if(Keywords.length > 20){
		alert("您输入的供应商机关键词过长！");
		return false;
	}
	if(Keywords == ""  || Keywords.substring(0,3) =="请输入") {
		alert("请输入你要搜索的供应商机！");
		return false;
	}
	parent.popupLoad.style.visibility="visible";
	return true;
}

function checkform2(frmObj){
	var Keywords = trim(frmObj.Keywords.value);
	if(Keywords.length > 20){
		alert("您输入的产品名过长！");
		return false;
	}
	if(Keywords == ""  || Keywords.substring(0,3) =="请输入") {
		alert("请输入产品名！");
		return false;
	}
	parent.popupLoad.style.visibility="visible";
	return true;
}
function checkform3(frmObj){
	var Keywords = trim(frmObj.Keywords.value);
	if(Keywords.length > 20){
		alert("您输入的企业名关键词过长！");
		return false;
	}
	if(Keywords == ""  || Keywords.substring(0,3) =="请输入") {
		alert("请输入企业名关键词！");
		return false;
	}
	parent.popupLoad.style.visibility="visible";
	return true;
}
function checkform4(frmObj){
	var Keywords = trim(frmObj.Keywords.value);
	if(Keywords.length > 20){
		alert("您输入的资讯关键词过长！");
		return false;
	}
	if(Keywords == ""  || Keywords.substring(0,3) =="请输入") {
		alert("请输入资讯关键词！");
		return false;
	}
	parent.popupLoad.style.visibility="visible";
	return true;
}
function checkform5(frmObj){
	var Keywords = trim(frmObj.Keywords.value);
	if(Keywords.length > 20){
		alert("您输入的展会关键词过长！");
		return false;
	}
	if(Keywords == ""  || Keywords.substring(0,3) =="请输入") {
		alert("请输入展会关键词！");
		return false;
	}
	parent.popupLoad.style.visibility="visible";
	return true;
}

function checkform6(frmObj){
	var Keywords = trim(frmObj.Keywords.value);
	if(Keywords.length > 20){
		alert("您输入的产品名过长！");
		return false;
	}
	if(Keywords == ""  || Keywords.substring(0,3) =="请输入") {
		alert("请输入你要查询的关键词！");
		return false;
	}
	parent.popupLoad.style.visibility="visible";
	return true;
}
function checkform7(frmObj){
	var Keywords = trim(frmObj.Keywords.value);
	if(Keywords.length > 20){
		alert("您输入的关键词过长！");
		return false;
	}
	if(Keywords == ""  || Keywords.substring(0,3) =="请输入") {
		alert("请输入关键词！");
		return false;
	}
	parent.popupLoad.style.visibility="visible";
	return true;
}
function checkform8(frmObj){
	var Keywords = trim(frmObj.Keywords.value);
	if(Keywords.length > 20){
		alert("您输入的求购商机关键词过长！");
		return false;
	}
	if(Keywords == ""  || Keywords.substring(0,3) =="请输入") {
		alert("请输入你要搜索的求购商机！");
		return false;
	}
	parent.popupLoad.style.visibility="visible";
	return true;
}
function checkformv(frmObj){
	var k = trim(frmObj.k.value);
	if(k.length > 50){
		alert("您输入的关键词过长！");
		return false;
	}
	if(k == ""  || k.substring(0,3) =="请输入") {
		alert("请输入关键词！");
		return false;
	}
	parent.popupLoad.style.visibility="visible";
	return true;
}
function trim(inputString) {
	return inputString.replace(/^ +/,"").replace(/ +$/,"");
}
function overtab(srcObj){
	if(srcObj.className.indexOf("activedtab")!=-1)return;
	else
	srcObj.className = "otab"+(srcObj.className).replace("ntab","");
}
function outtab(srcObj){
	if(srcObj.className.indexOf("activedtab")!=-1)return;
	else
	srcObj.className = "ntab"+(srcObj.className).replace("otab","");
}
function focusit(inputobj){
	if(inputobj.value.indexOf('请输入')!=-1)inputobj.value='';
	inputobj.style.color="#000000";
}
//Firefox
// This function does the actual browser detection
function writeCookie(name, value, hours)
{
	var expire = "";
	if(hours != null)
	{
		expire = new Date((new Date()).getTime() + hours * 3600000);
		expire = "; expires=" + expire.toGMTString();
	}
	document.cookie = name + "=" + escape(value) + expire;
}

// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
	var cookieValue = "";
	var search = name + "=";
	if(document.cookie.length > 0)
	{
		offset = document.cookie.indexOf(search);
		if (offset != -1)
		{
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			cookieValue = unescape(document.cookie.substring(offset, end))
		}
	}
	return cookieValue;
}



function hasIE_hasIE() {
  var ua = navigator.userAgent.toLowerCase();
  return ((ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) && 
          (ua.indexOf('webtv') == -1) &&
          (location.href.indexOf('seenIEPage') == -1));
}

function hasIE_showLayer(whichLayer)
{
  if (document.getElementById)
    {
      var style2 = document.getElementById(whichLayer).style;
      style2.display = "block";
    }
  else if (document.all)
    {
      var style2 = document.all[whichLayer].style;
      style2.display = "block";
    }
  else if (document.layers)
    {
      var style2 = document.layers[whichLayer].style;
      style2.display = "block";
    }
}

// Hides and shows sections of the page based on whether or not it's
// running in IE
function hasIE_hideAndShow()
{
  if (hasIE_hasIE())
  {
    hasIE_showLayer("hasIE_level1");  
  }
  else{}
}

function hasIE_ContinueWithoutFF() {
    if (location.href.indexOf('?') != -1)
        location.href += '&seenIEPage=1';
    else
        location.href += '?seenIEPage=1';
}
function closediv(i) {
	writeCookie("status","showed24",240);
	document.getElementById(i).style.display='none'; 
}


