var isNS4 = (navigator.appName=="Netscape")?1:0;

if (document.images) 
{
//Preload arrow image

			var arrowoff = new Image();
			arrowoff.src = 'images/arrow_on.gif';
			var arrowon = new Image();
					arrowon.src = 'images/arrow_hover.gif';
}
var urlarray  = new Array();

var _clickE=null;
var _locationHref='#';
function _click(e,n,d) 
{
	if(typeof(d)=='undefined') 
		d = true; // e=element; n=pixelID; d=delay page transition
	if (CITI_CT_PID == '' || CITI_CT_PID == null) 
		return;
		//_sendClick(n);
	if(d) 
	{
		e.hrefsav = e.href;
		e.href = 'javascript:void(0)';
		_clickE = e;
		setTimeout('_doClick()',200);
	}
}

function disableddlRFDLifeChangingEvent()
{
	document.Form1.ddlRFDLifeChangingEvent.disabled=true;
	//document.Form1.ddlRFDLifeChangingEvent.selectedIndex=0
}

function disableOtherReasonText()
{
	document.Form1.txtOtherReason.disabled=true;
}

function _doClick() 
{
	if (_clickE!=null) 
	{
		_clickE.href = _clickE.hrefsav;
		_locationHref = _clickE.hrefsav;
		_clickE=null;
	}
	location.href=_locationHref;
}

function __doPostBack(eventTarget, eventArgument) 
{
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) 
	{
		theform = document.forms["Form1"];
	}
	else 
	{
		theform = document.Form1;
	}
	theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
	theform.__EVENTARGUMENT.value = eventArgument;
	theform.submit();
}

function enableddlRFDLifeChangingEvent()
{
	document.Form1.ddlRFDLifeChangingEvent.disabled=false;
	document.Form1.ddlRFDLifeChangingEvent.focus();
}

function enableOtherReasonText()
{
	document.Form1.txtOtherReason.disabled=false;
	document.Form1.txtOtherReason.focus();
}

function filterCharacters(e)
{
	if(valueExists(e.keyCode))
	{
		if ((e.keyCode > 32 && e.keyCode < 65) || (e.keyCode > 90 && e.keyCode < 97)) e.returnValue = false;
	}
		else
		{
			if ((e.which > 32 && e.which < 65) || (e.which > 90 && e.which < 97)) return false;
	}	
}
/* filterCharactersCity */
function filterCharactersCity(e)
{
	if(valueExists(e.keyCode))
	{
		/*alert(e.keyCode);*/
		if ((e.keyCode > 32 && e.keyCode < 65 && e.keyCode != 45) || (e.keyCode > 90 && e.keyCode < 97)) e.returnValue = false;
	}
		else
		{
			if ((e.which > 32 && e.which < 65) || (e.which > 90 && e.which < 97)) return false;
	}	
}

function filterLastName(e)
{
	if(valueExists(e.keyCode))
	{
		if ((e.keyCode > 32 && e.keyCode < 39) || (e.keyCode > 39 && e.keyCode < 45) || (e.keyCode > 45 && e.keyCode < 65) || (e.keyCode > 90 && e.keyCode < 97)) e.returnValue = false;
	}
	else
	{
		if ((e.which > 32 && e.which < 39) || (e.which > 39 && e.which < 45) || (e.which > 45 && e.which < 65) || (e.which > 90 && e.which < 97)) return false;
	}	
}

/*	filterNonDigits

	Filter out all charaters from input string, except 0-9 and return result
*/
/*function filterNonDigits(sInput)
{
	var sResult = new String();
	var aResult = sInput.match(/\d+/g);
	if(aResult != null)
	{
		for(var i = 0; i < aResult.length; i++)
		{
			sResult += aResult[i];
		}
	}
	return sResult;
}*/
function filterNonDigits(e)
{
	if(valueExists(e.keyCode))
	{
		if ((e.keyCode >= 32 && e.keyCode < 48) || (e.keyCode > 58)) e.returnValue = false;
	}
	else
	{
		if ((e.which >= 32 && e.which < 48) || (e.which > 58)) return false;
	}	
}

/*	formatNumber

*/
function formatNumber( num )
{
	// strip commas from previous entry
	var c = /,/g;
	var s = ''
	s = num.replace(c, '');
	num = s
	// check to see if it's a string

	if (num == "Not Disclosed")
		return "Not Disclosed";

	//----- make sure it's a valid number
	if( !isFinite(num) )
		return "";

	//----- check for zero
	if( num == 0 )
		return "0";

	var	szRet = "";
	var	number = Math.abs( num );

	var r = number;
	while( r > 0 )
	{
		var oldNumber = r;
		r = Math.floor( r / 1000 );
		var	szMod = ( oldNumber - ( r * 1000 ) ) + "";
		while( szMod.length < 3 && r > 0 )
			szMod = "0" + szMod;
		if( szRet.length > 0 )
			szRet = "," + szRet;
		szRet = szMod + szRet;
	}

	//----- check for negative number
	if( num < 0 )
		szRet = "-" + szRet;

	//----- check to see if the number is floating point
	//----- if so, truncate to 2 digits after the decimal point
	if( szRet.indexOf(".") > 0 )
	{
		szRet = szRet.substring( 0, szRet.indexOf(".")+3 );
	}

	return szRet;
}

function formatCC( num )
{
	// strip commas from previous entry
	var c = /,/g;
	var s = ''
	s = num.replace(c, '');
	num = s
	// check to see if it's a string
	if (num == "Not Disclosed")
		return "Not Disclosed";
	//----- make sure it's a valid number
	if( !isFinite(num) )
		return "";
	//----- check for zero
	if( num == 0 )
		return "0";
	var	szRet = "";
	var	number = Math.abs( num );
	var r = number;
	while( r > 0 )
	{
		var oldNumber = r;
		r = Math.floor( r / 1000 );
		var	szMod = ( oldNumber - ( r * 1000 ) ) + "";
		while( szMod.length < 3 && r > 0 )
			szMod = "0" + szMod;
		szRet = szMod + szRet;
	}
	//----- check for negative number
	if( num < 0 )
		szRet = "-" + szRet;
	//----- check to see if the number is floating point
	//----- if so, truncate to 2 digits after the decimal point
	if( szRet.indexOf(".") > 0 )
	{
		szRet = szRet.substring( 0, szRet.indexOf(".")+3 );
	}
	return szRet;
}

function formFocus(flds)
{
	// pass a list of required form fields(comma sep) and it will set focus on first empty field
	//var thisField;
	var fields = new Array();
	fields = flds.split(",");
	for(var k in fields)
	{
		//alert('here');
		//document.getElementById(fields[k]);
		thisField = document.getElementById(fields[k]);
		if(thisField)
		{
			if((!thisField.value)  || (thisField.value == '-- Choose --'))
			{
				// the following setTimeout code is needed for firefox to work.
				// google javascript firefox .focus
				window.setTimeout("thisField.focus();",250);
				return false;
			}
		}
	}
	return true;
}

function FormFocus(flds)
{
	// pass a list of required form fields(comma sep) and it will set focus on first empty field
	//var thisField;
	var fields = new Array();
	fields = flds.split(",");
	for(var k in fields)
	{
		//alert('here');
		//document.getElementById(fields[k]);
		thisField = document.getElementById(fields[k]);
		if(thisField)
		{
			if((!thisField.value)  || (thisField.value == '-- Choose --'))
			{
				// the following setTimeout code is needed for firefox to work.
				// google javascript firefox .focus
				window.setTimeout("thisField.focus();",250);
				return false;
			}
			else
			{
				if((thisField.name == 'PaymentDollars') || (thisField.name == 'txtPaymentDollars'))
				{
					if (thisField.value <= '0')
					{
						// the following setTimeout code is needed for firefox to work.
						// google javascript firefox .focus
						window.setTimeout("thisField.focus();",250);
						return false;
					}
				}
			}
		}
	}
	return true;
}

function goback() 
{
  history.go(-1);
}

/*
launch a single pop-up window that stays on top regardless on number of clicks
*/
var child_win = null;

function launchPopup(url,winName,winParams) 
{
  if( winName == '_top' ) 
	{ 
		top.location.href = url; 
		return; 
	}
  //Create random window name - IDS
  
  winName = windowNameRandom();
  if(child_win != null && !child_win.closed) 
		child_win.close(); 
		child_win = window.open( url, winName, winParams );
}

/*

	When used with onkeypress="return maskKeyPress(event)" will 
	not allow non-numerical entry in text fields.

*/
function maskKeyPress(objEvent)
{
	var iKeyCode;
	iKeyCode = objEvent.keyCode;
	if((iKeyCode>=48 && iKeyCode<=57) || (iKeyCode==46)) return true;
	return false;
}

function popup()
{
	newwin = window.open('','Security','width=610,height=250,resizable=yes,toolbar=yes,scrollbars=yes,status=yes');
}

function popupVeriSign(url) 
{
	newwin = window.open('','VeriSign','width=250,height=250,resizable=yes,toolbar=no,scrollbars=yes,status=no'); 
}

function RTeSurvey2(cguid, hguid1,langid) {
				var theHeight = screen.height-115;
				var theWidth = 640;
				var theTop=(screen.availHeight/2)-(theHeight/2);
				var theLeft=(screen.availWidth/2)-(theWidth/2);
				window.open('https://ecollector.responsetek.com/collection/collection.aspx?cguid=' + cguid + '&hguid1=' + hguid1  + '&langid=' + langid, "survey",  "height=" + theHeight + ",width=640,top="+theTop+",left="+theLeft+",location=no,directories=no,status=no,menubar=no,resizable=no")
			}

function swapImg(img,dir)
{
	if (document.images)
	{
		if(dir=='off')
		{
			document[img].src=eval(img+'off.src');
		}
		else if(dir=='on')
		{
			document[img].src=eval(img+'on.src');
		}
	}
}

function textCounter(field,cntfield,maxlimit) 
{
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
	cntfield.value = maxlimit - field.value.length;
}

function timerRedirect() 
{ 
	location.replace("SessionTimeOut.aspx"); 
}

function timerRemind(msg1) 
{ 
	launchPopup('SessionWarning.aspx','Security','toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,resizable=no,width=300,height=150,left=400,top=400)'); 
	setTimeout('timerRedirect()',300000); 
}

/* textLimit */
function textLimit(field, maxlimit)
{
	if (field.value.length > maxlimit) 
	{
		// if too long...trim it!
		field.value = field.value.substring(0, maxlimit); 
	}
}

/*	valueExists

	Performs various tests to see if a javascript variable
	exists and contains a value other than empty or null

*/
function valueExists( szValue )
{
	try
	{
		if ( szValue == null )
			return false;
		else if ( szValue == "undefined" )
			return false;
		else if (typeof(szValue) == "object" && szValue.constructor && szValue.constructor == Array)
		{
			return true;
		}
		else if ( szValue == "" )
			return false;
		else
			return true;
	}
	catch(e)
	{
		alert("ERROR: valueExists - " + e.description + "<br>Caller = " + valueExists.caller);
	}
}
//Create random window name - IDS
function windowNameRandom()
{
	var name = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
	a = Math.floor(Math.random() * name.length);
	b = Math.floor(Math.random() * name.length);
	c = Math.floor(Math.random() * name.length);
	d = Math.floor(Math.random() * name.length);
	e = Math.floor(Math.random() * name.length);
	f = Math.floor(Math.random() * name.length);
	g = Math.floor(Math.random() * name.length);
	h = Math.floor(Math.random() * name.length);
	var myRandom = name[a]+name[b]+name[c]+name[d]+name[f]+name[g]+name[h];
 	return myRandom;
}

function xx()
{
	if(!isNS4)
	{
		if (event.keyCode==34 || event.keyCode==39) event.returnValue = false;
	}
		else
		{
			if (event.which==34 || event.which==39) return false;
		}
}
// -->

