// This method takes the elementId and returns the element
function $(elementId) {
    if (document.getElementById(elementId)) {
        return document.getElementById(elementId);
    }
    else if (document.getElementById(masterID + elementId)) {
        return document.getElementById(masterID + elementId);
    }
    else if (document.getElementById(otherFormID + elementId)) {
        return document.getElementById(otherFormID + elementId);
    }
}

function toggleOne(divId)
{
	var li = $(divId.concat('_li'));
	var div = document.getElementById(divId);
	
	if(div.style.display == "none") {
		li.className = "expanded";
		div.style.display = "";
	} else {
		li.className = "collapsed";
		div.style.display = "none";
	}
}
var oPopup = null;
if(navigator.userAgent.indexOf("MSIE")>=0)
{ 
 oPopup = window.createPopup();
}

function infoShow() {
    if (event.srcElement.id == "lowmedia" || event.srcElement.id == "lowpack") {
        infoShowLow();
    } else if (event.srcElement.id == "lowcoa") {
        infoShowLowCOA();
    } else if (event.srcElement.id == "midmedia" || event.srcElement.id == "midpack" || event.srcElement.id == "himedia" || event.srcElement.id == "hipack") {
        infoShowMidHi();
    } else if (event.srcElement.id == "midcoa") {
        infoShowMidCOA();
    } else if (event.srcElement.id == "hicoa") {
        infoShowHiCOA();
    }
}
function infoShowLow()
{
	if(null != oPopup)
	{
	    if (event.srcElement.id == "lowmedia")
		    oPopup.document.body.innerHTML = oLowMedia.innerHTML;
	    else if (event.srcElement.id == "lowpack")
		    oPopup.document.body.innerHTML = oLowPack.innerHTML;
	    oPopup.show(24, -40, 280, popupRealHeight(), event.srcElement);
	}
}
function infoShowMidHi()
{
	if(null != oPopup)
	{
	    if (event.srcElement.id == "midmedia")
		    oPopup.document.body.innerHTML = oMidMedia.innerHTML;
	    else if (event.srcElement.id == "himedia")
		    oPopup.document.body.innerHTML = oHiMedia.innerHTML;
	    else if (event.srcElement.id == "midpack")
		    oPopup.document.body.innerHTML = oMidPack.innerHTML;
	    else if (event.srcElement.id == "hipack")
		    oPopup.document.body.innerHTML = oHiPack.innerHTML;
		oPopup.show(-284, -40, 280, popupRealHeight(), event.srcElement);
	}
}
function infoShowLowCOA()
{
	if(null != oPopup)
	{
	    if (event.srcElement.id == "lowcoa")
		    oPopup.document.body.innerHTML = oLowCOA.innerHTML;
		oPopup.show(24, -20, 280, popupRealHeight(), event.srcElement);
	}
}
function infoShowMidCOA()
{
	if(null != oPopup)
	{
	    if (event.srcElement.id == "midcoa")
		    oPopup.document.body.innerHTML = oMidCOA.innerHTML;
		oPopup.show(-284, -20, 280, popupRealHeight(), event.srcElement);
	}
}
function infoShowHiCOA()
{
	if(null != oPopup)
	{
	    if (event.srcElement.id == "hicoa")
		    oPopup.document.body.innerHTML = oHiCOA.innerHTML;
		oPopup.show(-284, -140, 280, popupRealHeight(), event.srcElement);
	 }
}
function popupRealHeight() {
    var popupBody = oPopup.document.body;
    oPopup.show(0, 0, 280, 0);
    var realHeight = popupBody.scrollHeight;
    oPopup.hide();
    return realHeight;
}

/*Features*/
/* OpenWindow():
* Opens a window with the following URL, window width and window height
*/
function showFeature(strURL, iWidth, iHeight) {
    window.open(strURL, 'strWindowTitle', 'width=' + iWidth + ',height=' + iHeight + ',resizable=no,toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no');
    return;
}
function showGallery(strURL, iWidth, iHeight) {
    window.open(strURL, 'strWindowTitle', 'width=' + iWidth + ',height=' + iHeight);
    return;
}
