function ToggleCB( CB ) {
	var MYCB = eval( "document." + CB );
	if( MYCB.checked == true ) {
		MYCB.checked = false;
	} else {
		MYCB.checked = true;
	}
}


function ToggleRadio( RADIONAME , POSITION ) {
	eval( "document." + RADIONAME + "[" + POSITION + "].checked=true" );
}


//# - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - #
//
// Functions to pop up the bigger picture in a new window.

function PopUp( URL , Name , X , Y , Xoff , Yoff ) {
	if( ! Xoff ) { Xoff = 25; }
	if( ! Yoff ) { Yoff = 25; }
	var newWindow = window.open( URL , Name , "screenX=" + Xoff + ",left=" + Xoff + ",screenY=" + Yoff + ",top=" + Yoff + ",width=" + X + ",height=" + Y + ",scrollbars=yes,resizable=yes,location=yes,toolbar=yes" , false );
	newWindow.focus();
}

function PopUpStorePic( myPic ) {
	var myURL = ( "/cgi-bin/p/ewdp-showpic.cgi?p=" + myPic );
	var PreviewWindow = window.open( myURL , "storepic" , "width=600,height=600,top=25,left=50,screenX=50,screenY=25,resizable" , false );
	PreviewWindow.focus();
}

function PopUpScrapbook ( myPic, width, height ) {
	var myURL = ( "/cgi-bin/p/ewdp-showpic.cgi?p=" + myPic );
	var PreviewWindow = window.open( myURL , "mypic" , "width=" + width + ",height=" + height + ",top=25,left=50,screenX=50,screenY=25,resizable" , false );
	PreviewWindow.focus();
}


//# - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - #


function VFGB() {
	var Mesg = "";
	if( ! document.guestbook.name.value ) {
		Mesg += "      + Please fill in the NAME field          \n";
	}
	if( document.guestbook.subscribe ) {
		if( document.guestbook.subscribe.checked ) {
			if( ! ValidEmail( trim( document.guestbook.email.value ) ) ) {
				Mesg += "      + You must supply email address to subscribe      \n";
			}
		}
	}
	if( Mesg ) {
		alert( "\n\n    The form cannot be submitted:          \n\n" + Mesg + "\n\n" );
		return false;
	} else {
		document.guestbook.thing.value="desmond";
		return true;
	}
}


//# - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - #


function VFServicePublic() {
	var Mesg = "";
	var GoodEmail = 1;
	var GoodPhone = 1;

	// validate that there's a name.

	if( ! document.service.name.value ) {
		Mesg += "      Please fill in the NAME field.          \n";
	}

	// validate that there's a phone number.

	if( ! document.service.phone.value ) {
		GoodPhone = 0;
	}

	// validate that if there's an email entered that it looks valid...

	if( ( ! document.service.email.value ) || ( ! document.service.email.value.match( /^[\w\.-_]+@[^\.][\w\.]+$/ ) ) | ( ! document.service.email.value.match( /\.[a-zA-Z]{2,}$/ ) ) ) {
		GoodEmail = 0;
	}

	if( GoodPhone + GoodEmail == 0 ) {
		Mesg += "      Please fill in either the PHONE or EMAIL field.          \n";
	}

	if( ! document.service.service.value ) {
		Mesg += "      Please fill in the SERVICES NEEDED area.          \n";
	}

	if( Mesg ) {
		alert( "\n\n    The form cannot be submitted:          \n\n" + Mesg + "\n\n" );
		return false;
	} else {
		document.service.thing.value = "desmond";
		return true;
	}
}


//# - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - #

function SetRfpEmail() {
	var myCookie = document.cookie;
	var Pos = myCookie.indexOf( "rfp=" );
	if( Pos != -1 ) {
		var start = Pos + 4;
		var end = myCookie.indexOf( ";" , start );
		if( end == -1 ) end = myCookie.length;
		var value = myCookie.substring( start , end );
		document.rfp.email.value=value;
	}
}



function VFRfp() {
	var Email = trim( document.rfp.email.value );
	if( ! ValidEmail( Email ) ) {
		alert( "Cannot submit without the email address.      \n" );
		return false;
	} else {
		document.cookie = "rfp=" + Email + ";path=/; expires=Friday, 12-Dec-25 05:06:00;";
		return true;
	}
}

//# - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - #


function ValidEmail( Email ) {
	if( ( ! Email ) | ( ! Email.match( /^[\w\.-_]+@[^\.][\w\.]+$/ ) ) | ( ! Email.match( /\.[a-zA-Z]{2,}$/ ) ) ) {
		return false;
	} else {
		return true;
	}
}


//# - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - #


function trim( myStr ) {
	myStr = myStr.replace( /^\s+/ , "" );
	myStr = myStr.replace( /\s+$/ , "" );
	return myStr;
}

//# - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - #


function HL( Row , Color ) {
	document.getElementById( Row ).bgColor=Color;
}


//# - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - #


function UHL( Row , Color ) {
	document.getElementById( Row ).bgColor=Color;
}

//# - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - #
//# - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - #


