// ******************************************************************************
// Filename     :  JS_Functions.js
// Description  :  JavaScript functions - Cross-Browser
// Contents     :  imageChange, toggleDiv
//  
// ------------------------------------------------------------------------------
// ACTION:                                                 BY:        DATE:
// ------------------------------------------------------------------------------
// Created                                                 Sylvania   21 Sep 2002
// 
// ******************************************************************************

// Path constants
DIR_ROOT			=	"http://www.VictorianDays.org"
//DIR_ROOT			=	"http://family/VictorianDays"
DIR_IMG				=	"http://www.VictorianDays.org/Images/"
//DIR_IMG				=	"http://family/VictorianDays/Images/"
DIR_IMG_MENU	=	"http://www.VictorianDays.org/Images/Menu/"
//DIR_IMG_MENU	=	"http://family/VictorianDays/Images/Menu/"

// ******************************************************************************
// Function     :  imageChange
// Description  :  Change image on mouseover/mouseout/mouseup/
//					 mousedown
//
// Input        :  Up to 4 imageID/imageName pairs
// Output       :  none
//  
// ------------------------------------------------------------------------------
// ACTION:                     BY:       DATE:
// ------------------------------------------------------------------------------
// Created                     Sylvania  24 Nov 1997
// 
// ******************************************************************************

function imageChange(imageID0,imageName0) {
	document.images[imageID0].src = eval(imageName0 + ".src");
	//document.images[imageID1].src = eval(imageName1 + ".src");
}

// browser sniffer
nn4 = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4");

// ******************************************************************************
// Function		: toggleNode
// Description	: Show/hide TreeView nodes on click
//
// Input		: ndeChild [id], icoTrigger [id]
// Output		: none
//  
// ------------------------------------------------------------------------------
// ACTION:		BY:					DATE:
// ------------------------------------------------------------------------------
// Created		Sylvania				28 Sep 2002
// 
// ******************************************************************************

var openIcon = new Image(); openIcon.src = DIR_IMG + 'Icons/icoFolderOpen.gif';
var closedIcon = new Image(); closedIcon.src = DIR_IMG + 'Icons/icoFolderClosed.gif';


function toggleNode(ndeChild, icoTrigger) {
	var objNode;
	var objIcon;
	
	objNode = document.getElementById(ndeChild).style;
	objIcon = document.getElementById(icoTrigger);
  
  if (objNode.display=='block') {
    objNode.display='none';
  } else {
    objNode.display='block';
  }
  
  if (objIcon.src.indexOf(DIR_IMG + 'Icons/icoFolderOpen.gif') > -1) {
    objIcon.src = closedIcon.src;
  } else {
    objIcon.src = openIcon.src;
	}
}

// ******************************************************************************
// Function		: toggleDiv
// Description	: Show/hide div object
//
// Input		: divID [string]
// Output		: none
//  
// ------------------------------------------------------------------------------
// ACTION:		BY:					DATE:
// ------------------------------------------------------------------------------
// Created		Sylvania				02 Feb 2004
// 
// ******************************************************************************

function toggleDiv(divID, state) {
  var objDiv = document.getElementById(divID);
  if (state) {
    objDiv.style.visibility = 'visible';
    objDiv.style.display = 'block';
  } else {
    objDiv.style.visibility = 'hidden';
    objDiv.style.display = 'none';
  }
}

// ******************************************************************************
// Function		: loadGalleryImages, loadGalleryThumbnails
// Description	: display gallery images
//
// Input		: none
// Output		: none
//  
// ------------------------------------------------------------------------------
// ACTION:		BY:					DATE:
// ------------------------------------------------------------------------------
// Created		Sylvania				01 Apr 2008
// 
// ******************************************************************************

function loadGalleryImages() {
	var aryGalleryImages = new Array();
	
	aryGalleryImages[0] = new Image(); aryGalleryImages[0].src = '2007/AroundTown/KylieW2.png';
}

function loadGalleryThumbnails() {
	var aryGalleryThumbnails = new Array();
	
	aryGalleryThumbnails[0] = new Image(); aryGalleryThumbnails[0].src = '2007/AroundTown/TN_KylieW2.png';
}

// ******************************************************************************
// Function		: galleryImageChange
// Description	: show requested gallery image on thumbnail click
//
// Input		: none
// Output		: none
//  
// ------------------------------------------------------------------------------
// ACTION:		BY:					DATE:
// ------------------------------------------------------------------------------
// Created		Sylvania				01 Apr 2008
// 
// ******************************************************************************

var intZ = 7;
function galleryImageChange(imageID, strSrc, strP, strCaption){
	//intZ++
	//alert(imageID0 + ', ' + intZ);
	//document.getElementById('divider').style.zIndex = intZ;
	//intZ++;
	//alert(intZ);
	//document.getElementById(imageID).style.zIndex = intZ;
	
	document.getElementById(imageID).src = strSrc;
	document.getElementById(strP).innerHTML = strCaption;
}

// ******************************************************************************
// Function		: toggleSlide
// Description	: clide thumbnail menu
//
// Input		: none
// Output		: none
//  
// ------------------------------------------------------------------------------
// ACTION:		BY:					DATE:
// ------------------------------------------------------------------------------
// Created		Sylvania				01 Apr 2008
// 
// ******************************************************************************

function toggleSlide(strID) {
	if (document.getElementById(strID).style.display == 'inline') {
		document.getElementById(strID).style.display = 'none';
		return;
	}
	
	// hide all divs
	document.getElementById('TN_2003').style.display = 'none';

	// show requested div
	document.getElementById(strID).style.display = 'inline';
	
}
// ******************************************************************************
// Function		: scrollMenu
// Description	: scroll thumbnail menu
//
// Input		: none
// Output		: none
//  
// ------------------------------------------------------------------------------
// ACTION:		BY:					DATE:
// ------------------------------------------------------------------------------
// Created		Sylvania				01 Apr 2008
// 
// ******************************************************************************

function scrollMenu(strDir) {
	switch (strDir) {
		case 'up':
			document['scrollUp'].src = DIR_IMG + 'scrollup_on.png';
			new Effect.Move('thumbMenu', { x: 0, y: +525, transition: Effect.Transitions.sinoidal });
			break;
		case 'down':
			document['scrollDown'].src = DIR_IMG + 'scrolldown_on.png';
			new Effect.Move('thumbMenu', { x: 0, y: -525, transition: Effect.Transitions.sinoidal });
			break;
		case 'stop':
			document['scrollUp'].src = DIR_IMG + 'scrollup_off.png';
			document['scrollDown'].src = DIR_IMG + 'scrolldown_off.png';
			break;
	}
}
