﻿
// 有无DOCTYPE声明 
var getElmObj = document.documentElement;
function isDBody(){
  return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function getElmID(xID){
  return document.getElementById(xID);
}

function ShowDiv(xID)
{
 nDiv = getElmID(xID);
 if(nDiv.style.display=='none') { nDiv.style.display = ''; }
 else { nDiv.style.display = 'none'; } 
}   

// onload="javascript:ReSizePic(this,150,150);"
function setImgSiz2(xImg,xWidth,xHeight)
{
 var MaxWidth=xWidth;          var MaxHeight=xHeight; 
 var ObjImg=new Image();       ObjImg.src=xImg.src; 
 var ImgWidth=ObjImg.width;    var ImgHeight=ObjImg.height; 
 var RatHW=ImgHeight/ImgWidth; var RatWH=ImgWidth/ImgHeight;
 if(ImgWidth>MaxWidth){
    ImgWidth=MaxWidth;   ImgHeight=MaxWidth*RatHW;
 }
 if(ImgHeight>MaxHeight){
    ImgHeight=MaxHeight; ImgWidth=MaxHeight*RatWH;
 }
    xImg.width=ImgWidth; xImg.height=ImgHeight;
}


// 折叠目录树
function ChkTree(xID)
{
  ///////////////////////////
  var aLays,j // sLays
  aLays=sLays.split(";");
  for(j=0;j<aLays.length;j++)
  { 
    if ( (aLays[j]!="") && (xID.indexOf(aLays[j])<0) )
	{ 
	  eval("PeaceM" + aLays[j] + ".style.display=\"none\";"); 
	}
  }
  ///////////////////////////
  var aID,i;
  aID = xID.split(";"); 
  for(i=0;i<aID.length;i++)
  {
    if(aID[i]!="")
	{
//////////////////
try
 {
//////////////////
      e = eval("PeaceM" + aID[i]); 
	  if ( (aID.length<=2) || (aID.length>2)&&(i==aID.length-2) ) {
	     if (e.style.display == "none"){eval("PeaceM" + aID[i] + ".style.display=\"\";");    }
	     else                          {eval("PeaceM" + aID[i] + ".style.display=\"none\";");}
	  }else {
	     eval("PeaceM" + aID[i] + ".style.display=\"\";");
	  }
//////////////////
 }catch(o){ 
 }
//////////////////
    }
  }
}

function PicReLoad(xPath,xType)
{
  var dImg = getElmID("ChkCImg"); // undefined document.write(xType); 
  var dTyp = ""; if(xType!=undefined) { dTyp="&SysPCode="+xType; }
  dImg.setAttribute("src",xPath+"sadm/pcode/img_frnd.asp?xRnd="+Math.random()+dTyp+"");
}

function InnSearch(xThis){
  var KW = xThis.KW.value;
  var TP = xThis.TP.value; if(TP.length==0) { alert("请选择一个类别"); return false; }
  var Url = TP+'&KeyWD='+KW; 
  xThis.action = Url;
  xThis.submit(); //return false;
  return true;
}


function getXmlHttp() {
  var xmlHttp = false;
  try {
     xmlHttp = new XMLHttpRequest();
  } catch (trymicrosoft) {
    try {
       xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (othermicrosoft) {
      try {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (failed) {
        xmlHttp = false;
      }
    }
  }
  if (!xmlHttp){
    alert("无法创建 XMLHttpRequest 对象！");
  }
  return xmlHttp;
}
//var xmlHttp = getXmlHttp();
function getForm(xMod) {
  var url = "pub_ajax.php?yAct=GetForm&tMod="+xMod; 
  xmlHttp.open("GET", url, true); //这里的true代表是异步请求
  xmlHttp.onreadystatechange = showForm;
  xmlHttp.send(null);
}
function showForm(){
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText; 
  }
}
