
function isvalidform(form) {

if ( // NC needs this syntax for select fields
  	form.language_1.options[form.language_1.selectedIndex].value == 'empty' &&
	form.country.options[form.country.selectedIndex].value == 'empty' && 
	form.sex.options[form.sex.selectedIndex].value == 'empty' &&
	form.age.options[form.age.selectedIndex].value == 'empty'
){
	alert ("Please enter at least one search criteria!");
  	return false;
} 

// country mandatory check
if (form.mandatory_country.checked == 1	&& 	form.country.options[form.country.selectedIndex].value == 'empty'){
	alert ("If you choose country to be mandatory,\nyou have to select the country you are searching for!");
	return false;
}

// province mandatory check
if (form.province){ // only if visible
	if (form.mandatory_province.checked == 1	&& 	form.province.options[form.province.selectedIndex].value == 'empty'){
		alert ("If you choose province to be mandatory,\nyou have to select the province you are searching for!");
		return false;
	}
}

// city mandatory check
if (form.city){ // only if visible
	if (form.mandatory_city.checked == 1	&& 	form.city.options[form.city.selectedIndex].value == 'empty'){
		alert ("If you choose city to be mandatory,\nyou have to select the city you are searching for!");
		return false;
	}
}

// sex mandatory check
if (form.mandatory_sex.checked == 1	&& 	form.sex.options[form.sex.selectedIndex].value == 'empty'){
	alert ("If you choose sex to be mandatory, you have to select male or female!");
	return false;
}

// age mandatory check
if (form.mandatory_age.checked == 1	&& 	form.age.options[form.age.selectedIndex].value == 'empty'){
	alert ("If you choose age to be mandatory,\nyou have to select the age range you are searching for!");
	return false;
}

// sex mandatory check
if (form.mandatory_language.checked == 1	&& 	form.language_1.options[form.language_1.selectedIndex].value == 'empty'){
	alert ("If you choose language to be mandatory,\nyou have to select the language you are searching for!");
	return false;
}

 // if everything is ok proceed the form
 return true;
}
//-------------------------------------------------------------------------------------------------------


// get citys where members are registered 
//-------------------------------------------------------------------------------------------------------
function go_country(host,country,language_1,age,sex,lm,sm,am,cm,pm){
	window.location.href = host+ 'subapp_community/index.php?fuseaction=search_members&country='+country+'&language_1='+language_1+'&age='+age+'&sex='+sex+'&lm='+lm+'&sm='+sm+'&am='+am+'&cm='+cm+'&pm='+pm
};
//-------------------------------------------------------------------------------------------------------


//-----------------------------------------------------------------------------------------------------------------
// mandatory check box set color or the input lines to mandatory or voluntary 

			function check_mandatory(box,table_id,color_mandatory,color_voluntary){
				
				// checkbox is checked set mandatory color
				if (box.checked) {
                    if (document.all){ // for IE 4
						document.all[table_id+'_1'].style.backgroundColor = color_mandatory;
						document.all[table_id+'_2'].style.backgroundColor = color_mandatory;
						document.all[table_id+'_3'].style.backgroundColor = color_mandatory;
					} // for IE6 and NN 6
                    else if (document.getElementById) 	document.getElementById[table_id+'_1'].style.backgroundColor = 'color_mandatory';}

				// checkbox is unchecked set voluntary color
				else{ 
					if (document.all){
						document.all[table_id+'_1'].style.backgroundColor = color_voluntary;
						document.all[table_id+'_2'].style.backgroundColor = color_voluntary;
						document.all[table_id+'_3'].style.backgroundColor = color_voluntary;
					} // for IE6 and NN 6
                    else if (document.getElementById) 	document.getElementById[table_id+'_1'].style.backgroundColor = 'color_voluntary';
				}
			}
//-----------------------------------------------------------------------------------------------------------------

