/* 上传图片处理 */
function UploadPic(InputName, PicName) {
    var Width=320;
    var Height=280;
    var Left=window.screen.width/2-Width/2;
    var Top=window.screen.height/2-Height/2;
    window.open('../admin/upload_image.php?PicName='+PicName+'&code='+document.getElementsByName(InputName)[0].value+'&InputName='+InputName, 'UploadPic', 'width='+Width+', height='+Height+', top='+Top+', left='+Left+', resizable=no, scrollbars=yes');
}
function UploadOther(InputName, PicName) {
    var Width=320;
    var Height=280;
    var Left=window.screen.width/2-Width/2;
    var Top=window.screen.height/2-Height/2;
    window.open('../admin/upload_other.php?PicName='+PicName+'&code='+document.getElementsByName(InputName)[0].value+'&InputName='+InputName, 'UploadOther', 'width='+Width+', height='+Height+', top='+Top+', left='+Left+', resizable=no, scrollbars=yes');
}
function DelPic(InputName, PicName) {
    if (document.getElementsByName(InputName)[0].value!="")
        window.open('../admin/upload_save.php?PicName='+PicName+'&mtlAction=del&code='+ document.getElementsByName(InputName)[0].value+ '&InputName='+ InputName, 'up', 'width=1, height=1, top=2000, left=2000, resizable=no, scrollbars=no');
    else
        alert('提示: 没有找到文件.');
}
function ViewPic(InputName, PicName) {
    if (document.getElementsByName(InputName)[0].value!="")
        window.open('../'+PicName+'/'+document.getElementsByName(InputName)[0].value, 'ViewPic', '');
    else
        alert('提示: 没有找到任何文件.');
}
/**/
function jShowMySubmenu(id) {
	for (var i=0; ; i++) {
		if (document.getElementById('submenu_'+i)) {
			if (i == id) {
				var _display = document.getElementById('submenu_'+i).style.display;
				//alert (_display);
				document.getElementById('submenu_'+i).style.display = (_display)?'':'none';
			}
			else {
				document.getElementById('submenu_'+i).style.display='none';
			}
		}
		else {
			return;
		}
	}
}
/* 仿PHP trim 函数 */
function trim(string) {
	if (string==null) return "";
	if (typeof(string)=='object'&&(''+string=='null'||''+string=='undefined')) return '';
	if (typeof(string)!="string") string=""+string;
	return string.replace(/^\s+|\s+$/g,"");
}
/* 搜索检查 */
function jCheckSearcher(theform, language) {
    var _msg;
    if (language=="chinese")
        _msg="提示：请输入搜索关键字后再进行查询。";
    else if (language=="english")
        _msg="Tips: you must input the keyword field.";
    else
        return false;
	if (!trim(theform.swhere.value)) {
		alert(_msg);
		theform.swhere.focus();
		return false;
	}
	if (!trim(theform.keywords.value)) {
		alert(_msg);
		theform.keywords.focus();
		return false;
	}
}
/* 弹出窗口 */
function jOpenWindow(oWindowName, url, oWidth, oHeight, oResizable) {
	oWidth=(oWidth>0)?(oWidth + 38):"550";
	oHeight=(oHeight>0)?oHeight:"420";
	oResizable=(oResizable>0)?oResizable:"no";
	window.open(url, oWindowName, 'width='+oWidth+', height='+oHeight+', resizable='+oResizable+', scrollbars=yes, top=0');
}

/* 鼠标经过图片JS */
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

window.onload=flashstyle;
// 当页面载入成功时自动运行
function flashstyle() {
	var obj=document.body.getElementsByTagName("input");
	for (var i=0;i<obj.length;i++) {
		switch (obj[i].type) {
			case "text" :
			case "password" :
			case "file" :
				//obj[i].style.backgroundColor="#1A8DD8";
				obj[i].style.border="solid 1px #A3A3A3";
				obj[i].style.padding="1px 2px 1px 2px";
				obj[i].onmouseover=function(){this.style.borderColor="#C2C2C2";}
				obj[i].onmouseout=function(){this.style.borderColor="#A3A3A3";}
				obj[i].onfocus=function(){this.style.borderColor="#FFD9B3";}
			break;
			case "submit" :
			case "reset" :
			case "button" :
				obj[i].style.cursor="pointer";
				obj[i].style.fontWeight="bold";
				obj[i].style.padding="2px";
				//obj[i].style.letterSpacing="2em";
				obj[i].style.backgroundColor="#1A58A4";
				obj[i].style.color="#FFFFFF";
				obj[i].style.border="solid 1px #539EFB";
				obj[i].onmouseover=function(){this.style.borderColor="#A6CEFF";}
				obj[i].onmouseout=function(){this.style.borderColor="#539EFB";}
				obj[i].style.filter="progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#1A58A4,EndColorStr=#236AC1)";
			break;
			case "checkbox" :
			case "radio" :
				obj[i].onfocus=function(){this.blur()}
			break;
		}
	}
}

/* 弹出窗口显示图片 */
function jShowPhoto(url) {
	if (!url)
		url = "show_photo.html";
    else
        url = "show_photo.html#" + url;
	window.open(url, 'ShowPhoto', 'width=150, height=50, resizable=no, scrollbars=no, top=0');
}


/* 页面顶部 */
function jT(MenuID) {
	var Gb2312_Url;
	var En_Url;
	Gb2312_Url = window.location.href ;
	En_Url = window.location.href ;
	Gb2312_Url = Gb2312_Url.replace("/english/", "/simplified/");
	En_Url = Gb2312_Url.replace("/simplified/", "/english/");

	var i;
	var MMM = new Array()

	for (i=0; i<10; i++) {
		if (MenuID == i) { MMM[i] = "class='selected'" ;}
		else { MMM[i] = "" ;}
	}

	reval  = "";
	reval += "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"images/top_bg.jpg\">";
	reval += "  <tr>";
	reval += "    <td width=\"65%\" height=\"70\"><img src=\"images/logo.gif\" /></td>";
	reval += "    <td width=\"35%\"><embed src='flash/banner2.swf' width='370' height='80' wmode='transparent'></embed></td>";
	reval += "  </tr>";
	reval += "</table>";
	reval += "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"#FFFFFF\">";
	reval += "  <tr align=\"center\" bgcolor=\"#F6681E\">";
	reval += "    <td width=\"1%\" height=\"27\" bgcolor=\"#F6681E\"></td>";
	reval += "    <td width=\"10%\" bgcolor=\"#CBC5C5\"><a href='" + En_Url + "'><img src='images/lang_english.gif' border='0' /></a></td>";
	reval += "    <td width=\"87%\"><ul id=\"mainmenu\">";
	reval += "        <li " + MMM[0] + "><a href=\"./\">首 页</a></li>";
	reval += "        <li " + MMM[1] + "><a href=\"aboutus.php\">关于我们</a></li>";
	reval += "        <li " + MMM[2] + "><a href=\"news_list.php?genre_id=1\">新闻动态</a></li>";
	reval += "        <li " + MMM[3] + "><a href=\"products_list.php\">产品展示</a></li>";
	reval += "        <li " + MMM[4] + "><a href=\"safety_standards.php\">安全标准</a></li>";
	reval += "        <li " + MMM[5] + "><a href=\"manuals.php\">用户指南</a></li>";
	reval += "        <li " + MMM[6] + "><a href=\"news_list.php?genre_id=3\">技术资讯</a></li>";
	//reval += "        <li " + MMM[7] + "><a href=\"inquiry.php\">网上询价</a></li>";
	reval += "        <li " + MMM[8] + "><a href=\"contactus.php\">联系我们</a></li>";
	reval += "    </ul></td>";
	reval += "  </tr>";
	reval += "</table>";

    document.write(reval);
}

/* 页面底部 */
function jB() {
	reval  = "";
	reval += "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
	reval += "  <tr>";
	reval += "    <td height='3' bgcolor='#B8B4B3'></td>";
	reval += "  </tr>";
	reval += "  <tr>";
	reval += "    <td height='45' align='center' bgcolor='#CBC5C5'>";
	reval += "深圳市德安泰防护科技有限公司版权所有&copy; 2005<br />公司地址：深圳市南山区西丽官龙第一工业区H栋二楼 邮编：518055<br />总机电话：0755-8665 4055 &nbsp; 传真：0755-8665 4081 &nbsp; 电子邮件：<a href='mailto:info@tecronsafety.com'>info@tecronsafety.com</a><br />";
	reval += "</td>";
	reval += "  </tr>";
	reval += "</table>";

    document.write(reval);
}


