﻿<!--

var AT_CODE = "900100310";
var AU_CODE = "19700197";
var BE_CODE = "3669";
var DE_CODE = "81750";
var ES_CODE = "7603";
var IE_CODE = "57080";
var NL_CODE = "3669";
var UK_CODE = "87766";
var US_CODE = "51732";

var AT_PRICE = "€2.00";
var AU_PRICE = "$10.00";
var BE_PRICE = "€3.00";
var DE_PRICE = "€2.49";
var ES_PRICE = "€1.80";
var IE_PRICE = "€4.00";
var NL_PRICE = "€2.20";
var UK_PRICE = "£3.00";
var US_PRICE = "$1.99";

var selIndex = "";

/**
 *  Called by country select onchange.
 *
 *	@type (Function) doCountrySelect	evals selection and displays country price and shortcode
 *	@param (Object)	_incomingObj		incoming select object reference
 */
function doCountrySelect( _incomingObj ) {

	try {
	
		var select_obj = _incomingObj;
		selIndex = select_obj.selectedIndex;
		var selectVal_str = select_obj.options[selIndex].value;
		

		//alert( "doCountrySelect with " + selectVal_str );
		
		switch( selectVal_str ) {
		
			case "AT":
				
				doShortcode(AT_CODE);
				doPrice(AT_PRICE);
				
				break;

			case "AU":
				
				doShortcode(AU_CODE);
				doPrice(AU_PRICE);

				break;

			case "BE":
				
				doShortcode(BE_CODE);
				doPrice(BE_PRICE);

				break;

			case "DE":
				
				doShortcode(DE_CODE);
				doPrice(DE_PRICE);

				break;

			case "ES":
				
				doShortcode(ES_CODE);
				doPrice(ES_PRICE);

				break;

			case "IE":
				
				doShortcode(IE_CODE);
				doPrice(IE_PRICE);

				break;

			case "NL":
				
				doShortcode(NL_CODE);
				doPrice(NL_PRICE);

				break;

			case "UK":
				
				doShortcode(UK_CODE);
				doPrice(UK_PRICE);

				break;

			case "US":
				
				doShortcode(US_CODE);
				doPrice(US_PRICE);

				break;
		}
		
		doSelectors();
	}
	catch (err) {
	
		alert( "Error in doCountrySelect() " + err );

	}
}

/**
 *  Called by country select onchange.
 *
 *	@type (Function) doPrice		evals selection and displays country price
 *	@param (Object)	_incomingStr	incoming country price
 */
function doPrice( _incomingStr ) {

	try {
	
		var price_str = _incomingStr;
		var priceArray = new Array;
		
		priceArray = getElementsByClass("price");
		
		var priceLength = priceArray.length;
		
		//alert( "priceLength is " + priceLength );
		
		for ( var i = 0; i < priceLength; i++ ) {
		
			priceArray[i].innerHTML = price_str;
		}
	}
	catch (err) {
	
		alert( "Error in doPrice() " + err );
	
	}
}

/**
 *  Called by country select onchange.
 *
 *	@type (Function) doShortcode	evals selection and displays country shortcode
 *	@param (Object)	_incomingStr	incoming country shortcode
 */
function doShortcode( _incomingStr ) {

	try {

		var shortcode_str = _incomingStr;
		var shortcodeArray = new Array;
		
		shortcodeArray = getElementsByClass("shortcode");
		
		var shortcodeLength = shortcodeArray.length;
		
		//alert( "shortcodeLength is " + shortcodeLength );
		
		for ( var i = 0; i < shortcodeLength; i++ ) {
		
			shortcodeArray[i].innerHTML = shortcode_str;
		}
	}
	catch (err) {

		alert( "Error in doShortcode() " + err );
	
	}
}

/**
 *  Called by country select onchange.
 *
 *	@type (Function) doSelectors	ensures all country selectors match
 */
function doSelectors(  ) {

	try {

		var selectorArray = new Array;
		
		selectorArray = getElementsByClass("sel");
		
		var selectorLength = selectorArray.length;
		
		//alert( "selectorLength is " + selectorLength );
		
		for ( var i = 0; i < selectorLength; i++ ) {
		
			selectorArray[i].selectedIndex = selIndex;
		}
	}
	catch (err) {

		alert( "Error in doSelectors() " + err );
	
	}
}

//-->
