///
///	$RCSfile: lib.js,v $
///	$Author: bobby $
///	$Date: 2007/05/07 15:09:31 $
///	$Revision: 1.4 $
///

function UrlEncode(text)
{
	var SAFECHARS = "0123456789"
		+"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
		+"abcdefghijklmnopqrstuvwxyz"
		+"-_.!~*'()";
	var retval = "";
		
	for(var i = 0; i < text.length; i++)
	{
		if(SAFECHARS.indexOf(text.charAt(i)) != -1)
		{
			retval += text.charAt(i);
		}
		else if(text.charAt(i) == " ")
		{
			retval += "+";
		}
		else
		{
			retval += "%"+text.charCodeAt(i).toString(16);
		}
	}
	
	return retval;
}

function displayFlash(filename, width, height)
{
	document.write("<object type=\"application/x-shockwave-flash\" width=\""+width+"\" height=\""+height+"\" data=\""+UrlEncode(filename)+"\">");
	document.write("	<param name=\"movie\" value=\""+UrlEncode(filename)+"\" />");
	document.write("	<param name=\"menu\" value=\"false\" />");
	document.write("</object>");
}

function displayTitle(text)
{
	document.write("<object type=\"application/x-shockwave-flash\" width=\"405\" height=\"32\" data=\"Images/loader.swf?path=Images%2Ftext.swf%3Ftext%3D"+UrlEncode(UrlEncode(text))+"\">");
	document.write("	<param name=\"movie\" value=\"Images/loader.swf?path=Images%2Ftext.swf%3Ftext%3D"+UrlEncode(UrlEncode(text))+"\" />");
	document.write("	<param name=\"quality\" value=\"high\" />");
	document.write("	<param name=\"menu\" value=\"false\" />");
	document.write("	<param name=\"wmode\" value=\"transparent\" />");
	document.write("</object>");
}


/// Opens a new popup window
function openWindow(url, name, width, height)
{
	window.open(url, name, "height="+height+", location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=yes, toolbar=no, width="+width);
}
