// JavaScript Document
//Public Javascript

function searchOn(obj){
	if (obj.value == "- Search the Site -"){
		obj.value = '';	
	}
}

function searchOff(obj){
	if (obj.value == ""){
		obj.value = '- Search the Site -';
	}
}

function newsletterOn(obj){
	if (obj.value == "- Your Email Address -"){
		obj.value = '';	
	}
}

function newsletterOff(obj){
	if (obj.value == ""){
		obj.value = '- Your Email Address -';
	} else if (!isEmailAddress(obj.value)){
		alert('That is not a valid email format. Please re-enter your email address');
		obj.value = '- Your Email Address -';
	}
}

function isEmailAddress(str) {
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        return false;
    } else {
        return true;
    }
}

function showHide(hideLayer, showLayer)
{
	var hider=document.getElementById(hideLayer);	
	var shower=document.getElementById(showLayer);
	hider.className='hidetext';
	shower.className='showtext';
}

function invert_display(elem){
	var obj = document.getElementById(elem);
	if (obj){
		if (obj.style.display=='none'){
			obj.style.display = 'block';
		} else {
			obj.style.display = 'none';
		}
	}
}
