/*
//Get the docroot form js Url
var scripts = document.getElementsByTagName("script");
var thisScript = scripts[scripts.length-1];
var thisScriptsSrc = thisScript.src;

 function get_hostname_from_url(url) {
     return url.match(/:\/\/(.[^/]+)/)[1];
 }
  
this.hostname = 'http://'+get_hostname_from_url(thisScriptsSrc);

// Ajax Basic Functions Starts here..
agent = navigator.userAgent;

*/

/*
  Function Name: loadcountry.
  Purpose      : load the city based on the Country.
*/

function loadcountry(country,city)
{
	if(document.getElementById('dynamiclocation')!=null)
	{
		document.getElementById('dynamiclocation').innerHTML=''; 
	}

	if(document.getElementById('shopnamelist')!=null)
	{
		document.getElementById('shopnamelist').innerHTML=''; 
	}

	if(document.getElementById('citytag')!=null)
	{
		document.getElementById('citytag').innerHTML=''; 
	}

	if(document.getElementById('edit_cm_citytag')!=null)
	{
		document.getElementById('edit_cm_citytag').innerHTML=''; 
	}
	 	
  if(country!='')
  {
	if(document.getElementById('citytag')!=null)
	{
		document.getElementById('citytag').innerHTML=''; 
	} 

	loadurl2("/includes/jloadstate.php",country,city,"dynamiclocation");
 }
 
}

/* trying first jquery ajax call. funk. */
function loadurl2(url,country,city,div) {
document.getElementById(div).innerHTML="";
$.ajax({
   type: "GET",
   url: url,
   data: "countrycode=" + country + "&citycode=" +city,
   success: function(msg){
   //i know there's probably a fancier way to do this with jquery but I don't know it yet. Just learning.
   document.getElementById(div).innerHTML=msg;
   }
 });
 }

 /* if skipping registration make sure we store the city
 he/she selected anyways. */
function skip_reg(url) {

var wcity = document.getElementById('subscription_division_id');
/* get the city ID */
var scity = wcity.options[wcity.selectedIndex].value;
url += "&cityid=" + scity;
//alert(url);
location.href=url;
 }
