﻿var g_Popup=null; 
var lastPopup; 
var stopHide = false; 

function getBodyScrollLeft()
{
	return self.pageXOffset || (document.documentElement && document.documentElement.scrollLeft) || (document.body && document.body.scrollLeft);
}

function getClientWidth()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function getClientHeight()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}

function PopupSubMenu(tagId, e, width, content) 
{
    var content_array = content.split(";");
    //content_array[0] - header
    //content_array[1] - body
    stopHide = true; 
    var popup       = document.getElementById(tagId+"_PopupMenu"); 
    var popupHeader = document.getElementById(tagId+"_PopupTableHeader"); 
    var popupBody   = document.getElementById(tagId+"_PopupTableBody"); 
    
    popupHeader.innerHTML   = content_array[0];
    popupBody.innerHTML     = content_array[1];
    
    /*var content_array = content.split(";");
    popupHeader.innerHTML = content_array[1]+"-"+content_array[2]+"   "+content_array[0]; 
    popupBody.innerHTML = "";
    if (content_array[7] != "")
    popupBody.innerHTML = content_array[7] + "<br/>";
    if (content_array[8] != "")
    popupBody.innerHTML = popupBody.innerHTML + content_array[8] + "<br/>";
    if (content_array[9] != "")
    popupBody.innerHTML = popupBody.innerHTML + content_array[9] + "<br/>";*/
    
    if(popup == null) 
        return; 

    if(g_Popup != null)
    { 
        g_Popup.style.display = "none"; 
        popup.style.display = "none"; 
    }

    popup.style.display = (popup.style.display=="")?"none":""; 
    popup.style.position = "absolute"; 
    popup.style.zIndex = 65000;
    
    //getting mouse position----->
    var centerX = parseInt(getClientWidth()/2);//+getBodyScrollLeft();
    //alert(centerX);
    var x = 0, y = 0;
    if (!e) e = window.event;

    if (e.pageX || e.pageY)
    {
        x = e.pageX;
        y = e.pageY;
    }
    else if (e.clientX || e.clientY)
    {
        //window.status =  popup.style.left + " ; " + popup.style.top;
        //x = e.screenX;
        //y = e.screenY;
        x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft; 
        y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
    }
    
/*    var winW, winH;
    if (parseInt(navigator.appVersion)>3) {
        if (navigator.appName=="Netscape") {
            winW = window.innerWidth;
            winH = window.innerHeight;
        }  
        if (navigator.appName.indexOf("Microsoft")!=-1) {
            winW = document.body.offsetWidth;
            winH = document.body.offsetHeight;
        }
    }*/
    
    //<-----window.innerWidth
    popup.style.visibility = "visible";
    popup.style.left = x + 3 + "px";//590 + 1950 - width + "px"; ////
    popup.style.top = y - 23 + "px"; //y + 10 + "px";//
    
    //alert(popup.style.left + " ; " + popup.style.top);
    //window.status =  winW;//popup.style.left + " ; " + popup.style.top;
        
    g_Popup = popup;
}

function EmptyFunction(){ }

function HidePopup() 
{
if(g_Popup == null || stopHide) 
    return; 
g_Popup.style.display = "none"; 
}

function StartHidePopupOnMouseOver() 
{
stopHide = false; 
window.setTimeout("HidePopup()", 300); 
}

function StopHide() 
{
stopHide = true; 
}  
