// JavaScript functions for Electronic Mirror
//		    contact:gary@electronicmirror.com

// For home page time of day greeting
function greetingtime() {
	var dateNow = new Date(); 
	var hourNow = dateNow.getHours();        
	if (hourNow >= 0 && hourNow < 12 ) {  
		document.write ("Good Morning");
 	}
	if (hourNow >= 12 && hourNow < 18 ) {  
		document.write ("Good Afternoon");
 	}
	if (hourNow >= 18 && hourNow < 24 ) {  
		document.write ("Good Evening");
 	}
	return true;
}

// For drop down menu with go button
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http:// javascript.internet.com -->

function gotopage(form1) {
	var index=form1.choice.selectedIndex;
	this.location.href=(form1.choice.options[index].value);
	index = 0; // Reset pulldown menu
}


// Run slideshow
function allslides() {
	setTimeout("document.slideframe.src='images/toslide1.jpg' ", 2000);
	setTimeout("document.slideframe.src='images/toslide2.jpg' ", 6000);
	setTimeout("document.slideframe.src='images/toslide3.jpg' ", 10000);
	setTimeout("document.slideframe.src='images/toslide4.jpg' ", 13000);
	setTimeout("document.slideframe.src='images/toslide5.jpg' ", 17000);
	setTimeout("document.slideframe.src='images/toslidestart.gif' ", 22000);
	return true;
}

// For rollover effects with highlight and lowlight class in style sheet
function rollon() {
  if (window.event.srcElement.className == "lowlight") {
     window.event.srcElement.className = "highlight";
  }
}
function rolloff() {
  if (window.event.srcElement.className == "highlight") {
     window.event.srcElement.className = "lowlight";
  }
}
function nm_rollon() {
  if (window.event.srcElement.className == "nm_lowlight") {
     window.event.srcElement.className = "nm_highlight";
  }
}
function nm_rolloff() {
  if (window.event.srcElement.className == "nm_highlight") {
     window.event.srcElement.className = "nm_lowlight";
  }
}

// Generic load frame function
function load(url) {			
  parent.main.location.href= url; // main is a frame's name
}
function loadtwo() {
  parent.frame1.location.href= "first.htm";	// frame1 and frame2 are
  parent.frame2.location.href= "second.htm"; //     also frame names
}
// If you want to keep the function more flexible you can use variable passing here as well. This looks like this: 
function loadtwo(url1, url2) {
  parent.frame1.location.href= url1;
  parent.frame2.location.href= url2;
}
// <a href="javascript:load('first.htm')">first</a>
// <a href="second.htm" target="main">second</a>
// <a href="third.htm" target="_top">third</a>

// Function to find javascript version
function findjsversion(){
	if (navigator.userAgent.indexOf("4.0") != -1)
   		jsVersion = "1.2";
	else if (navigator.userAgent.indexOf("3.0") != -1)
   		jsVersion = "1.1";
	else
   		jsVersion = "1.0";
 }


