﻿//Author        : alan
//Description   : 提示信息
//Version       : 1.0
//CreateDate    : 2008-01-01
//ModifyDate    : 
function sAlert(str,url){
    var msgw,msgh,bordercolor;
    msgw=300;//提示窗口的宽度
    msgh=50;//提示窗口的高度
    titleheight=25 //提示窗口标题高度
    bordercolor="#336699";//提示窗口的边框颜色
    titlecolor="#99CCFF";//提示窗口的标题颜色

    var sWidth,sHeight;
    sWidth=document.body.offsetWidth;
	sHeight=document.body.offsetHeight;
	document.body.style.overflow="hidden";//滚动条

    var bgObj=document.createElement("div");
    bgObj.setAttribute('id','bgDiv1');
    bgObj.style.position="absolute";
    bgObj.style.top="0";
    bgObj.style.background="#777";
    bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
    bgObj.style.opacity="0.6";
    bgObj.style.left="0";
    bgObj.style.width=sWidth + "px";
    bgObj.style.height=sHeight+ "px";
    bgObj.style.zIndex = "10000";
    document.body.appendChild(bgObj);

    var msgObj=document.createElement("div")
    msgObj.setAttribute("id","msgDiv1");
    msgObj.setAttribute("align","center");
    msgObj.style.background="white";
    msgObj.style.border="1px solid " + bordercolor;
    msgObj.style.position = "absolute";
    msgObj.style.left = "50%";
    msgObj.style.top = "52%";
    msgObj.style.font="13px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
    msgObj.style.marginLeft = "-150px" ;
    msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";
    msgObj.style.width = msgw + "px";
    msgObj.style.height =msgh + "px";
    msgObj.style.textAlign = "center";
    msgObj.style.lineHeight ="25px";
    msgObj.style.zIndex = "10001";
    document.body.appendChild(msgObj);

    var txt=document.createElement("p");
    txt.style.margin="1em 0"
    txt.setAttribute("id","msgTxt1");
    txt.innerHTML=str;
    document.getElementById("msgDiv1").appendChild(txt);
     ///调用模拟时间延迟
    Sleep(this,3000);
      this.NextStep=function() 
      {
       document.body.removeChild(bgObj);
       document.body.removeChild(msgObj);
       if(url!="")
       {
           window.location=url;
       }
    }
  
}
///sleep 模拟时间延迟
function Sleep(obj,iMinSecond) 
 {  
      if (window.eventList==null)  
      window.eventList=new Array();  
      var ind=-1; 
      for (var i=0;i<window.eventList.length;i++) 
      {   
       if (window.eventList[i]==null)  
       {  
        window.eventList[i]=obj;    
        ind=i;   
        break;   
       }  
      }  
      if (ind==-1) 
      {   
       ind=window.eventList.length;   
       window.eventList[ind]=obj; 
      }  
      setTimeout("GoOn(" + ind + ")",iMinSecond); 
     } 
function GoOn(ind) 
{  
      var obj=window.eventList[ind]; 
      window.eventList[ind]=null; 
      if (obj.NextStep) 
      obj.NextStep(); 
      else obj(); 
 }
 
 
 function Alert(str)
 {
  var msgw,msgh,bordercolor;
    msgw=150;//提示窗口的宽度
    msgh=10;//提示窗口的高度
    titleheight=25 //提示窗口标题高度
    bordercolor="#8DD3FF";//提示窗口的边框颜色
    titlecolor="#99CCFF";//提示窗口的标题颜色

    var msgObj=document.createElement("div")
    msgObj.setAttribute("id","msgDiv");
    msgObj.setAttribute("align","center");
    msgObj.style.background="#E2F2FF";
    msgObj.style.border="1px solid " + bordercolor;
    msgObj.style.position = "absolute";
    msgObj.style.right = "45%";
    msgObj.style.top = "2.2%";
    msgObj.style.font="10px,Arial";
    msgObj.style.width = msgw + "px";
    msgObj.style.height =msgh + "px";
    msgObj.style.textAlign = "center";
    document.body.appendChild(msgObj);

    var txt=document.createElement("p");
    txt.style.margin="2px"
    txt.setAttribute("id","msgTxt");
    txt.innerHTML=str;
    document.getElementById("msgDiv").appendChild(txt);
     ///调用模拟时间延迟
      Sleep(this,3000);
      this.NextStep=function() 
      {
       document.body.removeChild(msgObj);
        
      }
      

  }
//Menu 在updatepanel控件上的解决方案
function FixMenu() {
    if (typeof(IsMenuFixed)!='undefined')
    return;
    if (!window.Menu_HideItems)
    return;
    window.OldMenu_HideItems=window.Menu_HideItems;
    window.Menu_HideItems=function(items) {
    try {
    OldMenu_HideItems(items);
        }
    catch(ex){
    if (items && items.id) {
    PopOut_Hide(items.id);}
              }
    }
    IsMenuFixed=true;
}

function SystemAlert(str,url){
	var msgw,msgh,bordercolor;
	msgw=400;//提示窗口的宽度
	msgh=100;//提示窗口的高度
	titleheight=25 //提示窗口标题高度
	bordercolor="#336699";//提示窗口的边框颜色
	titlecolor="#99CCFF";//提示窗口的标题颜色
	
	var sWidth,sHeight;
	sWidth=document.body.offsetWidth;
	sHeight=document.body.offsetHeight;
	document.body.style.overflow="hidden";//滚动条
	var bgObj=document.createElement("div");
	bgObj.setAttribute('id','bgDiv');
	bgObj.style.position="absolute";
	bgObj.style.top="0";
	bgObj.style.background="#777";
	bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
	bgObj.style.opacity="0.6";
	bgObj.style.left="0";
	bgObj.style.width=sWidth + "px";
	bgObj.style.height=sHeight + "px";
	bgObj.style.zIndex = "10000";
	document.body.appendChild(bgObj);
	
	var msgObj=document.createElement("div")
	msgObj.setAttribute("id","msgDiv");
	msgObj.setAttribute("align","center");
	msgObj.style.background="white";
	msgObj.style.border="1px solid " + bordercolor;
	msgObj.style.position = "absolute";
    msgObj.style.left = "50%";
    msgObj.style.top = "50%";
    msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
    msgObj.style.marginLeft = "-225px" ;
    msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";
    msgObj.style.width = msgw + "px";
    msgObj.style.height =msgh + "px";
    msgObj.style.textAlign = "center";
    msgObj.style.lineHeight ="25px";
    msgObj.style.zIndex = "10001";

   var title=document.createElement("h4");
   title.setAttribute("id","msgTitle");
   title.setAttribute("align","right");
   title.style.margin="0";
   title.style.textAlign="justify";
   title.style.padding="3px";
   title.style.background=bordercolor;
   title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
   title.style.opacity="0.75";
   title.style.border="1px solid " + bordercolor;
   title.style.height="18px";
   title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
   title.style.color="white";
   title.style.cursor="pointer";
   title.innerHTML="<div style='float:left'>[系统提示]</div><div style='float:right'>[×]</div>";
   //title.innerHTML+="&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;关闭";
   title.onclick=function(){
        document.body.removeChild(bgObj);
        document.getElementById("msgDiv").removeChild(title);
        document.body.removeChild(msgObj);
        if(url!="")
        {
            window.location=url;
        }
   }
   document.body.appendChild(msgObj);
   document.getElementById("msgDiv").appendChild(title);
   var txt=document.createElement("p");
   txt.style.margin="1em 0"
   txt.setAttribute("id","msgTxt");
   txt.innerHTML=str;
   document.getElementById("msgDiv").appendChild(txt);
}

 //MM的图片交换、图片复原、图片预读方法
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 ChangeChannel(tag,total,channel){ 
 for(i=1; i <= total; i++)
 {
  if (i==tag)
  { 
   document.getElementById("id"+i).className="img"+channel+i;
   document.getElementById("id"+i).getElementsByTagName("img")[0].className="vh";
  }
  else{
   document.getElementById("id"+i).className="";
   document.getElementById("id"+i).getElementsByTagName("img")[0].className="";
  } 
 }
}
function ChangeMainChannel(tag,total,channel){ 
 for(i=1; i <= total; i++)
 {
  if (i==tag)
  { 
   document.getElementById("mainid"+i).className="img"+channel+i;
   document.getElementById("mainid"+i).getElementsByTagName("img")[0].className="vh";
   document.getElementById("mainid"+i).getElementsByTagName("a")[0].href="javascript:void(0);";
  }
  else{
   document.getElementById("mainid"+i).className="";
   document.getElementById("mainid"+i).getElementsByTagName("img")[0].className="";
  } 
 }
}



function $(objId)
{
    return document.getElementById(objId);
}
    function fnGetWindowWidth(){
	var vw = 0;
	var _dEt = document.documentElement;
	var _dBy = document.body;
	if(typeof window.innerWidth=='number')vw = window.innerWidth;
	else{
		if(_dEt&&_dEt.clientWidth)vw = _dEt.clientWidth;
		else{
			if(_dBy&&_dBy.clientWidth)vw = _dBy.clientWidth;
		}
	}
	if(!vw||vw<100)vw = 100;
	return vw;
}
function fnGetWindowHeight(){
	var vh = 0;
	var _dEt = document.documentElement;
	var _dBy = document.body;
	if(typeof window.innerHeight=='number')vh = window.innerHeight;
	else{
		if(_dEt&&_dEt.clientHeight)vh = _dEt.clientHeight;
		else{
			if(_dBy&&_dBy.clientHeight)vh = _dBy.clientHeight;
		}
	}
	if(!vh||vh<100)vh = 100;
	return vh;
}
    var fraCityList;
function LoadCityList(url)
{
    if (!fraCityList){
        fraCityList = document.createElement('IFRAME');
        fraCityList.id = 'fraCityList';
        fraCityList.frameBorder = '0';
        fraCityList.scrolling = "no";
        fraCityList.style.position = 'absolute';
        fraCityList.style.overflow = 'hidden';
        fraCityList.allowTransparency = 'true';
        fraCityList.style.width = '800px';
        fraCityList.style.height = '620px';  
        fraCityList.style.left = (fnGetWindowWidth()-800)/2 + 'px';
        fraCityList.style.top = '100px';
        fraCityList.style.zIndex = '10001';
        fraCityList.src = url;
        document.body.appendChild(fraCityList);
    }
    fraCityList.style.display = 'block';
    $('BG').style.display = 'block';
    $('BG').style.width = fnGetWindowWidth() + 'px';
    $('BG').style.height = fnGetWindowHeight() + 'px';
}
function fnCityListHiddn()
{
    fraCityList.style.display = 'none';
    $('BG').style.display = 'none';
}

      function popnew(url,title,width,height){
    var w = 1024;
    var h = 768;

    if (document.all || document.layers){
        w = screen.availWidth;
        h = screen.availHeight;
    }

    var leftPos = (w/2-width/2);
    var topPos = (h/2.3-height/2.3);

    window.open(url,title,"width="+width+",height="+height+",top="+topPos+",left="+leftPos+",scrollbars=yes,resizable=no,status=no")
}
