
function BuildStateDropDown(num,obj,obj2, s1, s2)
{
		//Select the first Contact
		obj.selectedIndex=0;
		obj.length=1;
		
		//Set the length of the select list
		if (typeof CountryState[num] == 'object')
		{
			obj.length=CountryState[num].length+1;
		
			//For every contact in the array for this person, add a new option
			for(ctr = 0; ctr < CountryState[num].length; ctr++)
			{		
				obj.options[ctr+1]=new Option(String(CountryState[num][ctr]),String(CountryState[num][ctr]));
			}
		}
		else {
			obj.length = 1
		}
		if(obj2.options[2].selected == true) {
			obj.options[0].value='';			
			obj.options[0].text=s2;
		} else if (obj2.options[1].selected == true) {
			obj.options[0].value='';
			obj.options[0].text=s1;
		} else {
			obj.options[0].value='';
			obj.options[0].text='--';
		}
		
		//obj.options[0] = new Option('State','');
		obj.selectedIndex = 0;
}

function BuildStateDropDown2(ctryIndex,ddlState,ddlCtry, defText, fullStateName)
{
		//Select the first Contact
		ddlState.selectedIndex=0;
		ddlState.length=1;
		
		//Set the length of the select list
		if (typeof arrCtryState[ctryIndex] == 'object')
		{
			ddlState.length=arrCtryState[ctryIndex].length+1;
		
			//For every contact in the array for this person, add a new option
			for(ctr = 0; ctr < arrCtryState[ctryIndex].length; ctr++)
			{		
			    if ( fullStateName ) {
				    ddlState.options[ctr+1]=new Option(String(arrCtryState[ctryIndex][ctr][1]),String(arrCtryState[ctryIndex][ctr][0]));
			    }
			    else {
			        ddlState.options[ctr+1]=new Option(String(arrCtryState[ctryIndex][ctr][0]),String(arrCtryState[ctryIndex][ctr][0]));
			    }
			}
		}
		else {
			ddlState.length = 1
		}
		if(defText == '') {
		    ddlState.options[0].value='';
			ddlState.options[0].text='--';
		} else   {
			ddlState.options[0].value='';			
			ddlState.options[0].text=defText;
		}   
		ddlState.selectedIndex = 0;
}


function BuildStateDropDown3(ctryIndex,ddlState,ddlCtry, defText,selStateCode, fullStateName)
{
		//Select the first Contact
		ddlState.selectedIndex=0;
		ddlState.length=1;
		
		//Set the length of the select list
		if (typeof arrCtryState[ctryIndex] == 'object')
		{
			ddlState.length=arrCtryState[ctryIndex].length+1;
		
			//For every contact in the array for this person, add a new option
			for(ctr = 0; ctr < arrCtryState[ctryIndex].length; ctr++)
			{		
			    if ( fullStateName ) {
				    ddlState.options[ctr+1]=new Option(String(arrCtryState[ctryIndex][ctr][1]),String(arrCtryState[ctryIndex][ctr][0]));
			    }
			    else {
			        ddlState.options[ctr+1]=new Option(String(arrCtryState[ctryIndex][ctr][0]),String(arrCtryState[ctryIndex][ctr][0]));
			    }
			    
			    if (selStateCode) {
			        if(selStateCode == arrCtryState[ctryIndex][ctr][0])  
			            ddlState.selectedIndex= ctr+1;
			    }
			}
		}
		else {
			ddlState.length = 1
		}
		if(defText == '') {
		    ddlState.options[0].value='';
			ddlState.options[0].text='--';
		} else   {
			ddlState.options[0].value='';			
			ddlState.options[0].text=defText;
		}   
}

function BuildStateDropDown4(num,obj,obj2)
{
	//obj.selectedIndex=0;
	obj.length=1;
	
	if (typeof CountryState[num] == 'object')
	{
		obj.length=CountryState[num].length+1;

		for(ctr = 0; ctr < CountryState[num].length; ctr++)
		{		
			obj.options[ctr+1]=new Option(String(CountryState[num][ctr]),String(CountryState[num][ctr]));
		}
	}
	else {
		obj.length = 1
	}
	
	for(x=0;x<obj.length;x++){
	    obj.options[x].selected = false;
	}
	
	
}

function BuildCountryDropDown(ddlCountry,selValue, defText)
{ 		
		//Set the length of the select list 
		ddlCountry.length=arrCountry.length+1;
	
		//For every contact in the array for this person, add a new option
		for(ctr = 0; ctr < arrCountry.length; ctr++)
		{		
		    ddlCountry.options[ctr+1]=new Option(String(arrCountry[ctr][1]),String(arrCountry[ctr][0]));
		   
		    if (selValue) {
		        if(selValue == arrCountry[ctr][0])  
		            ddlCountry.selectedIndex= ctr+1;
		    }
		} 
		
		ddlCountry.options[0].value='';			
		ddlCountry.options[0].text=defText;
}


















