function trim(trimStr) {
	trimStr = trimStr.replace( /^\s*/, "" )
	trimStr = trimStr.replace( /\s*$/, "" );
	return trimStr;
}
function imagesWindow(url,w,h,text) {
	if (!w) {
		w = "670"
	} else {
		w = w+30
	}
	if (!h) {
		h = "530"
	} else {
		h = h+50
	}
	if (!text) text = "Friendship Ride - Image Viewer"
	newWindow = window.open("/images/images.cgi?img="+url+"&desc="+text,"shots","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=" + w +",height=" + h);
}
function imagesScrollWindow(url,desc,w,h) {
	if (!w) w = "640"
	if (!h) h = "480"
	if (desc) desc = "&desc="+desc
	newWindow = window.open("/images/images.cgi?img="+url+desc,"shots","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + w +",height=" + h);
}
function galleryWindow(gallery,img,dim) {
	if (!dim) {
		w = 670;
		h = 531;
	} else {
		w = 510;
		h = 691;
	}
   if (navigator.userAgent.indexOf("MSIE 7") != -1) {
		h = h + 4;
	}
	newWindow = window.open("/gallery/gallery_viewer.cgi?src="+gallery+"&img="+img,"shots","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=" + w +",height=" + h);
}
function checkContactForm() {
	//check for name password
	var name = trim(document.getElementById("name").value);
	if (!name) {
      document.getElementById("name").focus();
		alert("Please provide your name.");
      return false;
	}
	//check for email
	var regExp = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
	var email = trim(document.getElementById("email").value);
	var resluts = regExp.exec(email);
	if (!resluts) {
      document.getElementById("email").focus();
		alert("Pleaes enter a valid email address.");
      return false;
	}
	//check for comments
	var comments = trim(document.getElementById("comments").value);
	if (!comments) {
		document.getElementById("comments").focus();
		alert("Please provide your comments.");
      return false;
	}
   return true;
}
function checkListForm() {
	//check for email
	var regExp = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
	var email = trim(document.getElementById("email_list").value);
	var resluts = regExp.exec(email);
	if (!resluts) {
      document.getElementById("email_list").focus();
		alert("Pleaes enter a valid email address.");
      return false;
	}
   return true;
}
