// JavaScript Document
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) {
    if (obj.style) {obj=obj.style;}
	v=args[i+2];
	if(v){v=(v=='show')?'visible':(v=='hide')?'hidden':v;}
	else {v=obj.visibility; v=(v=='hidden')?'visible':(v=='visible')?'hidden':v;}
    obj.visibility=v; }
}

function doselectAll(theBox){
  	xState=theBox.checked;
  	elm=theBox.form.elements;
  	for(i=0;i<elm.length;i++) {
   		if(elm[i].type=="checkbox") {
			elm[i].checked=xState;
		}
	}    
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' 必须是一个EMAIL地址.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' 必须包含一个数字.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' 必须在数字 '+min+' 和 '+max+'之间.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' 是必填的.\n'; }
  } if (errors) alert('有以下错误发生:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

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];}}
}

// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + value + expire;
}

// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

function switchTab(tabid)
{
    var obj;
    var obj2;
	for(i=1; i <=6; i++)
	{
		obj=document.getElementById("navtab_"+i);
		obj2=document.getElementById("tabcontent"+i);
		if (obj!=null)
		{
   		   if (i==tabid)
		   {
		     if(i!=1) obj.className="nav_on";
		     if (obj2!=null)
		        obj2.style.display='block';
		   }
		   else
		   {
   		     if(i!=1) obj.className="nav";
		     if (obj2!=null)
		        obj2.style.display='none';
		   }
		}
    } 
}

function area_switchTab(tabid)
{
    var obj;
    var obj2;
	for(i=1; i <=8; i++)
	{
		obj=document.getElementById("area_tab_"+i);
		obj2=document.getElementById("area_tabcontent"+i);
		if (obj!=null)
		{
   		   if (i==tabid)
		   {
		     obj.className="tuijian_nav_on";
		     if (obj2!=null)
		        obj2.style.display='block';
		   }
		   else
		   {
   		     obj.className="tuijian_nav";
		     if (obj2!=null)
		        obj2.style.display='none';
		   }
		}
    } 
}

function confirm_redirect(url,text)
{
	if (confirm(text)) {
			window.location = url;
	}
}
function   myAddPanel(title,url,desc)   {   
  if   ((typeof   window.sidebar   ==   'object')   &&   (typeof   window.sidebar.addPanel   ==   'function'))//Gecko   
  {   
  window.sidebar.addPanel(title,url,desc);   
  }   
  else//IE   
  {   
  window.external.AddFavorite(url,title);   
  }   
}   

function s_login(){
	var eSrc=(document.all)?window.event.srcElement:arguments[1];
	var shield = document.createElement("DIV");
	shield.id = "shield";
	shield.style.position = "absolute";
	shield.style.left = "0px";
	shield.style.top = "0px";
	shield.style.width = "100%";
	shield.style.height = ((document.documentElement.clientHeight>document.documentElement.scrollHeight)?document.documentElement.clientHeight:document.documentElement.scrollHeight)+"px";
	shield.style.background = "#333";
	shield.style.textAlign = "center";
	shield.style.zIndex = "10000";
	shield.style.filter = "alpha(opacity=0)";
	shield.style.opacity = 0;
/*
	var alertFram = document.createElement("DIV");
	alertFram.id="alertFram";
	alertFram.style.position = "absolute";
	alertFram.style.left = "50%";
	alertFram.style.top = "50%";
	alertFram.style.marginLeft = "-225px" ;
	alertFram.style.marginTop = -75+document.documentElement.scrollTop+"px";
	alertFram.style.width = "450px";
	alertFram.style.height = "150px";
	alertFram.style.border = "8px solid #EEEEEE";
	alertFram.style.background = "#FFFFFF";
	alertFram.style.textAlign = "center";
	alertFram.style.lineHeight = "150px";
	alertFram.style.zIndex = "10001";
	//strHtml = document.getElementById('login_form').innerHTML;

	strHtml  = "<ul style=\"list-style:none;margin:0px;padding:0px;width:100%\">\n";
	strHtml += "	<li style=\"background:#DD828D;text-align:left;padding-left:20px;font-size:14px;font-weight:bold;height:25px;line-height:25px;border:1px solid #F9CADE;\">[系统提示]</li>\n";
	strHtml += "	<li style=\"background:#fff;text-align:center;font-size:12px;height:120px;line-height:120px;border-left:1px solid #F9CADE;border-right:1px solid #F9CADE;\">"+txt+"</li>\n";
	strHtml += "	<li style=\"background:#FDEEF4;text-align:center;font-weight:bold;height:25px;line-height:25px; border:1px solid #F9CADE;\"><input type=\"button\" value=\"确 定\" id=\"do_OK\" onclick=\"doOk()\" /></li>\n";
	strHtml += "</ul>\n";

	strHtml = "<form style=\"padding:0; margin:0\">\n";
	strHtml  += "<ul style=\"list-style:none;margin:0px;padding:0px;width:100%\">\n";
strHtml += "<li style=\"text-align:right; padding:5px;\"><img src=\"img\/window_close_grey.gif\" border=\"0\" onclick=\"doOk()\" \/><\/li>\n";

strHtml += "</ul>\n";
strHtml += "<\/form>";

	alertFram.innerHTML = strHtml;
*/
	//document.body.appendChild(alertFram);
	document.body.appendChild(shield);
	document.getElementById("login_form").style.display='block';
	this.setOpacity = function(obj,opacity){
		if(opacity>=1)opacity=opacity/100;
		try{ obj.style.opacity=opacity; }catch(e){}
		try{ 
			if(obj.filters.length>0&&obj.filters("alpha")){
				obj.filters("alpha").opacity=opacity*100;
			}else{
				obj.style.filter="alpha(opacity=\""+(opacity*100)+"\")";
			}
		}catch(e){}
	}
	var c = 0;
	this.doAlpha = function(){
		if (++c > 20){clearInterval(ad);return 0;}
		setOpacity(shield,c);
	}
	var ad = setInterval("doAlpha()",1);
	this.doOk = function(){
		//alertFram.style.display = "none";
		//shield.style.display = "none";
		//document.body.removeChild(alertFram);
		document.getElementById("login_form").style.display='none';
		document.body.removeChild(shield);
		//eSrc.focus();
		document.body.onselectstart = function(){return true;}
		document.body.oncontextmenu = function(){return true;}
	}
	//document.getElementById("do_OK").focus();
	//eSrc.blur();
	document.body.onselectstart = function(){return false;}
	document.body.oncontextmenu = function(){return false;}
}