///
///	$RCSfile: lib.js,v $
///	$Author: bobby $
///	$Date: 2011/10/07 17:47:24 $
///	$Revision: 1.6 $
///

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()
{
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"100%\" height=\"100%\" VIEWASTEXT>");
	document.write("	<param name=\"movie\" value=\"splash.swf?clickid=&mode=normal&toload=website.swf\" />");
	document.write("	<param name=\"quality\" value=\"high\" />");
	document.write("	<param name=\"LOOP\" value=\"false\" />");
	document.write("	<param name=\"BGCOLOR\" value=\"#351048\" />");
	document.write("	<param name=\"menu\" value=\"false\" />");
	document.write("	<param name=\"scale\" value=\"noscale\" />");
	document.write("	<embed src=\"splash.swf?clickid=&mode=normal&toload=website.swf\" width=\"100%\" height=\"100%\" loop=\"False\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" bgcolor=\"#351048\" menu=\"false\" scale=\"noscale\"></embed>");
	document.write("</object>");
}

function displayTitle(text, width, height, baseUrl)
{
	document.write("<object type=\"application/x-shockwave-flash\" width=\""+width+"\" height=\""+height+"\" data=\""+baseUrl+"Images/loader.swf?path="+baseUrl+"Images%2Ftext.swf%3Ftext%3D"+UrlEncode(UrlEncode(text))+"\">");
	document.write("	<param name=\"movie\" value=\""+baseUrl+"Images/loader.swf?path="+baseUrl+"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);
}

function addToFavorite()
{
	/// Mozilla
	if(window.sidebar)
	{
		window.sidebar.addPanel("Lovable Labels", window.location, "");
	}
	/// IE
	else if(window.external)
	{
		window.external.AddFavorite(window.location, "Lovable Labels");
	}
}
function popupWindowSize(url, type, width, length) {
    popupWin = window.open(url, "PopupWindow", "scrollbars=no,resizable=no,location=no,status=no,width=" + width + ",height=" + length);
}

function noPostBack(sNewFormAction) {
    document.getElementById("__VIEWSTATE").name = 'NOVIEWSTATE';
    document.forms[0].action = sNewFormAction;
    document.forms[0].submit();
}

