// JavaScript Document

/*
	Cross-Browser Split 0.3
	By Steven Levithan <http://stevenlevithan.com>
	MIT license
	Provides a consistent cross-browser, ECMA-262 v3 compliant split method
*/

Array.prototype.findIndex = function(value){
var ctr = "-1";
for (var i=0; i < this.length; i++) {
// use === to check for Matches. ie., identical (===), ;
if (this[i] == value) {
return i;
}
}
return ctr;
};



String.prototype._$$split = String.prototype._$$split || String.prototype.split;

String.prototype.split = function (s /* separator */, limit) {
	// if separator is not a regex, use the native split method
	if (!(s instanceof RegExp))
		return String.prototype._$$split.apply(this, arguments);

	var	flags = (s.global ? "g" : "") + (s.ignoreCase ? "i" : "") + (s.multiline ? "m" : ""),
		s2 = new RegExp("^" + s.source + "$", flags),
		output = [],
		origLastIndex = s.lastIndex,
		lastLastIndex = 0,
		i = 0, match, lastLength;

	/* behavior for limit: if it's...
	- undefined: no limit
	- NaN or zero: return an empty array
	- a positive number: use limit after dropping any decimal
	- a negative number: no limit
	- other: type-convert, then use the above rules
	*/
	if (limit === undefined || +limit < 0) {
		limit = false;
	} else {
		limit = Math.floor(+limit);
		if (!limit)
			return [];
	}

	if (s.global)
		s.lastIndex = 0;
	else
		s = new RegExp(s.source, "g" + flags);

	while ((!limit || i++ <= limit) && (match = s.exec(this))) {
		var emptyMatch = !match[0].length;

		// Fix IE's infinite-loop-resistant but incorrect lastIndex
		if (emptyMatch && s.lastIndex > match.index)
			s.lastIndex--;

		if (s.lastIndex > lastLastIndex) {
			// Fix browsers whose exec methods don't consistently return undefined for non-participating capturing groups
			if (match.length > 1) {
				match[0].replace(s2, function () {
					for (var j = 1; j < arguments.length - 2; j++) {
						if (arguments[j] === undefined)
							match[j] = undefined;
					}
				});
			}

			output = output.concat(this.slice(lastLastIndex, match.index));
			if (1 < match.length && match.index < this.length)
				output = output.concat(match.slice(1));
			lastLength = match[0].length; // only needed if s.lastIndex === this.length
			lastLastIndex = s.lastIndex;
		}

		if (emptyMatch)
			s.lastIndex++; // avoid an infinite loop
	}

	// since this uses test(), output must be generated before restoring lastIndex
	output = lastLastIndex === this.length ?
		(s.test("") && !lastLength ? output : output.concat("")) :
		(limit ? output : output.concat(this.slice(lastLastIndex)));
	s.lastIndex = origLastIndex; // only needed if s.global, else we're working with a copy of the regex
	return output;
};

// Start of Code Proper
	var countryObj;
	var curRegion;
	var curPlugs;
	var curCountry;
	var curMade;
	var currentDate;
	var selectedPricePlan;
	var curReceived;
	var region_image;
	var productImage;
	var productLink;
	var availablePlansArray;
	var recommendedPlansArray;
	var totalcalls;
	var nStage;
	nStage = 1;
 	var url = "xml/roaming.xml";
    var xml = new JKL.ParseXML( url );
    var data = xml.parse();
	var i=0;
	var arrayCountry = [];
		for (i=0;i<=data.data.country.length -1;i++)
		{
			arrayCountry[i] = data.data.country[i].name;
		}
		
var worldArray = new Array(0, "Your Plan for Small Business", "Vodafone Business Clarity", "Total Business", "Vodafone volume tariff", "Small Business Community", "Simply price plan", "Anytime", "Anynet", "Sharetime", "Caller Plan", "Mobile Exchange", "Smartstep", "Smartplus");
var passportArray = new Array(0, "Small Business Community", "Your Plan for Small Business", "Total Business", "Anytime", "Anynet", "Smartstep", "Smartplus", "Simply price plan");
var europeArray = new Array(0, "Small Business Community", "Your Plan for Small Business", "Total Business", "Sharetime", "Caller Plan", "Vodafone Business Clarity", "Vodafone volume tariff", "Mobile Exchange");
var roamingbundlesArray = new Array(0, "Your Plan for Small Business", "Vodafone Business Clarity", "Total Business", "Vodafone volume tariff", "Small Business Community", "Simply price plan", "Anytime", "Anynet", "Sharetime", "Caller Plan", "Mobile Exchange", "Smartstep", "Smartplus");
var businessclarityArray = new Array(0, "Vodafone Business Clarity");
var dataArray = new Array(0, "Your Plan for Small Business", "Vodafone Business Clarity", "Total Business", "Vodafone volume tariff", "Small Business Community", "Simply price plan", "Anytime", "Anynet", "Sharetime", "Caller Plan", "Mobile Exchange", "Smartstep", "Smartplus");
var statementArray = new Array(0, "as the best value,", "as the most flexible,");
var prodDescArray = new Array(	["Vodafone World", "providing a simple flat rate for making a call.","images/icons/world.png",4],
										["Vodafone Passport", "take your existing price plan abroad to over 35 countries and pay just 64p ex vat per call.","images/icons/passport.png",2],
										["Vodafone Europe", "giving you cheaper calls and texts across 12 European countries for just £20.","images/icons/europe.png",5],
										["Roaming Bundles", "providing a bundle of minutes at a fixed price for all calls made and received.","images/icons/roaming.png",3],
										["Vodafone Business Clarity", "as you’ll get free calls and texts across 12 Vodafone Europe countries during June, July and August.","images/icons/VBC.png",8],
										["Daily Data Roaming and Reminders", "as there’s no contract to sign and you get a great price for a day’s data usage - it’s that simple!", "images/icons/data.png"],7);


		
var allPropostionsArray = new Array(0,
"Vodafone World",
"Vodafone Passport",
"Vodafone Europe",
"Roaming Bundles",
"Vodafone Business Clarity",
"Daily Data Roaming and Reminders");
		
function getCountry(c) {
	curCountry = c;
	for (i=0;i<=data.data.country.length -1;i++)
		{
			if (c == data.data.country[i].name) {setRegion(data.data.country[i].region);setPlugType(data.data.country[i].plugtype); countryObj = data.data.country[i];}
		}
}

//NEW LOGIC

function getAvailable() {

totalcalls = (curMade * 1) + (curReceived * 1);
//alert("AVAILABLE: world: " + countryObj.world + "\n Passport: " + countryObj.passport + "\n Europe: " + countryObj.europe + "\n Clarity: " + countryObj.businessclarity + " Roaming Bundles: " + countryObj.roamingbundles);

availablePlansArray = new Array("0");

if (worldArray.findIndex(selectedPricePlan) != -1 && countryObj.world == 1) {
	availablePlansArray.push("Vodafone World");
}
// customer can only have Vodafone Passport if not on Vodafone Business Clarity
if (selectedPricePlan != "Vodafone Business Clarity") {
	if (passportArray.findIndex(selectedPricePlan) != -1 && countryObj.passport == 1) {
		availablePlansArray.push("Vodafone Passport");
	}
}
if (europeArray.findIndex(selectedPricePlan) != -1 && countryObj.europe == 1) {
	availablePlansArray.push("Vodafone Europe");
}
if (roamingbundlesArray.findIndex(selectedPricePlan) != -1 && countryObj.roamingbundles == 1) {
	availablePlansArray.push("Roaming Bundles");
}
currentDate = new Date();
if (currentDate.getFullYear() == 2009 && currentDate.getMonth() <= 7) {
// if before 31st August 2009 offer business clarity
//alert("Plan: " + selectedPricePlan + "Index: " + businessclarityArray.findIndex(selectedPricePlan) )
	if (businessclarityArray.findIndex(selectedPricePlan) != -1 && countryObj.businessclarity == 1) {
		availablePlansArray.push("Vodafone Business Clarity");
	}
}
if (dataArray.findIndex(selectedPricePlan) != -1 && countryObj.data == 1) {
	availablePlansArray.push("Daily Data Roaming and Reminders");
}

if (selectedPricePlan == "Other" || selectedPricePlan == "Not on Vodafone") {
	if (countryObj.world == 1) {
		availablePlansArray.push("Vodafone World");
	}
	if (countryObj.passport == 1) {
		availablePlansArray.push("Vodafone Passport");
	}
	if (countryObj.europe == 1) {
		availablePlansArray.push("Vodafone Europe");
	}
	if (countryObj.roamingbundles == 1) {
		availablePlansArray.push("Roaming Bundles");
	}
	if (countryObj.data == 1) {
		availablePlansArray.push("Daily Data Roaming and Reminders");
	}
}
}

//NEW GET REC
function getRec() {
recommendedPlansArray = new Array("0");
//alert("DEBUG INFO: Europe: " + countryObj.europe + "\nPrice Plan: " + selectedPricePlan + "\nTotal Calls: " + totalcalls);

if (countryObj.europe == 1) {
	// EUROPE
	if (totalcalls < 30) {
		// LESS THAN 30 CALLS
		if (selectedPricePlan != "Your Plan for Small Business" && selectedPricePlan != "Anytime"){
			if (availablePlansArray.findIndex("Vodafone Business Clarity") != -1) {
				recommendedPlansArray.push("Vodafone Business Clarity");
			} else {
				recommendedPlansArray.push("Vodafone Europe");
				if (availablePlansArray.findIndex("Roaming Bundles") != -1) {
					recommendedPlansArray.push("Roaming Bundles");
				}
			}
		} else {
			// OTHER - Anytime or Your Plan for Small Business 
			if (currentDate.getFullYear() == 2009 && currentDate.getMonth() <= 7) {
				if (availablePlansArray.findIndex("Vodafone Passport") != -1) {
					recommendedPlansArray.push("Vodafone Passport");
					prodDescArray[1][1] = "free calls and texts in over 35 countries this summer with Vodafone Passport";
				}
				else {
					recommendedPlansArray.push("Vodafone Europe");
					if (availablePlansArray.findIndex("Roaming Bundles") != -1) {
						recommendedPlansArray.push("Roaming Bundles");
					}
				}
			} else {
				if (availablePlansArray.findIndex("Vodafone Passport") != -1) {
					recommendedPlansArray.push("Vodafone Passport");
				}
				recommendedPlansArray.push("Vodafone Europe");
				if (availablePlansArray.findIndex("Roaming Bundles") != -1) {
					recommendedPlansArray.push("Roaming Bundles");
				}
			}
		}
	} else {
		// MORE THAN 30 CALLS
		if (selectedPricePlan != "Your Plan for Small Business" && selectedPricePlan != "Anytime") {
			// - no anytime/your plan
			if (availablePlansArray.findIndex("Vodafone Business Clarity") != -1) {
				recommendedPlansArray.push("Vodafone Business Clarity");
			}
			else{
				recommendedPlansArray.push("Vodafone Europe");
				if (availablePlansArray.findIndex("Roaming Bundles") != -1) {
					recommendedPlansArray.push("Roaming Bundles");
				}
			}
		} else {
			// OTHER - Anytime or Your Plan for Small Business 
			if (currentDate.getFullYear() == 2009 && currentDate.getMonth() <= 7) {
				if (availablePlansArray.findIndex("Vodafone Passport") != -1) {
					recommendedPlansArray.push("Vodafone Passport");
					prodDescArray[1][1] = "free calls and texts in over 35 countries this summer with Vodafone Passport";
				}
			} else {
				if (availablePlansArray.findIndex("Vodafone Passport") != -1) {
					recommendedPlansArray.push("Vodafone Passport");
				}
				recommendedPlansArray.push("Vodafone Europe");
				if (availablePlansArray.findIndex("Roaming Bundles") != -1) {
					recommendedPlansArray.push("Roaming Bundles");
				}
			}
		}
	}
} else {
	//WORLD
	if (selectedPricePlan != "Your Plan for Small Business" && selectedPricePlan != "Anytime") {
		if (availablePlansArray.findIndex("Vodafone Passport") != -1) {
			recommendedPlansArray.push("Vodafone Passport");
		}
		if (totalcalls < 30) {
			if (availablePlansArray.findIndex("Vodafone World") != -1) {
				recommendedPlansArray.push("Vodafone World");
			}
		} else {
			if (availablePlansArray.findIndex("Roaming Bundles") != -1) {
				recommendedPlansArray.push("Roaming Bundles");
			}
		}
	} else {
		// OTHER - Anytime or Your Plan for Small Business 
		if (currentDate.getFullYear() == 2009 && currentDate.getMonth() <= 7) {
			if (availablePlansArray.findIndex("Vodafone Passport") != -1) {
				recommendedPlansArray.push("Vodafone Passport");
				prodDescArray[1][1] = "free calls and texts in over 35 countries this summer with Vodafone Passport";
			}
			else
			{
				if (availablePlansArray.findIndex("Vodafone World") != -1) {
					recommendedPlansArray.push("Vodafone World");
				}
				if (availablePlansArray.findIndex("Roaming Bundles") != -1) {
					recommendedPlansArray.push("Roaming Bundles");
				}
			}
		} else {
			if (availablePlansArray.findIndex("Vodafone Passport") != -1) {
				recommendedPlansArray.push("Vodafone Passport");
			}
			if (totalcalls < 30) {
				if (availablePlansArray.findIndex("Vodafone World") != -1) {
					recommendedPlansArray.push("Vodafone World");
				}
			} else {
				if (availablePlansArray.findIndex("Roaming Bundles") != -1) {
					recommendedPlansArray.push("Roaming Bundles");
				}
			}
		}
	}
}

}
//OLD GET REC
/*function getRec() {

	recommendedPlansArray = new Array("0");

	if (countryObj.europe == 1) {
	// EUROPE
	if (curMade < 30) {
	// LESS THAN 30 CALLS
		if (availablePlansArray.findIndex("Vodafone Business Clarity") != -1) {
			recommendedPlansArray.push("Vodafone Business Clarity");
		}
		if (availablePlansArray.findIndex("Vodafone Passport") != -1) {
			recommendedPlansArray.push("Vodafone Passport");
		}
		recommendedPlansArray.push("Vodafone Europe");
		if (availablePlansArray.findIndex("Roaming Bundles") != -1) {
			recommendedPlansArray.push("Roaming Bundles");
		}
	} else if (selectedPricePlan != "Your Plan for Small Business" && selectedPricePlan != "Anytime") {
		// MORE THAN 30 CALLS - no anytime/your plan
		if (availablePlansArray.findIndex("Vodafone Passport") != -1) {
			recommendedPlansArray.push("Vodafone Passport");
		}
		recommendedPlansArray.push("Vodafone Europe");
		if (availablePlansArray.findIndex("Roaming Bundles") != -1) {
			recommendedPlansArray.push("Roaming Bundles");
		}
	} else {
		// OTHER
		if (availablePlansArray.findIndex("Vodafone Passport") != -1) {
			recommendedPlansArray.push("Vodafone Passport");
		}
		recommendedPlansArray.push("Vodafone Europe");
		if (availablePlansArray.findIndex("Roaming Bundles") != -1) {
			recommendedPlansArray.push("Roaming Bundles");
		}
	}
	} else {
	//WORLD
	if (availablePlansArray.findIndex("Vodafone Passport") != -1) {
		recommendedPlansArray.push("Vodafone Passport");
	}
	if (curMade < 30) {
		if (availablePlansArray.findIndex("Vodafone World") != -1) {
			recommendedPlansArray.push("Vodafone World");
		}
	} else {
		if (availablePlansArray.findIndex("Roaming Bundles") != -1) {
			recommendedPlansArray.push("Roaming Bundles");
		}
	}
 	}
}*/

function showRecommends() {
	var x;
	var y;
	x = '';
	y = '<div style="width:100%">';
	for (i = 1; i < recommendedPlansArray.length && i <= 4; i++) {
		
		for(var j=0; j<prodDescArray.length; j++)
	{
	//alert("Product Description: " + prodDescArray[j][0] + "Rec Plans Array: " + recommendedPlansArray[i]);
		//trace("descIndex = :"+j);
		if(prodDescArray[j][0] == recommendedPlansArray[i])
		{
			productDescription = prodDescArray[j][1];
			productImage = prodDescArray[j][2];
			productLink = prodDescArray[j][3];
			//trace("productDescription = :"+productDescription);
			break;
		}
	}
	
	 y = y + "<div class='rNum'>" + i + ". </div><div class='rIcon'><a href='javascript:init(" + productLink + ")'><img border='0' src='" + productImage + "' alt='" + recommendedPlansArray[i] + "' /></a></div><div class='rText'>" + recommendedPlansArray[i] + " " + statementArray[i] + " " + productDescription +  "</div>";
	}
	
		 y = y + "<div class='rNum'>&nbsp;</div><div class='rIcon'><a href='javascript:init(7)'><img border='0' src='images/icons/data.png' alt='Daily Data Roaming and Reminders' /></a></div><div class='rText'>You may also be interested in Daily Data Roaming and Reminders, as there’s no contract to sign and you get a great price for a day’s data usage - it’s that simple!</div>";
	
	
	
	return y + '</div>';
}



//define your itemSelect handler function:   
 var itemCountrySelectHandler = function(sType, aArgs) {   
    var itemSelected = aArgs[2][1].country; // object literal of data for the result   
	getCountry(itemSelected);
};

function setRegion(r) {
	curRegion = r;
	switch (r) {
	  case "1": //Rest of world
			region_image = "ROW.png";
			break;
	  case "2": //North America
			region_image = "n_america.png";
			break;
	  case "3": //Europe
			region_image = "europe.png";
			break;
	  case "4": //Asia Pacific
			region_image = "asia_pacific.png";
			break;
	  default:
			region_image = "world_map.png";
			break;
	}
	document.getElementById("travelToMap").src = "images/" + region_image;
}

function setPlugType(p) {
	curPlugs = data.data.country[i].plugtype;
	var strPlugs = curPlugs;
    var arrPlugs = strPlugs.split(/,/);
	document.getElementById("plugToUse").src = "plugs/" + arrPlugs[0] + "plug.png";
	document.getElementById("plugInfo").innerHTML = "<b>" + data.data.country[i].name + "</b> uses pluf type(s):" + curPlugs + ".<br/>The plug displayed below is type " + arrPlugs[0] + "</b>";
}

function getPlans() {
	curMade = document.getElementById("slider-converted-value").value;
	curReceived = document.getElementById("slider-converted-value-r").value;
	selectedPricePlan = document.getElementById("selPricePlan").value;
	//Now do the logic
	getAvailable()
	getRec()
	
}

function next() {
	var tStage;
	switch (nStage) {
	  case 1: //Move to second page
	  	  if (document.getElementById("CountryInput").value != '') {
	  		document.getElementById("CountryMap").style.display = "none";
			document.getElementById("btnPrevious").style.visibility = "visible";
			document.getElementById("CountryBox").style.display = "none";
			document.getElementById("selectPlan").style.display = "block";
			document.getElementById("selectCallsMade").style.display = "block";
			document.getElementById("selectCallsReceived").style.display = "block";
			document.getElementById("InsButtons").style.display = "block";
			document.getElementById("InsStartButton").style.display = "none";
			document.getElementById("txtInstructions").className = "lrgeTxtInstructions";
			tStage = 2;
			document.getElementById("HelpText").innerHTML = "Step 2:<br/>Choose the price plan that your currently on. Click on the box to see the price plans, then click the price plan name to select.<br/><br/><br/>Step 3:<br/>Select the total number of calls you're likely to make while you're away. Use the slide to select the total number of calls.<br/><br/><br/>Step 4:<br/>Select the total number of calls you're likely to receive while you're away. Use the slide to select the total number of calls.<br/><br/><br/>Click the next button to continue."
			} else {alert("Please enter a country into the box in the top left before continuing");tStage = 1;};
			break;
		case 2: //Move to Third Page
			tStage = 3;
			document.getElementById("Plugs").style.display = "none"
			document.getElementById("BeforeYouGo").style.display = "block"
			getPlans();
			document.getElementById("HelpText").innerHTML = "Step 5:<br/>Click on the options to find out more.<br/><br/>Click the 'next' button to continue."
			document.getElementById("summary").innerHTML = "<p>You're going to <b>" + curCountry  + "</b><br/>Your current Price Plan is <b>" + selectedPricePlan + "</b><br/>You think you'll be making about <b>" + curMade + "</b> calls, and receiving <b>" + curReceived + "</b> calls while you're abroad. </p><p><b>Based on what you've told us we'd recommend:</b></p>" + showRecommends();
			document.getElementById("selectPlan").style.display = "none";
			document.getElementById("selectCallsMade").style.display = "none";
			document.getElementById("selectCallsReceived").style.display = "none";
			document.getElementById("pageFour").style.display = "block";
			break;
		case 3: //Move to Fourth Page
			tStage = 4;
			document.getElementById("HelpText").innerHTML = "So, now you know where you are going and know which roaming package is the best, but there are a few other things you should check before you go.<br/><br/>Alternatively, if you want to change any of your criteria, simply use the buttons below to navigate to the relevant page."
			document.getElementById("btnNext").style.visibility = "hidden";
			document.getElementById("pageFour").style.display = "none";
			document.getElementById("pageFive").style.display = "block";
			break;
		case 4: //Move to Fourth Page
			tStage = 5;
			document.getElementById("HelpText").innerHTML = "So, now you know where you are going and know which roaming package is the best, but there are a few other things you should check before you go.<br/><br/>Alternatively, if you want to change any of your criteria, simply use the buttons below to navigate to the relevant page."
			break;
		case 5: //End do nothing
			tStage = 5
			break;
	  default:  //No stage goto beginning
			break;
	}
		nStage = tStage;
}

function previous() {
		var tStage;
	switch (nStage) {
	  case 1: // Should not be possible
	  	tStage = 1;
			break;
	  case 2: //Move to first page
	  if (document.getElementById("CountryInput").value != '') {
	  		document.getElementById("CountryMap").style.display = "block";
			document.getElementById("CountryBox").style.display = "block";
			document.getElementById("btnPrevious").style.visibility = "hidden";
			document.getElementById("btnPrevious").focus = false;
			document.getElementById("InsButtons").style.display = "none";
			document.getElementById("InsStartButton").style.display = "block";
			document.getElementById("selectPlan").style.display = "none";
			document.getElementById("selectCallsMade").style.display = "none";
			document.getElementById("selectCallsReceived").style.display = "none";
						document.getElementById("txtInstructions").className = "smllTxtInstructions";
			
			tStage = 1;
			document.getElementById("HelpText").innerHTML = "Step 1:<br/><br/>Enter your destination in the box above.<br /><br />Once you have found your Country, click the 'next' button to continue."
	  	} else {alert("Please enter a country into the box in the top left before continuing");}
			break;
	  case 3: //Move to second page
			tStage = 2;
			document.getElementById("Plugs").style.display = "block"
			document.getElementById("BeforeYouGo").style.display = "none"
			document.getElementById("HelpText").innerHTML = "Step 2:<br/>Choose the price plan that your currently on. Click on the box to see the price plans, then click the price plan name to select.<br/><br/><br/>Step 3:<br/>Select the total number of calls you're likely to make while you're away. Use the slide to select the total number of calls.<br/><br/><br/>Step 4:<br/>Select the total number of calls you're likely to receive while you're away. Use the slide to select the total number of calls.<br/><br/><br/>Click the next button to continue."
			document.getElementById("selectPlan").style.display = "block";
			document.getElementById("selectCallsMade").style.display = "block";
			document.getElementById("selectCallsReceived").style.display = "block";
			document.getElementById("pageFour").style.display = "none";
			break;
		case 4: //Move to Third Page
			tStage = 3;
getPlans();
			document.getElementById("HelpText").innerHTML = "Step 5:<br/>Click on the options to find out more.<br/><br/>Click the 'next' button to continue."
			document.getElementById("summary").inerHTML = "<p>You're going to <b>" + curCountry  + "</b><br/>Your current Price Plan is <br/>You think you'll be making about " + curMade + " calls, and receiving " + curReceived + " calls while you're abroad. </p><p>&nbsp;</p><p>Based on what you've told us we'd recommend:</p>"
			document.getElementById("selectPlan").style.display = "none";
			document.getElementById("selectCallsMade").style.display = "none";
			document.getElementById("selectCallsReceived").style.display = "none";
			document.getElementById("pageFour").style.display = "block";
			document.getElementById("pageFive").style.display = "none";
			document.getElementById("btnNext").style.visibility = "visible";
			break;
		case 5: //Move to Fourth Page
			tStage = 4;
			document.getElementById("btnNext").style.visibility = "visible";
			document.getElementById("pageFour").style.display = "block";
			document.getElementById("pageFive").style.display = "none";
			document.getElementById("HelpText").innerHTML = "So, now you know where you are going and know which roaming package is the best, but there are a few other things you should check before you go.<br/><br/>Alternatively, if you want to change any of your criteria, simply use the buttons below to navigate to the relevant page."
			
			break;
		case 6: //Move to Fifth Page
			tStage = 5;
			document.getElementById("HelpText").innerHTML = "So, now you know where you are going and know which roaming package is the best, but there are a few other things you should check before you go.<br/><br/>Alternatively, if you want to change any of your criteria, simply use the buttons below to navigate to the relevant page."
	  default:  //No stage goto beginning
			break;
	}
	nStage = tStage;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

YAHOO.namespace("example.container");

function init(id) {
			// Instantiate a Panel from markup
			//YAHOO.example.container.panel1 = new YAHOO.widget.Panel("panel" + id, { width:"900px", visible:false, constraintoviewport:true, fixedcenter: true,modal: true,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}} );
			
			//YAHOO.example.container.panel1
			                                                    
			//YAHOO.example.container.panel1.render();

			//YAHOO.example.container.panel1.show();
			
			switch (id) {
	  case 0: 
	  	YAHOO.example.container.panel0.show();
	   		break;
	  case 1: 
	  document.getElementById("CountryInput").value = '';
	  	YAHOO.example.container.panel1.show();
			break;
	  case 2: 
	  	YAHOO.example.container.panel2.show();
			break;
	  case 3: 
	  	YAHOO.example.container.panel3.show();
			break;
	  case 4: 
	  	YAHOO.example.container.panel4.show();
			break;
	  case 5: 
	  	YAHOO.example.container.panel5.show();
			break;
	  case 6: 
	  	YAHOO.example.container.panel6.show();
			break;
	  case 7: 
	  	YAHOO.example.container.panel7.show();
			break;
	  case 8: 
	  	YAHOO.example.container.panel8.show();
			break;
	  case 9: 
	  	YAHOO.example.container.panel9.show();
	   break;
	   
	   }
	  
		}
		
		function loadpanel() {
			
YAHOO.example.container.panel0 = new YAHOO.widget.Panel("panel0", { width:"900px", visible:false, constraintoviewport:true, fixedcenter: true,modal: true,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}} );
			
YAHOO.example.container.panel1 = new YAHOO.widget.Panel("panel1", { width:"900px", visible:false, constraintoviewport:true, fixedcenter: true,modal: true,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}} );

YAHOO.example.container.panel2 = new YAHOO.widget.Panel("panel2", { width:"900px", visible:false, constraintoviewport:true, fixedcenter: true,modal: true,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}} );
			
YAHOO.example.container.panel3 = new YAHOO.widget.Panel("panel3", { width:"900px", visible:false, constraintoviewport:true, fixedcenter: true,modal: true,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}} );
						
YAHOO.example.container.panel4 = new YAHOO.widget.Panel("panel4", { width:"900px", visible:false, constraintoviewport:true, fixedcenter: true,modal: true,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}} );

YAHOO.example.container.panel5 = new YAHOO.widget.Panel("panel5", { width:"900px", visible:false, constraintoviewport:true, fixedcenter: true,modal: true,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}} );

YAHOO.example.container.panel6 = new YAHOO.widget.Panel("panel6", { width:"900px", visible:false, constraintoviewport:true, fixedcenter: true,modal: true,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}} );
			
YAHOO.example.container.panel7 = new YAHOO.widget.Panel("panel7", { width:"900px", visible:false, constraintoviewport:true, fixedcenter: true,modal: true,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}} );
						
YAHOO.example.container.panel8 = new YAHOO.widget.Panel("panel8", { width:"900px", visible:false, constraintoviewport:true, fixedcenter: true,modal: true,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}} );

YAHOO.example.container.panel9 = new YAHOO.widget.Panel("panel9", { width:"900px", visible:false, constraintoviewport:true, fixedcenter: true,modal: true,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}} );


YAHOO.example.container.panel0.render();
YAHOO.example.container.panel1.render();
YAHOO.example.container.panel2.render();
YAHOO.example.container.panel3.render();
YAHOO.example.container.panel4.render();
YAHOO.example.container.panel5.render();
YAHOO.example.container.panel6.render();
YAHOO.example.container.panel7.render();
YAHOO.example.container.panel8.render();
YAHOO.example.container.panel9.render();


		init(1);
			
		}