﻿function OpenTDiv(transClass, nonTransClass, ary, Src)
{
    var tobj = document.getElementById("___transDiv");
    var nontObj = document.getElementById("___nontransDiv");
    if(tobj == null)
    {
        tobj = document.createElement("div");
        tobj.style.position = "absolute";
        tobj.className = transClass;
        tobj.setAttribute("id", "___transDiv");
        tobj.style.zIndex = 1000;
        document.body.appendChild(tobj);
        
        nontObj = document.createElement("div");
        nontObj.style.position = "absolute";
        nontObj.className = nonTransClass;
        nontObj.setAttribute("id", "___nontransDiv");
        nontObj.style.zIndex = 1001;
        document.body.appendChild(nontObj);
        nontObj.innerHTML = "<div style='text-align: center; vertical-align: middle; width: 95%; height: 95%;'><table class='"+ nonTransClass +"' cellspacing='0' cellpadding='0' width='100%' height='100%'><tr><td style='height: 100%' id='___transObjBody'><table  align='center'><tr><td><span onclick='document.getElementById(\"___transDiv\").style.display=\"none\"; document.getElementById(\"___nontransDiv\").style.display=\"none\"; ' style='float: right; cursor: pointer; font-family: verdana; font-size: 10px; color: white;'>[Close]</span><br /><img id='__imgMainImg___' onload='FixDivSize(this)' /><br><span id='__prevNextSpan__' style='float: right; cursor: pointer; font-family: verdana; font-size: 10px; color: white;' ></span></td></tr></table></td></tr></table></div>";
        
        tobj.style.height = document.documentElement.clientHeight +"px";
        tobj.style.width =  document.documentElement.clientWidth +"px";
        tobj.style.top = "0px";
        tobj.style.left = "0px";
        
        nontObj.style.height = document.documentElement.clientHeight +"px";
        nontObj.style.width =  document.documentElement.clientWidth +"px";
        
        nontObj.style.overflow = "auto";
        nontObj.style.top = "0px";
        nontObj.style.left = "0px";
    
    
   
   }
   
   
    tobj.style.display = 'inline';
    
    nontObj.style.display = 'inline'; 
    
    var arr = eval( ary +"[\""+ Src +"\"]" +";");
    var arrString = new Array();
    var imgObj = document.getElementById("__imgMainImg___");
    if(imgObj)
    {
        imgObj.src = arr[1];
    }
    
    var revnextSpan =  document.getElementById("__prevNextSpan__");
    revnextSpan.innerHTML = "";
    if(arr[0] || arr[2])
    { 
      if(arr[0])
            revnextSpan.innerHTML = "[<span style='cursor: pointer; ' onclick='OpenTDiv(\""+ transClass +"\", \""+ nonTransClass +"\",  \""+ ary +"\", \""+ arr[0] +"\")'> prev </span>]&nbsp;&nbsp;&nbsp;";
       if(arr[2])
            revnextSpan.innerHTML+= "[<span style='cursor: pointer; ' onclick='OpenTDiv(\""+ transClass +"\", \""+ nonTransClass +"\",  \""+ ary +"\", \""+ arr[2] +"\")'> next </span>]&nbsp;&nbsp;&nbsp;";
    
    }
    
    
}

function FixframeSize(frameid)
{
    var objFrame = document.getElementById(frameid);
    
    if(objFrame)
    {
        objFrame.style.height = objFrame.parentNode.offsetHeight +"px";
        objFrame.style.width = objFrame.parentNode.offsetWidth +"px";
        
    }
}


function FixDivSize(img)
{
    var tobj = document.getElementById("___transDiv");
    var nontObj = document.getElementById("___nontransDiv");
    
    tobj.style.width = nontObj.offsetWidth +"px";
    tobj.style.height =  nontObj.offsetHeight +"px"; 
    
    if(parseInt(top.document.getElementById(self.name).offsetHeight) > nontObj.offsetHeight)
    {
        nontObj.style.height =  parseInt(top.document.getElementById(self.name).offsetHeight)  +"px";
        tobj.style.height =  parseInt(top.document.getElementById(self.name).offsetHeight) +"px"; 
    
    
    }

}

    var ___currentMoveObj_____ = null;
    
    function ___Ticker(obj, message)
    {
        var objDiv = document.getElementById("___ticker___");
        if(!objDiv)
        {
            objDiv = document.createElement("div");
            objDiv.id = "___ticker___";
            objDiv.className = "HideDiv";
            objDiv.style.position = "absolute";
            document.body.appendChild(objDiv); 
        }
        
        ___currentMoveObj_____ = obj;
        objDiv.className = "ShowDiv";
        objDiv.innerHTML = message;
        
        obj.onmousemove = __TickerMoveMessage__;
        
        obj.onmouseout = function(){
            document.getElementById("___ticker___").className =  "HideDiv";
            ___currentMoveObj_____ = null;
        };
    
    }
    
    function __TickerMoveMessage__(e)
    {
        if(___currentMoveObj_____ == null)
            return;
                   
        var xMousePos;
        var yMousePos;
        
        if (document.all) 
        {
              xMousePos = window.event.x+document.body.scrollLeft;
              yMousePos = window.event.y+document.body.scrollTop;
              //xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
              //yMousePosMax = document.body.clientHeight+document.body.scrollTop;
    	} 
        else if (document.getElementById) 
        {
            xMousePos = e.pageX;
            yMousePos = e.pageY;
              //xMousePosMax = window.innerWidth+window.pageXOffset;
              //yMousePosMax = window.innerHeight+window.pageYOffset;
        }
        
        var ticker = document.getElementById("___ticker___");
        //top.document.title = xMousePos  +", "+ yMousePos;
	    if(ticker)
		{
		    ticker.style.left = (xMousePos + 15) +"px";
	        ticker.style.top = (yMousePos + 20) + "px";
 
		}
    
    }

