var xmlHttp

function openpnac(m){
									 x = parseInt(window.screen.width) / 2 - 250;
									 y = parseInt(window.screen.height) / 2 - 150;
									
									//if (!(NewWin.closed)) { alert("open")}
								 
									//alert(typeof(NewWin))
										if (typeof(NewWin) != "undefined") { 
											//var popWin 
											popWin.window.NewWin.focus();
											return false;
										}
									 
									  popWin = window.open('','NewWin', "toolbar=no,status=no,menubar=no,scrollbars=no"); 
									
									  message = "<head><title>Coupon Code</title></head><body bgcolor='#99ccff'>";
									  
									  message += m;
								
									  message += "</body>";
									 
									 popWin.document.write(message);
									 popWin.focus();
									
									
									 if (navigator.appName.indexOf("Explorer")!= -1) {
									  popWin.location.reload(); 
									  popWin.moveTo(x,y); 
									  }
								}
									
function turnOutCountry(){
	
	//alert(str +" "+ str2 +" "+ str3)
       
			var url="/processcountry.asp";
			xmlHttp=GetXmlHttpObject();
			xmlHttp.open("GET", url , false);
			xmlHttp.send(null);
			
			var tac = xmlHttp.responseText;
	//alert(xmlHttp.responseText)		
			//pass to flash
			//window.document.textholder.SetVariable('inmessage',tac)
			window.document.getElementById("countrySelect").innerHTML=xmlHttp.responseText; 
			
	}			

function track(){
	
	var str = unescape(document.searchform.as_q.value);
       //alert(str)
			var url="/search_track.asp?searchStr="+str;
			xmlHttp=GetXmlHttpObject();
			xmlHttp.open("GET", url , false);
			xmlHttp.send(null);
			var tac = xmlHttp.responseText;
			//alert(tac)
	}	


function showApex(str)
{ 

		var url="/processallflash.asp?productid="+str;
		xmlHttp=GetXmlHttpObject();
		xmlHttp.open("GET", url , false);
		xmlHttp.send(null);
		
		var tac = xmlHttp.responseText;
		//pass to flash
		//alert(xmlHttp.responseText);
		//openpnac(xmlHttp.responseText)
		window.document.textholder.SetVariable('inmessage',tac);
		//document.getElementById("innertext").innerHTML=xmlHttp.responseText; 
} 


function showApexCarrier(str)
	{ 
	
	
	if ((str!='en_US')&&(str!='en_CA')){
		//alert(str)
		switch(str)
			{
			case 'en_GB':
			  window.location = 'http://uk.datapilot.com'
			  break    
			case 'de_DE':
			  window.location = 'http://uk.datapilot.com'
			  break
			case 'it_IT':
			  window.location = 'http://uk.datapilot.com'
			  break
			case 'es_ES':
			  window.location = 'http://uk.datapilot.com'
			  break
			case 'fr_FR':
			  window.location = 'http://uk.datapilot.com'
			  break
			default:
		}
		window.document.getElementById("carrier").innerHTML='<select name="carrier" disabled> <option value="">Please Select Carrier</option></select>'
		window.document.getElementById("model").innerHTML='<select name="model" disabled> <option value="">Please Select Model</option></select>'
		var toc = str
		showApexMaker(toc,'hey')
		}else {
	
			var url="/processall.asp?country="+str;
			//alert(url)
			xmlHttp=GetXmlHttpObject();
			xmlHttp.open("GET", url , false);
			xmlHttp.send(null);
			
			var tac = xmlHttp.responseText;
	//alert(xmlHttp.responseText)		
			//pass to flash
			//window.document.textholder.SetVariable('inmessage',tac)
			window.document.getElementById("carrier").innerHTML=xmlHttp.responseText; 
			window.document.getElementById("maker").innerHTML='<select name="maker" disabled> <option value="">Please Select Maker</option></select>'
			window.document.getElementById("model").innerHTML='<select name="model" disabled> <option value="">Please Select Model</option></select>'
		}
		if(str==""){
			window.document.getElementById("carrier").innerHTML='<select name="carrier" disabled> <option value="">Please Select Carrier</option></select>'
			window.document.getElementById("maker").innerHTML='<select name="maker" disabled> <option value="">Please Select Maker</option></select>'
			window.document.getElementById("model").innerHTML='<select name="model" disabled> <option value="">Please Select Model</option></select>'
			}
	} 
	
function determineDropdownsPro()
	{ 
	
	var str
	var country = window.document.getElementById("countryDropDown").value;
	var maker = window.document.getElementById("makerDropDown").value;
	var carrier = window.document.getElementById("carrierDropDown").value;
	
	document.getElementById("country").innerHTML = "Loading...";
	document.getElementById("maker").innerHTML = "Loading...";
	document.getElementById("carrier").innerHTML = "Loading..."; 
	
	
	 if((country=='')&&(maker=='')&&(carrier=='')){
		 
		 	str = '?all=all';
		
		}else{
			
			str = '?country='+country+'&maker='+maker+'&carrier='+carrier;
			//alert(str)
			}
	
	
	if ((country!='en_US')&&(country!='en_CA')&&(country!='')){
		
		switch(country)
			{
			case 'en_GB':
			  window.location = 'http://uk.datapilot.com';
			  break    
			case 'de_DE':
			  window.location = 'http://uk.datapilot.com';
			  break
			case 'it_IT':
			  window.location = 'http://uk.datapilot.com';
			  break
			case 'es_ES':
			  window.location = 'http://uk.datapilot.com';
			  break
			case 'fr_FR':
			  window.location = 'http://uk.datapilot.com';
			  break
			default:
			break
		}
		}
		else {
	
			var url="/processallpro.asp"+str;
			
			xmlHttp=GetXmlHttpObject();
			xmlHttp.open("GET", url , false);
			xmlHttp.send(null);
			
			var tac = xmlHttp.responseText;
			
			window.document.getElementById("dropHolders").innerHTML=xmlHttp.responseText; 
		}
		buildwholepage(1)
	} 
	
function buildwholepage(page){
	//alert("punk")
		var country = window.document.getElementById("countryDropDown").value;
		var maker = window.document.getElementById("makerDropDown").value;
		var carrier = window.document.getElementById("carrierDropDown").value;
		
		var str = '?country='+country+'&maker='+maker+'&carrier='+carrier+'&page='+page+'&wholePagePagin=sheep';
		
		var url="/processallpro.asp"+str;
			
			xmlHttp=GetXmlHttpObject();
			xmlHttp.open("GET", url , false);
			xmlHttp.send(null);
			
			var tac = xmlHttp.responseText;
			//alert(tac)
			window.document.getElementById("bothPaginPage").innerHTML=xmlHttp.responseText; 
	
	}


function showApexMaker(str,str2)
	{ 
	//alert(str +" "+ str2)
			var url="/processall.asp?country="+str+"&carrier="+str2;
			xmlHttp=GetXmlHttpObject();
			xmlHttp.open("GET", url , false);
			xmlHttp.send(null);
	
			var tac = xmlHttp.responseText;
	//alert(xmlHttp.responseText)			
			//pass to flash
			//window.document.textholder.SetVariable('inmessage',tac)
			window.document.getElementById("maker").innerHTML=xmlHttp.responseText; 
			window.document.getElementById("model").innerHTML='<select name="model" disabled> <option value="">Please Select Model</option></select>'
			
	} 
	
function showApexModel(str,str2,str3)
	{ 
	//alert(str +" "+ str2 +" "+ str3)
	var hey = 'hey';
       
			var url="/processall.asp?country="+str+"&carrier="+str2+"&maker="+str3;
			xmlHttp=GetXmlHttpObject();
			xmlHttp.open("GET", url , false);
			xmlHttp.send(null);
			
			var tac = xmlHttp.responseText;
	//alert(xmlHttp.responseText)		
			//pass to flash
			//window.document.textholder.SetVariable('inmessage',tac)
			window.document.getElementById("model").innerHTML=xmlHttp.responseText; 
			
	} 

function showApexCountry()
	{ 
	//alert(str +" "+ str2 +" "+ str3)
       
			var url="/processall.asp?country=refinement";
			xmlHttp=GetXmlHttpObject();
			xmlHttp.open("GET", url , false);
			xmlHttp.send(null);
			
			var tac = xmlHttp.responseText;
	//alert(xmlHttp.responseText)		
			//pass to flash
			//window.document.textholder.SetVariable('inmessage',tac)
			window.document.getElementById("country").innerHTML=xmlHttp.responseText; 
			
	} 
	
function showApexAll(str)
	{ 
	
	var hey = 'hey';
	//alert(str)
			var url="/processall.asp?"+str+"&buildall=yes";
			xmlHttp=GetXmlHttpObject();
			xmlHttp.open("GET", url , false);
			xmlHttp.send(null);
			
			var tac = xmlHttp.responseText;
	
			//pass to flash
			//window.document.textholder.SetVariable('inmessage',tac)
//alert(xmlHttp.responseText)
			document.getElementById('hospital').innerHTML=xmlHttp.responseText; 
			
	} 

function GetXmlHttpObject()
{
    var objXmlHttp = null;

    try
    {
        objXmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
    }
    catch (E)
    {
        try
        {
            objXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (E)
        {
          objXmlHttp = null;
        }
    }

    if ((objXmlHttp == null) && (typeof(XMLHttpRequest) != 'undefined'))
    {
        objXmlHttp = new XMLHttpRequest();
    }

    return objXmlHttp;
}
