/* ====================================================================

	File Name:	window_open.js
	Purpose:	These javascript functions should be included if you
				are wanting to open a new window with a passed URL
	Developer:	Bill Quinlan AG Consulting ADP National Hosting Center
	Copyright:	August 2000
   	Modifications:
	  Date		Developer	Change
	------------	---------------	----------------------------
	Auguust 2000	Bill Quinlan	Genisis
   =================================================================
	Decode(sURL)
		PURPOSE: Decode an encoded URL string
		INPUT  : URL to decode
		RETURNS: decoded URL string
	URL(sURL)
		PURPOSE: Make a url string safe
		INPUT  : string of url
		RETURNS: newly formated url safe string
	OpenWindow(sURL,sTarget)
		PURPOSE: Open a new popup window
		INPUT  : url of new window, target
		RETURNS: NA
   ====================================================================== */
/* -------------------------------------------------------------------
	Decode(sURL)
	PURPOSE: Decode a coded URL
	INPUT  : URL String
	RETURNS: Decoded String
	NOTES  :
--------------------------------------------------------------------  */
function Decode(sURL) {
	var l ;
	var i = 0;
	var q = '';

	if (sURL) {
	   l = sURL.length ;
	}
	else {
		return q;
	}
	for (i = 0; i < l; i++)
	{
		if (sURL.charAt(i) == '%')
		{
			i++;
			if ( sURL.charAt(i) == '2' )
			{
				i++;
				if ( sURL.charAt(i) == '5' )
				{
					q += '%';
				}
				else
				{
					q += '\'';
				}
			}
		}
		else
		{
		  	q += sURL.charAt(i);
		}
	}
	return q;
}

/* -------------------------------------------------------------------
	URL(sURL)
	PURPOSE: Code a URL to a safe string
	INPUT  : URL String
	RETURNS: Coded String
	NOTES  :
--------------------------------------------------------------------  */
function URL(sURL) {
var l ;
var i = 0;
var q = '';

if (sURL)
{
   l = sURL.length ;
}
else
{
    return q;
}

for (i = 0; i < l; i++)
{
    if (sURL.charAt(i) == ' ')
    	q += '%20';
//    else
//      	if (sURL.charAt(i) == ':')
//      		q += '%3A';
    else
      	q += sURL.charAt(i);
}
return q;
}

function showCarpetPallet() {
	OpenWindow('images/logocarpet_palet.gif', '_blank', 'default3');
}
/* -------------------------------------------------------------------
	OpenWindow(sURL,target)
	PURPOSE: Open any window via a javascript function
	INPUT  : URL of nedw document, target window, winProperties as True/False
	RETURNS: NA
	NOTES  :
--------------------------------------------------------------------  */
function OpenWindow(sURL, sTarget, winProperties)
{
	var newWindow;
    var urlString =     sURL;
//	alert("!"+sURL);
	 urlString = URL(urlString);
//	 alert(urlString);
    if (!winProperties)
		newWindow = window.open(urlString, sTarget);
	else
	{
		if (winProperties == 'default')
			var sProperties = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=470,height=360';
		else
		if (winProperties == 'default2')
			var sProperties = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=503,height=600';
		else
		if (winProperties == 'default3')
			var sProperties = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=785,height=300';
		else
			var sProperties = winProperties;
		newWindow = window.open(urlString, sTarget, sProperties);
	}
    if (!newWindow.opener)
    {
        newWindow.opener = window;
    }
}
