function iframeFitHeight(oIframe) {//Iframe窗口自适应高度 兼容IE6.0 FF2.0以上 
    try {
        var oWin = oIframe.name ? window.frames[oIframe.name] : oIframe.contentWindow;
        oIframe.style.height = oWin.document.body.scrollHeight + "px";
    }
    catch (e) { }
}
function isIe(flashId, flash, _width, _height) {
    document.writeln("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + _width + "\" height=\"" + _height + "\" id=\"" + flashId + "\">");
    document.writeln("   <param name=\"movie\" value=\"" + flash + "\" />");
    document.writeln("   <param name=\"allowScriptAccess\" value=\"sameDomain\" />");
    document.writeln("   <param name=\"quality\" value=\"high\" />");
    document.writeln("   <param name=\"menu\" value=\"false\" />");
    document.writeln("   <param name=\"wmode\" value=\"transparent\" />");
    document.writeln("   <embed src=\"" + flash + "\" quality=\"high\"  allowScriptAccess=\"sameDomain\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + _width + "\" height=\"" + _height + "\" wmode=\"transparent\"></embed>");
    document.writeln("</object>");
}

function isFF(flashId, flash, _width, _height) {
    document.writeln("<EMBED src=\"" + flash + "\"  width=\"" + _width + "\"  height=\"" + _height + "\"  allowScriptAccess=\"sameDomain\" quality=\"high\" TYPE=\"application/x-shockwave-flash\" id=\"" + flashId + "\" scale=\"exactfit\" wmode=\"transparent\" menu=\"false\">");
    document.writeln("</EMBED>");
}

function ShowFlash(flashId, flash, _width, _height) {
    var OsObject = "";
    if (navigator.userAgent.indexOf("MSIE") > 0) {
        isIe(flashId, flash, _width, _height);
    }
    else if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
        isFF(flashId, flash, _width, _height);
    }
    else {
        isFF(flashId, flash, _width, _height);
    }
}

function ProSearch() {
    var search = document.getElementById("ProKeys").value;
    if (search == "") {
        window.location = "/Products-0-0-0-0-0.html";
    }
    else {
        window.location = "/Products/Search?KeyWords=" + escape(search);
//         $.ajax({
//            type: "POST",
//            dataType: "html",
//            url: "/Products/Search",
//            data: "KeyWords="+escape(search)+"&timeStamp=" + new Date().getTime(),
//            success: function(result) {
//                if (result == "1") {
//                    window.location.href = window.location.href;
//                }
//            }
//        })
    }

}
function NewsSearch() {
    var search = document.getElementById("NewsKeys").value;
	var Types = document.getElementById("Tyes").value;
    if (search == "") {
        alert("请先输入搜索关键词");
        return false;
    }
    else {
		  if(Types=="1"){
        window.location = "/News/Search?KeyWords=" + escape(search);
		  }
		  else if(Types=="2"){
        window.location = "/Products/Search?KeyWords=" + escape(search);
		  }  else if(Types=="3"){
        window.location = "/Bidding/Class/1?KeyWords=" + escape(search);
		  }  else if(Types=="4"){
        window.location = "/HR/Search?KeyWords=" + escape(search);
		  }
    }

}

function include(path,type,title){
	var s,i,t;
	if(arguments.length < 1){
		return;
	}
	if(arguments.length == 1){
		type = "js";
	}
	switch(type.toLowerCase()){
		case "css":
			t = document.getElementsByTagName("link");
			for(i=0;i<t.length;i++){
				if(t[i].href && t[i].href.indexOf(path)!=-1){
					return;
				}
			}
			s=document.createElement("link");
			s.rel="alternate stylesheet";
			s.type="text/css";
			s.href=path;
			s.title=title;
			s.disabled=false;
		break;
			case "js":
			case "javascript":
		default:
			t = document.getElementsByTagName("script");
			for(i=0;i<t.length;i++){
				if(t[i].src && t[i].src.indexOf(path)!=-1){
					return;
				}
			}
			s=document.createElement("script");
			s.type="text/javascript";
			s.src=path;
		break;
	}
	var h=document.getElementsByTagName("head")[0];
	h.appendChild(s);
}
//验证是否日期
function strDateTime(str){ 
var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/; 
var r = str.match(reg); 
if(r==null)return false; 
var d= new Date(r[1], r[3]-1,r[4]); 
var newStr=d.getFullYear()+r[2]+(d.getMonth()+1)+r[2]+d.getDate() 
return newStr==str 
} 

//字符处理;去左右空格; 
function trim(s){
 	return rtrim(ltrim(s)); 
}
//去左空格; 
function ltrim(s){
 	return s.replace( /^\s*/, ""); 
} 
//去右空格; 
function rtrim(s){ 
 	return s.replace( /\s*$/, ""); 
}
//验证信息;空字符值; 
function isEmpty(s){
	s = trim(s); 
	return s.length == 0; 
}
//Email;
function isEmail(s){
	s = trim(s); 
 	var p = /^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.){1,4}[a-z]{2,3}$/i; 
 	return p.test(s);
}
//数字; 
function isNumber(s){
	return !isNaN(s); 
}
//颜色值; 
function isColor(s){ 
	s = trim(s); 
	if (s.length !=7) return false; 
	return s.search(/\#[a-fA-F0-9]{6}/) != -1; 
}

//电话号码
function isTelphone(s){
	s = trim(s);
	var p = /(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/;
	return p.test(s);
}
//手机号码; 
function isMobile(s){ 
	s = trim(s); 
	var p = /(13|15|18)\d{9}/; 
	return p.test(s);
}
//身份证;
function isCard(s){ 
	s = trim(s); 
	var p = /^\d{15}(\d{2}[xX0-9])?$/; 
	return p.test(s);
}
//URL;
function isURL(s){
	s = trim(s).toLowerCase();
	var p = /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/;
	return p.test(s);
}

//Double;
function isDouble(s){
	s = trim(s);
	var p = /^[-\+]?\d+(\.\d+)?$/;
	return p.test(s);
}
//Integer;
function isInteger(s){
	s = trim(s);
	var p = /^[-\+]?\d+$/;
	return p.test(s);
}
//English;
function isEnglish(s){
	s = trim(s);
	var p = /^[A-Za-z]+$/;
	return p.test(s);
}
//大于0的整数
function isBig(s) {
    s = trim(s);
    var p = /^\d+$/;
    return p.test(s)
}

//中文;
function isChinese(s){
	s = trim(s);
	var p = /^[\u0391-\uFFE5]+$/;
	return p.test(s);
}
//双字节
function isDoubleChar(s){
	var p = /^[^\x00-\xff]+$/;
	return p.test(s);
}
//含有中文字符
function hasChineseChar(s){
	var p = /[^\x00-\xff]/;
	return p.test(s);
}
function hasAccountChar(s){
	var p = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,15}$/;
	return p.test(s);
}
String.prototype.getLength=function(){
 var text=this.replace(/[^\x00-\xff]/g,"**");
 return text.length;
}

function limitLen(s,Min,Max){
	s=trim(s);
	//alert(s.getLength());
	if(s=="") return false;
	if((s.getLength()<Min)||(s.getLength()>Max))
		return false;
	else
		return true;
}
//功能;
//延时事件;
function setDeferEvent(type,action,time){
	if (trim(time).length == 0) time = 1;
	if (typeof(time)!="number") time = 1;
	
	switch(type.toLowerCase()){
		case "go":
			window.setTimeout("window.location='"+ action +"'",time);
			break;
		case "alert":
			window.setTimeout("alert('"+ action +"')",time);
			break;
		case "js":
		case "javascript":
			window.setTimeout("'"+ action.toString() +"'",time);
			break;
		default:
			alert("Nothing will do!");
			break
	}		
}
function addLoadListener(handler){
	if (typeof window.addEventListener != 'undefined')
		window.addEventListener('load', handler, false);
	else if (typeof document.addEventListener != 'undefined')
		document.addEventListener('load', handler, false);
	else if (typeof window.attachEvent != 'undefined')
		window.attachEvent('onload', handler);
};
function addEventListener(element, eventType, handler, capture){
	try{
		if (element.addEventListener)
			element.addEventListener(eventType, handler, capture);
		else if (element.attachEvent)
			element.attachEvent("on" + eventType, handler);
	}
	catch (e) {}
};
function removeEventListener(element, eventType, handler, capture){
	try{
		if (element.removeEventListener)
			element.removeEventListener(eventType, handler, capture);
		else if (element.detachEvent)
			element.detachEvent("on" + eventType, handler);
	}
	catch (e) {}
};
//Image;
function preloadImages(){
	var d = document;
	if(d.images){
		if(!d.p_i_a) d.p_i_a = new Array();
		var i,j=d.p_i_a.length,a=arguments;
		for(i=0;i<a.length;i++){
			d.p_i_a[j]= new Image();
			d.p_i_a[j++].src = a[i];
		}
	}
}
window.onload=function(){
var obj=(document.getElementById("topnav").getElementsByTagName("li"));

obj[6].getElementsByTagName("div")[0].innerHTML='';
}

