﻿window.onload=function(){
 if (!/*@cc_on!@*/0){ document.readyState="complete";}
}

var JumpUrl = "/logout.php",JumpTimer = 1800;
var TimerCount = 0,Timer,IsStopJump = false;
var TimerOut = 1800; //超时自动退出的时间，单位是秒
function $(_sId){return document.getElementById(_sId);}
function SetAutoJumpUrl(timers,url){JumpTimer = timers;JumpUrl = url;Timer = setTimeout("AutoJumpUrl()",1100);}
function AutoJumpUrl(){
   if(IsStopJump) return;
   if(TimerCount<(JumpTimer-1)){
    TimerCount ++;
    $('CountDown').innerText = JumpTimer-TimerCount;
    setTimeout("AutoJumpUrl()",1100);
   }else {
    document.location.href = JumpUrl;
   }
}
function HandJump(){
   if(IsStopJump == false){
    IsStopJump = true;
    $('DoStop').innerText="v";
    $('DoStop').title="恢复倒计时";
   }else{
    IsStopJump = false;
    $('DoStop').innerText="x";
    $('DoStop').title="停止倒计时";
    AutoJumpUrl();
   }
}


function custList(ele,picFolder,picWidth){
  for(var i=0,c=ele.firstChild;c;c=c.nextSibling){
    if(!c.tagName||c.tagName!="LI") continue;
    c.style.position="relative";
    c.insertBefore(makeIcon(++i),c.firstChild);
  }
  function makeIcon(n){
    n=(n<10?"0":"")+n.toString();
    var div=document.createElement("div");
    div.style.position="absolute";
    div.style.top="0px";
	div.style.padding="7px 3px 2px 33px";
    div.style.left=-n.length*picWidth-5+"px";
    div.innerHTML=n.replace(/\d/g,function(s){
      return '<img src="'+picFolder+s+'.gif" />';
    });
    return div;
  }
}


//********对title的显示***默认设置定义.*********************
tPopWait=100;//停留tWait豪秒后显示提示。
tPopShow=15000;//显示tShow豪秒后关闭提示
showPopStep=20;
popOpacity=99;

//***************内部变量定义*****************
sPop=null;
curShow=null;
tFadeOut=null;
tFadeIn=null;
tFadeWaiting=null;
    


document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText {  background-color: #7D97DB;color:#ffffff; border: 1px #4B70CD solid;font-color: font-size: 12px; padding-right: 4px; padding-left: 4px;  padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");
document.write("</style>");
document.write("<div id='dypopLayer' style='position:absolute;z-index:1000;left:12;top:12;' class='cPopText'></div>");

function GetPageSize() {//获取页面大小、窗口大小
  var scrW, scrH;
  if(window.innerHeight && window.scrollMaxY) {    // Mozilla
    scrW = window.innerWidth + window.scrollMaxX;
    scrH = window.innerHeight + window.scrollMaxY;
  }
 else if(document.body.scrollHeight > document.body.offsetHeight){    // all but IE Mac
    scrW = document.body.scrollWidth;
    scrH = document.body.scrollHeight;
  }
 else if(document.body) { // IE Mac
    scrW = document.body.offsetWidth;
    scrH = document.body.offsetHeight;
  }
    var winW, winH;
  if(window.innerHeight) { // all except IE
    winW = window.innerWidth;
    winH = window.innerHeight;
  }
 else if (document.documentElement && document.documentElement.clientHeight) {    // IE 6 Strict Mode
    winW = document.documentElement.clientWidth;
    winH = document.documentElement.clientHeight;
  }
 else if (document.body) { // other
    winW = document.body.clientWidth;
    winH = document.body.clientHeight;
  }
    // for small pages with total size less then the viewport
  var pageW = (scrW<winW) ? winW : scrW;
  var pageH = (scrH<winH) ? winH : scrH;
    return {PageW:pageW, PageH:pageH, WinW:winW, WinH:winH};
}

function GetPageScroll() {//获取滚动条位置
  var x, y;
  if(window.pageYOffset) {    // all except IE
    y = window.pageYOffset;
    x = window.pageXOffset;
  }
 else if(document.documentElement && document.documentElement.scrollTop) {    // IE 6 Strict
    y = document.documentElement.scrollTop;
    x = document.documentElement.scrollLeft;
  }
 else if(document.body) {    // all other IE
    y = document.body.scrollTop;
    x = document.body.scrollLeft;
   }
  return {X:x, Y:y};
}

function mousePosition(ev){
    //支持 火狐
    if(ev.pageX || ev.pageY){
        return {x:ev.pageX, y:ev.pageY};
     }
    //支持IE
    return {
         x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
         y:ev.clientY + document.body.scrollTop - document.body.clientTop
     };
}
function showPopupText(ev){
var o=event.srcElement;
	ev = ev || window.event;
    var mousePos = mousePosition(ev);
		MouseX=mousePos.x;
		MouseY=mousePos.y;
	if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
        if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
	if(o.dypop!=sPop) {
			sPop=o.dypop;
			clearTimeout(curShow);
			clearTimeout(tFadeOut);
			clearTimeout(tFadeIn);
			clearTimeout(tFadeWaiting);	
			if(sPop==null || sPop=="") {
				dypopLayer.innerHTML="";
				dypopLayer.style.filter="Alpha()";
				dypopLayer.filters.Alpha.opacity=0;	
				}
			else {
				if(o.dyclass!=null) popStyle=o.dyclass 
					else popStyle="cPopText";
				curShow=setTimeout("showIt()",tPopWait);
			}
			
	}
}

function showIt(){
		dypopLayer.className=popStyle;
		dypopLayer.innerHTML=sPop;
		popWidth=dypopLayer.clientWidth;
		popHeight=dypopLayer.clientHeight;
var getp = GetPageSize();
var gets = GetPageScroll();
		if(MouseX+12+popWidth>getp.WinW) popLeftAdjust=-popWidth-24;
			else popLeftAdjust=0;
		if(MouseY+12+popHeight>getp.WinH) popTopAdjust=-24;
			else popTopAdjust=0;
			
		dypopLayer.style.left=MouseX+12+gets.X+popLeftAdjust;
		dypopLayer.style.top=MouseY+12+gets.Y+popTopAdjust;
		dypopLayer.style.filter="Alpha(Opacity=0)";
		fadeOut();
}

function fadeOut(){
	if(dypopLayer.filters.Alpha.opacity<popOpacity) {
		dypopLayer.filters.Alpha.opacity+=showPopStep;
		tFadeOut=setTimeout("fadeOut()",1);
		}
		else {
			dypopLayer.filters.Alpha.opacity=popOpacity;
			tFadeWaiting=setTimeout("fadeIn()",tPopShow);
			}
}

function fadeIn(){
	if(dypopLayer.filters.Alpha.opacity>0) {
		dypopLayer.filters.Alpha.opacity-=1;
		tFadeIn=setTimeout("fadeIn()",1);
		}
}
document.onmouseover=showPopupText;
