<!-- Begin VIEWER AND POPUP SIZES AND OPTIONS CODE

// CHANGE ANY OF THESE VARIABLES FOR THE IMAGE VIEWER

//  use only lowercase on options

var viewer 		= "same"	// OPTIONS: | new | popup | same | New browser or a popup
var width 		= "750"		// WIDTH OF THE POPUP
var height 		= "625"		// WIDTH OF THE POPUP
var scrollbars		= "yes"		// SHOW SCROLLBARS IN POPUP - yes OR no
var menu		= "no"		// SHOW MENU IN POPUP - yes OR no
var tool		= "no"		// SHOW TOOLBAR IN POPUP - yes OR no

var rotate_delay 	= 6000; 	// AUTOPLAY SPEED - in milliseconds (5000 = 5 secs)

var right_click_on	= "yes"		// RIGHT CLICK PROTECTION ON
var block_imagebar	= "yes"		// BLOCK WINDOWS IMAGE TOOL BAR
var hide_status		= "no"		// HIDE LINK IN STATUS BAR

var status_text 	= "Welcome"	// TEXT IN THE STATUS BAR
var right_click_text	= "You may not right mouse click this page."	// RIGHT CLICK TEXT


// COPYRIGHT 2007 © Allwebco Design Corporation
// Unauthorized use or sale of this script is strictly prohibited by law

// YOU DO NOT NEED TO EDIT BELOW THIS LINE

// START IMAGE VIEW CODE

// declare and initialize the total number of images in the viewer-slideshow.htm file
var numImgs = "0" ;


function ViewImage(data) {
	
	// Parse current gallery & page
	var currentpath = window.location.pathname;
	var dot = currentpath.lastIndexOf(".");
	var length = currentpath.lastIndexOf("-");
	var gallIndx = currentpath.lastIndexOf("gallery");
	var galleryIndex = currentpath.substring( gallIndx+7, length );
	var currentpage = new Number(currentpath.substr( length+1, dot-length));
	imageIndex = new Number((currentpage-1)*9 + parseInt(data));
	
	// data will contain gallery number and image number, e.g. '1-1'
	data = galleryIndex  + '-' + imageIndex;
	
	
   	if (viewer == "popup") {
		windowHandle = window.open('viewer-slideshow.htm' + '?' + data,'windowName',',scrollbars='+scrollbars+',resizable=yes,toolbar='+tool+',menubar='+menu+',width='+width+',height='+height+'');
	}
	else if (viewer == "new") {
    	windowHandle = window.open('viewer-slideshow.htm' + '?' + data,'windowName');
	}
	else if (viewer == "same") {
    	window.location.href = ('viewer-slideshow.htm' + '?' + data);
	}
}



// END IMAGE VIEW CODE


// SLIDESHOW IMAGE CHANGER CODE

var galleryID ;
var galleryIndex ;
var imageIndex ;

function ShowImage() {
	// show the image and image number
	var SlideNumber = document.getElementById("SlideNumber");
	var SlideName = document.getElementById("SlideName");
	var SlideTitle = document.getElementById("SlideTitle");
	var galleryIndx = galleryIndex+1 ;
	var imageIndx = imageIndex+1;
	
	// update the image number "nn of TTT"
	SlideNumber.firstChild.nodeValue = imageIndex+1 ;
	
	// change the slide image source based on the directory structure:
	//	'galleries/galleryNN/FgalleryNN-II.jpg
	var src = document.forms[galleryID].slide[imageIndex].id;
	document.images.show.src = '../images/' + galleryID + '/' + src;

	// update the slide name "Image NN-II"
	var length = src.lastIndexOf( "Fgallery" );
	var dot = src.lastIndexOf( "." )
	SlideName.firstChild.nodeValue = 'Image ' + src.substring( length+8, dot ) ;
		
	// update the slide title
	SlideTitle.firstChild.nodeValue = document.forms[galleryID].slide[imageIndex].value;
	
	if (watermark == "yes") {
		var watermarkLayer = document.getElementById( "watermark" );
		
		// turn off the watermark before the image is updated to stop "flickering" of the watermark outside the image boundaries
		watermarkLayer.style.display ="none" ;
	}	
}


function OpenViewer() {
	// open the slide viewer by initializing the global variables:
	//		galleryIndex - 	[0..n] will index into the gallery forms in viewer-slideshow.htm
	//		galleryID -		e.g. "gallery1" the id of one of the forms
	//		imageIndex - 	[0..n] will index into the input elements of the gallery form
		
	// Parse parameter sent from function ViewImage:  "?gg-ii" where 'gg' is the gallery number and 'ii' is the image number
	var data = location.search ;
	var galleryLength = new Number( location.search.lastIndexOf( "-" ));

	galleryIndex = new Number(location.search.substring(1,galleryLength));
	galleryID = 'gallery' + galleryIndex ;
	galleryIndex--;
	imageIndex = data.substring(galleryLength+1,data.length) - 1;

	// update the total number of images in gallery "nn of TTT"
	var TotalSlides = document.getElementById("TotalSlides");
	TotalSlides.firstChild.nodeValue = document.forms[galleryIndex].length ;

	// If a watermarking is enabled then move the watermark layer after the slide image is loaded, so
	// the function MoveWatermark has the correct width and height data available
	if (watermark == "yes") document.images.show.onload = MoveWatermark ;
	
	// show the image number and slide image
	ShowImage() ;
}

	
function NextImage() {
	// move to the next slide image in the viewer-slideshow.htm file
	
	if (imageIndex < document.forms[galleryID].length-1)
		// it is in the current gallery form, so just increment the image index
		imageIndex++ ;
	else {
		imageIndex = 0 ;
	}
	ShowImage() ;
}

function PreviousImage() {
	// move to the previous slide image in the view-slideshow.htm file
	
	if (imageIndex)
		// it is in the current gallery form, so just decrement the image index
		imageIndex-- ;
	else {
		imageIndex = document.forms[galleryIndex].length-1;
	}
	ShowImage();
}

function AllPlay(text) {
	// Auto play the slide show starting at the current image or stop playing the slide show
	// based on the state of the button
	
	// if the button is "Stop" then toggle button text and the show will stop automatically
	if (document.slideform.slidebutton.value == "Stop")
		document.slideform.slidebutton.value = "Auto Play"
	else {
	// if the button is "AutoPlay" then toggle button text and start the show by calling the rotate function
		document.slideform.slidebutton.value = "Stop"
		window.setTimeout("PlayNext()", rotate_delay);
	}
}

function PlayNext() {
	// while the button text is "Stop" the show is running,
	// so set one shot timer to re-call this function and
	// show the next slide image
	
	if (document.slideform.slidebutton.value == "Stop") {
		NextImage() ;
		window.setTimeout("PlayNext()", rotate_delay);
	}
}

// MOUSEOVER STATUS

if (hide_status == "yes") {

	function hidestatus(){
		window.status=status_text
		return true
	}

	if (document.layers)
		document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
		
	document.onmouseover=hidestatus
	document.onmouseout=hidestatus	
}



// BLOCK IMAGE TOOLBAR

if (block_imagebar == "yes") {
	document.write('<META HTTP-EQUIV="imagetoolbar" CONTENT="no">')
}



// RIGHT CLICK PROTECTION


if (right_click_on == "yes") {
	var message=right_click_text;
	if (navigator.appName == 'Microsoft Internet Explorer'){
		function NOclickIE(e) {
		if (event.button == 2 || event.button == 3) {
			alert(message);
			return false;
		}
		return true;
	}
	document.onmousedown=NOclickIE;
	document.onmouseup=NOclickIE;
	window.onmousedown=NOclickIE;
	window.onmouseup=NOclickIE;
}
else {
	function NOclickNN(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=NOclickNN; }
		document.oncontextmenu=new Function("alert(message);return false")
	}
}



// End -->
