<!-- Idea by:  Nic Wolfe -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- pop up window treatment
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=440,height=550,left = 383,top = -16');");
}
var gscr ='crwindow';
function popUpcr(URL) {
day = new Date();
id = day.getTime();
eval("crwindow = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=440,height=550,left = 383,top = -16');");

var	newColor = '<a href="" onClick="javascript:closewindow(\'coolroof_popup.html\')" style="color:#426638;" >Cool Roof Finishes</a>';
document.getElementById("cr").innerHTML = newColor;
}
// End -->
function closewindow(URL){
	var p = 'crwindow';
crwindow.close();
var	newColor = '<a href="" onClick="javascript:popUpcr(\'coolroof_popup.html\')">Cool Roof Finishes</a>';
document.getElementById("cr").innerHTML = newColor;
 
}
<!-- rollover div

function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}
//-->


<!-- validate email
function isValidText(str,regex)
{
	if (window.RegExp){
		if (typeof(regex)=='string')
			regex=new RegExp(regex);
		return regex.test(str);
	}else{
		window.alert("RegExp not available!");
		return true;
	}
}


function isEMailAddress(str)
{
		return isValidText(str,"^([\\w\\._-]+)@([\\w_-]+\\.)+([\\w_]+)$");
}


// -->

<!-- form validation onsubmit

	function validate(){
		if(document.contactform.first_name.value==""){
			window.alert("Please enter your first name.");
			document.contactform.first_name.focus();
			return false;
		}
		if(document.contactform.last_name.value==""){
			window.alert("Please enter your last name.");
			document.contactform.last_name.focus();
			return false;
		}
		if(document.contactform.address.value==""){
			window.alert("Please enter your street address.");
			document.contactform.address.focus();
			return false;
		}
		if(document.contactform.city.value==""){
			window.alert("Please enter your city.");
			document.contactform.city.focus();
			return false;
		}
		if(document.contactform.state.value==""){
			window.alert("Please enter your state.");
			document.contactform.state.focus();
			return false;
		}
		if(document.contactform.postal_code.value==""){
			window.alert("Please enter your postal code.");
			document.contactform.postal_code.focus();
			return false;
		}
		if(!isEMailAddress(document.contactform.email.value)){
			window.alert("Please enter a valid email address.");
			document.contactform.email.focus();
			return false;
		}
		if(document.contactform.work_phone.value==""){
			window.alert("Please enter your work phone.");
			document.contactform.work_phone.focus();
			return false;
		}
		return true;
	}


//-->

