function adjustIframeModalHeight(el){
    if ( $(".modalWindow").length > 0 || $(".modalDialog").length > 0 ){
        var height = $("body").height();
        window.parent.setIframeModalHeight( el, height );
        
        height = $("body").height();
        window.parent.setIframeModalHeight( el, height );
    }
}
function setIframeModalHeight(el, height){
    $(el).height(height);
}

//To increase or decrease the height to iframe as per needed.
function autoAdjustIframeModalHeight(){
    if ( $(".modalWindow").length > 0 || $(".modalDialog").length > 0 ){
		var height = $("body").height();
		try { window.parent.setAllIframeModalHeight( height ); } catch (e){}
		
        $(window).load(function(){
            var height = $("body").height();
            try { window.parent.setAllIframeModalHeight( height ); } catch (e){}
        });
    }
}
function setAllIframeModalHeight(height){
    $("body > .ui-dialog > .ui-dialog-content:visible").each(function(){
        if ( !$(this).find("iframe").hasClass("modalNoResize") ){
            $(this).height(height);
            if ( $(this).find("iframe").length > 0 ){
                $(this).find("iframe").height(height);
            }
        }
    });
}

function closeModalWindow( sel ){
    if ( window.parent == window ){
        try {
            $( sel ).dialog( 'close' );
        } catch (e) {}
    } else {
        try {
            window.parent.$( sel ).dialog( 'close' );
        } catch (e) {}
    }
}

function closeAllModalWindows(){
    $("body > .ui-dialog > .ui-dialog-content").each(function(){
        $(this).dialog("close");
    });
}

function hideAllModalWindows(){
    $(".ui-widget-overlay, .ui-dialog").css("display", "none");
}

function pageRefresh(){
    document.location.href = document.location.href;
}
