﻿// JScript File
//var wsUrl="http://localhost/onlinemobilephoneshop.co.uk/";
var wsUrl = "http://www.onlinemobilephoneshop.co.uk/";  
function bookmarksite(){
	if (document.all)
	window.external.AddFavorite('http://www.onlinemobilephoneshop.co.uk ', 'Online Mobile Phone Shop');
	else if (window.sidebar)
	window.sidebar.addPanel('Online Mobile Phone Shop', 'http://www.onlinemobilephoneshop.co.uk', "");
}
function Addtofavourite(){
if (document.all)
	window.external.AddFavorite(location.href, document.title);
	else if (window.sidebar)
	window.sidebar.addPanel(document.title, location.href, "");
} 

// JavaScript Document
function emailcheck(){
	var str = document.getElementById('txtmail').value;
	var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (filter.test(str))
		testresults = true;
	else{
		alert("Please input a valid email address");
		testresults = false;}
	return (testresults);
}

function sendmail(){
var evalue = document.getElementById('txtmail').value;
if (evalue == ""){
	alert("Please fill your email id!");
	document.getElementById('txtmail').focus();
	return false;
}
if(document.getElementById('txtmail').value != ""){
	var emailresult = emailcheck();
	if (emailresult == false){
		document.getElementById('txtmail').focus();
		return false;}
	if (emailresult != false){
		showEmail("aff_id=Super_aff&email="+ document.getElementById('txtmail').value);}	
    }
}

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 SetDealType(name, value, seconds) {
	if (seconds) {
		var date = new Date();
		date.setTime(date.getTime()+(seconds*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
    //alert("HI");
	SetDealType(name,"",-1);
}

function headerfill(spnId, ctlId){
var xmlHttp;	
	var url = wsUrl + "ajax/headerfill.asp";
	url=url + "?ctlId="+ctlId;
    url = url + "&rnd=" + Math.random();
	xmlHttp = GetHttpObject(); 
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function(){StateChanged(xmlHttp, spnId)};
	xmlHttp.send(null);
}

function StateChanged(xmlHttp, spnId) { 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){
		document.getElementById(spnId).innerHTML = xmlHttp.responseText;	 
	}else{ 
	}
}


function headerphone(phoneName){
	if (phoneName !="")
		window.location.href = wsUrl + phoneName.toLowerCase() + "-deals.aspx";
}

function headergift(gift){
	if(gift!=0){
		window.location= wsUrl + "free-gifts/" + gift.toLowerCase() +"-deals.aspx";
	}
}

function showGift(Gift){ 
    var xmlHttp2;
    xmlHttp2=GetHttpObject()
    if (xmlHttp2==null){
        alert ("Browser does not support HTTP Request")
        return
    } 
    var url=wsUrl+ "ajax/Gift.asp";
    url=url + "?Gift="+Gift;
    url=url+"&sid="+Math.random();
    //	alert(url);
    xmlHttp2.onreadystatechange=function(){stateChanged2(xmlHttp2)};
    xmlHttp2.open("GET",url,true)
    xmlHttp2.send(null)
}

function stateChanged2(xmlHttp2){ 
		if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete"){ 
			document.getElementById('SPNGFT').innerHTML=xmlHttp2.responseText 
		} 
	} 


function showEmail(str){ 
var xmlHttp;
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
    alert ("Browser does not support HTTP Request")
return} 
var url=wsUrl+"email.asp?";
url=url + str;
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=showEmailstateChanged(xmlHttp) 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function showEmailstateChanged(xmlHttp){ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	document.getElementById('txtmail').value=""; 
	alert("You are successfully subscribed to the newsletter");} 
} 

sfHover = function(){
	var sfEls = document.getElementById("tp-lnk").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++){
		sfEls[i].onmouseover=function(){
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function(){
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

loc=escape(window.location);
var pos=loc.indexOf("index.asp");
var posws=loc.indexOf("www.onlinemobilephoneshop.co.uk");
if(pos!=''&&pos!=-1&&posws!=''&&posws!=-1){
var redirectURL=loc.substring(0,pos-1);window.location=unescape(redirectURL);}

function menu(){
    var z=document.getElementById("show");
    z.style.display="block";
}
function menu1(){
    var z=document.getElementById("show");
    z.style.display="none";
}

function select_phone(reff,Type,net){
	//alert(reff);
    //alert(Type);
var reffgo = reff.value;
if (reffgo!=''){
	if (net!=''){
	window.location = wsUrl + reffgo.toLowerCase() + "-deals.aspx";}
	else if (Type=='Contract' && net==""){
	window.location = wsUrl + reffgo.toLowerCase() + "-deals.aspx";}
	else if (Type=='upg'){	
	document.frm_head.action = wsUrl +"mobile-upgrades.asp";

	document.frm_head.submit();}
	else if (Type=='SimFree'){
	window.location = wsUrl + reffgo.toLowerCase() + "-deals.aspx"}
	else if (Type=='PAYG'){
	window.location =wsUrl + reffgo.toLowerCase() + "-deals.aspx";}
	else if (Type=='12MonthsFree'){
	window.location = wsUrl + reffgo.toLowerCase() + "-deals.aspx";}
	else if (Type=='Clearance'){
	window.location = wsUrl + reffgo.toLowerCase() + "-deals.aspx";}
	}		
}
function select_rsH(reff){
	document.getElementById(50).action = wsUrl +"tariff_deal.asp?tariff="+ reff.value;
	document.getElementById(50).submit();
}
	
function select_qdf(reff){
		document.getElementById(50).action =wsUrl + "QuickDealFinder.asp?id_value="+ reff.value;
		document.getElementById(50).submit();
}
function hidemenu(){
	document.frmheader.select3.options[0].selected = true;
	document.getElementById("contract").style.display="none";
	document.getElementById("simfree").style.display="none";
	document.getElementById("payg").style.display="none";
}
function inc(filename){
	var body = document.getElementsByTagName('body').item(0);
	script = document.createElement('script');
	script.src = filename;
	script.type = 'text/javascript';
	body.appendChild(script)
}

function formSubmit(){
	var manufacturer,model,type,network,minut,text,rental,gift;
	manufacturer = 	document.frmheader.select1.value;
	model = 	document.frmheader.select2.value;
	type = 	document.frmheader.select3.value;
	if(document.frmheader.select2.options[0].selected){
		document.frmheader.hidmanufacturer.value = manufacturer;
		document.frmheader.hidmodel.value = model;
		document.frmheader.hidtype.value = type;
		if (type == "C"){
			network = document.frmheader.select4.value;
			minut = document.frmheader.select6.value;
			text = document.frmheader.select8.value;
			rental = document.frmheader.select5rental.value;
			gift = document.frmheader.select7.value;
			document.frmheader.hidnetwork.value = network;
			document.frmheader.hidminut.value = minut;
			document.frmheader.hidtext.value = text;
			document.frmheader.hidrental.value = rental;
			document.frmheader.hidgift.value = gift;
		}
		else if(type == "P"){document.frmheader.hidpaygnetwork.value = document.frmheader.select5payg.value;}
		else if(type == "S"){document.frmheader.hidsimfreeprice.value = document.frmheader.select5Simfree.value;}
		document.frmheader.action = wsUrl +"searchhandset.asp";
		document.frmheader.submit();
	}
	else{document.frmheader.hidmanufacturer.value = manufacturer;
		document.frmheader.hidmodel.value = model;
		document.frmheader.hidtype.value = type;
		if (type == "C"){network = document.frmheader.select4.value;
			minut = document.frmheader.select6.value;
			text = document.frmheader.select8.value;
			rental = document.frmheader.select5rental.value;
			gift = document.frmheader.select7.value;
			document.frmheader.hidmanufacturer.value = manufacturer;
			document.frmheader.hidmodel.value = model;
			document.frmheader.hidtype.value = type;
			document.frmheader.hidnetwork.value = network;
			document.frmheader.hidminut.value = minut;
			document.frmheader.hidtext.value = text;
			document.frmheader.hidrental.value = rental;
			document.frmheader.hidgift.value = gift;
		}if (type == "P"){document.frmheader.hidpaygnetwork.value = document.frmheader.select5payg.value;}
		if (type == "S"){document.frmheader.hidsimfreeprice.value = document.frmheader.select5Simfree.value;}
		document.frmheader.action = wsUrl +"dealsearch.asp";
		document.frmheader.submit();
	}
}

function searchPhoneSubmit(phoneName){
	document.frmheader.hidmodel.value = phoneName
	document.frmheader.action = wsUrl +"dealsearch.asp";
	document.frmheader.submit();
}

function srch(){
	if(document.frmheader.select1.options[0].selected){
			alert("Please Select Manufacturer")
			document.frmheader.select3.options[0].selected = true;
			document.frmheader.select1.focus();
			return false;
	}
	if(document.frmheader.select3.options[1].selected)	{
		document.getElementById("simfree").style.display="none";
		document.getElementById("payg").style.display="none";
		var modelName,manufacturer;		
		manufacturer = document.frmheader.select1.value;
		modelName = document.frmheader.select2.value;
		inc("script/contractssearchoption.js");
		ShowModelNameContract(modelName,manufacturer);
		document.getElementById("contract").style.display="block";
	}
	else if(document.frmheader.select3.options[2].selected){
		document.getElementById("simfree").style.display="block";
		document.getElementById("contract").style.display="none";
		document.getElementById("payg").style.display="none";
	}
	else if(document.frmheader.select3.options[3].selected){
		document.getElementById("payg").style.display="block";
		document.getElementById("simfree").style.display="none";
		document.getElementById("contract").style.display="none";
		var modelName,manufacturer;
		manufacturer = document.frmheader.select1.value;
		modelName = document.frmheader.select2.value;
		inc("script/networkspaygsearch.js");
		showNetwork(manufacturer,modelName);
	}
	if(document.frmheader.select3.options[0].selected){
		document.getElementById("contract").style.display="none";
		document.getElementById("simfree").style.display="none";
		document.getElementById("payg").style.display="none";
		document.getElementById("norm").style.display="block";	
	}
}
			  
function bookmarksite(){
	if (document.all)
	window.external.AddFavorite('http://www.onlinemobilephoneshop.co.uk ', 'Online Mobile Phone Shop');
	else if (window.sidebar)
	window.sidebar.addPanel('Online Mobile Phone Shop', 'http://www.onlinemobilephoneshop.co.uk', "");
}
function Addtofavourite(){
if (document.all)
	window.external.AddFavorite(location.href, document.title);
else if (window.sidebar)
	window.sidebar.addPanel(document.title, location.href, "");
} 
var write_1Flash ='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="974" height="276" background="images/bg-flash.jpg" id="main" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="pngimages/omps1.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="pngimages/omps1.swf" quality="high" wmode="transparent" width="974" height="276" name="main" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed></object>';
function show_1Flash (){
    document.write(write_1Flash);
}

function fillhandset(spnId, ctlId, GId, Phid){ 
	var xmlHttp;
	var url = wsUrl + "ajax/giftsearch.asp";
	url += "?ctlId="+ctlId;
	url += "&Phid="+Phid;
	url += "&GId="+GId.replace('+','*');
    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 redirectPage(id,gift){
//	if(gift!=0){
//		if (gift.indexOf("Cashback")!=""){
//			window.location=gift +"-gift-deals.aspx";
//			}
//		else{
//			window.location=gift +".aspx";
//		}
//		}
//	}

function ChangeNames(linkId, divId){		
	for (i=65; i<91;i++){
		document.getElementById('div'+String.fromCharCode(i)).style.display= "none"; 
		document.getElementById(String.fromCharCode(i)).className= ""; 
	}	
		document.getElementById(divId).style.display= ""
		document.getElementById(linkId).className = "selected";
} 

function ChangeTab(type, manufacturer){
	document.getElementById("S1").style.display='none';
	document.getElementById("S2").style.display='none';
	document.getElementById("C1").style.display='none';	
	document.getElementById("C2").style.display='none';	
	document.getElementById("P1").style.display='none';	
	document.getElementById("P2").style.display='none';	
	document.getElementById("Contract1").style.display='none';
	document.getElementById("PayG1").style.display='none';
	document.getElementById("Simfree1").style.display='none';
	document.getElementById("S1").style.display='none';
	if (type == "c"){
		document.getElementById("S2").style.display='';
		document.getElementById("C1").style.display='';		
		document.getElementById("P2").style.display='';	
		document.getElementById("Contract1").style.display='';
	}else if(type == "s"){
		document.getElementById("S1").style.display='';
		document.getElementById("C2").style.display='';		
		document.getElementById("P2").style.display='';	
		document.getElementById("Simfree1").style.display='';	
	}else if(type == "p"){
		document.getElementById("S2").style.display='';
		document.getElementById("C2").style.display='';	
		document.getElementById("P1").style.display='';	
		document.getElementById("PayG1").style.display='';	
	}
}

function CTabManufacturer(manufacturer){
	document.getElementById("General").style.display='block';
	document.getElementById("Nokia").style.display='none';
	document.getElementById("Htc").style.display='none';
	document.getElementById("Soni").style.display='none';
	document.getElementById("O2").style.display='none';
	document.getElementById("Samsung").style.display='none';
	document.getElementById("Lg").style.display='none';
	document.getElementById("Blackberry").style.display='none';		
	if (manufacturer == "nokia"){
		document.getElementById("Nokia").style.display='';
	}else if (manufacturer == "htc"){
		document.getElementById("Htc").style.display='';
	}else if (manufacturer == "sony"){
		document.getElementById("Soni").style.display='';
	}else if (manufacturer == "o2"){
		document.getElementById("O2").style.display='';
	}else if (manufacturer == "samsung"){
		document.getElementById("Samsung").style.display='';
	}else if (manufacturer == "lg"){
		document.getElementById("Lg").style.display='';
	}else if (manufacturer == "blackberry"){
		document.getElementById("Blackberry").style.display='';
	}else if (manufacturer == "siemens"){
		document.getElementById("Siemens").style.display='';
	}else if (manufacturer == "imate"){
		document.getElementById("IMate").style.display='';
	}else if (manufacturer == "gen"){
		document.getElementById("General").style.display='';
	}
}



function showDropdownshead(Type,net){ 
var xmlHttp1;
xmlHttp1=GetHttpObject()
if (xmlHttp1==null){
	alert ("Browser does not support HTTP Request")
	return
} 
var url=wsUrl + "ajax/header.asp";
//alert(Type)
url=url + "?Type=" + Type+"&net="+net;
url=url+"&sid="+Math.random() 
xmlHttp1.onreadystatechange= function(){StateChangedded(xmlHttp1)}; 
xmlHttp1.open("GET",url,true);
xmlHttp1.send(null)
}
function StateChangedded(xmlHttp1) { 
	if (xmlHttp1.readyState == 4 || xmlHttp1.readyState == "complete"){
		document.getElementById("2222").innerHTML = xmlHttp1.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 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 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  ccsubmit(country)
{
     window.location.href=country.toLowerCase().replace(/ /g,"-")+"-calling-cards.asp";
	//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.form1.action='international-sim-cards.asp'	

	document.form1.submit();
	return true;
}




function submitPhoneType(phonename){
	if(document.formphtype.phoneType.value=="Contract"){
		document.formphtype.action = wsUrl + phonename.toLowerCase() + "-deals.aspx";
		document.formphtype.submit();
	}
	else if(document.formphtype.phoneType.value=="PayG"){
		document.formphtype.action = wsUrl + phonename.toLowerCase() + "-deals.aspx";
		document.formphtype.submit();
	}
	else if(document.formphtype.phoneType.value=="SimFree"){
		document.formphtype.action = wsUrl + phonename.toLowerCase() + "-deals.aspx";
		document.formphtype.submit();
	}
	else if(document.formphtype.phoneType.value=="Clearance"){
		document.formphtype.action = wsUrl + phonename.toLowerCase() + "-deals.aspx";
		document.formphtype.submit();
	}
}

function showhide(elemnt){
	if(document.getElementById(elemnt).style.display=="none"){
		document.getElementById(elemnt).style.display="block";
		return false;}
	else{
		document.getElementById(elemnt).style.display="none";
		return true;}
}
function showhide_ds(divid){
		document.getElementById('divcomment').style.display = "none";document.getElementById('div2').style.display = "none";document.getElementById('div3').style.display = "none";document.getElementById('div4').style.display = "none";document.getElementById('div5').style.display = "none";document.getElementById('div6').style.display = "none";document.getElementById('t1');document.getElementById('t2');document.getElementById('t3');document.getElementById('t4');document.getElementById('t5');
		document.getElementById('t6');
if(divid == 'a'){
		document.getElementById('divcomment').style.display = "";document.getElementById('t1');document.getElementById('div2').style.display = "none";document.getElementById('div3').style.display = "none";document.getElementById('div4').style.display = "none";document.getElementById('div5').style.display = "none";
		document.getElementById('div6').style.display = "none";
	} 
if(divid == 'b'){
		document.getElementById('div2').style.display = "";document.getElementById('t2');document.getElementById('divcomment').style.display = "none";document.getElementById('div3').style.display = "none";document.getElementById('div4').style.display = "none";document.getElementById('div5').style.display = "none";
		document.getElementById('div6').style.display = "none";
	}
if(divid == 'c'){
		document.getElementById('div3').style.display = "";document.getElementById('t3');document.getElementById('divcomment').style.display = "none";document.getElementById('div2').style.display = "none";document.getElementById('div4').style.display = "none";document.getElementById('div5').style.display = "none";
		document.getElementById('div6').style.display = "none";
	}
else if(divid == 'd'){
		document.getElementById('div4').style.display = "";document.getElementById('t4');document.getElementById('divcomment').style.display = "none";document.getElementById('div2').style.display = "none";document.getElementById('div3').style.display = "none";document.getElementById('div5').style.display = "none";
		document.getElementById('div6').style.display = "none";
	}
else if(divid == 'e'){
		document.getElementById('div5').style.display = "";document.getElementById('t5');document.getElementById('divcomment').style.display = "none";document.getElementById('div2').style.display = "none";document.getElementById('div3').style.display = "none";document.getElementById('div4').style.display = "none";
		document.getElementById('div6').style.display = "none";
	}
else if(divid == 'f'){ 
	   document.getElementById('div6').style.display = "";document.getElementById('t6');document.getElementById('divcomment').style.display = "none";document.getElementById('div2').style.display = "none";document.getElementById('div3').style.display = "none";document.getElementById('div4').style.display = "none";
	   document.getElementById('div5').style.display = "none";
	}                 
}
function submitSimOnly(val)
{
	document.formphtype.action = "simonly.asp";
	document.getElementById("hidSimOnly").value =  val ;  
	document.formphtype.submit();
}
function submitUpgrade(val)
{
	document.frm2.action="mobile-upgrades.asp";
	document.getElementById("hidUpgrade").value = val;
	document.frm2.submit();
}

function submitBrodband(val)
{ 
  document.form1.action ="mobile-broadband-deals.asp";
  document.getElementById("hidUpgrade").value =val;
  document.form1.submit();
}

function showBroadBandDeal(spnId,Phonetype){
    var xmlHttpb;
	var url = wsUrl + "ajax/fillbroadband.asp";
	url=url + "?Phonetype="+Phonetype;
	url = url + "&rnd=" + Math.random();
	xmlHttpb = GetHttpObject(); 
	xmlHttpb.onreadystatechange = function(){StateChanged(xmlHttpb,spnId)};
	xmlHttpb.open("GET", url , true);
	xmlHttpb.send(null);
}
function StateChanged(xmlHttpb,spnId) { 
	if (xmlHttpb.readyState == 4 || xmlHttpb.readyState == "complete"){
		document.getElementById(spnId).innerHTML = xmlHttpb.responseText;	 
	}else{// For Loading...		
	}
} 

function Brodandfill(spnId,catName, phid, tariff){ 
	var xmlHttpbr;
	var url = wsUrl + "ajax/BroadbandMask.asp";
	url=url + "?catName="+catName;
	url=url + "&phid="+phid;
    url=url + "&tariff="+tariff;
    url = url + "&rnd=" + Math.random();
	//alert(url);
	xmlHttpbr = GetHttpObject(); 
	xmlHttpbr.open("GET", url, true);
	xmlHttpbr.onreadystatechange = function(){StateChanged(xmlHttpbr, spnId)};
	xmlHttpbr.send(null);
}

function StateChanged(xmlHttpbr, spnId) { 
	if (xmlHttpbr.readyState == 4 || xmlHttpbr.readyState == "complete"){
		document.getElementById(spnId).innerHTML = xmlHttpbr.responseText;	 
	}else{ 
	}
}

function fillcount(spnId,selectedcountry){ 
	var xmlHttpicc;
	var url = wsUrl +"international-calls/IccMask.asp";
	url=url + "?src="+spnId;
	//url=url + "?descountry="+descountry;
	url=url + "&sc="+selectedcountry;
	url = url + "&rnd=" + Math.random();
	xmlHttpicc = GetHttpObject(); 
    xmlHttpicc.onreadystatechange = function(){StateChanged2(xmlHttpicc,spnId)};
	xmlHttpicc.open("GET", url , true);
	xmlHttpicc.send(null);
}
function StateChanged2(xmlHttpicc, spnId) { 
	if (xmlHttpicc.readyState == 4 || xmlHttpicc.readyState == "complete"){
		document.getElementById(spnId).innerHTML = xmlHttpicc.responseText;	
		}else{// For Loading...		
	}
} 

//function redirectCallinCard()
//{
//document.location.href = 'calling-card-list-details.asp?source='+document.getElementById("ddlsrccountry").value.toLowerCase().replace(/ /g,"-").replace(/&/g,"-and-")+"&countrty="+document.getElementById("ddldesicounty").value.toLowerCase().replace(/ /g,"-").replace(/&/g,"-and-");
//alert(document.location.href);
//}

function redirectCallinCard()
{
  if (document.getElementById("ddlsrccountry").value.toLowerCase() == "uk")
    {
	document.location.href = document.getElementById("ddldesicounty").value.toLowerCase().replace(/ /g,"-").replace(/&/g,"-and-")+"-calling-cards.asp";
    }
    else
    {
     document.location.href = document.getElementById("ddlsrccountry").value.toLowerCase().replace(/ /g,"-").replace(/&/g,"-and-")+"-to-"+document.getElementById("ddldesicounty").value.toLowerCase().replace(/ /g,"-").replace(/&/g,"-and-")+"-calling-cards.asp";
     
			
    }
}

function GetImage(im, id){
    var xmlHttpcall;
	var url =wsUrl+"international-calls/getimage.asp?id="+id;	
	url = url + "&rnd=" + Math.random();
 	xmlHttpcall = GetHttpObject(); 
    xmlHttpcall.onreadystatechange = function(){
			if (xmlHttpcall.readyState == 4 && xmlHttpcall.status == 200){				
				im.src = xmlHttpcall.responseText;
				
				
			}
			else{
				//alert(xmlHttp.readyState);
			}			
		};
	xmlHttpcall.open("GET", url , true);
	xmlHttpcall.send(null); 
 }
 
var popp=0;
function popUp(URL)
{

	//alert(URL);
	if(popp)
	{
		if(!popp.closed)
		{
			popp.close();
		}
	}
	popp=open(URL,'','width=280,height=320,menubar=no,resizable=1,dependent=1,toolbar=no,top=90,left=240,scrollbars=1');
}	
