



function handleMouseovers(e){

	var src = window.event ? e.srcElement : e.target;
	//alert("mouse over A here")
	while( src && !src.handleMenuActions) src = src.parentNode;
	
	if(src){
		
		// do the show/hide up and down the id hierarchy as appropriate
		var sourceID = src.id;
		for(var i=0;i<window.menuArray.length;i++){
		
			var objectNode = window.menuArray[i];
			

		if( objectNode.className != 'XA' ){
			var bIsB = false;
			
		
			// Test if this is a parent element
					
			if( objectNode.id == sourceID ){bIsB = true;}
			else if( objectNode.id + ":" == sourceID.substring(0, objectNode.id.length + 1) ){bIsB = true;}		
			// If this node is a direct child we also show it
			else {	
			if(objectNode.id.substring(0,sourceID.length + 1) == sourceID + ":"){
						var sTail = objectNode.id.substring(sourceID.length+1);
						
						bIsB = sTail && sTail.indexOf(":") < 0;
												}
					
				
				}
				
				// Now update the classname
				objectNode.className = ( bIsB ?
					objectNode.className.substring(0,objectNode.className.length - 1) + "B" :
					objectNode.className.substring(0,objectNode.className.length - 1) + "A");
			}			
		
		}
	}

}



function handleMouseovers2(e){
var src = window.event ? e.srcElement : e.target;
	
	var src = window.event ? e.srcElement : e.target;
	
	while( src && !src.handleMenuActions2) src = src.parentNode;
	
	if(src){
		
		// do the show/hide up and down the id hierarchy as appropriate
		var sourceID2 = src.id;
		for(var i=0;i<window.menuArray2.length;i++){
		
			var objectNode2 = window.menuArray2[i];
			

		if( objectNode2.className != 'YC' ){
			var bIsC = false;
			
		
			// Test if this is a parent element
					
			if( objectNode2.id == sourceID2 ){bIsC = true;}
			else if( objectNode2.id + ":" == sourceID2.substring(0, objectNode2.id.length + 1) ){bIsC = true;}		
			// If this node is a direct child we also show it
			else {	
			if(objectNode2.id.substring(0,sourceID2.length + 1) == sourceID2 + ":"){
						var sTail = objectNode2.id.substring(sourceID2.length+1);
						
						bIsC = sTail && sTail.indexOf(":") < 0;
												}
					
				
				}
				
				// Now update the classname
				objectNode2.className = ( bIsC ?
					objectNode2.className.substring(0,objectNode2.className.length - 1) + "D" :
					objectNode2.className.substring(0,objectNode2.className.length - 1) + "C");

			}			
		
		}
	}

}



/*
*	Initialisation functions
*/
function init(){
JSClock();



sequenceImages(this.form);

	window.menuArray = Array();
	setupHandlers(window.document.documentElement);

	window.menuArray2 = Array();
	setupHandlers2(window.document.documentElement);
}


function chkObject (theVal) 

{

    if (document.getElementById(theVal) != null)

    {
//alert('Select 2 exists');
        return true;

    }

    else

    {
//alert('select 2 no exists');

       return false;

    }

}


function setupHandlers(objectNode){

	try{
	
		if(objectNode.className && objectNode.className.substring(objectNode.className.length-1,objectNode.className.length) == "A" )
			{
			objectNode.onmouseover = function(e){ handleMouseovers(e ? e : event) };
			objectNode.handleMenuActions = true;
			window.menuArray[window.menuArray.length] = objectNode;
			}
	
		for(var i=0;i<objectNode.childNodes.length;i++){setupHandlers(objectNode.childNodes[i]);}
	}
		catch(e){alert("Menue Error A");}

		}


function setupHandlers2(objectNode2){

	try{
	
		if(objectNode2.className && objectNode2.className.substring(objectNode2.className.length-1,objectNode2.className.length) == "C" )
			{
			objectNode2.onmouseover = function(e){ handleMouseovers2(e ? e : event) };
			objectNode2.handleMenuActions2 = true;
			window.menuArray2[window.menuArray2.length] = objectNode2;
			}
	
		for(var i=0;i<objectNode2.childNodes.length;i++){setupHandlers2(objectNode2.childNodes[i]);}
	}
		catch(e){alert("Menue Error B");}

		}

window.onload = init;

function GoRemoveIt(y) {
   
   ImageControl.style.display = ""; 
   ImageControl.style.Visibility = "visible" ; 
   ImageControlExtra.style.visibility = "hidden" ;
   ImageControlExtra.style.display = "none"; 
 
} 

function GoShowIt(y) {
  
   ImageControl.style.display = "none"; 
   ImageControl.style.Visibility = "hidden";  
   ImageControlExtra.style.display = ""; 
   ImageControlExtra.style.visibility = "visible"; 
   
}


function JSClock() {
   var time = new Date()
   var hour = time.getHours()
   var minute = time.getMinutes()
   var second = time.getSeconds()
   var temp = "" + ((hour > 12) ? hour - 12 : hour)
   temp += ((minute < 10) ? ":0" : ":") + minute
   temp += ((second < 10) ? ":0" : ":") + second
   temp += (hour >= 12) ? " P.M." : " A.M."
   document.clockForm.digits.value = temp
   id = setTimeout("JSClock()",1000)
}


/* Define image objects */
		var prevBtnOff = new Image( 30, 45 );
		prevBtnOff.src = "Images/LB1.bmp"; 

		var prevBtnOn =  new Image( 30, 45 );
		prevBtnOn.src = "Images/LG1.bmp"; 		
		
		var nextBtnOff = new Image( 30, 45 );
		nextBtnOff.src = "Images/RB1.bmp"; 

		var nextBtnOn =  new Image( 30, 45 );
		nextBtnOn.src = "Images/RG1.bmp"; 		
		
		
	  /* Changes image being displayed. */
		function highlightButton(placeholder, imageObject) { 
			document.images[placeholder].src = eval( imageObject + ".src" )
		} 		



var imageDBIndex = 0
imageDB = new Array(4)
imageDB[0] = new Image(405,118)
imageDB[0].src = "Images/Pic1.jpg"
imageDB[1] = new Image(405,118)
imageDB[1].src = "Images/Pic2.jpg"
imageDB[2] = new Image(405,118)
imageDB[2].src = "Images/Pic3.jpg"
imageDB[3] = new Image(405,118)
imageDB[3].src = "Images/Pic4.jpg"


function loadImages2(form) {
	imageDBIndex = form.images2.selectedIndex
	document.thumbnail2.src = imageDB[imageDBIndex].src
}

function sequenceImages(form) {
//alert("here");

//if(chkObject('select2'))alert('age exists');
//chkObject (document.select2.timerBox) {

//}

	if ((chkObject('select2')) && (document.select2.timerBox.checked)) {
//if (document.select2.timerBox.checked) {
//alert("do here");
document.thumbnail2.src = imageDB[imageDBIndex].src
document.select2.images2.selectedIndex = imageDBIndex
if (imageDBIndex < imageDB.length - 1) {

			imageDBIndex = imageDBIndex + 1 
} else {
imageDBIndex = 0} 
		var timeoutID = setTimeout("sequenceImages(select2)",2000)
	}
}



function formatDate() {
	FullDate = new Date();

	DayNo = FullDate.getDay();
	DayIs = getDayName(DayNo);
	
	DateNow = FullDate.getDate();
	
	MonthNo = FullDate.getMonth();
	MonthIs = getMonthName(MonthNo);
	
	

	TodaysDate = DayIs + " " + DateNow + " " + MonthIs;

	return TodaysDate;
}

//val is 1 to 7 so look up Day name in array weekDayArray
function getDayName(val) {
	var weekDayArray = new 	Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	return weekDayArray[val];
}

//val is 1 to 12 so look up Month name in array monthArray
function getMonthName(val) {
	var monthArray = new Array("Jan","Feb","March","April","May","June","July","Aug","Sept","Oct","Nov","Dec");
	return monthArray[val];
}


