﻿// JScript File

function Blur(p_obj)
{
    if(null != p_obj && this.blur)
        p_obj.blur();
}

function resizeIFrame(p_frameId, p_height, p_resetLastIFrameHeight)
{
    if(0 < p_height)
    {
        var frame = document.getElementById(p_frameId);
        var frameStyleObj = null;
        var extraHeight = 0;
        if(frame.addEventListener) //If Mozilla browser
            extraHeight = 20;

        frameStyleObj = (frame.style) ? frame.style : frame;
        frameStyleObj.height = p_height + extraHeight + "px";
    }
}

function DocumentSize(p_width, p_height)
{
    this.Width = p_width;
    this.Height = p_height;
}

function GetDocumentWidth()
{
    return GetDocumentSize().Width;
}

function GetDocumentHeight()
{
    return GetDocumentSize().Height;
}

function GetDocumentSize()
{
    var width = 0;
    var height = 0;
    if (window.innerHeight && window.scrollMaxY) // Mozilla
    { 
	    width = window.innerWidth + window.scrollMaxX;
	    height = window.innerHeight + window.scrollMaxY;
    } 
    else if (document.documentElement) // IE
    { 
        width = document.documentElement.scrollWidth;
	    height = document.documentElement.scrollHeight;
    } 
    else // the rest..
    {
	    width = document.body.offsetWidth;
	    height = document.body.offsetHeight;
    }
//alert("Window width : " + width + ", and height : " + height );

    return new DocumentSize(width, height);
}

function resizeMe(p_iframeId)
{
    try
    {
	    if (window.parent && window.parent.resizeIFrame) 
	    {
	        var iframeId = "mainPlaceHolderIFrame";
	        if(null != p_iframeId && typeof(p_iframeId) != undefined && 0 < p_iframeId.length)
	            iframeId = p_iframeId;
		    window.parent.resizeIFrame(iframeId, GetDocumentHeight() );
	    }
	}
	catch(nothing)
	{
	}
}
