var _defaultLocation = '';
var hwCallBackHandleLocations = {
	getGeoIPLocation:function(result)
	{
		if(result['userdefaultlocation'] != "")
		{
			if((result['userdefaultlocation'] != "undefined") && (result['userdefaultlocation'] != null))
			{
				//$('location').value = result['userdefaultlocation'];
				setDefaultLocationParams(result['userdefaultlocation']);
				_defaultLocation = result['userdefaultlocation'];
			}
		}
		$('defaultlocation').checked = result['isuserdefaultlocation'];
	}
}

var remoteHandleLocations = new handleLocations(hwCallBackHandleLocations);

function getLocationInformation()
{
	remoteHandleLocations.getGeoIPLocation();
}

function setDefaultLocationParams(_location_params)
{
	var _country_name =_location_params['country_name'];
	var _state_name =_location_params['state_code'];
	var _country = $('country_code');
	var _state = $('state_code');
	var _city = $('city_name');
	var cnt = 0;

/*	for(cnt=0; cnt<_country.options.length; cnt++)
	{
		if(_country.options[cnt].value.toLowerCase() == _country_name.toLowerCase())
		{
			_country.options[cnt].selected = true;
			var selected_country = _country.options[cnt].value;
			break;
		}
	}
	loadStates(_country);
	if(_country_name == 'USA')
	{
		for(cnt=0; cnt<_state.options.length; cnt++)
		{
			if(_state.options[cnt].value.toLowerCase() == _state_name.toLowerCase())
			{
				_state.options[cnt].selected = true;
				break;
			}		
		}
		$('lblStates').style.display = '';
		$('comboStates').style.display = '';			
	}else
	{
		$('lblStates').style.display = 'none';
		$('comboStates').style.display = 'none';		
	}*/
//	_city.value = _location_params['city_name'];
	_city.value = _location_params['locationdisplay'];
}