var thecontainer;
var refrehfunction;
function WindowSelfRefresh(){
    window.location = window.location ;
}
function parentRefresh()
{
    if (window.parent)
    {
        window.parent.location = window.parent.location;
        window.close();
    }
}
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.unblockUI({ 
       onUnblock: function(){ jQuery("#dialogcontent").html("");document.body.removeChild(thecontainer) } 
    }); 

}

function showdialog(title,url,w,h){
	createContainer();
	jQuery.blockUI({ message: jQuery('#FM_BlockUI_Dialog'),css: { 
	    top: '6%',
	    width: '70%',
            border: 'none',
	    left: '15%',
	    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=no></iframe>")
	jQuery("#dialogcontent").html("<iframe class='ui-iframe' width='"+w+"' height='"+h+"' src='" + url + "' style='border:0px;'  frameborder='0' SCROLLING=yes></iframe>")

	jQuery("#dialogtitle").html(title)

}

function createContainer(){ // Create Container
thecontainer =  document.createElement("div")
thecontainer.id = "thecontainer"
thecontainer.style.display = "none"
thecontainer.innerHTML =
"<div id='FM_BlockUI_Dialog' align='center' >" +
"<table cellpadding='0' cellspacing='0' border='0' height='100'>"+
"<tr><td class='tl' width='10' height='10'></td><td class='b'></td>"+
"<td class='tr' width='10'height='10'></td></tr>"+
"<tr><td class='b'></td><td class='inner'>"+
"<div class='titlebar'><table cellpadding='0' cellspacing='0' border='0' width='100%' ><tr><td align='left'>&nbsp;&nbsp;<span id='dialogtitle'></span></td>"+
"<td align='right' nowrap='nowrap'><a href='javascript:void(0);' class='closebutton' onclick='closedialog()'><img src='images/popup_btnClose.gif' border='0' /></a>&nbsp;&nbsp;"+
"</td></tr></table></div>"+
"<div id='dialogcontent'></div>"+
"</td><td class='b'></td></tr>"+
"<tr><td class='bl' width='10' height='10'></td><td class='b'></td>"+
"<td class='br' width='10' height='10'></td></tr></table></div>"
document.body.appendChild(thecontainer)
}

/*-----------Auto start token holder------------------------------*/
function StartEditToolbar(){
    var thetoolbars = jQuery(".token_holder")
    if (thetoolbars){
        thetoolbars.hover(
            function(){
                jQuery(this).find(".token_holder_toolbar").css({'display':'block'})
                 jQuery(this).css({'border':'1px dashed #3300ff'})
             
            },
            function(){
               jQuery(this).find(".token_holder_toolbar").css({'display':'none'})
                   jQuery(this).css({'border':'1px dashed #cccccc'})
              
                
            }
        )
    }
}
jQuery(function(){
try{
      StartEditToolbar();
}
catch(e){
}
  
});

