function flip(strDiv) {
	if (document.all) {
		if ((document.all[strDiv].style.display == 'none') || (document.all[strDiv].style.display == '')) {
			document.all[strDiv].style.display = 'block';
		} else {
			document.all[strDiv].style.display = 'none' ;
		}
	} else if (document.getElementById) {
		if ((document.getElementById(strDiv).style.display == 'none') || (document.getElementById(strDiv).style.display == '')) {
			document.getElementById(strDiv).style.display = 'inline';
		} else {
			document.getElementById(strDiv).style.display = 'none';
		}
	}
}

function check(objItem, strDiv, strSel) {
	if (objItem.value == strSel) {
		flip(strDiv);
	}
}

function checkIndex(objItem, strDiv, strSel) {
	if (objItem.selectedIndex == strSel) {
		flip(strDiv);
	}
}

function checkValue(objItem,strDiv,intVal) {
	if (objItem.value >= intVal) {
		flip(strDiv);
	}
}

function checkValue1(objItem,strDiv,intVal) {
	if (objItem.value <= intVal) {
		flip(strDiv);
	}
}

function navFlip(strName,strState) {
	if (strState == 'on') {
		document.images[strName].src = eval("nav_"+strName+"_on.src");
	} else {
		document.images[strName].src = eval("nav_"+strName+".src");
	}
}

// preload images for nav
nav_home = new Image(); nav_home.src = '/cobrand/ConnectionClub/nav/images/nav_home.gif'; nav_home_on = new Image(); nav_home_on.src = '/cobrand/ConnectionClub/nav/images/nav_home_on.gif';
nav_about = new Image(); nav_about.src = '/cobrand/ConnectionClub/nav/images/nav_about.gif'; nav_about_on = new Image(); nav_about_on.src = '/cobrand/ConnectionClub/nav/images/nav_about_on.gif';
nav_dating = new Image(); nav_dating.src = '/cobrand/ConnectionClub/nav/images/nav_dating.gif'; nav_dating_on = new Image(); nav_dating_on.src = '/cobrand/ConnectionClub/nav/images/nav_dating_on.gif';
nav_matchmaking = new Image(); nav_matchmaking.src = '/cobrand/ConnectionClub/nav/images/nav_matchmaking.gif'; nav_matchmaking_on = new Image(); nav_matchmaking_on.src = '/cobrand/ConnectionClub/nav/images/nav_matchmaking_on.gif';
nav_act = new Image(); nav_act.src = '/cobrand/ConnectionClub/nav/images/nav_act.gif'; nav_act_on = new Image(); nav_act_on.src = '/cobrand/ConnectionClub/nav/images/nav_act_on.gif';
nav_store = new Image(); nav_store.src = '/cobrand/ConnectionClub/nav/images/nav_store.gif'; nav_store_on = new Image(); nav_store_on.src = '/cobrand/ConnectionClub/nav/images/nav_store_on.gif';
nav_faq = new Image(); nav_faq.src = '/cobrand/ConnectionClub/nav/images/nav_faq.gif'; nav_faq_on = new Image(); nav_faq_on.src = '/cobrand/ConnectionClub/nav/images/nav_faq_on.gif';

function validateEmail(email) {
	// a very simple email validation checking. 
	// you can add more complex email checking if it helps
	// function borrowed from Author : Prasanth M J
	var splitted = email.match("^(.+)@(.+)$");
	if(splitted == null) return false;
	if(splitted[1] != null ) {
		var regexp_user=/^\"?[\w-_\.]*\"?$/;  // " 
		if(splitted[1].match(regexp_user) == null) return false;
	}
	if(splitted[2] != null)	{
		var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
		if(splitted[2].match(regexp_domain) == null) {
			var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
			if(splitted[2].match(regexp_ip) == null) return false;
		}
		return true;
	}
	return false;
}				

// lets make sure the email domain isnt ours and the name isn't something we don't want
function validateDomain(field) {
	var mask = /@connectionclub.com/i;
	if (mask.test(field.value)) {
		alert('Invalid domain, sorry, try again!');
		return false;
	}
	var mask2 = /^(root|abuse|webmaster|help|postmaster|sales|resumes|contact|advertising)@/i;
	if (mask2.test(field.value)) {
		alert('This email address is not permitted here, please choose another.');
		return false;
	}
	return true;
}