var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	xmlhttp = new XMLHttpRequest();
}

function populate_form(){
	//age from
	el = document.getElementById("age_from");
	str = '<option value="">Any</option>';
	el.options[0] = new Option("Any", "", false, false);
	for(i=18;i<=100;i++){
		var opt = new Option(i, i, false, i == age_from);
		eval("el.options[i-17]=opt");
	}

	//age to
	el = document.getElementById("age_to");
	str = '<option value="">Any</option>';
	el.options[0] = new Option("Any", "", false, false);
	for(i=18;i<=100;i++){
		var opt = new Option(i, i, false, i == age_to);
		eval("el.options[i-17]=opt");
	}

	var inp = new Array('user_zip','keyword', 'type');
	for(i=0;i<inp.length;i++){
		document.getElementById(inp[i]).value = eval(inp[i]);
	}
	var sel = new Array('user_sex', 'user_dating', 'user_smoke', 'user_drink', 'country_id', 'user_job', 'user_religion', 'user_orientation', 'radius', 'display');
	for(i=0;i<sel.length;i++){
		el = document.getElementById(sel[i]);
		with(el)
		{
			for(j=0;j<options.length;j++)
			{
				if(options[j].value == eval(eval("sel[i]"))){
					selectedIndex = j;break;
				}
			}
		}
	}
	if((country_id == '31' ||country_id == '181' ||country_id == '182') && state_id != '')
	{
		get_state(document.getElementById('country_id'), state_id);
		if(county_id != '')
		{
			window.setTimeout('get_county(document.getElementById("state_id"), county_id)', 100);
		}
	}
}
function get_state(sel, curr)
{
	if(!sel) return;
	li	= document.getElementById('state_li');
	htm1 = document.getElementById('state_holder');
//	htm2 = document.getElementById('county_holder');
	if(sel.value == '31' || sel.value == '181' || sel.value == '182')
	{
		li.style.display = "block";
		htm1.innerHTML = '<blink>Loading ... please wait</blink>';
//		htm2.innerHTML = 'US, Canada & UK only(choose the country and state first)';
		xmlhttp.open("GET", '/include/ax/state_county.php?op=get_state&country_id=' + sel.value + '&curr='+curr,true);
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4) {
				var data = xmlhttp.responseText;
				htm1.innerHTML = data;
			}
		}
		xmlhttp.send(null);
	}
	else
	{
		li.style.display = "none";
		htm1.innerHTML = 'US, Canada & UK only(choose the country first)';
//		htm2.innerHTML = 'US, Canada & UK only(choose the country and the state first)';
	}
}
/*function get_county(sel, curr)
{
	if(!sel)
	{
		sel = document.getElementById('state_id');
		if(!sel)
		return;
	}

	htm2 = document.getElementById('county_holder');
	if(sel.value != '0')
	{
		htm2.innerHTML = '<blink>Loading ... please wait</blink>';
		xmlhttp.open("GET", '/include/ax/state_county.php?op=get_county&state_id=' + sel.value + '&curr='+curr, true);
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4) {
				var data = xmlhttp.responseText;
				htm2.innerHTML = data;
			}
		}
		xmlhttp.send(null);
	}
}*/