var frmnameobj;
var countryobj;
var stateobj;
var objcitychar;
var objcity;
var browser_type = false;
//alert(window.navigator.vendor)
//if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1)
if (window.navigator.vendor=="Firefox" || !window.navigator.vendor)
{
	browser_type = true;
}


//--------	FETCH STATE LIST  --------//
function fetchstatelist(frmnameobj,countryobj,stateobj,objcitychar,objcity)
{
	//alert(stateobj.name);
	this.frmnameobj=frmnameobj;
	this.countryobj=countryobj;
	this.stateobj=stateobj;
	this.objcitychar=objcitychar;
	this.objcity=objcity;
	
	if(countryobj.value != "")
	{
		this.stateobj.disabled=false;
		this.objcitychar.disabled=false;
		this.objcity.disabled=false;
		if(stateobj.value == "")
		{
			this.objcitychar.disabled=true;
			this.objcity.disabled=true;
		}
		else
		{
			this.objcitychar.disabled=false;
			this.objcity.disabled=false;
		}
		//alert(this.countryobj.name + ":" + this.stateobj.name)
		if(browser_type)
		{
			fsm.style.display = "block";
		}
		this.stateobj.options[0].value="";
		this.stateobj.options[0].text="Wait, State List is being fetched...";
		var selval=this.countryobj.options[this.countryobj.selectedIndex].value;
		pagename="statelist/" + selval + "/states.xml";
		fldname="s";
		ifrm_fetch.location="state_city_xml.php?fldname=" + fldname + "&pagename=" +pagename+ "&frmname=" + this.frmnameobj.name + "&state_city=" + this.stateobj.name;
	}
	else
	{
		this.stateobj.disabled=true;
		this.objcitychar.disabled=true;
		this.objcity.disabled=true;
	}
}

//--------	FETCH CITY LIST  --------//
function fetchcitylist(frmnameobj,countryobj,stateobj,objcitychar,objcity)
{
	this.frmnameobj=frmnameobj;
	this.countryobj=countryobj;
	this.stateobj=stateobj;
	this.objcitychar=objcitychar;
	this.objcity=objcity;
	var selstate=this.stateobj.options[this.stateobj.selectedIndex];
	var selcountry=this.countryobj.options[this.countryobj.selectedIndex];
	var selcitychar=this.objcitychar.options[this.objcitychar.selectedIndex];
	
	//alert(selstate.value);
	
	if(selstate.value == "")
	{
		this.objcitychar.disabled=true;
		this.objcity.disabled=true;
	}
	else
	{
		this.objcitychar.disabled=false;
		this.objcity.disabled=false;
	}
	if(selstate.value != "")
	{	
		if(browser_type)
		{
			fcm.style.display = "block";
		}
		this.objcity.options[0].value = "";
		this.objcity.options[0].text = "Wait, City List is being fetched...";
		
		pagename="splited/" + selcountry.value + "/" + selstate.value + "/" + selcitychar.value + ".txt";
		fldname="c";
		ifrm_fetch.location="state_city_xml.php?fldname=" + fldname + "&pagename=" +pagename+ "&frmname=" + this.frmnameobj.name + "&state_city=" + this.objcity.name;
	}
	if(selstate.value != "")
	{
		this.objcitychar.disabled=false;
		this.objcity.disabled=false;
	}
}
