// JavaScript Document
function submitform(form){
	if (form.value.length == 0)
	{
	alert("Please enter a Measurement for this item");
	return false;
	} else {
	var x=form.value
    var anum=/(^\d+$)|(^\d+\.\d+$)/
    if (anum.test(x))
    return true;
    else{
    alert("Please input a valid Meassurement (numbers only)!")
    return false
    }
	}
    }
	

function contactform(form){	
var alertmessage = "Following Fields are required:\n\n";
var check = true;
	if (form.firstname.value.length == 0) { alertmessage = alertmessage + "First Name\n"; check = false;}
	if (form.lastname.value.length == 0) { alertmessage = alertmessage + "Last Name\n"; check = false; }
	
	//make sure the email is valid
    var EmailCorrect = false
	var theemail = form.email.value;
				for (var i = 0; i <= theemail.length; i++)
					{
 				if (theemail.charAt(i) == "@") {
				 EmailCorrect = true;
				 var marker = i;
				 }

				}

if (EmailCorrect == true){
for (var j = marker; j <= theemail.length; j++)
{
 if (theemail.charAt(j) != ".") {
 EmailCorrect = false
 } else {
 EmailCorrect = true
 j = theemail.length;
 }
 }
}
	
	
	if (EmailCorrect == false){alertmessage = alertmessage + "Valid Email Address\n"; check= false}
	if (form.comments.value.length == 0) { alertmessage = alertmessage + "Comments\n"; check = false;}

if (check == true){
	return check;
} else {
	alert(alertmessage);
	return check;
}

}
	
	
function image_viewer(image, title) {
imageViewer = window.open(title, "Enlarge" , "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,copyhistory=0,width=350,height=350");
imageViewer.document.open();
imageViewer.document.write("<html><head>");
imageViewer.document.write("<title>" + title + "</title>");
imageViewer.document.write("</head><body leftmargin=\"0\" topmargin=\"0\" bottommargin=\"0\" rightmargin=\"0\">");
imageViewer.document.write("<a href=\"javascript:window.close()\"><img src='" + image + "' border=0></a>");
imageViewer.document.write("</body></html>");
imageViewer.document.close();
    }
	
function loadad() {
imageViewer = window.open("AGA Mag", "Enlarge" , "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,copyhistory=0,width=400,height=597");
imageViewer.document.open();
imageViewer.document.write("<html><head>");
imageViewer.document.write("<title>AGA Mag</title>");
imageViewer.document.write("</head><body leftmargin=\"0\" topmargin=\"0\" bottommargin=\"0\" rightmargin=\"0\">");
imageViewer.document.write("<a href=\"javascript:window.close()\"><img src='images/agamag2006.jpg' border=0></a>");
imageViewer.document.write("</body></html>");
imageViewer.document.close();
    }