//Javascript functions that are used on the home pages (index.asp files of each directory)
/*
fnGetShipping is used to control the show or hide the shipping info section.  if the Shipping Information Checkbox is checked, the Shipping 
Section will not be displayed.  if the Shipping Information Checkbox is unchecked, the Shipping Section will be displayed
*/
function fnGetShipping()
	{	
	if(document.getElementById("ShippingAddress").checked == true)
		{
		document.getElementById("BillingNShippingModeSame_Same").checked=false;
		document.getElementById("BillingNShippingModeSame_Diff").checked=true;
		document.getElementById("tblShipping").style.display="block";
		}
	else
		{
		document.getElementById("BillingNShippingModeSame_Same").checked=true;
		document.getElementById("BillingNShippingModeSame_Diff").checked=false;
		document.getElementById("tblShipping").style.display="none";
		}
	}

/*
popUpCIC is used to create the Credit Card Validation Pop Up.
*/
function popUpCIC(url) 
	{
	CICWin = window.open(url,'win','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=450');
	self.name = "mainWin";
	}

/*
popUp is used for generating the Privacy Policy pop up. 
*/
function popUp(url) 
	{
	Win = window.open(url,'win','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=795,height=500');
	self.name = "mainWin";
	}


function SetCountry(State,Country,Island)
	{	
	var CountryIsland=new Array(
	new Array('Álava', 'País Vasco','Peninsula'),
	new Array('Albacete', 'Castilla-La Mancha',	'Peninsula'),
	new Array('Alicante', 'Comunidad Valenciana', 'Peninsula'),
	new Array('Almería', 'Andalucía',	'Peninsula'),
	new Array('Asturias', 'Principado de Asturias',	'Peninsula'),
	new Array('Ávila', 'Castilla y León', 'Peninsula'),
	new Array('Badajoz', 'Extremadura', 'Peninsula'),
	new Array('Barcelona', 'Cataluña', 'Peninsula'),
	new Array('Burgos', 'Castilla y León', 'Peninsula'),
	new Array('Cáceres', 'Extremadura', 'Peninsula'),
	new Array('Cádiz', 'Andalucía', 'Peninsula'),
	new Array('Cantabria', 'Cantabria', 'Peninsula'),
	new Array('Castellón', 'Comunidad Valenciana', 'Peninsula'),
	new Array('Ciudad Real', 'Castilla-La Mancha', 'Peninsula'),
	new Array('Córdoba', 'Andalucía', 'Peninsula'),
	new Array('La Coruña', 'Galicia', 'Peninsula'),
	new Array('Cuenca', 'Castilla-La Mancha', 'Peninsula'),
	new Array('Gerona', 'Cataluña', 'Peninsula'),
	new Array('Granada', 'Andalucía', 'Peninsula'),
	new Array('Guadalajara', 'Castilla-La Mancha', 'Peninsula'),
	new Array('Guipúzcoa', 'País Vasco', 'Peninsula'),
	new Array('Huelva', 'Andalucía', 'Peninsula'),
	new Array('Huesca', 'Aragón', 'Peninsula'),
	new Array('Islas Baleares', 'Islas Baleares', 'Baleares'),
	new Array('Jaén', 'Andalucía', 'Peninsula'),
	new Array('León', 'Castilla y León', 'Peninsula'),
	new Array('Lérida', 'Cataluña', 'Peninsula'),
	new Array('Lugo', 'Galicia', 'Peninsula'),
	new Array('Madrid', 'Comunidad de Madrid', 'Peninsula'),
	new Array('Málaga', 'Andalucía', 'Peninsula'),
	new Array('Murcia', 'Región de Murcia', 'Peninsula'),
	new Array('Navarra', 'Comunidad Foral de Navarra', 'Peninsula'),
	new Array('Orense', 'Galicia', 'Peninsula'),
	new Array('Palencia', 'Castilla y León', 'Peninsula'),
	new Array('Pontevedra', 'Galicia', 'Peninsula'),
	new Array('La Rioja', 'La Rioja', 'Peninsula'),
	new Array('Salamanca', 'Castilla y León', 'Peninsula'),
	new Array('Segovia', 'Castilla y León', 'Peninsula'),
	new Array('Sevilla', 'Andalucía', 'Peninsula'),
	new Array('Soria', 'Castilla y León', 'Peninsula'),
	new Array('Tarragona', 'Cataluña', 'Peninsula'),
	new Array('Teruel', 'Aragón', 'Peninsula'),
	new Array('Toledo', 'Castilla-La Mancha', 'Peninsula'),
	new Array('Valencia', 'Comunidad Valenciana', 'Peninsula'),
	new Array('Valladolid', 'Castilla y León', 'Peninsula'),
	new Array('Vizcaya', 'País Vasco', 'Peninsula'),
	new Array('Zamora', 'Castilla y León', 'Peninsula'),
	new Array('Zaragoza', 'Aragón', 'Peninsula'));
	
	var StateIndex=document.getElementById(State).selectedIndex;
	var StateName=document.getElementById(State).options[document.getElementById(State).selectedIndex].text;
	
	document.getElementById('Payment_Amount').value="0.00";
	
	for(i=0;i<CountryIsland.length; i++)
		{
		if(StateName==CountryIsland[i][0])
			{
			document.getElementById(Country).value = CountryIsland[i][1];
			if(CountryIsland[i][2]=="Peninsula")
				{
				document.getElementById(Island).value="IS00000001";
				}
			else
				{
				document.getElementById(Island).value="IS00000002";	
				}
			break;
			}
		}

	var ShipToIsland;
	if(document.getElementById('ShippingAddress').checked==false)
		{
		ShipToIsland=document.getElementById('Island').value;
		}
	else
		{
		ShipToIsland=document.getElementById('SIslandHidden').value;
		}

	//alert(ShipToIsland);
	
	if(ShipToIsland=="IS00000001")
		{
		document.getElementById('Payment_Amount').value="69.90";
		}
	if(ShipToIsland=="IS00000002")
		{
		document.getElementById('Payment_Amount').value="79.85";
		}
	}
