function show_dom(id) {
	x = document.getElementById(id);
	x.style.display = '';
}

function hide_dom(id) {
	x = document.getElementById(id);
	x.style.display = 'none';
}

function toggle_doms(id1, id2) {
	toggle_dom(id1);
	toggle_dom(id2);
}

function toggle_dom(id) {
	x = document.getElementById(id);
	if (x.style.display == 'none') {	
		show_dom(id);
	}else {
		hide_dom(id);
	}
}

function check_date_field(e) {
	var field = document.getElementById("date")
	var val = field.value
	
	if (window.event) {
		val+=e.keyCode;
	}else if (e.which) {	
		val+=e.which;
	}
		
	if (!val.match(/^((\d\d\d\d)|(0*))$/)) {	
		field.style.backgroundColor = '#FCC;';
		return false;
	}else {
		field.style.backgroundColor = 'white;';
		return true;
	}
}


function validate_advsearch() {
	return true;
	return (check_date_field());
}

function check_event(e, n) {
	var characterCode; 
	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e;
		characterCode = e.which; //character code is contained in NN4's which property
	} else {
		e = event;
		characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}

	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		document.forms[n].submit(); //submit the form
		return false;
	} else{
		return true;
	}
}

function validate_email(email) {
	return email.matches(/hello/);
//	return email.matches(/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i);
}
