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";
		
		if (id == 'frame')
		{
			hide('core-popup');
			hide('lightbox');
		}
		
		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";
		
		if (id == 'frame')
		{
			show('core-popup');
			show('lightbox');
		}
		
		return true;
	} else {
		return false;
	}
}

function showPopup() {
	var popup = document.getElementById('core-popup');
	
	if (popup) {
		popup.style.display = '';
	}
}

function hidePopup() {
	var popup = document.getElementById('core-popup');
	
	if (popup) {
		popup.style.display = 'none';
	}
}


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();
}

function emailPopup() {
	x = (screen.width / 2) - 340;
	y = (screen.height / 2) - 255;
	newWindow = window.open('http://www.singlesnet.com/?setlocation=help&setarea=membership_popup#email','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 show_core_form() {
	window.clearTimeout(window.coreTimer);
	
	document.getElementById('lightbox').style.display = '';
	document.getElementById('core-popup').style.display = '';
}

function start_timer() {
	window.coreTimer = window.setTimeout(show_core_form, 2000);
}

