﻿function AdjustFootertHeight()
{
    /*
    
    Description:
        - Enforces min height
        - Adjusts the height of left, main, and right section of the page to be the same.
    
    MODs:
        - 2007-??-??: Initial script.
        - 2007-08-24: Add the ability to re-adjust heights of the containers in the array
    */

    var arrContainerNames = new Array("FooterLeft", "Footer", "FooterRight");

    var intMininumHeightAllowed = 0;                // 0 means no minimum height being enforced
    var intMinimumHeight = intMininumHeightAllowed; // the mininum height of the containers in the array
    var intMaximumHeight = intMininumHeightAllowed; // the maximum height of the containers in the array

    for(i=0;i<arrContainerNames.length;i++)
    {
        var obj = document.getElementById(arrContainerNames[i]);
        if(obj != null)
        {
            obj.style.height = "auto";  // reset height that was previously set (by this script)

            var intCurrentHeight = obj.offsetHeight;
            // find minimum height
            if(intCurrentHeight > intMininumHeightAllowed   // must be at least greater than the height allowed
                && intCurrentHeight < intMinimumHeight)
            {
                intMinimumHeight = intCurrentHeight;
            }
            
            // find maximum height
            if(intCurrentHeight > intMaximumHeight)
            {
                intMaximumHeight = intCurrentHeight;
            }
        }
    }
    //intMaximumHeight = intMaximumHeight - 20;
    // by now, min and max height have been found    

    for(i=0;i<arrContainerNames.length;i++)
    {
        var obj = document.getElementById(arrContainerNames[i]);
        if (obj != null) {
            
            obj.style.height = intMaximumHeight + "px";
        }
    }    
}
function SetFooterSideBarWidth() {
    //alert(document.body.offsetWidth);
    var intCurrentWidth = document.body.offsetWidth;
    var intSideBarWidth = (intCurrentWidth - 970) / 2;
    var varFooterRightBar = document.getElementById('FooterRight');
    var varFooterLeftBar = document.getElementById('FooterLeft');

    varFooterRightBar.style.width = (intSideBarWidth - 2) + 'px';

    var varBannerRight = document.getElementById('BannerRight');

    var isiPad = navigator.userAgent.match(/iPad/i) != null;
    if (!isiPad) {
        varBannerRight.style.display = 'block';
    }
}
function AdjustLeftMainRightHeight() {
    /*
    
    Description:
    - Enforces min height
    - Adjusts the height of left, main, and right section of the page to be the same.
    
    MODs:
    - 2007-??-??: Initial script.
    - 2007-08-24: Add the ability to re-adjust heights of the containers in the array
    */

    var arrContainerNames = new Array("FeaturedCategory", "HealthAlerts", "LatestNews");

    var intMininumHeightAllowed = 0;                // 0 means no minimum height being enforced
    var intMinimumHeight = intMininumHeightAllowed; // the mininum height of the containers in the array
    var intMaximumHeight = intMininumHeightAllowed; // the maximum height of the containers in the array

    for (i = 0; i < arrContainerNames.length; i++) {
        var obj = document.getElementById(arrContainerNames[i]);
        if (obj != null) {
            obj.style.height = "auto";  // reset height that was previously set (by this script)

            var intCurrentHeight = obj.offsetHeight;
            // find minimum height
            if (intCurrentHeight > intMininumHeightAllowed   // must be at least greater than the height allowed
                && intCurrentHeight < intMinimumHeight) {
                intMinimumHeight = intCurrentHeight;
            }

            // find maximum height
            if (intCurrentHeight > intMaximumHeight) {
                intMaximumHeight = intCurrentHeight;
            }
        }
    }
    //intMaximumHeight = intMaximumHeight - 20;
    // by now, min and max height have been found    

    for (i = 0; i < arrContainerNames.length; i++) {
        var obj = document.getElementById(arrContainerNames[i]);
        if (obj != null) {

            obj.style.height = intMaximumHeight + "px";
        }
    }
}

 function CheckUploadImageArea()
    {
    var strUploadImageContainer = document.getElementById('PublicRightContent');
    var intWidth = strUploadImageContainer.offsetWidth;
    
    //alert(intWidth);
    
//    document.getElementById(lblImageAreaWidth).innerHTML = 'Tiger';
//    var txtBox = document.getElementById('<%= lblImageAreaWidth.ClientID %>').innerHTML;
//    
//    alert(txtBox);
//    
//   
    }

function setViewportDimensions(hiddenFieldID)
{
   
    var field = document.getElementById(hiddenFieldID);
    var width;
    var height;
    
    // see http://evolt.org/node/30655
    
    if (window.innerWidth)
    {
	    width = window.innerWidth;
	    height = window.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientWidth)
    {
	    width = document.documentElement.clientWidth;
	    height = document.documentElement.clientHeight;
    }
    else if (document.body)
    {
	    width = document.body.clientWidth;
	    height = document.body.clientHeight;
    }
    field.value = width + "," + height;
     alert('This is right');
}

