function showhide(div_id) {
	var message = document.getElementById(div_id);	
		
	if(message.style.display == "none" || message.style.display=="") 
	{
		message.style.display = "block"; 		
	}
	else 
	{
		message.style.display = "none";		
	}
}
function show(div_id) {
	var message = document.getElementById(div_id);	
	message.style.display = "block"; 		
}

function hide(div_id) {
	var message = document.getElementById(div_id);	
	message.style.display = "none";			
}



function validate() {
	var query = document.getElementById("headerId").query.value;
	if(query == "" || query == "Member name") {
		alert("Please enter the member's name to search.");
		return false;
	}
	else
	{
		return true;
	}
}

function checkVote() {
  if (document.vote.answers == "") {
    alert ('Please select an answer before voting');
 }
}

function checkForm() {

 if (document.login.email.value == "")
	{
		alert('Please enter your email address');
		return false;
	}	
// else if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.login.email.value))
	//{
		//alert('Please enter a valid email address');
		//return false;
	//}
 else if (!(document.login.password.value.match(/^[a-zA-Z0-9]+$/)))
	{
		alert('Password can contain letters and numbers only');
		return false;
	}		
	return true;	
}

function openHRBWin() {
	window.open("hrb-form.php","window","width=450,height=250,left=100,top=100,location=0,menubar=0,scrollbars=1,status=0,titlebar=1,toolbar=0");
}

function openBenefitsWin() {
	window.open("benefits.php","window","width=630,height=400,left=50,top=50,location=0,menubar=0,scrollbars=1,status=0,titlebar=1,toolbar=0");
}

function openMembershipWin() {
	window.open("membership.php","window","width=630,height=300,left=50,top=50,location=0,menubar=0,scrollbars=1,status=0,titlebar=1,toolbar=0");
}

function openTermsWin() {
	window.open("terms.php","window","width=630,height=400,left=50,top=50,location=0,menubar=0,scrollbars=1,status=0,titlebar=1,toolbar=0");
}

function openPrivacyWin() {
	window.open("privacy.php","window","width=630,height=400,left=50,top=50,location=0,menubar=0,scrollbars=1,status=0,titlebar=1,toolbar=0");
}

function openTermsWin2() {
	window.open("../terms.php","window","width=630,height=400,left=50,top=50,location=0,menubar=0,scrollbars=1,status=0,titlebar=1,toolbar=0");
}

function openPrivacyWin2() {
	window.open("../privacy.php","window","width=630,height=400,left=50,top=50,location=0,menubar=0,scrollbars=1,status=0,titlebar=1,toolbar=0");
}

function openWhosInside() {
	window.open("../whos-inside.php","window","width=530,height=500,left=50,top=50,location=0,menubar=0,scrollbars=1,status=0,titlebar=1,toolbar=0");
}

function openSampleWin() {
	window.open("sample.php","window","width=430,height=520,left=50,top=50,location=0,menubar=0,scrollbars=1,status=0,titlebar=1,toolbar=0");
}

function openTarget (form, features, windowName) {
  if (!windowName)
    windowName = 'formTarget' + (new Date().getTime());
  form.target = windowName;
  open ('', windowName, features);
}

function doregion(region_div, no_region_div)
{
	if (document.register.country.value == "United Kingdom")
	{
		document.getElementById(region_div).style.display = "block";
		document.getElementById(no_region_div).style.display = "none";
	}
	else
	{
		document.getElementById(region_div).style.display = "none";
		document.getElementById(no_region_div).style.display = "block";
	}
}

function popup() {
	window.open('login-error.php','LoginError','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=250,height=140,left=100,top=100');
}

