﻿// JScript 文件

var framearray = new Array();
var frmleft = 0;
var frmtop = 0;
var frmwidth = 0;
var frmheight = 0;
var clientheight = 0;
var clientwidth = 0;
var heightthreshold = 700;
var widththreshold =960;
var curframe = -1;
var arraylen = 0;
var hintarr = new Array();
var hintcount = 0;
var hintspeed = 1;
var hintstay = 2000;   //停留时间
var loginshow = 0;
var loginfrm;
var indexloaded = true;
var lastclickindex = -1;
var lastclickcount = 0;
var maxid = 0;
var tabshell;
var topheight = 95;
var toolbarheight = 8+28;
var taskbarheight = 27;
var bottomheight = 13;
var navigatewidth = 3+1+263+7+1;

var tabshelldiv;
var arrayTd;
var xfdebug = true;
var debugInfo="17Done DebugInfo:\n";
//function RemoveAll(father)
//{
//    while(father.childNodes.length>0)
//    {
//        RemoveAll(father.childNodes[0]);
//        father.removeChild(father.childNodes[0]);
//    }
//}
function SetCookie(name,value,expires,path,domain,secure)
{
    var expDays = expires*24*60*60*1000;
    var expDate = new Date();
    expDate.setTime(expDate.getTime()+expDays);
    var expString = ((expires==null) ? "" : (";expires="+expDate.toGMTString()))
    var pathString = ((path==null) ? "" : (";path="+path))
    var domainString = ((domain==null) ? "" : (";domain="+domain))
    var secureString = ((secure==true) ? ";secure" : "" )
    document.cookie = name + "=" + escape(value) + expString + pathString + domainString + secureString;
} 

function GetCookie(name)
{
    var result = null;
    var myCookie = document.cookie + ";";
    var searchName = name + "=";
    var startOfCookie = myCookie.indexOf(searchName);
    var endOfCookie;
    if (startOfCookie != -1)
    {
        startOfCookie += searchName.length;
        endOfCookie = myCookie.indexOf(";",startOfCookie);
        result = unescape(myCookie.substring(startOfCookie, endOfCookie));
    }
    return result;
} 

function ClearCookie(name)
{
    var ThreeDays=3*24*60*60*1000;
    var expDate = new Date();
    expDate.setTime(expDate.getTime()-ThreeDays);
    document.cookie=name+"=;expires="+expDate.toGMTString();
}

function SetDebugInfo(infoStr)
{
    var oldCookie=GetCookie("debugInfo");
    var expDate = new Date();    
    SetCookie("debugInfo",oldCookie+"\n"+infoStr,1);
}

function ShowDebugInfo()
{
    alert(GetCookie("debugInfo"));
}

function SetTimeOutRunScript(scriptToRun,time)
{
    setTimeout(scriptToRun,time);
}
function FrameItem(frame, tab, title, order, id, tag, objid,important)
{
    this.Frame = frame;
    this.Tab = tab;
    this.Title = title;
    this.Order = order;
    this.Id = id;
    this.Tag = tag;
    this.ObjectId = objid;
    if(important) 
        this.IsImportant=important;
    else 
        this.IsImportant=0;
}

function HintItem(frame, width)
{
    this.Frame = frame;
    this.Width = width;
}

function Position(left, top, right, bottom)
{
    this.Left = left;
    this.Top = top;
    this.Right = right;
    this.Bottom = bottom;
}

function init()
{
    tabshell = document.getElementById("tabShell");
    tabshelldiv = document.getElementById("tabShellDiv");
    arrayTd = document.getElementById("arrayTd");
    ReloadWindowSize();
    LoadHome();
    navigatechange(0);
}

function getMinWindowPosition()
{
    return new Position(frmleft, frmtop, frmleft + frmwidth, frmtop + frmheight);
}


function TestParentNode(node)
{    
    var top ;
    var left;
    var width;
    while(node.tagName != "BODY")
    { 
        top = node.offsetTop;
        left = node.offsetLeft;
        width = node.offsetWidth;
        alert(" tag:"+ node.tagName+ " node:"+ node.id+ " offsettop:"+top+" offsetleft:"+left+" offsetWidth:"+width); 
        
    	node = node.offsetParent;
    }
}

// 得到窗口的高度
function GetWindowHeight()
{
    if(window.innerHeight)
    {return window.innerHeight;}
    if(document.documentElement.clientHeight)
    {return document.documentElement.clientHeight;}
    if(document.body.clientHeight)
    {return document.body.clientHeight;}    
}
// 得到窗口的宽度
function GetWindowWidth()
{
    if(window.innerWidth)
    {return window.innerWidth;}
    if(document.documentElement.clientWidth)
    {return document.documentElement.clientWidth;}
    if(document.body.clientWidth){return document.body.clientWidth;}
}
function ReloadWindowSize()
{
    // 得到窗口大小
//    //ie6不符合dom标准，此时要判断一下
//    var _clientheight=(document.documentElement.clientHeight==0)?document.body.clientHeight:document.documentElement.clientHeight;
//    var _clientwidtht=(document.documentElement.clientWidth==0)?document.body.clientWidth:document.documentElement.clientWidth;
//    clientheight = _clientheight || window.innerHeight;
//    clientwidth = _clientwidtht || window.innerWidth;    
    clientheight=GetWindowHeight();
    clientwidth=GetWindowWidth();
    
    if(clientwidth<widththreshold){
        document.body.style.overflowX="scroll";
        clientwidth = widththreshold;
    }else{
        document.body.style.overflowX="hidden";
    
    }
    if(clientheight<heightthreshold){
        document.body.style.overflowY="scroll";
        clientheight = heightthreshold;
    }else{
        document.body.style.overflowY="hidden";
    }
    
    
    var tdWidth = clientwidth - navigatewidth;
    
    
    
    
    frmwidth = tdWidth-10 ;
    frmheight = clientheight - topheight - toolbarheight - taskbarheight - bottomheight-5;
    frmtop = topheight + toolbarheight + 2;
    frmleft = navigatewidth;
    
    
    document.getElementById('outtable').style.width = clientwidth+ "px";
    document.getElementById("tdContent").style.width = tdWidth + "px";
    document.getElementById("tableContent").style.width = tdWidth + "px";
    document.getElementById("topTdContent").style.height = frmheight + "px";
    
    tabshelldiv.style.width = tdWidth + "px";
    tabshelldiv.style.height = taskbarheight + "px";
    tabshelldiv.style.top = frmtop + frmheight+ "px";;
    tabshelldiv.style.left = frmleft + "px";
    
    //TestParentNode( document.getElementById('topTdContent'));
    
    arrayTd.style.height = (clientheight - topheight - toolbarheight - bottomheight - 16 -1) + 'px';
    

    for(var i=0;i<arraylen;i++)
	{
		framearray[i].Frame.style.width = frmwidth + "px";
		framearray[i].Frame.style.height = frmheight + "px";
		framearray[i].Frame.style.top = frmtop + "px";
		framearray[i].Frame.style.left = frmleft + "px";
	}
	for(var i=0; i<NavigateObjArray.length; i++)
	{
	    var frmobj = document.getElementById("frmNavigate" + i);
	    frmobj.style.width = (navigatewidth - 63- 20)>0?(navigatewidth - 63- 20):0 + "px";
	    frmobj.style.height = (clientheight - topheight - toolbarheight - bottomheight - 25) + "px";
	}	
	//CallIframeResizeWindow();
	setTimeout("CallIframeResizeWindow()", 0);	
}

function CallIframeResizeWindow()
{
	for(var i=0; i<NavigateObjArray.length; i++)
	{
	    if(!NavigateObjArray[i].isReady) continue;
	    
	    var frmobj = document.getElementById("frmNavigate" + i);
	    if (typeof(frmobj.contentWindow.ResizeWindow) == "function")
	    {
	        frmobj.contentWindow.ResizeWindow();
	    }        	   
    }
}
        
function LoadHome()
{
	openindexframe();
}

function openindexframe()
{
//top.activechildframe('/src/Desktop.aspx?OpenType=3','我的桌面','8','804',-1,'False');
	CreateFrame('Desktop.aspx?OpenType=3', '我的桌面', "8", '804');// 这个为了方便刷新，用page的getopenstring方法在main.aspx中生成了bylsr
	indexloaded = true;
}

function openchildframe(desturl, tabtitle, tag, objid,important)
{
    var frameimportant;
    if (important) 
        frameimportant=important; 
    else 
        frameimportant=0;
	if (indexloaded)
	{
		CreateFrame(desturl, tabtitle, tag, objid,frameimportant);
	}
}

function Refreshchildframe(desturl, tabtitle, tag, objid,StringToShow,showChildFrame,important)
{
    var frameimportant;
    if (important) 
        frameimportant=important; 
    else 
        frameimportant=0;
    var found = false;
    for(var i=0; i<arraylen; i++)
    {
        var thisfrm = framearray[i];
        if((thisfrm.Tag == tag) && (thisfrm.ObjectId == objid))
        {
            settab(thisfrm.Tab, "tableft_gray", "tabcenter_gray", "tabright_gray", thisfrm.Id, tabtitle);
            thisfrm.Title = tabtitle;
            document.getElementById("frame"+thisfrm.Id).src=desturl;
            //frames["frame" + thisfrm.Id].location.href=desturl;
            //frames["frame" + thisfrm.Id].location.reload();
            thisfrm.IsImportant=frameimportant;
            if (!found)
            {
                if(showChildFrame != 'False')
                {
                    changetab(i);
                }
            }
            found = true;
        }
    }
    if (!found)
    {
        if(showChildFrame == 'True')
            openchildframe(desturl, tabtitle, tag, objid);
        else
            if(StringToShow&&StringToShow!="")
                alert(StringToShow);
    }
}
function RefreshAllWindow(n)
{    
    var tempfrm;
    if (arraylen<=0) {
    return;
    }
    for(var i=0; i<arraylen; i++)
    {  
        tempfrm = framearray[i];
        getFrameNode("frame" + tempfrm.Id).location.reload();
        //frames["frame" + tempfrm.Id].location.reload();
    }
    changetab(n);
}
function RefreshWindow(n)
{
    if ((arraylen<=0)||(n<0)) return false;
    var tempfrm = framearray[n]; 
    //frames["frame" + tempfrm.Id].location.reload();
    getFrameNode("frame" + tempfrm.Id).location.reload();
    changetab(n);
}
function RemoveOpenType(tempStr,withoutQuery)
{    

    var i;
    if (withoutQuery&&withoutQuery=="True")    
    i=tempStr.indexOf('?');    
    else
    i=tempStr.indexOf('OpenType=');
    if (i>0) return tempStr.substring(0,i-1);
    else return tempStr;
}
function GetOpenType(tempStr)
{
    var i=tempStr.indexOf('OpenType=');
    if (i>0) return tempStr.substring(i-1);
    else return tempStr;
}
function ChangeUpTab(tag, objid,tabid,StringToShow,ifOpen,desturl,tabtitle,important,withoutQuery)
{
    var frameimportant;
    if (important) 
        frameimportant=important; 
    else 
        frameimportant=0;
    var found = false;
    var exist = -1;    
    for(var i=0; i<arraylen; i++)
    {
        var thisfrm = framearray[i];
        if((thisfrm.Tag == tag) && (thisfrm.ObjectId == objid)&&(!found)&&(exist==-1))
        {
            exist=i;            
            var tempSrc=RemoveOpenType(document.getElementById("frame" + thisfrm.Id).src,withoutQuery);//to test
            var tempDesturl=RemoveOpenType(desturl,withoutQuery);
            if(tempSrc == tempDesturl)//to test
            {                
                changetab(i);  
                found=true;
                tryChangeLocalTabs(9,"frame"+ thisfrm.Id,String(tabid));
           }           
        }
    }
    if(!found)
    {
        if(ifOpen=="True")
        {
            if(exist==-1)
                openchildframe(desturl, tabtitle, tag, objid,frameimportant);
            else
            {               
                
                //frames["frame" + thisfrm.Id].QdPageIsLoaded=false;
                getFrameNode("frame" + thisfrm.Id).QdPageIsLoaded=false;
                document.getElementById("frame"+framearray[exist].Id).src=desturl;
                framearray[exist].IsImportant=frameimportant;
                changetab(exist);              
            }
            for(var i=arraylen-1;i>=0;i--)
            {
                var thisfrm = framearray[i];
                if((thisfrm.Tag == tag) && (thisfrm.ObjectId == objid)&&(!found))
                {
                    found=true;                   
                    tryChangeLocalTabs(9,"frame"+ thisfrm.Id,String(tabid));
                }
            }
        }    
        else
        {
            if(StringToShow&&StringToShow!="")
            alert(StringToShow);
        }
    }
}
function tryChangeLocalTabs(tryTime,frameName,tabid,url)
{

    tryTime = tryTime - 1;
    var topFrame = document.getElementById(frameName);
    if (topFrame != null) topFrame = topFrame.contentWindow;
    if (topFrame && topFrame.changeLocalTabs && topFrame.QdPageIsLoaded)
    {
        topFrame.changeLocalTabs(String(tabid));     
    }
    else
    {
        if (tryTime>0)
            setTimeout("tryChangeLocalTabs("+tryTime+",\""+frameName+"\","+tabid+")",100);
    }    

}

function activechildframe(desturl, tabtitle, tag, objid,important,forbidden)
{
    var frameimportant;
    var forbiddenReload;
    if (forbidden)
        forbiddenReload=forbidden;
    else
        forbiddenReload="False";
    if (important) 
        frameimportant=important; 
    else 
        frameimportant=0;
    var found = false;
    for(var i=0; i<arraylen; i++)
    {
        var thisfrm = framearray[i];
        if((thisfrm.Tag == tag) && (thisfrm.ObjectId == objid))
        {
            if (forbiddenReload=="False"||document.getElementById("frame" + thisfrm.Id).src !=desturl)
                document.getElementById("frame" + thisfrm.Id).src = desturl;
            settab(thisfrm.Tab, "tableft_gray", "tabcenter_gray", "tabright_gray", thisfrm.Id, tabtitle);
            thisfrm.Title = tabtitle;
            thisfrm.IsImportant=frameimportant;
            if (!found)
            {
                changetab(i);
            }
            found = true;
        }
    }
    if (!found)
    {
        openchildframe(desturl, tabtitle, tag, objid,frameimportant);
    }
}

function closechildframe(tag, objid)
{
    for(var i=arraylen - 1; i>=0; i--)
    {       
        var thisfrm = framearray[i];       
        if((thisfrm.Tag == tag) && (thisfrm.ObjectId == objid))
        {
            closewindow(i);
        }
    }
}

function ResizeWindow()
{
    ReloadWindowSize();
    
    popWindowObj.updateMinIcons();//更新IM最小化窗口
}

function CreateFrame(desturl, tabtitle, tag, objid,important)
{
	var n = arraylen;
	var frameimportant;
	if (important) 
        frameimportant=important; 
    else 
        frameimportant=0;
	
    
	frm = document.createElement("DIV");
	frm.style.zIndex = 102 + n;
	frm.style.position = "absolute";
	frm.style.left = frmleft + "px";
	frm.style.top = frmtop + "px";
	frm.style.width = frmwidth + "px";
	frm.style.height = frmheight + "px";
	frm.style.visibility = "hidden";
	
	frm.innerHTML = "<iframe id='frame" + maxid +
	 "' src='" + desturl + "' width=\"100%\" scrolling=auto height=\"100%\" MARGINWIDTH=0 MARGINHEIGHT=0 frameborder=0></IFRAME>";
	document.body.appendChild(frm);
	
	
	
	tab = document.createElement("td");
	tab.id = "tab" + n;
	tab.width = "6px";
	tab.height = "25px";
	tab.title=tabtitle;
	settab(tab, "tableft_gray", "tabcenter_gray", "tabright_gray", maxid, tabtitle);
	   
	
	
	//插入当前tab
	tabshell.insertBefore(tab, null);
	
	var frameitem = new FrameItem(frm, tab, tabtitle, n, maxid, tag, objid,frameimportant);
	maxid++;
	
	framearray[n] = frameitem;
	
	arraylen = arraylen + 1;
	
	changetab(n);
	
	if (n>15&&n<30) 
	{
	    var k=5;
	    if (confirm("您打开的窗口过多，是否关掉一部分（最久未使用的五个页面）？"))
	    for(var i=0;i<n;i++)
	    {       
	        if (framearray[i].Order>n-k)
	            {   
	                if (framearray[i].IsImportant<=0)
                        closewindow(i);
                    else
                        k++;
	            }
	    }
	}
	if (n>=30)
	{
	    var k=10;
	    if (confirm("您开的窗口过多，将导致系统变慢，是否关掉一部分（最久未使用的十个页面）？"))
	    for(var i=0;i<n;i++)
	    {    
	        if (framearray[i].Order>n-k)
	            {   
	                if (framearray[i].IsImportant<=0)
                        closewindow(i);
                    else
                        k++;
	            }
	    }
	}
}

function GoBack(n){
    if (arraylen<=0) return false;
    if (n>0) {
        changetab(n-1);
    }
    else
    {
        changetab(arraylen-1);
    }
}

function setalltabs(){
    
    var width=0;
    if(arraylen*80>frmwidth){
        width = frmwidth/arraylen;
        
    
    }else{
        width = 80;
        
    
    }
    
    for(var i=0; i<arraylen; i++)
    {
	    var tab = framearray[i].Tab;
	    tab.style.width = width;
	    var tabdiv = document.getElementById('tabdiv'+framearray[i].Id);
	    tabdiv.style.width = (width -4)>0?(width-4):2;
	    tabdiv.style.overflow="hidden";
	    tabdiv.style.textOverflow="ellipsis";
		
    }
    

}

function settab(tab, leftcss, centercss, rightcss, n, title)
{   
        //RemoveAll(tab);
	    tab.innerHTML = "<table style=\"width:100%\" cellspacing=0 cellpadding=0 border=0><tr>"
		    + "<td class=\""+leftcss+"\"></td>"
		    + "<td ><div id=\"tabdiv"+n+"\" class=\""+centercss+"\" onclick=\"clicktab(" + n + ")\" ondblclick=\"clicktab(" + n + ")\"  ><NOBR>" + title + "</NOBR></div></td>"
		    + "<td class=\""+rightcss+"\"></td>"
		    + "</tr></table>";
}



function clicktab(n)
{
    var b = false;
	var curnumber = 0;
	for(var i=0; i<arraylen; i++)
	{
		if (framearray[i].Id == n)
		{
			curnumber = i;
			b = true;
			break;
		}
	}
	
	if (b)
	{
		if (lastclickcount == 0)
		{
			lastclickindex = curnumber;
			lastclickcount = 1;
			setTimeout("processclick()", 300);
		}
		else
		{
			if (lastclickindex == curnumber)
			{
				lastclickcount++;
			}
			else
			{
				lastclickindex = curnumber;
				lastclickcount = 1;
			}
		}
	}
	
	setalltabs();
}

function processclick()
{
	if (lastclickcount > 1)
	{	    
		closewindow(lastclickindex,true);
	}
	else
	{
		changetab(lastclickindex);
	}
	
	lastclickcount = 0;
}

function changetab(n)
{
    if ((arraylen<=0)||(n<0)) return false;
	if (arraylen > n)
	{
		var oldorder = framearray[n].Order;
		for(var i=0; i<arraylen; i++)
		{
			if (framearray[i].Order < oldorder) 
			{
				framearray[i].Order = framearray[i].Order + 1;
			}
		}
		
		framearray[n].Order = 0;
		
		if (curframe >=0)
		{
			hidewindow(curframe);
		}	
		showwindow(n);
		
		curframe = n;
	}
	setalltabs();
}

function showwindow(n)
{
	framearray[n].Frame.style.visibility = "visible";
	settab(framearray[n].Tab, "tableft_color", "tabcenter_color", "tabright_color", framearray[n].Id, framearray[n].Title);
	framearray[n].Frame.style.zIndex = 103;
}

function hidewindow(n)
{
	framearray[n].Frame.style.visibility = "hidden";
	settab(framearray[n].Tab, "tableft_gray", "tabcenter_gray", "tabright_gray", framearray[n].Id, framearray[n].Title);
	framearray[n].Frame.style.zIndex = 102;
}

function closeallwindow()
{
    if (arraylen<=0) return false;
    for(var i=0;i<arraylen;i++)
	{
		document.body.removeChild(framearray[i].Frame);
		tabshell.removeChild(framearray[i].Tab);
		
		delete framearray[i].Frame;
		delete framearray[i].Tab;
		delete framearray[i];
	}
		arraylen = 0;
		curframe = -1;
}
function closewindow(n,NeedConfirm)
{    
    if ((arraylen<=0)||(n<0)) return false;
    if (framearray[n].IsImportant>0&&NeedConfirm)
        if(!confirm("您正在关闭一个编辑页面，是否继续？")) 
            return;
	if ((arraylen > n) && (arraylen > 0))
	{
		var oldorder = framearray[n].Order;
		
		document.body.removeChild(framearray[n].Frame);
		tabshell.removeChild(framearray[n].Tab);
		
		delete framearray[n].Frame;
		delete framearray[n].Tab;
		delete framearray[n];
		
		for(var i=n;i<arraylen - 1;i++)
		{
			framearray[i] = framearray[i + 1];			
		}
		
		arraylen = arraylen - 1;
		
		var newshow = -1;
		
		for(var i=0;i<arraylen;i++)
		{
			if (framearray[i].Order > oldorder)
			{
				framearray[i].Order = framearray[i].Order - 1;
			}
			
			if (framearray[i].Order == 0)
			{
				newshow = i;
			}
		}
		
		if (curframe > n)
		{
			curframe = curframe - 1;
		}
		else if (curframe == n)
		{
			if (newshow >= 0)
			{
				showwindow(newshow);
				curframe = newshow;
			}
		}
	}
}

function closecurwindow()
{
    if ((arraylen<=0)||(curframe<0)) return false;
	closewindow(curframe,true);
	setalltabs();
}

function ShowHint(hintcode)
{
    if(indexloaded)
    {
	    CreateHint(hintcode, hintspeed, hintstay);
	}
}

function CloseHint(curhint)
{
    document.title = curhint;
    document.body.removeChild(hintarr[curhint].Frame);
	delete hintarr[curhint].Frame;
	delete hintarr[curhint];
	
	if(curhint == (hintcount - 1))
	{
		hintcount = hintcount - 1;
	}
}

function CreateHint(hintcode, hintspeed, hintstay)
{ 
	//占坑，如果全被占就新建，如果有坑就占
	var n = hintcount;
	var neednew = true;
	var curhint = 0;
	
	for(i=0; i<n; i++)
    {
	    if(!hintarr[i])
	    {
		    curhint = i;
		    neednew = false;
		    break;
	    }
    }
	
	if(neednew)
	{
		curhint = hintcount;
		hintcount = hintcount + 1;
	}
	
	var hinturl = "Hint.aspx?hint=" + hintcode + "&number=" + curhint;
	
	frm = document.createElement("DIV");
	frm.style.zIndex = 200;
	frm.style.position = "absolute";
	frm.style.left = clientwidth + "px";
	frm.style.top = (clientheight - (curhint + 1) * 114) + "px";
	frm.style.width = "0px";
	frm.style.height = "114px";
	frm.style.visibility = "visible";
	
	frm.innerHTML = "<table width=\"184\" height=\"20\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\"><tr><td align=\"right\"><img src=\"pic/banner/close.gif\" width=\"20\"" + 
	    " height=\"20\" onclick=\"CloseHint(" + curhint + ")\"></td></tr></table><iframe src=\"" + hinturl + "\" width=\"184\" scrolling=\"no\" height=\"94\" frameborder=\"1\"></iframe>";
	document.body.insertBefore(frm, null);
	
	var hintitem = new HintItem(frm, 0);
	hintarr[curhint] = hintitem;
	
	hintenter(curhint);
}

function hintenter(curhint)
{
	var tdiv = hintarr[curhint].Frame;
	
	if(hintarr[curhint].Width < 184)
	{
		hintarr[curhint].Width = hintarr[curhint].Width + 1;
		tdiv.style.width = (hintarr[curhint].Width + 2) + "px";
		tdiv.style.left = (clientwidth - hintarr[curhint].Width) + "px";
		setTimeout('hintenter(' + curhint + ',' + hintspeed + ',' + hintstay + ')', hintspeed);
	}
	else
	{
	    setTimeout('hintleave(' + curhint + ')', hintstay);
	}
}

function hintleave(curhint)
{
    if(hintarr[curhint])
    {
        var tdiv = hintarr[curhint].Frame;

        if(hintarr[curhint].Width > 0)
        {
	        hintarr[curhint].Width = hintarr[curhint].Width - 1;
	        tdiv.style.width = (hintarr[curhint].Width + 2) + "px";
	        tdiv.style.left = (clientwidth - hintarr[curhint].Width) + "px";
	        setTimeout('hintleave(' + curhint + ')', hintspeed);
        }
        else
        {
            CloseHint(curhint);
        }
	}
}

function showlogin()
{
	document.getElementById("hdlogincancel").value = "0";
	setunlogin();
	if (loginfrm == null)
	{
		loginfrm = document.createElement("DIV");
		loginfrm.classname = "halfalpha"
		loginfrm.style.zIndex = 200;
		loginfrm.style.position = "absolute";
		loginfrm.style.left = (window.document.body.clientWidth - 302) / 2 + "px";
		loginfrm.style.top = (window.document.body.clientHeight - 225) / 2 + "px";
		loginfrm.style.width = "300px";
		loginfrm.style.height = "223px";
		loginfrm.style.visibility = "visible";
		
		loginfrm.innerHTML = "<iframe src='LoginCheck.aspx' width=\"100%\" scrolling=auto height=\"100%\" MARGINWIDTH=0 MARGINHEIGHT=0 frameborder=0 class=\"halfalpha\"></IFRAME>";
		document.body.insertBefore(loginfrm, null);
	}
	else
	{
		loginfrm.style.visibility = "visible";
		loginfrm.innerHTML = "<iframe src='LoginCheck.aspx' width=\"100%\" scrolling=auto height=\"100%\" frameborder=0 MARGINWIDTH=0 MARGINHEIGHT=0 class=\"halfalpha\"></IFRAME>";
	}
}

function closelogin()
{
	if(loginfrm != null)
		loginfrm.style.visibility = "hidden";
}

function setlogin()
{
	document.getElementById("hdlogin").value = "1";
	document.getElementById("imgTL50").src = "pic/banner/tl50_2_summer.gif";
	document.getElementById("imgTL50").onclick = "";
	document.getElementById("imgTL50").style.cursor = "default";
}

function setunlogin()
{
	document.getElementById("hdlogin").value = "0";
	document.getElementById("imgTL50").src = "pic/banner/tl50_summer.gif";
	document.getElementById("imgTL50").onclick = "showlogin()";
	document.getElementById("imgTL50").style.cursor = "hand";
}

function cancellogin()
{
	document.getElementById("hdlogincancel").value = "1";
}

var _refreshCount = 0;
function refreshantikickout()
{
    _refreshCount += 1;
	document.getElementById("frmantikickout").src="Antikickout.aspx?rnd=" + _refreshCount;
	setTimeout("refreshantikickout()", 180000);
}





        function collapseNavigate(obj){
            var icontableObj = document.getElementById("icontableTd");
            var navigateObj = document.getElementById("navigateTd");
            var icontableBottom = document.getElementById("icontableBottom");
            var navigateBottom = document.getElementById("navigateBottom");
            var allmenutextTd = document.getElementById("ToolBarselect");
            if(icontableObj.style.display!="none"){
                icontableObj.style.display ="none";
                navigateObj.style.display ="none";
                icontableBottom.style.display ="none";
                navigateBottom.style.display ="none";
                
                allmenutextTd.style.display ="none";
                obj.src ="indeximages/arrow-out.gif";
                
                navigatewidth = 3+1+16+7+1;
            
            }else{
                icontableObj.style.display ="";
                navigateObj.style.display ="";
                icontableBottom.style.display ="";
                navigateBottom.style.display ="";
                
                allmenutextTd.style.display ="";
                obj.src ="indeximages/arrow.gif";
                navigatewidth = 3+1+263+7+1;
            }           
            
            ReloadWindowSize();
            popWindowObj.updateMinIcons();//更新IM最小化窗口
            
        
        }
