// JavaScript Document// Javascript BCMP
// Created By : Uttam Kumar Mishra
// Created on : 10th, Sept 2009

//var wsUrl = "http://172.16.0.5/mobile/mobilecentral/3MS-new/";
var wsUrl = "http://www.3mobileshop.co.uk/";   
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 fill(spnId, ctlId, mobId,net,incentive,linerental,contractLength,Merchant){ 
	var xmlHttp;
	
	var url = wsUrl + "ajax/filldropdown.asp";
	url=url + "?ctlId="+ctlId;
    url=url + "&mobId="+mobId+ "&net="+net+ "&incentive="+incentive+ "&linerental="+linerental+ "&contractLength="+contractLength+ "&Merchant="+Merchant;
	url = url + "&rnd=" + Math.random();
//	alert(url);
	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 RedirectHandset(id, category){
    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" || category=="ContractC")
        window.location.href="showphone.asp?id="+id;    
	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="showphone.asp?id="+id;
}

function ChangeNames(link1, rowId){
	document.getElementById('divA').style.display= "none"; 
	document.getElementById('divB').style.display= "none"; 
	document.getElementById('divC').style.display= "none"; 
	document.getElementById('divD').style.display= "none"; 
	document.getElementById('divE').style.display= "none"; 
	document.getElementById('divF').style.display= "none"; 
	document.getElementById('divG').style.display= "none"; 
	document.getElementById('divH').style.display= "none"; 
	document.getElementById('divI').style.display= "none"; 
	document.getElementById('divJ').style.display= "none"; 
	document.getElementById('divK').style.display= "none"; 
	document.getElementById('divL').style.display= "none"; 
	document.getElementById('divM').style.display= "none"; 
	document.getElementById('divN').style.display= "none"; 
	document.getElementById('divO').style.display= "none"; 
	document.getElementById('divP').style.display= "none"; 
	document.getElementById('divQ').style.display= "none"; 
	document.getElementById('divR').style.display= "none"; 
	document.getElementById('divS').style.display= "none"; 
	document.getElementById('divT').style.display= "none"; 
	document.getElementById('divU').style.display= "none"; 
	document.getElementById('divV').style.display= "none"; 
	document.getElementById('divW').style.display= "none"; 
	document.getElementById('divX').style.display= "none"; 
	document.getElementById('divY').style.display= "none"; 
	document.getElementById('divZ').style.display= "none"; 
	
	document.getElementById(rowId).style.display= "";
	 document.getElementById('divA').className = "";
}