function setToAny(cboSrc, cboDstName) {
	var cboDst = document.getElementById(cboDstName);
	
	if (cboSrc.selectedIndex==0) {
		cboDst.selectedIndex=0;
	}
}

function onCountryChange() {
	var _frm = document.getElementById("frm");
	try {
		nvld = document.createElement('<input type="hidden" id="nvld" name="nvld" value="1" />');
	}
	catch(err){  
		nvld = document.createElement('input');
	}
	nvld.setAttribute('type','hidden');
	nvld.setAttribute('id',  'nvld');
	nvld.setAttribute('name','nvld');
	nvld.setAttribute('value','1');
	
	_frm.appendChild(nvld);
	_frm.method = "GET";
	_frm.action = "/search/SimpleDatingMatrimonialAndFriendshipSearch.jsp";
	_frm.submit();
}

function onCountryChangeToInvoker(sFormAction, resetRegion) {
	var _frm = document.getElementById("frm");
	try {
		nvld = document.createElement('<input type="hidden" id="nvld" name="nvld" value="1" />');
	}
	catch(err){  
		nvld = document.createElement('input');
	}
	nvld.setAttribute('type','hidden');
	nvld.setAttribute('id',  'nvld');
	nvld.setAttribute('name','nvld');
	nvld.setAttribute('value','1');
	
	_frm.appendChild(nvld);
	
	if (resetRegion==true) {
    	document.getElementById("Region").value = "";
    }
    
	_frm.method = "GET";
	_frm.action = sFormAction;
	_frm.submit();
}

function window_onSubmit_checkAge() {
	var iMin = parseInt(document.getElementById("MinAge").value, 10);
	var iMax = parseInt(document.getElementById("MaxAge").value, 10);
	
	if (iMax < iMin) {
		alert("Maximum age must be greater than or equal to minimum age");
		f.MaxAge.focus();
		return false;
	}
	return true;
}

function window_onSubmit_checkAgeHeight() {
	if (window_onSubmit_checkAge()==false) { return false; }
	
	iMin = parseInt(document.getElementById("MinHeight").value, 10);
	iMax = parseInt(document.getElementById("MaxHeight").value, 10);
	if (iMax < iMin) {
		alert("Maximum height must be greater than or equal to minimum height");
		return false;
	}
	return true;
}

function window_onSubmit_checkAgeHeightWeight() {
	if (window_onSubmit_checkAgeHeight()==false) { return false; }
	
	iMin = parseInt(document.getElementById("MinHeight").value, 10);
	iMax = parseInt(document.getElementById("MaxWeight").value, 10);
	if (iMax < iMin)  {
		alert("Maximum weight must be greater than or equal to minimum weight");
		return false;
	}
	return true;
}

function gotoSavedSearch() {
	window.location.href='/servlet/search/SavedSearches?nvld=1#selectSearch';
}
