﻿function menuOver(obj, divName)
{
    obj.className = 'mOver';
    if (divName != '')
        document.getElementById(divName).style.display = 'block';
}

function menuOut(obj, divName)
{
    obj.className = 'mOut';
    if (divName != '')
        document.getElementById(divName).style.display = 'none';
}

function mChange(thisItem, newClass, showDiv, hideDiv)
{
    thisItem.className = newClass;
    
    if (showDiv != '')
        document.getElementById(showDiv).style.display = 'block';
    
    if (hideDiv != '')
        document.getElementById(hideDiv).style.display = 'none';
}

function mActivate(current, others, target, content, right)
{
    var currentL = current.split(',');
    for (var i in currentL)
    {
        var arrowL = currentL[i].split(':');
        
        if (arrowL[1] == 'T')
            document.getElementById(arrowL[0]).className = 'mih';
        else
            document.getElementById(arrowL[0]).className = 'mihn';
    }
        
    var othersL = others.split(',');
    
    for ( var j in othersL )
    {
        document.getElementById(othersL[j]).className = 'mi';
//        document.getElementById(target).innerHTML = '<div style="float: left; width: 20px"><img src="/Web/V4/Img/infob2.png" /></div><div style="float: left;">' + content + '</div>';
        document.getElementById(target).innerHTML = '<table cellpadding="0" cellspacing="0" border="0"><tr><td width="20" valign="top"><img src="/Web/V4/Img/infob2.png" /></td><td>' + content + '</td></tr></table>';
    } 
}

function mClick(url)
{
    window.location = url;
}

function supOver(obj)
{
    obj.className = 'supmOver';
}

function supGoOver(obj)
{
    obj.className = 'supGoOver';
}

function supGoOut(obj)
{
    obj.className = 'supGoOut';
}

function supOut(obj)
{
    obj.className = 'supOut';
}

function hidediv(id) {
    //safe function to hide an element with a specified id
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.display = 'none';
    }
    else {
        if (document.layers) { // Netscape 4
	        document.id.display = 'none';
        }
        else { // IE 4
	        document.all.id.style.display = 'none';
        }
    }
}

function showdiv(id) {
    //safe function to show an element with a specified id
		  
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.display = 'block';
    }
    else {
        if (document.layers) { // Netscape 4
	        document.id.display = 'block';
        }
        else { // IE 4
	        document.all.id.style.display = 'block';
        }
    }
}

var timerPopup;
var itemPopup;

function ResetPopup()
{
    pop = document.getElementById("divPopup");
    if (pop == null)
        document.writeln("<div id='divPopup' onmouseover='javascript:KeepPopup(this)' onmouseout='javascript:HidePopup()' style='width: 200px; height: 300px; position: absolute'>test</div>");
}

function ShowPopupContent(html) 
{ 
    var pop = $("#divPopup");
    var pos = $(itemPopup).offset();    
    
    // Set popup to visible 
    var leftCheck =  pos.left + $(itemPopup).width() - 10 + pop.width();
    if (leftCheck > $("#mContent").offset().left + $("#mContent").width())
        leftCheck = pos.left + 10 - pop.width(); 
    else
        leftCheck = pos.left + $(itemPopup).width() - 10;
    
    // Show Content
    var pcontent = $("#divContent");
    pcontent.css('display', 'block');
    pcontent.html(html); 
    
    // Hide iFrame
    var pframe = $("#ifPopup");
    pframe.css('display', 'none');
    
    pop.css('left', leftCheck); 
    pop.css('top', pos.top);
    pop.css('display', 'block');
} 

function ShowPopupURL(url) 
{ 
    var pop = $("#divPopup");
    var pos = $(itemPopup).offset();    
    
    // Set popup to visible 
    var leftCheck =  pos.left + $(itemPopup).width() - 10 + pop.width();
    if (leftCheck > $("#mContent").offset().left + $("#mContent").width())
        leftCheck = pos.left - 15 - pop.width(); 
    else
        leftCheck = pos.left + $(itemPopup).width() - 5;
    
    // Hide Content
    var pcontent = $("#divContent");
    pcontent.css('display', 'none');
    
    // Show iFrame
    var pframe = $("#ifPopup");
    pframe.css('display', 'block');
    pframe.attr('src', url);
    
    pop.css('left', leftCheck); 
    pop.css('top', pos.top + 3);
    pop.css('display', 'block');
} 

function KeepPopup() 
{ 
    clearTimeout(timerPopup);
    var pop = $("#divPopup");
    pop.css('display', 'block');
} 

function HidePopup() 
{ 
    clearTimeout(timerPopup);
    timerPopup = setTimeout("HideTimed()", 300);
} 

function HideTimed()
{
    var pop = $("#divPopup");
    pop.css('display', 'none');
}

function StartTimer(hoveritem)
{
    clearTimeout(timerPopup);
    timerPopup = setTimeout("ShowPopup()", 750);
    itemPopup = hoveritem;
}

function StartTimerHtml(hoveritem, html)
{
    clearTimeout(timerPopup);
    timerPopup = setTimeout("ShowPopupContent('" + html + "')", 750);
    itemPopup = hoveritem;
}

function StartTimerURL(hoveritem, url)
{
    clearTimeout(timerPopup);
    timerPopup = setTimeout("ShowPopupURL('" + url + "')", 750);
    itemPopup = hoveritem;
}

function mouseOver(obj)
{
    obj.className = 'mouseOver';
}

function mouseOut(obj)
{
    obj.className = 'mouseOut';
}
