function floatbox_show(width,height)
{
	if (width==null)
	{
		width=380;
	}
	if (height==null)
	{
		height=200;
	}
	floatbox_load(null,width,height);
}

function floatbox_load(url,width,height,hidden,closebutton)
{
	if (width==null)
	{
		width=620;
	}
	if (height==null)
	{
		height=410;
	}
	if (typeof(hidden)!="boolean")
	{
		hidden=false;
	}
	if (typeof(closebutton)!="boolean")
	{
		closebutton=true;
	}
	
	
	if (navigator.userAgent.toLowerCase().indexOf("safari")!=-1)
	{
		floatbox_load_safari(url,width,height,hidden,closebutton);
		return;
	}

	//Steve changed due to close button removed now
	var offsetheight=40;
	
	if (closebutton==false)
	{
		offsetheight=0;
	}
	
	var floatbox_panel=document.getElementById("floatbox_panel");
	var floatbox_bg=document.getElementById("floatbox_bg");
	var floatbox_screen=document.getElementById("floatbox_screen");
	var floatbox_content=document.getElementById("floatbox_content");
	var floatbox_message=document.getElementById("floatbox_message");
	var floatbox_window=document.getElementById("floatbox_window");
	var floatbox_close=document.getElementById("floatbox_close");
	
	floatbox_panel.style.width=(width+2)+"px";
	floatbox_panel.style.height=(height+offsetheight+2)+"px";

	floatbox_screen.style.left = 0;
	floatbox_screen.style.top = 0;
	floatbox_screen.style.width=screen.width+"px";
	floatbox_screen.style.height=screen.height+"px";
	floatbox_screen.style.display="";


	floatbox_bg.style.width=width+"px";
	floatbox_bg.style.height=(height+offsetheight)+"px";
	floatbox_content.style.width=width+"px";
	floatbox_content.style.height=(height+offsetheight)+"px";
	
	if (url==null)
	{
		floatbox_message.style.display="";
		floatbox_window.style.display="none";
	}
	else
	{
		window.floatboxwindow.document.body.innerHTML="";
		floatbox_window.style.width=width+"px";
		floatbox_window.style.height=height+"px";
		window.floatboxwindow.location.replace(url);
		floatbox_message.style.display="none";
		floatbox_window.style.display="";
	}
	
	floatbox_close.style.display=(closebutton) ? "" : "none";
	floatbox_panel.style.display=(hidden) ? "none" : "";
	
	floatbox_center();
	window.onresize = floatbox_center;
}



function floatbox_load_safari(url,width,height,hidden,closebutton)
{
	try
	{
		var offsetheight=50;
		
		var floatbox_panel=document.getElementById("floatbox_panel");
		var floatbox_bg=document.getElementById("floatbox_bg");
		var floatbox_content=document.getElementById("floatbox_content");
		var floatbox_message=document.getElementById("floatbox_message");
		var floatbox_window=document.getElementById("floatbox_window");
		var floatbox_close=document.getElementById("floatbox_close");
		var floatbox_iframe=document.getElementById("floatbox_iframe");
		
		
		if (hidden)
		{
			width=300;
			height=180;
		}
		
		
		floatbox_panel.style.width=(width+2)+"px";
		floatbox_panel.style.height=(height+offsetheight+2)+"px";
		
		floatbox_bg.style.width=width+"px";
		floatbox_bg.style.height=(height+offsetheight)+"px";
		floatbox_content.style.width=width+"px";
		floatbox_content.style.height=(height+offsetheight)+"px";


		if (url==null)
		{
			floatbox_message.style.display="";
			floatbox_iframe.style.display="none";
		}
		else
		{
			floatbox_iframe.style.display="";
			floatbox_iframe.innerHTML='<iframe src="'+url+'" id="floatbox_window" name="floatboxwindow" style="border:none; background:transparent; width:'+width+'px; height:'+height+'px;" frameborder="0" allowtransparency="true"></iframe>';

			floatbox_message.style.display="none";
		}
		
		floatbox_close.style.display=(closebutton) ? "" : "none";
//		floatbox_panel.style.display=(hidden) ? "none" : "";
		floatbox_panel.style.display="";
		
		floatbox_center();
		window.onresize = floatbox_center;
		
	}
	catch(e)
	{
		// error...
	}
}



function floatbox_hide()
{
	var floatbox_panel=document.getElementById("floatbox_panel");
	floatbox_panel.style.display="none";
	var floatbox_screen=document.getElementById("floatbox_screen");
	floatbox_screen.style.display="none";
}

function floatbox_setmessage(message)
{
	var o=document.getElementById("floatbox_message");
	var s='<center><div style="background-image:url(/images/popup_bg.gif); background-repeat:no-repeat; background-position:top center; width:347px; height:138px; padding-top:30px;"><p style="font-size:13px;">'+message+'</p>';
	s+='</div></center>';
	o.innerHTML=s;
}


function floatbox_confirm(question,yesaction,noaction)
{
	var o=document.getElementById("floatbox_message");
	var s='<center><div style="background-image:url(/images/popup_bg.gif); background-repeat:no-repeat; background-position:top center; width:347px; height:138px; padding-top:30px;"><p style="font-size:13px;">'+question+'</p>';
	s+='<input type="image" src="/images/btn_yes.gif" value="Yes" style="background:none;" onclick="'+yesaction+'" /> &nbsp; ';
	s+='<input type="image" src="/images/btn_no.gif" value="No" style="background:none;" onclick="'+noaction+'" />';
	s+='</div></center>';
	o.innerHTML=s;
	floatbox_load(null,380,165,false,false);
}


function floatbox_center()
{
	var floatbox_panel=document.getElementById("floatbox_panel");
	if ( !floatbox_panel || (iecheck((document.compatMode=='BackCompat')?true:false)) )
	{
		return;
	}
	windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;       
	windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	floatbox_panel.style.left = Math.max(0,(windowWidth/2 - floatbox_panel.scrollWidth/2)) +'px';
	floatbox_panel.style.top = Math.max(0,(windowHeight/2 - floatbox_panel.scrollHeight/2)) +'px';
}

function iecheck(inc_seven)
{
    if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent)
	{
	    var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
    	var iever = (inc_seven)?(rslt != null && Number(rslt[1]) >= 5.5):(rslt != null && Number(rslt[1]) >= 5.5 && Number(rslt[1]) < 7 );
    }
    return iever;
}
