/*
 * 函数说明：选择搜索类型
 * 参数：	actionUrl:搜索目标页面　　tracelog:跟踪参数
 * 返回值：	无
 * 时间：2005-5-12

 *modify
 *时间:20061109
 *说明:修正getElementById

 *modify
 *时间:20061123
 *说明:结构化搜索3个方法
 */

var searchActivedItem=1;
var tracelogStr="";
var otherParamStr="";
var searchFormObj = null;

//结构化搜索
//function SB_OnBlur_x(ctrlObj,ctrlMenuID, event){
//	if(searchActivedItem == 1){
//		return SB_OnBlur(ctrlObj,ctrlMenuID, event)
//	}else{
//		return true;
//	}
//}
function SB_OnKeyDown_x(ctrlObj,ctrlMenuID, event){
	if(searchActivedItem == 1){
		return SB_OnKeyDown(ctrlObj,ctrlMenuID, event)
	}else{
		return true;
	}
}
function SB_OnKeyUp_x(ctrlObj,ctrlMenuID, event){
	if(searchActivedItem == 1){
		return SB_OnKeyUp(ctrlObj,ctrlMenuID, event)
	}else{
		return true;
	}
}

//这里是显示搜索提示的
function searchInit(num,tracelog,otherParam){
	tracelogStr = tracelog;
	otherParamStr = otherParam;
	if(document.getElementById("searchform")!=null){
		searchFormObj = document.getElementById("searchform");
	}else{
		if(document.getElementsByName("searchform").length!=0){
			searchFormObj = document.getElementsByName("searchform")[0];
		}
	}
	doclick(document.getElementById("node"+num),num);

}
function doclick(srcObj,searchID){
	var tabList = srcObj.parentNode.getElementsByTagName("li");
	if(srcObj.className=="activedTab")return;
	for(var i=0;i<tabList.length;i++){
		if(tabList[i].className=="activedTab")tabList[i].className="nTab";
	}
	searchActivedItem = searchID;
	srcObj.className = "activedTab";//TAB切换
	
	if(document.getElementById("linkKwords"))document.getElementById("linkKwords").innerHTML = linkKeywords[searchID-1].surl//热门关键字付值
	
	var v = searchFormObj.key.value;
	if(trim(v) == "" || v.substring(0,3) =="请输入")searchFormObj.key.value = data[searchID-1].title;
}
function checkform(){
	var v = trim(searchFormObj.key.value);
	if(v.length > 100){
		alert("您输入的关键字过长！");
		return false;
	}
	if(v == ""  || v.substring(0,3) =="请输入") {
		alert("请输入关键字！");
		return false;
	}
	var s ="&";
	if((data[searchActivedItem-1].surl).indexOf("?")==-1)s="?";
	searchFormObj.action = data[searchActivedItem-1].surl+s+"key=" + searchFormObj.key.value;//给form的action付值
}
/*
 * 函数说明：去除头尾空格
 * 参数：	字符串
 * 返回值：	无
 * 时间：2005-5-12
 */
function trim(inputString) {
	return inputString.replace(/^ +/,"").replace(/ +$/,"");
}
/*
 * 函数说明：取cookie值
 * 参数：	cookie字段名
 * 返回值：	cookie值
 * 时间：2005-5-12
 */
function getCookie(sName) {
	  var aCookie = document.cookie.split("; ");
	  for (var i=0; i < aCookie.length; i++)
	  {
	    var aCrumb = aCookie[i].split("=");
	    if (sName == aCrumb[0]) 
	      return unescape(aCrumb[1]);
	  }
	  return null;		
}
/*搜索配置*/
var data = [
	{id:1,name:"供求",surl:"/Offer/Search.asp" , title:"请输入您感兴趣的供求信息名称！"},
	{id:2,name:"报价",surl:"/Offer/QuoteSearch.asp" , title:"请输入您感兴趣的报价名称！"},
	{id:3,name:"产品",surl:"/Product/Search.asp" , title:"请输入您感兴趣的产品名！"},
	{id:4,name:"企业",surl:"/Company/CompanyList.asp",title:"请输入您要查询的企业名称！" },
	{id:5,name:"资讯",surl:"/News/Search.asp" , title:"请输入您感兴趣的资讯关键词"},
	{id:6,name:"展会",surl:"/ExpoBid/ExpoSearch.asp", title:"请输入您感兴趣的关键词查找展会"},
	]

/*热门关键字*/
var linkKeywords = [
	{id:1,name:"供求",surl:"热门关键字：<a href=\"http://www.socotton.com/Offer/Search.asp?key=地产棉\" target=_blank>地产棉</a> <a href=\"http://www.socotton.com/Offer/Search.asp?key=三级皮棉\" target=_blank>三级皮棉</a> <a href=\"http://www.socotton.com/Offer/Search.asp?key=籽棉\" target=_blank>籽棉</a> <a href=\"http://www.socotton.com/Offer/Search.asp?key=棉籽\" target=_blank>棉籽</a> <a href=\"http://www.socotton.com/Offer/Search.asp?key=打包机\" target=_blank>打包机</a> <a href=\"http://www.socotton.com/Offer/Search.asp?key=棉纱\" target=_blank>棉纱</a> <a href=\"http://www.socotton.com/Offer/Search.asp?key=山东籽棉\" target=_blank>山东籽棉</a> <a href=\"http://www.socotton.com/Offer/Search.asp?key=三级棉\" target=_blank>三级棉</a>"},


	{id:2,name:"报价",surl:"热门关键字：<a href=\"http://www.socotton.com/Offer/QuoteSearch.asp?key=皮棉\" target=_blank>皮棉</a> <a href=\"http://www.socotton.com/Offer/QuoteSearch.asp?key=纱线\" target=_blank>纱线</a> <a href=\"http://www.socotton.com/Offer/QuoteSearch.asp?key=棉粕\" target=_blank>棉粕</a> <a href=\"http://www.socotton.com/Offer/QuoteSearch.asp?key=籽棉\" target=_blank>籽棉</a> <a href=\"http://www.socotton.com/Offer/QuoteSearch.asp?key=棉籽\" target=_blank>棉籽</a>"},



	{id:3,name:"产品",surl:'热门关键字：<a href="http://www.socotton.com/Product/Search.asp?key=纺纱设备" target=_blank>纺纱设备</a> <a href="http://www.socotton.com/Product/Search.asp?key=配件" target=_blank>配件</a> <a href="http://www.socotton.com/Product/Search.asp?key=打包" target=_blank>打包</a> <a href="http://www.socotton.com/Product/Search.asp?key=皮清机" target=_blank>皮清机</a> <a href="http://www.socotton.com/Product/Search.asp?key=棉籽剥绒" target=_blank>棉籽剥绒</a> <a href="http://www.socotton.com/Product/Search.asp?key=机械设备" target=_blank>机械设备</a>'},


	{id:4,name:"企业",surl:'热门关键字： <a href="http://www.socotton.com/Company/CompanyList.asp?key=山东棉花">山东棉花</a> <a href="http://www.socotton.com/Company/CompanyList.asp?key=进出口" target=_blank>进出口</a> <a href="http://www.socotton.com/Company/CompanyList.asp?key=代理" target=_blank>代理</a> <a href="http://www.socotton.com/Company/CompanyList.asp?key=个体经营" target=_blank>个体经营</a> <a href="http://www.socotton.com/Company/" target=_blank>更多</a>'},


	{id:5,name:"资讯",surl:'热门关键字： <a href="http://www.socotton.com/News/Search.asp?key=棉花价格" target=_blank>棉花价格</a> <a href="http://www.socotton.com/News/Search.asp?key=棉花市场" target=_blank>棉花市场</a> <a href="http://www.socotton.com/News/Search.asp?key=棉花信息" target=_blank>棉花信息</a> <a href="http://www.socotton.com/News/Search.asp?key=棉花行情" target=_blank>棉花行情</a> <a href="http://www.socotton.com/News/Search.asp?key=10年棉花" target=_blank>10年棉花</a> <a href="http://www.socotton.com/News/Search.asp?key=纺织市场" target=_blank>纺织市场</a> <a href="http://www.socotton.com/News/" target=_blank>更多</a>'},


	{id:6,name:"展会",surl:'热门关键字： <a href="http://www.socotton.com/ExpoBid/ExpoSearch.asp?key=棉花生产" target=_blank>棉花生产</a> <a href="http://www.socotton.com/ExpoBid/ExpoSearch.asp?key=棉花购销工作" target=_blank>棉花购销工作</a> <a href="http://www.socotton.com/ExpoBid/ExpoSearch.asp?key=纺织" target=_blank>纺织</a> <a href="http://www.socotton.com/ExpoBid/" target=_blank>更多</a>'},
]


function checkDom()
{
	this.name=navigator.appName.toLowerCase()
	this.ver=navigator.appVersion.toLowerCase()
	this.opera=(this.name=="opera")?1:0
	this.dom=(document.getElementById&&!this.opera)?1:0
	this.ie=(document.all)?1:0
	this.ie6=(this.dom&&this.ie&&this.ver.indexOf('msie 6'))?1:0
	this.ie5=(this.dom&&this.ie&&!this.ie6)?1:0
	this.ns4=(document.layers)?1:0
	this.ns6=(this.dom&&!this.ie)?1:0
	this.ns=(this.ns4||this.ns6)?1:0
	this.bw=(this.dom||this.ie||this.ns||this.opera)?1:0
}
bw = new checkDom()

// make dom object
function makeDom(name)
{
	if(!document.getElementById) return null
	this.name = name
	this.evnt = document.getElementById(name)
	this.css = this.evnt.style
	this.x = this.css.pixelLeft || this.evnt.offsetLeft
	this.y = this.css.pixelTop || this.evnt.offsetTop
	this.w = this.css.pixelWidth || this.evnt.offsetWidth
	this.h = this.css.pixelHeight || this.evnt.offsetHeight
	this.id = name
	this.obj = name + 'Object'; eval(this.obj + '=this')

	makeDom.prototype.moveTo = function(x,y)
	{
		x = parseInt(x); y = parseInt(y)
		this.css.left = x+'px'
		this.css.top = y+'px'
		this.x = x
		this.y = y
	}
	makeDom.prototype.writ = function(txt,where)
	{
		this.evnt.innerHTML = where ? where>0 ? this.evnt.innerHTML + txt : txt + this.evnt.innerHTML : txt
	}
}

function fadeTicker()
{
	this.running = 0
	this.speed = 0
	this.delay = 0
	this.box = 0
	this.scrl = 0
	this.onItem = 0
	this.to = 0
	this.alph = 100
	this.items = new Array()
	this.urls = new Array()
	eval(this.obj + '=this')
}
fadeTicker.prototype.addItem = function(itm,url)
{
	this.items[this.items.length] = itm
	this.urls[this.urls.length] = url
}
fadeTicker.prototype.init = function(spd,dly,tgt)
{
	this.speed = parseInt(spd)
	this.delay = parseInt(dly*1000)
	this.target = tgt ? tgt=='' ? '_self' : tgt : '_self'
	this.box = new makeDom('tickBox')
	this.scrl = new makeDom('tickCont')
	this.draw()
}
fadeTicker.prototype.draw = function()
{
	this.onItem = (this.onItem<this.items.length) ? this.onItem : 0
	this.scrl.moveTo(this.scrl.x,this.box.h)
	this.scrl.writ('·<a href="' + this.urls[this.onItem] + '" target="' + this.target + '">' + this.items[this.onItem] + '</a>')
	this.onItem++
	this.run()
}
fadeTicker.prototype.run = function()
{
	if(this.scrl.y>this.speed+1)
	{
		this.scrl.moveTo(this.scrl.x,this.scrl.y-this.speed)
		this.to = setTimeout(this.obj+'.run()',25)
	}
	else this.to = setTimeout(this.obj+'.fade()',this.delay)
}
fadeTicker.prototype.play = function()
{
	clearTimeout(this.to)
	this.to = setTimeout(this.obj+'.run()',1)
}
fadeTicker.prototype.pause = function()
{
	clearTimeout(this.to)
}
fadeTicker.prototype.fade = function()
{
	this.setOpac(this.alph)
	this.alph -= 10
	if(this.alph) setTimeout(this.obj+'.fade()',25)
	else
	{
		this.alph = 100
		this.setOpac(this.alph)
		this.draw()
	}
}
fadeTicker.prototype.setOpac = function(op)
{
	if(bw.ns6) this.scrl.css.MozOpacity = op+'%'
	else this.scrl.evnt.filters['alpha']['opacity'] = op
}


function check_Login(){
  if(Jtrim(document.form1.T_LoginID.value)==""){
    alert("您还没有填写用户名，请填写！")
	document.form1.T_LoginID.focus();
	return(false)
  }
  if(Jtrim(document.form1.T_PassWord.value)==""){
    alert("您还没有填写登录密码，请填写！")
	document.form1.T_PassWord.focus();
	return(false)
  }  
}

function ShowSubmit(){
  if(Jtrim(document.form3.T_Content.value)==""){
    alert("建议与意见的内容不能为空，请填写！谢谢对搜棉的支持!")
	document.form3.T_Content.focus()
	return(false)
  }
  if(!isEmail(document.form3.T_Email.value)){
    alert("您所填写的Email有误，请重新填写！")
	document.form3.T_Email.focus();
	return(false)
  }
  window.open("/Other/Footer/AdviceReturn.asp?Content="+document.form3.T_Content.value+"&Email="+document.form3.T_Email.value,"tjjy","top=0,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=320");  

  document.form3.T_Content.value=""
  document.form3.T_Email.value="请输入您的电子邮箱"
}

<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->

