//********************** DO NOT MODIFY THIS ******************************* //

var message="Photos and other materials at this website are protected by copyright law.\nPlease contact me regarding the use of these images.";

function jumpto(page){
	window.location.href=page;
}


var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable,status=1'
win = window.open(mypage,myname,settings)
}



///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")


var maxW,maxH,fromX,fromY,toX,toY,adjX,adjY,zBox,zStep=0,zLink,zNew;

function zoomBox(evt,zlink,maxw,maxh,tox,toy) {
if (arguments.length > 2) zNew=1;
scrollH=(window.pageYOffset!=null)?window.pageYOffset:document.body.scrollTop;
maxW=maxw?maxw:window.innerWidth?innerWidth:document.body.clientWidth;
maxH=maxh?maxh:window.innerHeight?innerHeight:document.body.clientHeight;
toX=tox?tox:0;
toY=(toy?toy:0)+scrollH;
fromX=evt.pageX?evt.pageX:evt.clientX;
fromY=(evt.pageY?evt.pageY:evt.clientY)+(document.all?scrollH:0);
adjX=toX+evt.screenX-fromX;
adjY=toY+evt.screenY-fromY;
if (document.createElement && document.body.appendChild && !zBox) {
	zBox=document.createElement("div");
	zBox.style.position="absolute";
	document.body.appendChild(zBox);
} else if (document.all && !zBox) {
	document.all[document.all.length-1].outerHTML+='<div id="zBoxDiv" style="position:absolute"></div>';
	zBox=document.all.zBoxDiv;
} else if (document.layers && !zBox) {
	zBox=new Layer(maxW);
	zBox.style=zBox;
	}
zLink=zlink;
doZoom();
}

function doZoom() {
zStep+=1;
zPct=(10-zStep)/10
if (document.layers) {
	zBox.moveTo(toX+zPct*(fromX-toX),toY+zPct*(fromY-toY));
	zBox.document.open();
	zBox.document.write("<table width='"+maxW*(1-zPct)+"' height="+maxH*(1-zPct)+" border=2 cellspacing=0><tr><td></td></tr></table>");
	zBox.document.close();
	} else {
	zBox.style.border="2px solid #999999";
	zBox.style.left=toX+zPct*(fromX-toX);
	zBox.style.top=toY+zPct*(fromY-toY);
	zBox.style.width=maxW*(1-zPct);
	zBox.style.height=maxH*(1-zPct);
	}
zBox.style.visibility="visible";
if (zStep < 10) setTimeout("doZoom("+fromX+","+fromY+","+toX+","+toY+")",30);
else {
	zBox.style.visibility='hidden';
	zStep=0;
	if (zLink && !zNew) location.href=zLink.href;
	else if (zLink && zNew) {
		var w=window.open(zLink.href,'','width='+maxW+',height='+maxH+',left='+adjX+',top='+adjY+',scrollbars=yes,resizable=yes');
		zNew=null;
		}
	}
}
// ************************************************************************************************** //





// CHECK FOR VALID EMAIL ADDRESS
function check_email(e) {
ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

for(i=0; i < e.length ;i++){
if(ok.indexOf(e.charAt(i))<0){ 
return (false);
}	
} 

if (document.images) {
re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
if (!e.match(re) && e.match(re_two)) {
return (-1);		
 } 
}

}


function validpostcard(){
var f = document.forms[0];
if(f.your_name.value==""){
alert("Please enter your name.     ");
f.your_name.focus();
return false;
}

if(f.your_email.value==""){
alert("Please enter your email address.    ")
f.your_email.focus();
return false;
}

if(f.your_email.value != ""){   
// check the first email address ( the exclamation means "not" )
if(!check_email(f.your_email.value)){
alert("Please enter a valid email address.    ");
f.your_email.focus();
return false;
 }
}

if(f.fr_name.value==""){
alert("Please enter your friend's name.    ");
f.fr_name.focus();
return false;
}

if(f.fr_email.value==""){
alert("Please enter your friend's email address.\t");
f.fr_email.focus();
return false;
}

if(f.fr_email.value != ""){   
// check the first email address ( the exclamation means "not" )
if(!check_email(f.fr_email.value)){
alert("Please enter a valid email address.    ");
f.fr_email.focus();
return false;
 }
}


if(f.message.value==""){
	alert("Please enter your message.        ");
	f.message.focus();
	return false;
}



}

function signguestbook(){
var f = document.forms[0];
if(f.name.value==""){
alert("Please enter your name.   ")
f.name.focus();
return false;
}

if(f.email.value != "") {
		if(!check_email(f.email.value)){
			alert("Please enter a valid email address.    ");
			f.email.focus();
			return false;
 		}
}


if(f.comments.value==""){
alert("Please enter a comment.   ")
f.comments.focus();
return false;
}
}



function CloseGBook(){
window.opener.location.href='guestbook.cfm';
window.close();
}

function subscribe(){
f = document.subscribeForm;
if(f.fname.value==""){
alert("Please enter your first name.      ");
f.fname.focus();
return false;
}
if(f.lname.value==""){
alert("Please enter your last name.       ");
f.lname.focus();
return false;
}

if(f.email.value==""){
alert("Please enter your email address.      ")
f.email.focus();
return false;
}

if(f.email.value != ""){   
// check the first email address ( the exclamation means "not" )
if(!check_email(f.email.value)){
alert("Please enter a valid email address.    ");
f.email.focus();
return false;
 }
}
/*
if(f.password.value==""){
alert("Please enter your password. Your password must contain a minimum of 5 characters.  ");
f.password.focus();
return false;
}

if(f.password.value.length<5){
alert("Please enter your password. Your password must contain a minimum of 5 characters.  ");
f.password.focus();
return false;
}

if(f.confirm_password.value!=f.password.value){
alert("Your passwords do not match. Please retype your password.");
f.confirm_password.focus();
return false;
}
*/

}

function validGalleryLogin(){
	f=document.forms[0];
	if(f.password.value==""){
		alert("Please enter the password for this gallery.     ");
		f.password.focus();
		return false;
	}
}


function validPasswordRequest(){
f = document.forms[0];
if(f.email.value==""){
alert("Please enter your email address.     ");
f.email.focus();
return false;
}
if(f.email.value != ""){   
// check the first email address ( the exclamation means "not" )
if(!check_email(f.email.value)){
alert("Please enter a valid email address.    ");
f.email.focus();
return false;
 }
}

}


function goslideshow(speed,galleryid){
 	var url = 'slideshow.cfm?galleryid=' + galleryid + '&speed=' + speed;
	NewWindow(url,'SlideShow','650','450','1');
}


function leaveMessage(){
	f = document.forms[0];
	if(f.from_name.value==""){
		alert("Please enter your name.       ");
		f.from_name.focus();
		return false;
	}
	
	if(f.from_email.value != ""){   	
		if(!check_email(f.from_email.value)){
		alert("Please enter a valid email address.    ");
		f.from_email.focus();
		return false;
	    }
	}
	
	if(f.message.value==""){
		alert("Wouldn't you like to leave me a message?      ");
		f.message.focus();
		return false;
	}
	
}

