﻿//JMH Master page reference to this file must be changed for website in root or in MPA subfolder.
var adjOffset = false;
function adjustLayout()
{ 
    var centerCol = document.getElementById("center-col");
    var leftCol = document.getElementById("left-col");
    var minHeight = document.getElementById("min-height");
   
    if(centerCol != null && typeof(centerCol) != "undefined" && leftCol != null && typeof(leftCol) != "undefined" && minHeight != null && typeof(minHeight) != "undefinded")
    { 
        if (centerCol.offsetHeight > leftCol.offsetHeight) 
            minHeight.style.height = (centerCol.offsetHeight - 150)+ "px";
        else 
            minHeight.style.height = (leftCol.offsetHeight - 150) + "px";
    }
    
    
    var cbTop = document.getElementById("ctl00_cbSection");
    var offset = document.getElementById("offset");
    var leftTop = document.getElementById("left-top");
    if(adjOffset && cbTop != null && typeof(cbTop) != "undefined" && offset != null && typeof(offset) != "undefined" && leftTop != null && typeof(leftTop) != "undefined")
    {
        var calHg;
        if(IsIE())
            calHg = cbTop.offsetHeight - leftTop.offsetHeight + 8;
        else
            calHg = cbTop.offsetHeight - leftTop.offsetHeight + 9;
        if(calHg > 0)
            offset.style.height = calHg + "px";        
    }
    // 20080701.JMH Don't show Stock Quote if not Default page.
    var sPath = window.location.pathname.toUpperCase();
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    var sQuote = document.getElementById("stockquote");
    var blklist = document.getElementById("right_blocklist");
    var content = document.getElementById("content");
    var rtcont = document.getElementById("right-content");
     var rtBottom = document.getElementById("right-bottom");
    //alert(sPath);
    //document.getElementById("ctl00_TextBox1").value = sPath;

   //JMH Need to test subfolder MPA paths also for testing on AKI ServerDemo.
    if(sPath != "/" && sPath != "/DEFAULT.ASPX" && sPath != "/MPA/" && sPath != "/MPA/DEFAULT.ASPX")
    {
        if(sQuote != null && typeof(sQuote) != "undefined")
        {
            sQuote.style.display = "none";
            if(blklist != null && typeof(blklist) != "undefined")
               blklist.style.top = 70 + "px";
        }
    }
   
    if(sPage == "BLOG.ASPX")
    {
        rtBottom.style.display = "none";
        content.style.width = 900 + "px";
        content.style.border = "dotted 1px yellow";
    }
    else
    {    
    // 20080702.JMH Adjust minHeight for right-content also.
    
    var rtht = sQuote.offsetHeight + blklist.offsetHeight;
    if(rtht > minHeight.offsetHeight)
        minHeight.style.height = (rtht - 30) + "px";    
    }
    // 20080708.JMH This should disable rt-clk; it doesn't.
     //window.frames["newsframe"].document.oncontextmenu = function(){alert("No way!"); return false;};
}

function ecmPopUpWindow(url, hWind, nWidth, nHeight, nScroll, nResize) 
{
	var popupwin,  cToolBar;
	cToolBar = 'toolbar=0,location=0,directories=0,status=' + nResize + ',menubar=0,scrollbars=' + nScroll + ',resizable=' + nResize + ',width=' + nWidth + ',height=' + nHeight;
	popupwin = window.open(url, hWind, cToolBar);
	return popupwin;
}

function IsIE()
{
	var ua = window.navigator.userAgent.toLowerCase();
	return ((ua.indexOf('msie') > -1) && (!(ua.indexOf('opera') > -1)));
}

