// JavaScript Document
var HTMLPopupUrl = "about:blank";
var HTMLPopupWidth = 640;
var HTMLPopupHeight = 480;
var ServerAddress = "";
function showPopup( url, width, height, hide, _settings )
{
	if ( url==null||url=="" ) 
		url = HTMLPopupUrl;
	if ( width==null||width=="" ) 
		width = HTMLPopupWidth;
	if ( height==null||height=="" ) 
		height = HTMLPopupHeight;
		
	if ( ServerAddress!="" && url.substr(0,8)=="src/docs" )
		url = ServerAddress + url;
	
	if ( $("#popupLink").length==0 )
		$("body").append("<a class='iframe' href='" + url + "' id='popupLink'></a>");
	else
		$("#popupLink").attr( "href", url ); 
	
	settings = {
		'width'				: width,
		'height'			: height,
		'type'				: 'iframe',
		'onClosed'			: closePopup,
		'hideOnContentClick': false,
		'overlayShow':false
	}
	if ( _settings!=null )
	{
		for( var p in _settings )
			settings[p] = _settings[p]
	}
	$("#popupLink").fancybox(settings);
	$("#popupLink").click();
	
	if ( $('#flashobj')[0].enableNxtbook )
		$('#flashobj')[0].enableNxtbook( false );
	if ( hide==true )
		$('#flashobj').css('visibility', 'hidden')
}
function closePopup() 
{
	if ( $('#flashobj')[0].enableNxtbook )
	{
		$('#flashobj')[0].enableNxtbook( true );
		$('#flashobj')[0].focus()
	}
	$('#flashobj').css('visibility', 'visible')
	
}
function reloadConfig()
{
	if ( $('#flashobj')[0].reloadConfig )
		$('#flashobj')[0].reloadConfig();
}

var wmodeInit=""
function setWmode( wmode )
{
	embed = $('param[name|="wmode"]')
	
	if ( embed==null )
		return;
		
	if ( wmodeInit=="" )
		wmodeInit = embed.attr("value");
	
	if ( wmode==null )
		wmode = wmodeInit
		
	embed.attr("value",wmode)
}
