function GetHttpObject(){
    var xmlHttpObj;
    try {   
        xmlHttpObj = new XMLHttpRequest();              
        return xmlHttpObj;
    }
    catch (e){        
        try{
            xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP");                   
            return xmlHttpObj; 
        }
        catch (e){           
            try{
                xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP");                      
                return xmlHttpObj;      
            }
            catch (e)
            {        
                alert("Sorry, Your browser does not support AJAX!");        
                return null;        
            }     
        }   
    }     
} 

function fillhandset(spnId, ctlId, mobId, netId, months,clr){ 
	var xmlHttp;
	var url = wsUrl + "ajax/fill.asp";
	url=url + "?ctlId="+ctlId;
    url=url + "&mobId="+mobId;
	url=url + "&netId="+netId;
	url=url + "&months="+months;
	url=url + "&clr="+clr;
	//alert(url);
    url = url + "&rnd=" + Math.random();
	xmlHttp = GetHttpObject(); 
    xmlHttp.onreadystatechange = function(){StateChanged(xmlHttp, spnId)};
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function dealshow(spnId, ctlId, gift, mobId){ 
	var xmlHttp;
	var url = wsUrl + "ajax/filldeal.asp";
	url=url + "?ctlId="+ctlId;
	url=url + "&gift="+gift;
    url=url + "&phid="+mobId;
//alert(url);
    url = url + "&rnd=" + Math.random();
	xmlHttp = GetHttpObject(); 
    xmlHttp.onreadystatechange = function(){StateChanged(xmlHttp, spnId)};
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function StateChanged(xmlHttp, spnId) { 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){
		document.getElementById(spnId).innerHTML = xmlHttp.responseText;	 
	}else{// For Loading...		
	}
} 

function FillUpgrade(spnId, ctlId,netid,ph){ 
	var xmlHttp;
	var url = wsUrl + "ajax/mbupgrade.asp";
	url=url + "?ctlId="+ctlId;
	url=url + "&netid="+netid;
	url=url + "&ph="+ph;
    url = url + "&rnd=" + Math.random();
	xmlHttp = GetHttpObject(); 
    xmlHttp.onreadystatechange = function(){StateChangedupgrd(xmlHttp, spnId)};
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function StateChangedupgrd(xmlHttp, spnId) { 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){
		document.getElementById(spnId).innerHTML = xmlHttp.responseText;	 
	}else{// For Loading...		
	}
}

function Fillsim(spnId, ctlId,netid){ 
	var xmlHttp;
	var url = wsUrl + "ajax/simfill.asp";
	url=url + "?ctlId="+ctlId;
	url=url + "&netid="+netid;
    url = url + "&rnd=" + Math.random();
	xmlHttp = GetHttpObject(); 
    xmlHttp.onreadystatechange = function(){StateChangedsimonly(xmlHttp, spnId)};
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function StateChangedsimonly(xmlHttp, spnId) { 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){
		document.getElementById(spnId).innerHTML = xmlHttp.responseText;	 
	}else{// For Loading...		
	}
}

function RedirectHandset(id, category){
	if(id != "")
	{
		if(category=="simfree")
			window.location.href="showsimfreephone.asp?id="+id;
		else if(category=="payg")
			window.location.href="showpayasyougo.asp?id="+id;
		else if(category=="Contract")
			//window.location.href="dealset.asp?id="+id;   
			document.location.href = wsUrl +"comparedeals/" + id.replace(/ /g,"-").toLowerCase() +".html";
		else if(category=="12MonthsFree")
			window.location.href="12alldeals.asp?id="+id;
		else if(category=="Clearance")
			window.location.href="clearance-deals.asp?id="+id;
		else
			//window.location.href="dealset.asp?id="+id;
			 document.location.href = wsUrl +"comparedeals/" + id.replace(/ /g,"-").toLowerCase() +".html";
	}
}

function redirectnetdeal(id,net)
{
//alert("hi");
	if(id!=0)
	{window.location="Netset.asp?id="+id+"&NetId="+net}
}
function redirectPage(id,MobID)
{
	if(id!="")
	{
	if (id=='SimFree')
	{
	window.location="showsimfreephone.asp?id="+MobID}
	if (id=='PAYG')
	{
	window.location="showpayasyougo.asp?id="+MobID}
	if (id=='Contract')
	{
	window.location="dealset.asp?id="+MobID}
	if (id=='Clearance')
	{
	window.location="clearance-deals.asp?id="+MobID}
	}
}

//function popUp(URL,PopWidth,PopHeight) {
//day = new Date();
//id = day.getTime();
//eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+PopWidth+",height="+PopHeight+",left =240,top=90');");
//}
var popp=0;
function popUp(URL)
{
	if(popp){
		if(!popp.closed){
			popp.close();}
	}
	popp=open(URL,'','width=500,height=320,menubar=no,resizable=1,dependent=1,toolbar=no,top=90,left=240,scrollbars=1');
}///***upgrade///
function fillUpghandset(spnId, ctlId, mobId, net, inc, mer, manu){ 
	var xmlHttp;
	var url = wsUrl + "ajax/fill.asp";
	url=url + "?ctlId="+ctlId;
    url=url + "&mobId="+mobId;
	url=url + "&net="+net;
	url=url + "&inc="+inc;
	url=url + "&mer="+mer;
	url=url + "&manu="+manu;
	//alert(url);
    url = url + "&rnd=" + Math.random();
	xmlHttp = GetHttpObject(); 
    xmlHttp.onreadystatechange = function(){StateChanged(xmlHttp, spnId)};
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function StateChanged(xmlHttp, spnId) { 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){
		document.getElementById(spnId).innerHTML = xmlHttp.responseText;	 
	}else{// For Loading...		
	}
} 
function fillcountry(src,spnid,selectedcountry){ 

	var xmlHttp;
	var url = wsUrl + "fillcountry.asp";
		url=url + "?src="+src;
		url=url + "&sc="+selectedcountry;
      url = url + "&rnd=" + Math.random();
	xmlHttp1 = GetHttpObject(); 
    xmlHttp1.onreadystatechange = function(){StateChanged1(xmlHttp1,spnid)};
	xmlHttp1.open("GET", url , true);
	xmlHttp1.send(null);
}

function StateChanged1(xmlHttp1, spnId) { 
	if (xmlHttp1.readyState == 4 || xmlHttp1.readyState == "complete"){
		document.getElementById(spnId).innerHTML = xmlHttp1.responseText;	 
	}else{// For Loading...		
	}
} 
function GetCountry(ctlId,value){ 
	var xmlHttp;
	var url = wsUrl + "ajax/accessfill.asp";
	url=url + "?ctlId="+ctlId;
	url=url + "&value="+value;	
    url = url + "&rnd=" + Math.random();
	//alert(url);
	xmlHttp = GetHttpObject(); 
    xmlHttp.onreadystatechange = function(){StateChangedaccess(xmlHttp, ctlId)};
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function StateChangedaccess(xmlHttp, ctlId) { 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){
		//alert(xmlHttp.responseText);
		document.getElementById(ctlId).innerHTML = xmlHttp.responseText;	 
	}else{// For Loading...		
	}
} 

function filltariff(src,spnid){ 

	var xmlHttp;
	var url = wsUrl + "showtariff.asp";
	url=url + "?src="+src;
	url = url + "&rnd=" + Math.random();
	xmlHttp2 = GetHttpObject(); 
    xmlHttp2.onreadystatechange = function(){StateChanged2(xmlHttp2,spnid)};
	xmlHttp2.open("GET", url , true);
	xmlHttp2.send(null);
}

function StateChanged2(xmlHttp2, spnId) { 
	if (xmlHttp2.readyState == 4 || xmlHttp2.readyState == "complete"){
		document.getElementById(spnId).innerHTML = xmlHttp2.responseText;	 
	}else{// For Loading...		
	}
} 
function SetType(country){
	//alert(country);
 	 var temp = country.toLowerCase();
	 //alert(temp);
	// alert(temp.search("mobile"));
	if (temp.search("mobile")> -1){
		document.getElementById("m").checked = true;	
	}else{
		document.getElementById("l").checked = true;		
	}	
}
function redirectUpgrade(net,id)
{
	if(id!=0)
	{window.location="dps_inner151209.asp?netid="+net+"&id="+id}
}
///
function FillModels(comp){ 

	xmlHttpphn= GetXmlHttpObjectphn()
	if (xmlHttpphn ==null){
		alert ("Browser does not support HTTP Request")
		return
	} 
		var url1="ajax/fill.asp";
		url1=url1 + "?Type="+comp;
	//	urll=urll + "&netid="+netid;
		url1=url1+"&sid="+Math.random()
		//alert(comp);
		xmlHttpphn.onreadystatechange = stateChangedealphn
		xmlHttpphn.open("GET",url1,true)
		xmlHttpphn.send(null)
}

function stateChangedealphn(){ 
	if (xmlHttpphn.readyState==4 || xmlHttpphn.readyState=="complete"){ 
		document.getElementById("spnUHdset").innerHTML=xmlHttpphn.responseText 
	} 
} 
function GetXmlHttpObjectphn(){ 
	var objXMLHttpphn=null
	if (window.XMLHttpRequest){
		objXMLHttpphn=new XMLHttpRequest()
	}else if (window.ActiveXObject){
		objXMLHttpphn=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttpphn
}
function  ccsubmit(country)
{
	window.location.href="calling-cards-"+country.toLowerCase().replace(/ /g,"-")+".asp";
}
function  acsubmit(country)
{
	window.location.href="access-number-"+country.replace(/ /g,"").replace(/&/,"-and-")+".asp";
}
function  txtsubmit(country)
{
	window.location.href="text-n-talk-"+country.toLowerCase().replace(/ /g,"-").replace(/&/,"and")+".asp";
}

function MVNOsubmit(country)
{
	document.getElementById('hndcountry').value=country

	document.getElementById('form1').action='international-sim-cards.asp'	

	document.form1.submit();
	return true;
}

function redirectupgrade2(id)
{
	if (id!="")
	{
		document.frm1.ph_name.action="upgrade-phones.asp"
		document.frm1.submit()
	}
}
//function check()
////alert("hi");
//{
//	//alert("hi");
//	//alert(document.getElementById('Unetsearch').value);
//	if (document.getElementById('Unetsearch').value != "" )
//	{
//		alert(document.getElementById('Unetsearch').value);
//		alert(document.getElementById('Cvalue').value);
////alert("hi");
//
//		document.getElementById('Cvalue').value =="";	
//		document.getElementById('cname').value =="";	
//
//		alert(document.getElementById('Cvalue').value);
//	}
//}



function showsub(comp){ 
	var xmlHttp;
	var url = wsUrl + "ajax/mobile_name.asp";
	url=url +  "?Type="+comp;
	url = url + "&rnd=" + Math.random();
	xmlHttp = GetHttpObject(); 
    xmlHttp.onreadystatechange = function(){StateChangedupgrd(xmlHttp)};
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function StateChangedupgrd(xmlHttp) { 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){
		document.getElementById(333).innerHTML = xmlHttp.responseText;	 
	}else{// For Loading...		
	}
}

function disp_alert()
{
	if (document.review.txtname.value=="")
	{
		alert("Please Enter Name")
		document.review.txtname.focus();
		return false;
	}
	else if (document.review.txtemail.value != "" && !checkemail(document.review.txtemail.value)){
		
        alert("Please enter the valid Email");
		return false;
        document.review.txtemail.value.focus();
        
    }

	else if (document.review.txtrtopic.value=="")
	{
		alert("Please Enter Title")
		document.review.txtrtopic.focus();
		return false;
	}
	else if (document.review.txtdesc.value=="")
	{
		alert("Please Enter Review ")
		document.review.txtdesc.focus();
		return false;
	}
 	else
        return true;
}

  function checkemail(emailadd){
        var result = false;
        var theStr = new String(emailadd);
        var index = theStr.indexOf("@");
        if (index > 0){  	
            var pindex = theStr.indexOf(".",index);
            if ((pindex > index+1) && (theStr.length > pindex+2))
                result = true;
        }  		
        return result;
    }
//function check()
////alert("hi");
//{
//	//alert("hi");
//	//alert(document.getElementById('Unetsearch').value);
//	if (document.getElementById('Unetsearch').value != "" )
//	{
//		alert(document.getElementById('Unetsearch').value);
//		alert(document.getElementById('Cvalue').value);
////alert("hi");
//
//		document.getElementById('Cvalue').value =="";	
//		document.getElementById('cname').value =="";	
//
//		alert(document.getElementById('Cvalue').value);
//	}
//}
