NameLists = new Array();
ValueLists = new Array();

var temp = 'AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,';
temp += 'OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,DC,WV,WI,WY,';
ValueLists["USA"] = temp.split(',');

temp = 'Alabama (AL)|Alaska (AK)|Arizona (AZ)|Arkansas (AR)|California (CA)|Colorado (CO)|Connecticut (CT)|';
temp += 'Delaware (DE)|Florida (FL)|Georgia (GA)|Hawaii (HI)|Idaho (ID)|Illinois (IL)|Indiana (IN)|Iowa (IA)|';
temp += 'Kansas (KS)|Kentucky (KY)|Louisiana (LA)|Maine (ME)|Maryland (MD)|Massachusetts (MA)|Michigan (MI)|';
temp += 'Minnesota (MN)|Mississippi (MS)|Missouri (MO)|Montana (MT)|Nebraska (NE)|Nevada (NV)|New Hampshire (NH)|';
temp += 'New Jersey (NJ)|New Mexico (NM)|New York (NY)|North Carolina (NC)|North Dakota (ND)|Ohio (OH)|Oklahoma (OK)|';
temp += 'Oregon (OR)|Pennsylvania (PA)|Rhode Island (RI)|South Carolina (SC)|South Dakota (SD)|Tennessee (TN)|';
temp += 'Texas (TX)|Utah (UT)|Vermont (VT)|Virginia (VA)|Washington (WA)|Washington, D.C. (DC)|West Virginia (WV)|Wisconsin (WI)|';
temp += 'Wyoming (WY)|Others';
NameLists["USA"] = temp.split('|');

temp = 'AB,BC,MB,NB,NL,NT,NS,NU,ON,PE,PQ,SK,YT,';
ValueLists["CANADA"] = temp.split(',');

temp = 'Alberta (AB);British Columbia (BC);Manitoba (MB);New Brunswick (NB);Newfoundland (NL);';
temp += 'Northwest Territories (NT);Nova Scotia (NS);Nunavut (NU);Ontario (ON);Prince Edward Island (PE);';
temp += 'Quebec (PQ,QC);Saskatchewan (SK);Yukon (YT);Others';
NameLists["CANADA"] = temp.split(';');

temp = '';
ValueLists["SL"] = temp.split(',');

temp = '';
NameLists["SL"] = temp.split(';');

temp = null;

function manageStateList(theSel,stateToSelect)
{
	var theForm = document.profile_form;
	var stateNameList    = null;
	var stateValueList    = null;
	var optionIndex = 0;

	theForm.State.length = 0;

	stateNameList = NameLists[theSel];
	stateValueList = ValueLists[theSel];

	if (stateNameList == null)
	{
		theForm.State.style.display="none";
		return;
	}

	theForm.State.options[optionIndex] = new Option('- - - - - - - - Select - - - - - - - -','');

	for(var i=0; i < stateNameList.length; i++)
	{
		optionIndex = i+1;
		theForm.State.options[optionIndex] = new Option(stateNameList[i],stateValueList[i]);
		if(stateValueList[i] == stateToSelect && optionIndex != stateNameList.length)
			theForm.State.selectedIndex = optionIndex;
	}
}

function isEmail(string)
{
	if(string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}

function isInteger1(s)
{
	var i;
	for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		if (((c < "0") || (c > "9"))) return false;
	}
	return true;
}

function isNumeric(s)
{
	if(s.search(/^[0-9\s]+$/) != -1)
		return true;
	else
		return false;
}

function isAlphaNumeric(s)
{
	if(s.search(/^[A-Za-z0-9'_\s]+$/) != -1)
		return true;
	else
		return false;
}

function isAlpha(s)
{
	if(s.search(/^[A-Za-z\s]+$/) != -1)
		return true;
	else
		return false;
}


function selectNxt(i)
{
			var t = i.value;
			if(t.length>0) 
			{
				t = t.replace(/[^\d\.]+/g, '');
			}
			var s = t.split('.');
			if(s.length>1) 
			{
				s[1] = s[0] ;//+ '.' + s[1];
				s.shift(s);
			}
			i.value = s.join('');
		
				if(document.profile_form.cid1.value.length == 3)	document.profile_form.cid2.focus();
}

function selectNxt1(i)
{
			var t = i.value;
			if(t.length>0) 
			{
				t = t.replace(/[^\d\.]+/g, '');
			}
			var s = t.split('.');
			if(s.length>1) 
			{
				s[1] = s[0] ;//+ '.' + s[1];
				s.shift(s);
			}
			i.value = s.join('');
		
//	if(document.profile_form.txt_AC.value.length == 3)	document.profile_form.cid3.focus();
}

function selectNxt2(i)
{
			var t = i.value;
			if(t.length>0) 
			{
				t = t.replace(/[^\d\.]+/g, '');
			}
			var s = t.split('.');
			if(s.length>1) 
			{
				s[1] = s[0] ;//+ '.' + s[1];
				s.shift(s);
			}
			i.value = s.join('');
		
}

function disableButton(frm)
{
	if(!frm.agree.checked)
	{
		alert("You have to check 'I authorize this transaction' to proceed");
		return false;
	}
	frm.fsubmit.value	= "Please Wait";
	document.getElementById("btn_Process_Payment").style.color = "red";
	frm.fsubmit.disabled = true;
	return true;
}
