// Get base url

url = document.location.href;
xend = url.lastIndexOf("/") + 1;
var base_url = url.substring(0, xend);

function phpzipcodelocator_do (url)
{
		div1 = document.getElementById('phpzipcodecontent1');
		div1.innerHTML = '<p>&nbsp;</p><table width="559" align="center" valign="middle"><tr><td><p align="center" valign="middle"><img src="http://www.phpzipcodelocator.com/beta/loading6.gif"></img></p></td></tr></table>';
		div = document.getElementById('phpzipcodecontent');
		div.innerHTML = '';
		// Does URL begin with http?
        if (url.substring(0, 4) != 'http')
		{
			base_url="http://www.phpzipcodelocator.com/beta/";
            url = base_url + url;
        }
		//alert ('test1');
        // Create new JS element
        var jsel = document.createElement('SCRIPT');
        jsel.type = 'text/javascript';
        //var test = url + '&username=' + username;
		//alert(test);
		jsel.src = url + '&username=' + username;
		//alert ('test2');
		//alert(jsel.src);
        // Append JS element (therefore executing the 'AJAX' call)
        document.body.appendChild (jsel);		
}
function ajax_get (url, el) {
        // Has element been passed as object or id-string?
        if (typeof(el) == 'string') {
                el = document.getElementById(el);
        }

        // Valid el?
        if (el == null) { return false; }		
        // Does URL begin with http?
        if (url.substring(0, 4) != 'http') {
                url = base_url + url;
        }

        // Create getfile URL
        getfile_url = base_url + 'getfile.php?url=' + escape(url) + '&el=' + escape(el.id);

        // Do Ajax
        phpzipcodelocator_do (getfile_url);

        return true;
}
document.writeln('<div id="phpzipcodecontent1"></div>');
document.writeln('<div id="phpzipcodecontent"></div>');
//document.onload=phpzipcodelocator_do('http://192.168.0.1/bhoomika/megha/backup_final/search.php?');
//alert('This will load the zipcode locator');
/*@cc_on @*/
 /*@if (@_win32)
document.write("<script id=__ie_onload defer src='http://www.phpzipcodelocator.com/beta/fix.js'><\/script>"); 
var script = document.getElementById("__ie_onload"); 
script.onreadystatechange = function() {
if (this.readyState == "complete") {
	if(typeof(pzcl_ccountry)=='undefined' ){		
		phpzipcodelocator_do('http://www.phpzipcodelocator.com/beta/loading_effect.php?loadtime=1');
	}
	else
	{
		phpzipcodelocator_do('list_results.php?countflag=1&ipflag=1&check=5&country1=' + escape(pzcl_ccountry) + '&username=' + escape(username));
		
	}
} 
};
/*@end @*/
if(navigator.userAgent.indexOf("Firefox")!=-1){	
	if(typeof(pzcl_ccountry)=='undefined' ){
				
		document.onload=phpzipcodelocator_do('http://www.phpzipcodelocator.com/beta/loading_effect.php?loadtime=1');
	}
	else
	{
		document.onload=phpzipcodelocator_do('list_results.php?countflag=1&ipflag=1&check=5&country1=' + escape(pzcl_ccountry) + '&username=' + escape(username));
	}
}
else
{
	if (navigator.appName.indexOf('Microsoft') != -1)
	{	
	}
	//alert(navigator.userAgent);
	else
	{
		document.onload=phpzipcodelocator_do('http://www.phpzipcodelocator.com/beta/loading_effect.php?loadtime=1');
	}
}