function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
	
	function getState(countryId) {	
		document.getElementById('mobile_loader').style.visibility = 'visible';
		var strURL="getModel.php?country="+countryId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
				document.getElementById('mobile_loader').style.visibility = 'hidden';	
				document.getElementById('Model').style.visibility = 'visible';

					if (req.status == 200) {
							//	document.getElementById('loader1').style.visibility = 'hidden';
						document.getElementById('statediv').innerHTML=req.responseText;												
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	function getProvider(countryId) {		
		document.getElementById('mobile_loader2').style.visibility = 'visible';
		var strURL="getProvider.php?provider="+countryId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					document.getElementById('mobile_loader2').style.visibility = 'hidden';
					if (req.status == 200) {						
						document.getElementById('providerdiv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	function getIMEI(countryId) {	
		var strURL="getIMEI.php?country="+countryId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
				document.getElementById('Info').style.visibility = 'visible';

					if (req.status == 200) {
							//	document.getElementById('loader1').style.visibility = 'hidden';
						document.getElementById('stateinfo').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	
    //on domready is a good way to start all javascript :)
/////////////////////////////////////////////////////////////////////////////

function GetD(dt)
{

	document.getElementById('credits').style.display='none';
	document.getElementById('faq').style.display='none';	
	document.getElementById('download').style.display='none';
    document.getElementById('info').style.display='none';
	document.getElementById('country').style.display='none';
	document.getElementById('country1').style.display='none';
	document.getElementById('model1').style.display='none';
	document.getElementById('model').style.display='none';
	document.getElementById('mep').style.display='none';
    
    
  
  $("#infotext").empty().html('<img src="images/loader.gif" />'); 	
  $("#infotext").load(
  	'getIMEI.php',{ 'ID': dt ,'Do':'info' }  

	);
    
    $.get('getIMEI.php?getserviceinfo=true&id=' + dt, doit);
    
    function doit(data) {

        var needNetwork   = false;
       	needNetwork   = (data.getElementsByTagName("needNetwork")[0].firstChild.data == "true");
        
        if(needNetwork){alert(data);}
        
       
    }

    
 	
    $("#download_link").load(
  	'getIMEI.php',{ 'ID': dt ,'Do':'link' }
	);
  
	
    $("#faq_dis").load(
  	'getIMEI.php',{ 'ID': dt ,'Do':'faq' }
	);
  
  
  

    $("#credit_dis").empty().html('<img src="images/loader.gif" />'); 	
    $("#credit_dis").load(
  	'getIMEI.php',{ 'ID': dt ,'Do':'credit' }
	);	
  
    $("#time").empty().html('<img src="images/loader.gif" />'); 
    $("#time").load(
  	'getIMEI.php',{ 'ID': dt ,'Do':'time' }
	);	
    
    
    
	$("#model_allow").empty().html('<img src="images/loader.gif" />'); 	
    $("#model_allow").load(
  	'getIMEI.php',{ 'ID': dt ,'Do':'model_allow' }
	);
    
    	
    $("#show_model").empty().html('<img src="images/loader.gif" />'); 	
    $("#show_model").load(
  	'getIMEI.php',{ 'ID': dt ,'Do':'model' }
	);	


    $("#country_allow").empty().html('<img src="images/loader.gif" />'); 	
    $("#country_allow").load(
  	'getIMEI.php',{ 'ID': dt ,'Do':'country_allow' }
	);	


    $("#show_country").empty().html('<img src="images/loader.gif" />');
    $("#show_country").load(
  	'getIMEI.php',{ 'ID': dt ,'Do':'country' }
	);


    $("#mep_allow").empty().html('<img src="images/loader.gif" />');	
    $("#mep_allow").load(
  	'getIMEI.php',{ 'ID': dt ,'Do':'mep_allow' }
	);	


    $("#show_mep").empty().html('<img src="images/loader.gif" />');	
    $("#show_mep").load(
  	'getIMEI.php',{ 'ID': dt ,'Do':'show_mep' }
	);		
	
	document.getElementById('credits').style.display='';
	document.getElementById('faq').style.display='inline';	
	document.getElementById('download').style.display='inline';
    document.getElementById('info').style.display='';
	document.getElementById('country').style.display='';
	document.getElementById('country1').style.display='';
	document.getElementById('model1').style.display='';
	document.getElementById('model').style.display='';
	document.getElementById('mep').style.display='';
	
}