	function popup(url, name, width, height) {
		var settings = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+width+",height="+height; 
		window.open(url,name, settings);
	 
	}

    function CatchKeyPress(KeyCode, Sender) { 
	} 
	
	function RemoveEnterAndEscEvents() { 
		if (event.keyCode == 13 || event.keyCode == 27) { 
			event.cancelBubble = true; event.returnValue = false; 
		} 
	} 

	function collapseSection( rowName, rowCount)
	{
		if(rowName.length > 0 && rowCount > 0)
		{
			if (DHTMLSupported())
			{
				if(document.getElementById(rowName.concat('1')))
				{
					var Display = '';
					if(document.getElementById(rowName.concat('1')).style.display == '')
						Display = 'none';
					for(var i=1; i<=rowCount; i++)
					{
						if(document.getElementById(rowName.concat(i)))
							document.getElementById(rowName.concat(i)).style.display = Display;
					}
				}
			}
		}
	}

	function populateSubDropDownData( subDropDown, category ) 
	{ 
		var frm = document.Form1;
 		for (var i=0; i < frm.length; i++) {
			var e = frm.elements[i];
			if ((e.type == 'select-one') && (e.id.indexOf(subDropDown) >= 0))
			{
				select = e;
				break;
			}
		}
		string	= ""; 
		// Clear the old list
		count = 0;
		select.options.length = count;
	 
		// Place all matching categories into Options. 
		for( i = 0; i < arrayData.length; i++ ) 
		{ 
			string = arrayData[i].split( "|" ); 
			if( string[0] == category ) 
			{ 
				select.options[count++] = new Option( string[1], string[2], string[3] ); 
			} 
		} 
	} 
	
	function populateSubDropDownData( subDropDown, category, defaultValue ) 
	{ 
		var frm = document.Form1;
 		for (var i=0; i < frm.length; i++) {
			var e = frm.elements[i];
			if ((e.type == 'select-one') && (e.id.indexOf(subDropDown) >= 0))
			{
				select = e;
				break;
			}
		}
		string	= ""; 
		// Clear the old list
		count = 0;
		select.options.length = count;
	 
		// Place all matching categories into Options. 
		for( i = 0; i < arrayData.length; i++ ) 
		{ 
			string = arrayData[i].split( "|" ); 
			if( string[0] == category ) 
			{ 
				if (string.length == 6)
					select.options[count++] = new Option( string[1], string[2] + "|" + string[3] + "|" + string[4] 
						+ "|"); 
				else if (string.length == 5)
					select.options[count++] = new Option( string[1], string[2] + "|" + string[3] + "|"); 
				else if (string.length == 4)
					select.options[count++] = new Option( string[1], string[2]); 
				else if (string.length == 3)
					select.options[count++] = new Option( string[1]); 
			} 
		} 
		
		//Select the default value
		if (defaultValue != null)
		{
			for (var i = 0; i < select.length; i++) {
				var string = select.options[i].value.split( "|" ); 
				if (string[0] == defaultValue)
				{
					select.options[i].selected = true;
					break;
				}
			}
		}
		else
			var string = select.options[select.selectedIndex].value.split( "|" ); 

		if (select.id.indexOf("BeginHoliday") >= 0)
		{
			divBeginDaysFromHoliday.innerHTML = '';
			divBeginDaysFromHoliday.innerHTML = string[1];
		}
		else if (select.id.indexOf("EndHoliday") >= 0)
		{
			divEndDaysFromHoliday.innerHTML = '';
			divEndDaysFromHoliday.innerHTML = string[2];
		}
	} 

    // Originally created by Janus Kamp Hansen - http://www.kamp-hansen.dk
    // Extended by Darrell Norton - http://dotnetjunkies.com/weblog/darrell.norton/ 
    //   -- added Mozilla support, fixed a few issues, improved performance
    //Modified to consolidate browser detection logic.
	function fnTrapKD(btn, event)
	{
		if(DHTMLSupported())
		{
			if (event.keyCode == 13 || event.which == 13)
			{
				event.returnValue=false;
				event.cancel=true;
				document.getElementById(btn).click();
			}
		}
	}

	//Ensures the browser supports DHTML. If so, it allows the developer to 
	//use document.getElementById regardless of the browser.
	function DHTMLSupported()
	{
		if (document.getElementById || document.all || document.layers)
		{
			if(!document.getElementById) 
			{
				if (document.all)
				{
					document.getElementById = function(id) 
					{
						return document.all[id];
					}
				}
				else if (document.layers)
				{
					document.getElementById = function(id) 
					{
						return document.layers[id];
					}
				}
				else
					return false;
			}
			else
				return true;
		}
		else
			return false;
	}

	function getControlPrefixName( control )
	{
		var UControlName = control.id.substr(0,control.id.lastIndexOf('_',control.id.length) + 1);	
		return UControlName;
	}
	
/*
Script Name: Javascript Cookie Script
Author: Public Domain, with some modifications
Script Source URI: http://tech.ratmachines.com/downloads/browser_detection.php
Version 1.0.0
Last Update: 30 May 2004

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
*/

// this function gets the cookie, if it exists
function Get_Cookie( name ) {
	
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
	{
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

	/*
	only the first 2 parameters are required, the cookie name, the cookie
	value. Cookie time is in milliseconds, so the below expires will make the 
	number you pass in the Set_Cookie function call the number of days the cookie
	lasts, if you want it to be hours or minutes, just get rid of 24 and 60.

	Generally you don't need to worry about domain, path or secure for most applications
	so unless you need that, leave those parameters blank in the function call.
	*/
	function Set_Cookie( name, value, expires, path, domain, secure ) {
		// set time, it's in milliseconds
		var today = new Date();
		today.setTime( today.getTime() );
		// if the expires variable is set, make the correct expires time, the
		// current script below will set it for x number of days, to make it
		// for hours, delete * 24, for minutes, delete * 60 * 24
		if ( expires )
		{
			expires = expires * 1000 * 60 * 60 * 24;
		}
		//alert( 'today ' + today.toGMTString() );// this is for testing purpose only
		var expires_date = new Date( today.getTime() + (expires) );
		//alert('expires ' + expires_date.toGMTString());// this is for testing purposes only

		document.cookie = name + "=" +escape( value ) +
			( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString()
			( ( path ) ? ";path=" + path : "" ) + 
			( ( domain ) ? ";domain=" + domain : "" ) +
			( ( secure ) ? ";secure" : "" );
	}

	// this deletes the cookie when called
	function Delete_Cookie( name, path, domain ) {
		if ( Get_Cookie( name ) ) document.cookie = name + "=" +
				( ( path ) ? ";path=" + path : "") +
				( ( domain ) ? ";domain=" + domain : "" ) +
				";expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}
	
	function OpenCertDetails()
	{
		thewindow =window.open('https://www.thawte.com/cgi/server/certdetails.exe?code=USHOTS18', 'anew',config='height=400,width=450,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
	}

	function confirmDelete()
	{
		if (confirm("Are you sure you want to delete this record?")==true) 
			return true; 
		else 
			return false; 
	}
	function AdminConfirmDelete()
	{
		if (confirm("This record may be referenced by other records. Deleting it may jeopardize the integrity of your data. Are you sure you want to delete this record?")==true) 
			return true; 
		else 
			return false; 
	}
	function confirmAction(Msg)
	{
		if (confirm(Msg)==true) 
			return true; 
		else 
			return false; 
	}

	function HideItem( controlName )
	{
		if(DHTMLSupported)
		{
			if(document.getElementById(controlName))
				document.getElementById(controlName).style.display = 'none';
		}
	}

	function UnHideItem( controlName )
	{
		if(DHTMLSupported)
		{
			if(document.getElementById(controlName))
				document.getElementById(controlName).style.display = '';
		}
	}

	function ReplaceReturnCharacters( strInput, replaceWith)
	{
		strInput = escape(strInput); //encode the string's carriage returns
		//loop through string, replacing carriage return encoding with HTML break tag
		for(i=0; i<strInput.length; i++)
		{ 
			if(strInput.indexOf("%0D%0A") > -1)
				//Windows encodes returns as \r\n hex
				strInput=strInput.replace("%0D%0A",replaceWith);
			else if(strInput.indexOf("%0A") > -1)
				//Unix encodes returns as \n hex
				strInput=strInput.replace("%0A",replaceWith);
			else if(strInput.indexOf("%0D") > -1)
				//Macintosh encodes returns as \r hex
				strInput=strInput.replace("%0D",replaceWith);
		}
		strInput=unescape(strInput);
		return strInput;
	}
	var oldload = false;
	if(window.onload != null) oldload = window.onload;
	window.onload = function(){
		//First get rid of the old broken key capture
		if(document.body.getAttribute('onkeydown') != null){
			document.body.removeAttribute('onkeydown');
		}
		if(typeof document.body.addEventListener != 'undefined'){
			window.event = false;
			document.addEventListener("keydown", function(e){
				CatchKeyPress(e.which, e.target)
			}, true);
		}else{
			document.attachEvent("onkeydown", function(e){
				CatchKeyPress(window.event.KeyCode, window.event.SrcElement);
			});
		}
		if(oldload != false) oldload();
	};