/*
 * FourthMedia Show Dialog base on BlcokUI
 * Version 1.0 (1 Dec 2008)
 * @requires jQuery v1.2.3 , JQuery BlcokUI 2.10 or later
 * Created By Brand HU
 */
var thecontainer // Global Object
var refrehfunction
function WindowSelfRefresh(){
    window.location = window.location ;
}
function autorefresh(ID){
    if (typeof(refrehfunction) != "undefined" ){
            if(typeof(ID) != "undefined" && ID != 0 ){
                eval(refrehfunction+"("+ID+")");
            }
            else
            {eval(refrehfunction+"()");}
        }
    else{
    alert("function not found")
    }
}
function closedialog(){
    jQuery("#FM_BlockUI_Dialog").draggable( 'destroy' )
    jQuery.unblockUI({
        onUnblock: function(){ jQuery("#dialogcontent").html("");} 
    });
//    jQuery.unblockUI({ 
//       onUnblock: function(){ jQuery("#dialogcontent").html("");document.body.removeChild(thecontainer) } 
//    }); 

}


function showdialog(title,url,w,h,createContainerfunction){
    if (!document.getElementById("thecontainer")){
        if (typeof(createContainerfunction) != "undefined" && createContainerfunction != "" ){
            eval(createContainerfunction + "();")
        }
        else{
            createContainer();
        }
	    
	}
	
	jQuery.blockUI({ message: jQuery('#FM_BlockUI_Dialog'),css: { 
	    top: '1%',
	    width: '98%',
        border: 'none',
        height: '98%',    
	    left: '1%',
	    backgroundColor:'transparent',
	    cursor: 'point' 
        },
	overlayCSS:  {  
        backgroundColor:'#000',  
        opacity:        '0.2'  
    	} ,
	fadeOut:  300 }); 
	jQuery("#dialogcontent").html("<iframe class='ui-iframe' width='"+w+"' height='"+h+"' src='" + url + "' style='border:0px;'  frameborder='0' SCROLLING=auto></iframe>")

	jQuery("#dialogtitle").html(title)
	jQuery("#FM_BlockUI_Dialog").draggable({handle:'.titlebar'})
    
}

