﻿// JavaScript Document
// JavaScript Document
// finally this javascript is capatible to IE and FF.
// Point 1: document.getElementById
// Point 2: var
function CheckBrowser() 
{
  var app=navigator.appName;
  var verStr=navigator.appVersion;
  if (app.indexOf('Netscape') != -1) {
    alert("友情提示：\n 你使用的是Netscape浏览器，可能会导致无法使用后台的部分功能。建议您使用 IE6.0 或以上版本。");
  } 
  else if (app.indexOf('Microsoft') != -1) {
    if (verStr.indexOf("MSIE 3.0")!=-1 || verStr.indexOf("MSIE 4.0") != -1 || verStr.indexOf("MSIE 5.0") != -1 || verStr.indexOf("MSIE 5.1") != -1)
      alert("友情提示：\n 您的浏览器版本太低，可能会导致无法使用后台的部分功能。建议您使用 IE6.0 或以上版本。");
  }
}




function CheckAdminLoginForm()
{
	if(document.Login.UserName.value=="")
	{
		alert("请输入登录帐号");
		document.Login.UserName.focus();
		return false;
	}
	if(document.Login.Password.value == "")
	{
		alert("请输入登录密码");
		document.Login.Password.focus();
		return false;
	}
	if (document.Login.CheckCode.value==""){
       alert ("请输入验证码");
       document.Login.CheckCode.focus();
       return(false);
    }
}


function CheckAdminLoginForm_En()
{
	if(document.Login.UserName.value=="")
	{
		alert("pls input Admin Name");
		document.Login.UserName.focus();
		return false;
	}
	if(document.Login.Password.value == "")
	{
		alert("pls input Admin Pass");
		document.Login.Password.focus();
		return false;
	}
	if (document.Login.CheckCode.value==""){
       alert ("pls input Verification Code");
       document.Login.CheckCode.focus();
       return(false);
    }
}


function ConfirmDelete()
{
	if(document.myform.Action.value=="confirmDelete")
	{
		if(confirm("您删除后还可以在回收站恢复."))
		    return true;
		else
			return false;
	}
	else if(document.myform.Action.value=="ConfirmFSODelete")
	{
	if(confirm("警告:您真的要将彻底删除所选内容,本操作不可恢复."))
			return true;
		else
			return false;
	}	
}



function showsubadmin_menu(sid)
{
var whichEl = document.getElementById("subadmin_menu" + sid);
if (whichEl.style.display == "none")
{
	whichEl.style.display="";
}
else
{
	whichEl.style.display="none";
}
}

function ChangeBg(element,to)
{
element.style.backgroundColor = to;
}

// JavaScript Document
	var screen=true;i=0;width=0;
	function shiftwindow()
	{
		if(screen==false)
		{
		   document.all("AtMovePic2").style.display=""
		   document.all("AtMovePic1").style.display="none"
			parent.left.cols='0,9,780*';
			screen=true;		
		}
		else if(screen==true)
		{
			parent.left.cols='182,9,*';
			screen=false;	
  		    document.all("AtMovePic2").style.display="none"
		    document.all("AtMovePic1").style.display=""
		}
	}	

function CheckBrowser() 
{
  var app=navigator.appName;
  var verStr=navigator.appVersion;
  if (app.indexOf('Netscape') != -1) {
    alert("Tips:\n    You are using netscape, part of the function may not perfectly run. recommend you shift to IE 6 or above.");
  } 
  else if (app.indexOf('Microsoft') != -1) {
    if (verStr.indexOf("MSIE 3.0")!=-1 || verStr.indexOf("MSIE 4.0") != -1 || verStr.indexOf("MSIE 5.0") != -1 || verStr.indexOf("MSIE 5.1") != -1)
      alert("Tips:\n    Your Browser is too old, recommend you shift to IE 6 or above");
  }
}

// Drop Path to the text box
function doChange(objText, objDrop){
	if (!objDrop) return;
	var str = objText.value;
	var arr = str.split("|");
	var nIndex = objDrop.selectedIndex;
	objDrop.length=1;
	for (var i=0; i<arr.length; i++){
		objDrop.options[objDrop.length] = new Option(arr[i], arr[i]);
	}
	objDrop.selectedIndex = nIndex;
}

	function doChange(objText, objDrop){
		if (!objDrop) return;
		var str = objText.value;
		var arr = str.split("|");
		var nIndex = objDrop.selectedIndex;
		objDrop.length=1;
		for (var i=0; i<arr.length; i++){
			objDrop.options[objDrop.length] = new Option(arr[i], arr[i]);
		}
		objDrop.selectedIndex = nIndex;
	}
	
	
	function doSubmit(){
  		if (document.myform.d_ClassID.value=="")
  		{
    		alert("请选择对应类别");
			return false;
  		}
	}
		
	function ExhibitionSubmit(){
  		if (document.myform.d_IndustryID.value=="")
  		{
    		alert("请选择相应的行业");
			return false;
  		}
			
  		if (document.myform.d_LocationID.value=="")
  		{
    		alert("请选择对应地区");
			return false;
  		}
	}
	
	
// JavaScript Document
function CheckfrmAddClass()
{
  if (document.frmAddClass.ClassName.value=="")
  {
    alert("产品标题不能为空");
	document.frmAddClass.ClassName.focus();
	return false;
  }
}


function check()
{
  if (document.form1.ClassName.value=="")
  {
    alert("产品标题不能为空");
	document.form1.ClassName.focus();
	return false;
  }
}

function ConfirmDel1()
{
   alert("次类别含有子类别,请先删除子类别内容.");
   return false;
}

function ConfirmDel2()
{
   if(confirm("注意:本操作不可恢复"))
     return true;
   else
     return false;
	 
}
function ConfirmDel3()
{
   if(confirm("注意:本操作不可恢复"))
     return true;
   else
     return false;
	 
}

function unselectall()
{
    if(document.myform.chkAll.checked){
	document.myform.chkAll.checked = document.myform.chkAll.checked&0;
    } 	
}

function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll"&&e.disabled==false)
       e.checked = form.chkAll.checked;
    }
  }
  
function ConfirmDel()
{
	if(document.myform.Action.value=="Del")
	{
		if(confirm("您删除后还可以在回收站恢复."))
		    return true;
		else
			return false;
	}
	else if(document.myform.Action.value=="ConfirmDel")
	{
	if(confirm("警告:您真的要将彻底删除所选内容,本操作不可恢复."))
			return true;
		else
			return false;
	}	
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

<!--
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];}
}
//------------------------
function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
//------------------------
function window_onresize() {
if(window.screen.width > 100){  //当窗口被拉宽时，恢复为默认窗口
	window.resizeTo(100,500)

}
}
//------------------------------
function window_onload() {
	window.moveTo(1,1)
	window.resizeTo(100,500)
}
//----------------------------
function window_onunload() {  //当窗口被刷新或关闭时，判断是否处理当前用户的在线状态
window.open ("switch.htm","","left=2000,top=-100, width=1,height=1")
}
//----------------------
function window_onblur() {
returnMsg()
}

//----------------------
function CheckAll0(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 SetFocus()
{
if (document.Login.UserName.value=="")
	document.Login.UserName.focus();
else
	document.Login.UserName.select();
}
function CheckForm()
{
	if(document.Login.UserName.value=="")
	{
		alert("pls input Admin Name");
		document.Login.UserName.focus();
		return false;
	}
	if(document.Login.Password.value == "")
	{
		alert("pls input Admin Pass");
		document.Login.Password.focus();
		return false;
	}
	if (document.Login.CheckCode.value==""){
       alert ("pls input Verification Code");
       document.Login.CheckCode.focus();
       return(false);
    }
}

function regInput(obj, reg, inputStr)
{
var docSel	= document.selection.createRange()
if (docSel.parentElement().tagName != "INPUT")	return false
oSel = docSel.duplicate()
oSel.text = ""
var srcRange	= obj.createTextRange()
oSel.setEndPoint("StartToStart", srcRange)
var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
return reg.test(str)
}

