function HTTPClient()
{};
HTTPClient.prototype = {
    xmlhttp: null,
    callback: null,
    loadRemoteContent: function(url, callbackFunction) 
    {
        this.callback = function(self) {
            eval(callbackFunction + '(self.xmlhttp);');
        }
        var self = this;
        if (window.XMLHttpRequest) {
            this.xmlhttp = new XMLHttpRequest();
            this.xmlhttp.onreadystatechange = function() {
                self.processReqChange(self);
            }
            this.xmlhttp.open("GET", url, true);
            this.xmlhttp.send(null);
        } else if (window.ActiveXObject) {
            this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            if (this.xmlhttp) {
                this.xmlhttp.onreadystatechange = function() {
                    self.processReqChange(self);
                };
				//alert(url);
                this.xmlhttp.open("GET", url, true);
                this.xmlhttp.send();
            }
        }
    },
    processReqChange: function(self) 
    {
        if (this.xmlhttp.readyState == 4) {
           if (this.xmlhttp.status == 200) {
              self.callback(self);
            } else {
                alert("There was a problem retrieving the data:\n" + this.xmlhttp.statusText);
            }
        }
    }
}


/* Function for the zoomox registeration*/


/* for the state function*/
function call_zoomox_state( countryID, stateID,pagevalue )
{
	
		var country = countryID;
		//code for when function is called from registration page.
		if(pagevalue==1)
		{
			document.getElementById("State").style.visibility = "visible";
			document.getElementById("Statediv").style.visibility = "visible";
			document.getElementById("city").style.visibility = "visible";
			document.getElementById("CityDiv").style.visibility = "visible";
			if(countryID=='US')
			{
				
				document.getElementById("Zip").style.visibility = "visible";
				document.getElementById("Zipdiv").style.visibility = "visible";
				//document.getElementById("zip").value = "";
				
			}
			else
			{
				
				document.getElementById("Zip").style.visibility = "hidden";
				document.getElementById("Zipdiv").style.visibility = "hidden";
				document.getElementById("zip").value = "";
				
			}
				
		}
		var r = Math.random();
        var httpClient = new HTTPClient();
		httpClient.loadRemoteContent("includes/lib/get_zoomox_state.php?countryID="+countryID+"&state="+stateID+"&t2="+r, 'handlezoomoxstate');
}


/* for the city function*/
function call_zoomox_city(stateID, countryID, cityID )
{	
		var r3 = Math.random();
        var httpClient = new HTTPClient();
		httpClient.loadRemoteContent("includes/lib/get_zoomox_city.php?stateID="+ stateID +"&countryID="+ countryID +"&cityID="+ cityID +"&n="+r3, 'handlezoomoxcity');
}


/* For Update of the user*/
function zoomox_state( countryID, stateID )

{					
		//alert('First State');
		var r = Math.random();
        var httpClient = new HTTPClient();
		httpClient.loadRemoteContent("includes/lib/get_zoomox_state.php?countryID="+countryID+"&state="+stateID+"&t2="+r, 'handlezoomoxstate');
}

function handlezoomoxstate(response)
{
    var message = response.responseText;
	//alert(message);
    var temp;
	document.getElementById('Statediv').innerHTML = message;
}
/* closing for the state function*/

/* for the city function*/
function zoomox_city(stateID, countryID, cityID )
{	
		//alert('First City');
		var r3 = Math.random();
        var httpClient = new HTTPClient();
		httpClient.loadRemoteContent("includes/lib/get_zoomox_city.php?stateID="+ stateID +"&countryID="+ countryID +"&cityID="+ cityID +"&t4="+r3, 'handlezoomoxcity');
}

function handlezoomoxcity(response)
{
    var message = response.responseText;
    var temp;
	//alert(message);
	document.getElementById('CityDiv').innerHTML = message;
}





/* closing for the state function*/



