/**************************************** 
 * Country State manipulation functions *
 ****************************************/

// enables country-state field and validatror manipulation through control names
// IMPORTANT!!!! - Need to use ServerSide functions to create the state list
// only the first two parameters are mandatory
function ddlCountry_ClientChanged(ddlCountry_ClientID, ddlState_ClientID, tdRequiredColumnState_ClientID, tdLeftColumnState_ClientID, selectedStateID)
{
	var i, state;
	var ddlCountry = document.getElementById(ddlCountry_ClientID);
	var ddlState = document.getElementById(ddlState_ClientID);
	var tdRequiredColumnState = document.getElementById(tdRequiredColumnState_ClientID);
	var tdLeftColumnState = document.getElementById(tdLeftColumnState_ClientID);

	if ((ddlCountry == null) ||
		(ddlState == null) ||
		(tdRequiredColumnState == null) ||
		(tdLeftColumnState == null))
	{
		return;
	}
	
	// retrive the chosen country
	var countryID = ddlCountry.options[ddlCountry.selectedIndex].value;

	// remove all old state list except the first item: - select -
	ddlState.options.length = 1;
	
	// add all the state of the given country code
	ddlState.options[0] = new Option(" - Select - ", 0);
	for (i=0; i < States.length; i++)
	{
		state = States[i].split("~");
		if (state[0] == countryID)
		{
			ddlState.options[ddlState.options.length] = new Option(state[2], state[1]);
		}
	}
	
	// manipulate the drop down of the state and their validators 
	// after checking if states were added to the drop down
	if (ddlState.options.length == 1)
	{
		ddlState.style.visibility = "hidden";
		if (tdRequiredColumnState != null)
		{
			tdRequiredColumnState.style.visibility = "hidden";
		}
		if (tdLeftColumnState != null)
		{
			tdLeftColumnState.style.visibility = "hidden";
		}
	}
	else
	{
		ddlState.style.visibility = "visible";
		if (tdRequiredColumnState != null)
		{
			tdRequiredColumnState.style.visibility = "visible";
		}
		if (tdLeftColumnState != null)
		{
			tdLeftColumnState.style.visibility = "visible";
		}
	}

	// finally, if a selectedStateID has been specified, set ddlState to have it selected:
	if ((selectedStateID != null) && (selectedStateID != "undefined"))
	{
		ddlState.value = selectedStateID;
	}
	
}




function CountryChangedConstStateText(drpCountryName, drpStateName, vldDrpStateName,txtStateName,vldReqStateName){

	drpCountry = document.getElementById(drpCountryName);
	drpState = document.getElementById(drpStateName);
	txtState = document.getElementById(txtStateName);
	txtState.style.display = "block";
	vldReqState = document.getElementById(vldReqStateName);

	// retrive the chosen country
	countryID = drpCountry.options[drpCountry.selectedIndex].value;
	// remove all old state list except the first item: - select -
	drpState.options.length = 1;
	// add all the state of the given country code
	for (i=0; i < States.length; i++){
		state=States[i].split("~");
		if (state[0] == countryID){
			drpState.options[drpState.options.length] = new Option(state[2], state[1]);
		}
	}
	
	vldDrpState = document.getElementById(vldDrpStateName);
	// manipulate the drop down of the state and their validators 
	// after checking if states were added to the drop down
	if (drpState.options.length == 1){
		drpState.style.display = "none";
		//if country has no state show the text state
		txtState.style.display = "block";
		
		if (vldDrpState != null){
			ValidatorEnable(vldDrpState, false);
		}

		ValidatorEnable(vldReqState, true);
		
	}else{
		drpState.style.display = "block";
		txtState.style.display = "none";
		txtState.value="";
		if (vldDrpState != null){
			ValidatorEnable(vldDrpState, true);
		}

		ValidatorEnable(vldReqState, false);
	}
}


var urlSpec= new Array(19) 
		urlSpec[0] = "www.kasamba.com"
		urlSpec[1] = "www.yahoo.com"
		urlSpec[2] = "www.yahoo.fr"
		urlSpec[3] = "www.msn.com"
		urlSpec[4] = "www.hotmail.com"
		urlSpec[5] = "www.google.com"
		urlSpec[6] = "www.excite.com"
		urlSpec[7] = "www.google.fr"
		urlSpec[8] = "www.aol.com"
		urlSpec[9] = "google"
		urlSpec[10] = "kasamaba"
		urlSpec[11] = "kassamba"
		urlSpec[12] = "kamsaba"
		urlSpec[13] = "kasmaba"
		urlSpec[14] = "ksamba"
		urlSpec[15] = "kasama"
		urlSpec[16] = "kasamba.co.uk"
		urlSpec[17] = "kasamba.uk"
		urlSpec[18] = "kasamba.au"
		urlSpec[19] = "casamba"
			
		
		function CheckSpecificUrl(sender, args)
		{			
			var i ;
			
			var url = args.Value;
			
			for(i=0;i<url.length;i++)	
			{
				
				if(url.toLowerCase().indexOf(urlSpec[i])!=-1)
				{
                   
					args.IsValid = false;
					return false;
					
				}
			}	
			args.IsValid = true;
			return true
			
		}





		

