function submit_login() {
	document.login.submit();
}

function submit_signup() {
	document.signup_form.submit();
}

function get_cities() {
	document.signup_form.action = "get_cities.php";
	submit_signup();
}

function select_state() {
	document.signup_form.action = "index.php?choose_state";
	submit_signup();
}

function hide(id) {
	if (typeof(id) == "string") {
		var element = document.getElementById(id);
	} else {
		var element = id;
	}
	
	if (element) {
		element.style.visibility = "hidden";
		
		return true;
	} else {
		return false;
	}
}

function show(id) {
	if (typeof(id) == "string") {
		var element = document.getElementById(id);
	} else {
		var element = id;
	}
	
	if (element) {
		element.style.visibility = "visible";
		
		return true;
	} else {
		return false;
	}
}

function show_sub_item(parent) {
	// this gets called when the user clicks on a radio button
	// it shows and / or hides the relevant sub-section of the profile
	
	var alt_parent_val	= (parent.value == 0) ? '1' : '0';
	
	var child_id		= 'sub_' + parent.name + '_' + parent.value;
	var alt_child_id	= 'sub_' + parent.name + '_' + alt_parent_val;
	
	var child = document.getElementById(child_id);
	
	if (child) {
		child.style.display = '';
	}
	
	var alt_child = document.getElementById(alt_child_id);
	
	if (alt_child) {
		alt_child.style.display = 'none';
	}
}

function membershipPopup() {
	x = (screen.width / 2) - 340;
	y = (screen.height / 2) - 255;
	newWindow = window.open('http://www.singlesnet.com/?setlocation=help&setarea=membership_popup','membership_agreement','toolbar=no,location=no,scrollbars=yes,resizable=yes,status=no,menubar=no,titlebar=yes,width=400,height=395,left='+x+',top='+y);
	newWindow.focus();
}

function privacyPopup() {
	x = (screen.width / 2) - 340;
	y = (screen.height / 2) - 255;
	newWindow = window.open('http://www.singlesnet.com/?setlocation=help&setarea=privacy_popup','privacy','toolbar=no,location=no,scrollbars=yes,resizable=yes,status=no,menubar=no,titlebar=yes,width=400,height=395,left='+x+',top='+y);
	newWindow.focus();
}