
/* Hide search value on focus*/
function hide_value(el)
{
	if(el.V) {
	if (el.value == el.V) {
	el.value = '';
	}
	} else {
	el.V = el.value;
	el.value = '';
	}
}


function validateForm()
{
	valid = true;
	
	if (document.travelForm.make.selectedIndex == 0) {
		alert ("Please select the manufacturer of your phone");
		valid = false;
	}else if (document.travelForm.model.selectedIndex == 0) {
		alert ("Please select the model of your phone");
		valid = false;
	}else if (document.travelForm.plan.selectedIndex == 0) {
		alert ("Please select the plan of the phone your using to roam");
		valid = false;
	}else if (document.travelForm.country.selectedIndex == 0) {
		alert ("Please select the country you wish to roam in");
		valid = false;
	}
	
	return valid;
}

function showpg(fname,width,height) {  	
   var features="width="+width+",height="+height+",scrollbars=1"   
   window.open(fname,"",features)
}

function loadXMLDoc() {
	xmlhttp=null;
	// code for Mozilla, etc.
	if (window.XMLHttpRequest) {
  		xmlhttp=new XMLHttpRequest();
  	}
	
	// code for IE
	else if (window.ActiveXObject){
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
 	xmlhttpObj = xmlhttp
}

/*----------------[START Coverage N Romading V4] -------------*/
function popi(type, sel_val, domain, lang_code){

	loadXMLDoc();
	
  var url;
  
	url = "http://www."+domain+"/coverage_and_roaming/cnr_phone_helper.php?type="+type;
	
	// Add url thats passed in to this  url for cnr_phone_helper as its outside
	// codeignitor and can't access domain information etc
	
	url += "&domain="+domain;
	url += "&lang_code="+lang_code;
	
	if (type == "model"){
		url += "&make="+sel_val;
	}

	if (xmlhttpObj!=null){
		xmlhttpObj.onreadystatechange=function(){
										if (xmlhttpObj.readyState == "Ready" || xmlhttpObj.readyState == "4"){
											document.getElementById(type+"_td").innerHTML = xmlhttpObj.responseText;
										}
										};
	
		xmlhttpObj.open("GET", url, true);
		xmlhttpObj.send(null);
	
	}else{
  		alert("Your browser does not support XMLHTTP.");
  	}
}


function stateChanged4() { 
	
	if (xmlHttp4.readyState==4 || xmlHttp4.readyState=="complete") { 
		//TESTING
	 	//document.getElementById("displayCompareArray").innerHTML = xmlHttp.responseText;
		
		document.getElementById("maincontent").innerHTML = xmlHttp4.responseText;
		
		//PhoneComparisons = xmlHttp.responseText;
	} 
	
}

function getCnRContent(country_code, page_name) {

	// Call on the GetXmlHttpObject function to create an XMLHTTP object, 
	xmlHttp4 = GetXmlHttpObject();
	
	var url="../coverage_and_roaming_v4/getAjaxContent.php";

	url=url+"?page_name="+page_name;	//Send page name
	
	url=url+"&country_code="+country_code;	//Send country code
	
	url=url+"&sid="+Math.random();
	
	//Tell the xmlHttp object to execute a function called stateChanged when a change is triggered
	xmlHttp4.onreadystatechange = stateChanged4;
	 
	//Open the XMLHTTP object with the url compare_storevals.php.
	xmlHttp4.open("GET",url, true);
	
	//Send the HTTP request to the server (compare_storevals.php) - response goes back to stateChanged xmlHttp.responseText
	xmlHttp4.send(null);
}

/*----------------[END Coverage N Romading V4] -------------*/