// Search Box validation.
function checkString(fld){
var error='';
if(fld.value.length < 2){fld.style.background='#CCCCCC';error='Please enter at least two characters!';}
else{fld.style.background='White';}
if(error!=''){alert(error);return false;}
window.location='about/history';return true;	
}

function trim(s){return s.replace(/^\s+|\s+$/,'');}

function Form_Validator(fld){
var error='',tfld=trim(fld.value), // value of field with whitespace trimmed off
emailFilter= /^[^@]+@[^@.]+\.[^@]*\w\w$/ ,illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ,bgColor='#CCCCCC';
if(fld.value==''){return false;}
else if(!emailFilter.test(tfld)){ // Make sure there's content after '@'
	fld.style.background=bgColor;error='Email address is invalid.';}
	else if(fld.value.match(illegalChars)){ //test email for illegal characters
	fld.style.background=bgColor;error='Email address contains illegal characters.';}
	else{fld.style.background='White';}
if(error!=''){alert(error);return false;}
return true;
}

 /*------- Toggle visibility of elements. -------- */
 	// For forms, if value of selection is 'chkValue', display given element.
function chkDisp(value,chkValue,element){
var d=document;
if(d.all)object=eval(element);
else if(d.getElementById)object=d.getElementById(element);
if(value!=''){
	if(value==chkValue) object.className='unhide';
	else object.className='hide';
}else{
	if (object.className=="hide") object.className="unhide";
	else object.className="hide";	
}
}
	// Toggle element view.
function view(id){
if(document.all) object=eval(id);
else if(document.getElementById)
	object=document.getElementById(id);
if (object.className=="hide") object.className="unhide";
else object.className="hide";
}
	// Show element
function show(id){
if(document.all) object=eval(id);
else if(document.getElementById)
	object=document.getElementById(id);
object.className="unhide";
}
	// Hide element
function hide(id){
if(document.all) object=eval(id);
else if(document.getElementById)
	object=document.getElementById(id);
object.className="hide";	
}