tPopWait=50;  
tPopShow=5000;
showPopStep=20;
popOpacity=99;
sPop=null;
curShow=null;
tFadeOut=null;
tFadeIn=null;
tFadeWaiting=null;
if(document.all)
{
	document.write("<style>.cPopText {Font-Size:9pt;  background-color: #F8F8F5;color:#000000; border: 1px #000000 solid;padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");
	document.write("</style>");
	document.write("<div id='dypopLayer' style='position:absolute;z-index:1000;width:150px;' class='cPopText'></div>");
}
function showPopupText(){
var o=event.srcElement;
	MouseX=event.x;
	MouseY=event.y;
	if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
        if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
	if(o.dypop!=sPop) {
			sPop=o.dypop;
			clearTimeout(curShow);
			clearTimeout(tFadeOut);
			clearTimeout(tFadeIn);
			clearTimeout(tFadeWaiting);	
			if(sPop==null || sPop=="") {
				dypopLayer.innerHTML="";
				dypopLayer.style.filter="Alpha()";
				dypopLayer.filters.Alpha.opacity=0;	
				}
			else {
				if(o.dyclass!=null) popStyle=o.dyclass 
					else popStyle="cPopText";
				curShow=setTimeout("showIt()",tPopWait);
			}
			
	}
}
function showIt(){
		dypopLayer.className=popStyle;
		dypopLayer.innerHTML=sPop;
		popWidth=dypopLayer.clientWidth;
		popHeight=dypopLayer.clientHeight;
		if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
			else popLeftAdjust=0;
		if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
			else popTopAdjust=0;
		dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
		dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
		dypopLayer.style.filter="Alpha(Opacity=0)";
		fadeOut();
}
function fadeOut(){
	if(dypopLayer.filters.Alpha.opacity<popOpacity) {
		dypopLayer.filters.Alpha.opacity+=showPopStep;
		tFadeOut=setTimeout("fadeOut()",1);
		}
		else {
			dypopLayer.filters.Alpha.opacity=popOpacity;
			tFadeWaiting=setTimeout("fadeIn()",tPopShow);
			}
}

function fadeIn(){
	if(dypopLayer.filters.Alpha.opacity>0) {
		dypopLayer.filters.Alpha.opacity-=1;
		tFadeIn=setTimeout("fadeIn()",1);
		}
}
if(document.all)
	document.onmouseover=showPopupText;
function change(which){
theobject=which;
which.filters.alpha.opacity=20;
highlighting=setInterval("highlightit(theobject)",70);
}
function high(which){
clearInterval(highlighting);
which.filters.alpha.opacity=100;
}
function highlightit(cur){
if (cur.filters.alpha.opacity<100)
cur.filters.alpha.opacity+=10;
else if (window.highlighting)
clearInterval(highlighting);
}
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
function MM_openBrWindow(theURL,winName,features) { //v2.0
  newwin=window.open(theURL,winName,features);
}
function CheckLogin(theForm)
{

  if (theForm.username.value == "")
  {
    alert("登录时必须填写用户名，谢谢！");
    theForm.username.focus();
    return (false);
  }

  if (theForm.password.value == "")
  {
    alert("登录时必须填写密码，谢谢！");
    theForm.password.focus();
    return (false);
  }
  return (true);
}

function selectChange(theForm)
{
if(theForm.action.value!="loop"){	
theForm.e_display.checked?document.info.kind[1].checked=false:document.info.kind[1].checked=true;
theForm.e_display.checked==false?document.info.kind[1].disabled=false:document.info.kind[1].disabled=true
theForm.e_display.checked==false?document.info.kind[2].disabled=false:document.info.kind[2].disabled=false
}   //document.info.kind[2].checked=true
if(theForm.display.value!="yes")
{
	num=confirm("你的用户信息还没有选择在\n英文版发布信息，要在英文版\n发布信息，请先修改用户信息！")
 	if (num==true)
    		return true;
    	else
    		if(theForm.action.value!="loop"){
    		theForm.e_display.checked=false;
    		theForm.e_display.checked==false?document.info.kind[1].disabled=false:document.info.kind[2].disabled=false
    		}
    		return false;
}
   
    if(theForm.e_display.checked)
	{
		theForm.coname.value=theForm.e_name.value;
		theForm.linkman.value=theForm.e_linkman.value;
		theForm.YesOrNo.value="yes"
	}
	else
	{
		theForm.coname.value=theForm.gb_name.value;
		theForm.linkman.value=theForm.gb_linkman.value;
		theForm.YesOrNo.value="no"

	}

}   
function CheckProduct(theForm)
{
	//供货
 theForm.NoService.value="false";
 theForm.file.disabled=false;
 return true;
 }
 
function CheckRadio(theForm)
{
	//需求
 theForm.NoService.value="false";
 theForm.file.disabled=false;
 return true;
 }
 
function CheckService(theForm)
{
	//合作
 theForm.NoService.value="true";
 theForm.file.disabled=true;
 return true;
 }
function CheckInfo(theForm)
{
if(theForm.action.value!="loop"){
  var radioSelected = false;
  for (i = 0;  i < theForm.kind.length;  i++)
  {
    if (theForm.kind[i].checked)
        radioSelected = true;
  }

  if (!radioSelected)
  {
    alert("请选择信息类型（是供货信息、求购信息，还是合作信息），谢谢。");
    if(theForm.e_display.checked==false)theForm.kind[1].focus();
    return (false);
  }
}
 if (theForm.name.value == "")
  {
    alert("请填写信息标题，谢谢。");
    theForm.name.focus();
    return (false);
  }

  if (theForm.text.value == "")
  {
    alert("请填写信息正文，谢谢。");
    theForm.text.focus();
    return (false);
  }

 
  if (theForm.coname.value == "")
  {
    alert("请填写公司名称，谢谢。");
    theForm.coname.focus();
    return (false);
  }

  if (theForm.linkman.value == "")
  {
    alert("请填写联系人，谢谢。");
    theForm.linkman.focus();
    return (false);
  }

  if (theForm.tel.value == "")
  {
    alert("请填写联系电话，谢谢。");
    theForm.tel.focus();
    return (false);
  }
  
  
 if(theForm.verifycode!=null)
 {
 if (theForm.verifycode.value =="")
   {
		alert ("请填写验证码！");
		theForm.verifycode.focus();
		return false;
	}
 }
  return (true);
}

function information(){
controlWindow=window.open("/gb/information.asp","surveywin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=350,height=390");
}
function openalert(){
alert("要使用短讯商情，请您先登录为会员，谢谢！");
return false;
}

function openit(){
controlWindow=window.open("/gb/ballot/index.asp","surveywin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=350,height=390");
}

function check_keyword(theForm)
{
if(theForm.keyword.value=="")
{	
	alert('请填写关键字');
	return false;
}
return true;
}	
function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }

  return elements;
}


	function get_ajax(obj,url_str,para)
{

	var opt = {
    // Use POST
    method: 'post',
    // Send this lovely data
    postBody: para,
    // Handle successful response
    onSuccess: function(t) {
       $(obj).innerHTML=t.responseText;
    },
    // Handle 404
    on404: function(t) {
        alert('Error 404: location "' + t.statusText + '" was not found.');
    },
    // Handle other errors
    onFailure: function(t) {
        alert('Error ' + t.status + ' -- ' + t.statusText);
    }
	}
	new Ajax.Request(url_str, opt);
}

	function get_ajax_ex(satement,url_str,para)
{

	var opt = {
    // Use POST
    method: 'post',
    // Send this lovely data
    postBody: para,
    // Handle successful response
    onSuccess: function(t) {
       eval(satement+'("'+t.responseText+'")');
    },
    // Handle 404
    on404: function(t) {
        alert('Error 404: location "' + t.statusText + '" was not found.');
    },
    // Handle other errors
    onFailure: function(t) {
        alert('Error ' + t.status + ' -- ' + t.statusText);
    }
	}
	new Ajax.Request(url_str, opt);
}

if (getRequest('action') == 'search') {
    for (i = 0; i < top_search.type.options.length; i++) {
        if (location.href.indexOf(top_search.type.options[i].value) > -1) {
            top_search.type.options[i].selected = true;
        }
    }



}

function getRequest(name) {
    var str = window.location.search;
    if (str.indexOf(name) != -1) {
        var pos_start = str.indexOf(name) + name.length + 1;
        var pos_end = str.indexOf("&", pos_start);
        if (pos_end == -1) {
            return str.substring(pos_start);
        }
        else {
            return str.substring(pos_start, pos_end)
        }
    }
    else {
        return "";
    }
}

function check_change(item) {
    if ((item.value.indexOf('/gb/comp_list.aspx') == -1) && (item.value.indexOf('/gb/info_list.aspx') == -1)
				&& (item.value.indexOf('/gb/jobs_list.aspx') == -1) && (item.value.indexOf('/gb/sample_list.aspx') == -1))
        top_search.state.disabled = true;
    else
        top_search.state.disabled = false;

}

function check_cust_search(theform) {
    if (top_search.keyword.value.length == 0) {
        if (top_search.state.value == '0') {
            alert('请输入您要搜索的内容，谢谢。');
            top_search.keyword.focus();
            return false;
        }
    }

    if (theform.type.value.indexOf("?") == -1) {
        theform.action = theform.type.value;
        theform.type.value = "";
    }
    else {
        theform.action = theform.type.value.substring(0, theform.type.value.indexOf("?"));
        //theform.type.value=theform.type.value.substring(theform.type.value.indexOf("=")+1,theform.type.value.indexOf("=")+2);
        theform.kind.value = theform.type.value.substring(theform.type.value.indexOf("=") + 1, theform.type.value.indexOf("=") + 2);
        theform.type.value = '';
    }
    return true;

}


function check_yp_search(theform) {
    if (theform.itemin == null) {
        if (theform.search_key.value.length < 2) {
            alert('型号至少要有2个字符！');
            return false;
        }
        else {
            return true;
        }
    }

    if (theform.itemin.value == '' && theform.itemout.value == '' && theform.itemwidth.value == '') {
        if (theform.search_key.value.length < 2) {
            alert('型号至少要有2个字符！');
            return false;
        }
        else {
            return true;
        }
    }
    else {
        if (theform.search_key.value != '') {
            if (theform.search_key.value.length < 2) {
                alert('型号至少要有2个字符！');
                return false;
            }
        }
        if (theform.itemwidth.value != '') {
            if (theform.itemin.value == '' || theform.itemout.value == '') {
                alert('请输入内径和外径数值！');
                return false;
            }
        }
        if (theform.itemout.value != '') {
            if (theform.itemin.value == '') {
                alert('请输入内径数值！');
                return false;
            }
        }

        return true;

    }


}

function check_word(word) {
    var aaa = word;
    var st = 0, en = 0;
    var st_tag = false, en_tag = false;
    for (i = 0; i < aaa.length; i++) {
        if (check_num(aaa.substring(i, i + 1)) && !st_tag) {
            st = i;
            st_tag = true;
        }
        if (st_tag) {
            if (!check_num(aaa.substring(i, i + 1)) && !en_tag) {
                en = i;
                en_tag = true;
            }
        }
    }
    if (en == 0)
        en = aaa.length;
    if ((en - st) == 1) {
        if (st != 0)
            return aaa.substring(st - 1, en);
        else if (aaa.length - en >= 1)
            return aaa.substring(st, en + 1);
    }

    return aaa.substring(st, en);
}
function check_num(w) {
    var num_arry = "0123456789";
    if (num_arry.indexOf(w) == -1)
        return false;
    else
        return true;
}
function search_baidu() {
    if (top_search.keyword.value.length > 0) {
        document.getElementById('baidu_form').word.value = top_search.keyword.value + ' site:cnbearing.biz';
        document.getElementById('baidu_form').submit();
    }
    else {
        alert('请输入您要搜索的内容，谢谢。');
        top_search.keyword.focus();
    }
}
function search_google() {
    if (top_search.keyword.value.length > 0) {
        document.getElementById('google_form').q.value = top_search.keyword.value;
        document.getElementById('google_form').submit();
    }
    else {
        alert('请输入您要搜索的内容，谢谢。');
        top_search.keyword.focus();
    }
}