	var lintFailSafeCounter = 0 ;
	var pstrNullGUID = "00000000-0000-0000-0000-000000000000" ;

	function ForgetIt()
	{
		lintFailSafeCounter = lintFailSafeCounter + 1 ;
		if ( lintFailSafeCounter > 1 ) 
		{
			lintFailSafeCounter = 0 ;
			return true;
		}
		return false;
	}

	function CheckEmail_RE( lobjName , lbolRequired  )
	{
		lobjName.value = lobjName.value.trim();
		var lstrValue = lobjName.value;
		var lstrErrorMessages = "" ;
		if ( lstrValue.length == 0 && !lbolRequired ) return true;
		
		var emailFilter=/^.+@.+\..{2,3}$/;
		
		if (!(emailFilter.test( lstrValue ))) 
		{ 
			lstrErrorMessages += "Please enter a valid email address.\n" ;
		}

		var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]\ \|\'\"\^]/
		if ( lstrValue.match(illegalChars)) 
		{
			lstrErrorMessages += "The email address contains one or more illegal characters, or a space.\n" ;
		}

		if ( lstrErrorMessages.length > 0 )
		{
			alert ( lstrErrorMessages  ) ;
			if ( ForgetIt() && !lbolRequired  )
			{
				if ( lobjName.value.trim().length == 0   ) 
				{
					history.go(2);
					return true;
				}
				else
					lobjName.value = "" ;
			}
			
			lobjName.focus();
			return false ;
		}
		return true;
	}

String.prototype.trim = function() {  return( this.replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') );  }
Date.prototype.getYearFixed = function()
{
	var lintYear = this.getYear();
	if ( lintYear < 1000 )
		return lintYear + 1900;
	else
		return lintYear ;
}

function CheckCardNumber_pre( lintKey ) 
{
	if ( IsNavigationKey( lintKey ) ) return true;

	if (!KeyPressedIsANumber( lintKey , true) ) 
	{
		event.returnValue = false ;
		return false ;
	}
}


function IsNumber ( lintValue )
{

	lintValue = lintValue.toString();
	lintValue = lintValue.trim();
	
	if (lintValue.length == 0)	return false;

	for (var n = 0; n < lintValue.length; n++)
		if (lintValue.substring(n, n+1) < "0" || lintValue.substring(n, n+1) > "9") 
			return false;

	return true;

}

function KeyPressedIsANumber ( lintKey , lbolNumbersOnly ) 
{
	//lbolNumbersOnly such as zipcode and phone numbers
	
	window.defaultStatus = "Numbers required [" + lintKey + "] step 1" ;
	
	if ( IsShiftKey() &&  ( IsNavigationKey( lintKey ) || IsSystemKey( lintKey ) || IsFunctionKey( lintKey ) ) ) return true;
	window.defaultStatus = "Numbers required [" + lintKey + "] step 2" ;


	if (	!( lintKey >=  48 && lintKey <=  57 ) &&   
		  	!( lintKey >=  96 && lintKey <= 101 ) &&   
			!( lintKey >= 102 && lintKey <= 105 )  )
	{
		alert ( "Numbers only please." );
		return false;
	}
	return  true 
}

function IsNavigationKey( lintKey ) 
{
	var lbolIsNavgiationKey = false;
	//03/23/2005 12:20 pm added 13
	//110 is the keypad period
	if ( /^(8|9|13|27|35|36|46|37|39|220)$/.test( lintKey ) ) lbolIsNavgiationKey = true;
	return lbolIsNavgiationKey ;
}


function IsShiftKey( lintKey ) { return (  lintKey == 16 )  }
function IsSystemKey( lintKey ) { return ( /^(17|18|19|20|27|145)$/.test( lintKey ) )  }
function IsFunctionKey( lintKey ) { return  lintKey >= 112 && lintKey <= 123  }

function DoSetFocus( lbolStopAtFirstField , lbolDoSelect )
{
	if (document.forms.length > 0) 
	{
		var field = document.forms[0];
		var lstrObjectName;
		var lstrObjectID;
		var lstrobjectValue;
		
		for (i = 0; i < field.length; i++) 
		{
			if ( ( field.elements[i].type == "select-one" || field.elements[i].type == "text"  || field.elements[i].type == "textarea" || field.elements[i].type == "password" ) && field.elements[i].name != "fooling") 
			{
				lstrObjectName = field.elements[i].name ;
				lstrObjectID  = field.elements[i].id ;
				lstrobjectValue  = field.elements[i].value ;

				if ( ( field.elements[i].value.length == 0 && !lbolStopAtFirstField ) || lbolStopAtFirstField )
				{
					field.elements[i].focus();
					if ( lbolDoSelect && field.elements[i].type != "select-one"  ) field.elements[i].select();
					break;
				}
			}
		}
	}
}


function MakeSureTargetWindowInFocus( lstrWindowName )
{
	if ( window.name != lstrWindowName ) 
	{
		window.close();
		var lobjTargetWindow = window.open( '' , lstrWindowName  );
		if ( lobjTargetWindow ) lobjTargetWindow.focus();
	}
}

	var lobjHideMiniDetailWindow;
	var lintKeepAlive = 3;
	
	function ShowMiniDetailWindow( lstrObjectNo , lintOption , lstrMiniDetailWindowPrefix ) 
	{
		if ( lintKeepAlive > 0 ) document.getElementById ( "DivHelp1_" + lstrObjectNo ).innerHTML = "";

		clearInterval ( lobjHideMiniDetailWindow  ) ;
		
		HideMiniDetailWindow(true, lstrMiniDetailWindowPrefix, lintOption );

		document.getElementById(lstrObjectNo).style.visibility = lintOption == 1 || lintOption == 3 ? 'visible' : 'hidden';
		document.getElementById("idMiniDetailWindowHoldLink_" + lstrObjectNo ).style.visibility = lintOption == 1 ? 'visible' : 'hidden';

		if ( lintOption == 2 || lintOption == 3 ) 
		{ 
			document.getElementById("idMiniDetailWindowHoldLink_" + lstrObjectNo ).style.visibility = 'hidden';
			return ; 
		}
		lobjHideMiniDetailWindow = setInterval( "HideMiniDetailWindow( false, '" + lstrMiniDetailWindowPrefix + "')" , 1000 );
		lintKeepAlive = 5;
		
	}
	
	function HideMiniDetailWindow( lbolForceIt , lstrMiniDetailWindowPrefix , lintOption )
	{
		if ( lbolForceIt == true ) lintKeepAlive = 0 ;
		else lintKeepAlive -- ; 
		
		var lobjCollection = document.getElementsByTagName("div");
		var lstrHelpOnClosingWindow1  = "Click anywhere blank or on another answer option to force it closed.&nbsp; Keeping your mouse moving keeps window open.";
		var lstrHelpOnClosingWindow2  = "Click anywhere blank or click on another answer option to close this window.";
		
		for (var i = 0; i < lobjCollection.length; i++ ) 
		{
			if ( lobjCollection.item(i).id.substring(0,lstrMiniDetailWindowPrefix.length)  == lstrMiniDetailWindowPrefix )
			{
				if ( lintKeepAlive > 0 ) document.getElementById ( "DivHelp1_" + lobjCollection.item(i).id ).innerHTML = "<I>This window closes in <b>" + lintKeepAlive + "</b> seconds.&nbsp " + lstrHelpOnClosingWindow1 + "&nbsp; Move mouse over 'Hold' to hold this window open.</I>";
				if ( lintOption == 3 ) 	
				{
					document.getElementById ( "DivHelp1_" + lobjCollection.item(i).id ).innerHTML = "<font size=+2>Window is locked open.</font>&nbsp; " + lstrHelpOnClosingWindow2  + "</I>";
				}
				if ( lintKeepAlive <= 0 ) 
				{
					document.getElementById("idMiniDetailWindowHoldLink_" + lobjCollection.item(i).id ).style.visibility = 'hidden';
					lobjCollection.item(i).style.visibility = 'hidden';		
				}
			}				
		}

		if ( lintKeepAlive <= 0 ) 	clearInterval ( lobjHideMiniDetailWindow  ) ;
	}
	
function fcompare ( lstr1 , lstr2 ) 
{
	var lintLength = Math.max( lstr1.length , lstr2.length ) ;
	var nn = 0 ;
	for ( var mm = 0 ; mm < lintLength ; mm ++ )
	{
		if ( lstr1.charCodeAt( mm ) == 10 && lstr2.charCodeAt( nn  ) == 13 &&  lstr2.charCodeAt( nn + 1 )  == 10 )
		{
			nn++;
		}
		else
		{
			if ( lstr1.charCodeAt( mm )  != lstr2.charCodeAt( nn )  ) return false ;
		}
		nn ++ ; 
	}
	return true ;
}

function clearDefaultButton() {pstrDefaultButton = "" ;}

function ScreenSize()
{
	this.frameWidth = 0 ;
	this.frameHeight = 0 ;
	this.lintCase = 0 ;
	
	if (self.innerWidth)
	{
		this.frameWidth = self.innerWidth;
		this.frameHeight = self.innerHeight;
		this.lintCase = 1 ;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		this.frameWidth = document.documentElement.clientWidth;
		this.frameHeight = document.documentElement.clientHeight;
		this.lintCase = 2 ;
	}
	else if (document.body)
	{
		this.frameWidth = document.body.clientWidth;
		this.frameHeight = document.body.clientHeight;
		this.lintCase = 3 ;
	}

}	

function setClassName( lobjRef, lstrClassName ) { lobjRef.className = lstrClassName ;}

function addBookmark( lstrTitle , lstrURL ) 
{ 
	if (window.sidebar) window.sidebar.addPanel( lstrTitle , lstrURL,""); 
	else if( document.all ) window.external.AddFavorite( lstrURL,  lstrTitle ); 
}

function PrefixQuote ( lstrVar ) 
{
	var lstrReturnVar = "";
	var lstrChar ;
	
	for ( mm = 0 ; mm < lstrVar.length ; mm ++ )
	{
		lstrChar = lstrVar.substring (0,mm);
		lstrChar = lstrChar .substring (mm-1,mm);
		
		if ( lstrChar == "'" ) lstrReturnVar = lstrReturnVar + "\\" ;
		if ( lstrChar == '"' ) lstrReturnVar = lstrReturnVar + "\\" ;
		lstrReturnVar = lstrReturnVar + lstrChar;
		
	}
	return lstrReturnVar ;
	
}

