﻿var myXmlDoc;
var IE;
var xmlhttp;
var UserXmlDoc;
var RootSite="/";
var ComID=0;
function ooj(idname){
	return document.getElementById( idname );
}
function oos(idname){
	return document.getElementsByName( idname );
}
try{
   myXmlDoc = new ActiveXObject("Microsoft.XMLDOM");
   UserXmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 
   IE=true;
   }catch(e){
   myXmlDoc =  document.implementation.createDocument("", "", null);
   UserXmlDoc =  document.implementation.createDocument("", "", null);
   IE=false;
  }
 
myXmlDoc.async=false;
UserXmlDoc.async=false;
try{
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   }catch(e){
   xmlhttp = new XMLHttpRequest();
}
String.prototype.Trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
function ShowMenu(id){
	var menu=document.getElementById(id);
	if (menu.style.display=="none"){
		menu.style.display="";
	}else{
		menu.style.display="none";
	}
}
function ShowOne(OrderName,OrderNum)
{
	try{
return myXmlDoc.getElementsByTagName(OrderName)[OrderNum].firstChild.nodeValue;
}catch(e){
		return "";
	}
}
function ShowOnes(OrderName,OrderNum)
{//attributes
return myXmlDoc.getElementsByTagName(OrderName)[OrderNum].attributes
}
function IsInt(code)
  {
  var i,j,strTemp;
  var GoInt=true;
 strTemp="0123456789";
 if ( code.length == 0 ){
 GoInt = false;
 }
 for (i=0;i<code.length;i++)
 {
  j=strTemp.indexOf(code.charAt(i)); 
  if (j==-1)
  {
   GoInt = false;
   break;
  }
 }
 return GoInt;
}
 
  function Em(str){return(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(str))}
  function Http(str){return(/^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/.test(str))}
  function QQ(str){return(/^[1-9]\d{4,11}$/.test(str))}
  
var AllCount=0;
var EnString="abcdefghijklmnopqrstuvwxyz1234567890_";
var GBCount=0;
var ENCount=0;
var AnyCount=0;
var kaka="Yes";
function GoCount(ckstring){
var kaka="Yes";
AllCount=0;
GBCount=0;
ENCount=0;
AnyCount=0;
ckstring=ckstring.toLowerCase();
var r;
for(i=0;i<ckstring.length;i++)   
          {   
                  r   =   ckstring.charCodeAt(i,1); 
                  if(r<=255){
				  AllCount++;
				  ENCount++;
				  var thisstring=ckstring.substring(i,i+1);
                     if (EnString.indexOf(thisstring)<0)
                     {
                     AnyCount++;
                     }
                     if(i==0&&thisstring=="_"){
                     AnyCount++;
                     }
                  }else{
				  AllCount=AllCount+2;
				  GBCount++;
				  } 
          }
          kaka=kaka;
}
function OpenUrl(){
var args=OpenUrl.arguments;
var GoLong=0;
//var type=new Array("Url","Name","height","width","top","left","toolbar","menubar","scrollbars","resizable","location","status");
var file=new Array("/Close.Html","CreatB.Com","300","450","yes","200","300","no","no","no","no","no");
if (args.length<1){
alert("Error!");
return false;
}
if (args.length>12){
GoLong=12;
}else{
GoLong=args.length;
}
for (var i=0;i<args.length;i++){
if (args[i].Trim()!="")file[i]=args[i];
}
window.open (file[0], file[1], 'height='+file[2]+', width='+file[3]+', scrollbars='+file[4]+', top='+file[5]+', left='+file[6]+', toolbar='+file[7]+', menubar='+file[8]+', resizable='+file[9]+',location='+file[10]+', status='+file[11]+'') //这句要写成一行
}
function OpenMiddle( url, winName, width, height) 
{
xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 ))
{
xposition = (screen.width - width) / 2;
yposition = (screen.height - height) / 2;
}
theproperty= "width=" + width + "," 
+ "height=" + height + "," 
+ "location=0," 
+ "menubar=0,"
+ "resizable=0,"
+ "scrollbars=1,"
+ "status=0," 
+ "titlebar=0,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + "," 
+ "screeny=" + yposition + ","
+ "left=" + xposition + "," //IE
+ "top=" + yposition; //IE 
window.open( url,winName,theproperty );
}
var flag=false;
function DrawImage(ImgD,Hw,Hh){
 var image=new Image();
 var iwidth = Hw;  
 var iheight = Hh; 
 image.src=ImgD.src;
 if(image.width>0 && image.height>0){
 flag=false;
 if(image.width/image.height>= iwidth/iheight){
  if(image.width>iwidth){  
  ImgD.width=iwidth;
  ImgD.height=(image.height*iwidth)/image.width;
  }else{
  ImgD.width=image.width;  
  ImgD.height=image.height;
  }
  }
 else{
  if(image.height>iheight){  
  ImgD.height=iheight;
  ImgD.width=(image.width*iheight)/image.height;  
  }else{
  ImgD.width=image.width;  
  ImgD.height=image.height;
  }
  }
 }
} 
function   HtmlDecode(text)   
{   
   try{
	   return encodeURIComponent(text);
   }catch(e){
       return   text.replace(/&/g,   '&amp').replace(/\"/g,   '&quot;').replace(/</g,   '&lt;').replace(/>/g,   '&gt;');
	   }
}
function QueryString(sName)   
  {   
  var   sSource   =   String(window.document.location);   
  var   sReturn   =   "";   
  var   sQUS   =   "?";   
  var   sAMP   =   "&";   
  var   sEQ   =   "=";   
  var   iPos;     
  iPos   =   sSource.indexOf(sQUS);   
  var   strQuery   =   sSource.substr(iPos,   sSource.length   -   iPos);   
  var   strLCQuery   =   strQuery.toLowerCase();   
  var   strLCName   =   sName.toLowerCase();    
  iPos   =   strLCQuery.indexOf(sQUS   +   strLCName   +   sEQ);   
  if   (iPos   ==   -1)   
  {   
  iPos   =   strLCQuery.indexOf(sAMP   +   strLCName   +   sEQ);   
  if   (iPos   ==   -1)   
  return   "";   
  }   
  sReturn   =   strQuery.substr(iPos   +   sName.length   +   2,strQuery.length-(iPos   +   sName.length   +   2));   
  var   iPosAMP   =   sReturn.indexOf(sAMP);    
  if   (iPosAMP   ==   -1)   
  return   sReturn;   
  else   
  {   
  sReturn   =   sReturn.substr(0,   iPosAMP);   
  }   
  return   sReturn;   
  }
function Flash(file, w, h)
{
	document.write("\r\n\
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + w + "' height='" + h + "'>\r\n\
	<param name='movie' value='" + file + "' />\r\n\
	<param name='wmode' value='Opaque' />\r\n\
	<param name='menu' value='true' />\r\n\
	<param name='quality' value='high' />\r\n\
	<param name='SCALE' value='noborder' /><param name=\"loop\" value=\"true\" />\r\n\
	<embed type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' loop='true' menu='true' quality='high' wmode='Opaque' src='" + file + "' width='" + w + "' height='" + h + "'  scale='noborder'></embed>\r\n\
</object>");
}
function UBBImage(ImageID){
  if(ImageID.width>550){
  ImageID.width=550;
  ImageID.height=(ImageID.height*550)/ImageID.width;
  }
}
function SelectAll(obj){
var CkeckType=document.getElementsByName("SelectID");
for (i=0;i<CkeckType.length;i++){
CkeckType[i].checked=obj.checked;
}
}
function CheckSelect()
{
    var aspnetForm=document.getElementsByName("SelectID");
    var checked=false;
    if (aspnetForm != null)
    {
            for (i=0;i<aspnetForm.length;i++)
            {
                if(aspnetForm[i].checked == true)
                {
                    checked=true;
                }
            }
    }
    if (checked == false)
    {
        alert("请至少选择一项！");
        return false;
    }
    else
    {
        if (!confirm("你确认执行此操作？"))
        {
            return false;
        }
    }
    return true;
}

function ckcode(){
   document.getElementById("ImageCode").src=""+RootSite+"Images/009.gif";
   document.getElementById("ImageCode").src=""+RootSite+"ShowCode.aspx?Rnd="+Math.random()+"";
}
function LinkShow(ImageID){
    gg=ooj("LinkImage_"+ImageID);
    gg.src="images/Link_"+ImageID+"_On.jpg";
    gg.onmouseover=null;
    gg.onmouseout=null;
}
function setCookie(name,value) {
   var today = new Date();
   var expires = new Date();
   expires.setTime(today.getTime() + 1000*60*60*24*365);
   try{
   document.cookie = name + "=" + encodeURIComponent(value) + "; expires=" + expires.toGMTString();
   }catch(e){
   document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString();
   }
}

function getCookie(Name) {
   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;
		 try{
         return decodeURIComponent(document.cookie.substring(offset, end));
		 }catch(e){
         return unescape(document.cookie.substring(offset, end));
		 }
      }
      else return('');
   }
   else return('');
}
function addEvent(obj,evtType,func,cap){
    cap=cap||false;
 if(obj.addEventListener){
     obj.addEventListener(evtType,func,cap);
  return true;
 }else if(obj.attachEvent){
        if(cap){
         obj.setCapture();
         return true;
     }else{
      return obj.attachEvent("on" + evtType,func);
  }
 }else{
  return false;
    }
}
function getPageScroll(){
    var xScroll,yScroll;
 if (self.pageXOffset) {
  xScroll = self.pageXOffset;
 } else if (document.documentElement  &&  document.documentElement.scrollLeft){
  xScroll = document.documentElement.scrollLeft;
 } else if (document.body) {
  xScroll = document.body.scrollLeft;
 }
 if (self.pageYOffset) {
  yScroll = self.pageYOffset;
 } else if (document.documentElement  &&  document.documentElement.scrollTop){
  yScroll = document.documentElement.scrollTop;
 } else if (document.body) {
  yScroll = document.body.scrollTop;
 }
 arrayPageScroll = new Array(xScroll,yScroll);
 return arrayPageScroll;
}
function GetPageSize(){
    var xScroll, yScroll;
    if (window.innerHeight  &&  window.scrollMaxY) { 
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight){
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } else {
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }
    var windowWidth, windowHeight;
    if (self.innerHeight) {
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    } else if (document.documentElement  &&  document.documentElement.clientHeight) {
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) {
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    } 
    if(yScroll < windowHeight){
        pageHeight = windowHeight;
    } else { 
        pageHeight = yScroll;
    }
    if(xScroll < windowWidth){ 
        pageWidth = windowWidth;
    } else {
        pageWidth = xScroll;
    }
    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
    return arrayPageSize;
}
var AdMoveConfig=new Object();
AdMoveConfig.IsInitialized=false;
AdMoveConfig.ScrollX=0;
AdMoveConfig.ScrollY=0;
AdMoveConfig.MoveWidth=0;
AdMoveConfig.MoveHeight=0;
AdMoveConfig.Resize=function(){
    var winsize=GetPageSize();
    AdMoveConfig.MoveWidth=winsize[2];
    AdMoveConfig.MoveHeight=winsize[3];
    AdMoveConfig.Scroll();
}
AdMoveConfig.Scroll=function(){
    var winscroll=getPageScroll();
    AdMoveConfig.ScrollX=winscroll[0];
    AdMoveConfig.ScrollY=winscroll[1];
}
addEvent(window,"resize",AdMoveConfig.Resize);
addEvent(window,"scroll",AdMoveConfig.Scroll);
function AdMove(id){
    if(!AdMoveConfig.IsInitialized){
        AdMoveConfig.Resize();
        AdMoveConfig.IsInitialized=true;
    }
    var obj=document.getElementById(id);
    obj.style.position="absolute";
    var W=AdMoveConfig.MoveWidth-obj.offsetWidth;
    var H=AdMoveConfig.MoveHeight-obj.offsetHeight;
    var x = W*Math.random(),y = H*Math.random();
    var rad=(Math.random()+1)*Math.PI/6;
    var kx=Math.sin(rad),ky=Math.cos(rad);
    var dirx = (Math.random()<0.5?1:-1), diry = (Math.random()<0.5?1:-1);
    var step = 1;
    var interval;
    this.SetLocation=function(vx,vy){x=vx;y=vy;}
    this.SetDirection=function(vx,vy){dirx=vx;diry=vy;}
    obj.CustomMethod=function(){
        obj.style.left = (x + AdMoveConfig.ScrollX) + "px";
        obj.style.top = (y + AdMoveConfig.ScrollY) + "px";
        rad=(Math.random()+1)*Math.PI/6;
        W=AdMoveConfig.MoveWidth-obj.offsetWidth;
        H=AdMoveConfig.MoveHeight-obj.offsetHeight;
        x = x + step*kx*dirx;
        if (x < 0){dirx = 1;x = 0;kx=Math.sin(rad);ky=Math.cos(rad);} 
        if (x > W){dirx = -1;x = W;kx=Math.sin(rad);ky=Math.cos(rad);}
        y = y + step*ky*diry;
        if (y < 0){diry = 1;y = 0;kx=Math.sin(rad);ky=Math.cos(rad);} 
        if (y > H){diry = -1;y = H;kx=Math.sin(rad);ky=Math.cos(rad);}
    }
    this.Run=function(){
        var delay = 10;
        interval=setInterval(obj.CustomMethod,delay);
        obj.onmouseover=function(){clearInterval(interval);}
        obj.onmouseout=function(){interval=setInterval(obj.CustomMethod, delay);}
    }
}

