// FormWindows.js
//
// SUMMARY
//
// This is a set of JavaScript functions for creating new windows
// and allowing the original web page to remain stationary.
imageDB = new Array(10)
imageMDB = new Array(10)
imageLDB = new Array(10)
imagePDB = new Array(10)
for (var i = 0; i < imageDB.length ; i++) {
	imageDB[i] = new Image(112,144)
	imageDB[i].src = "desk" + (i+1) + ".jpg"
	imageMDB[i] = new Image(112,144)
	imageMDB[i].src = "mesk" + (i+1) + ".jpg"
	imageLDB[i] = new Image(112,144)
	imageLDB[i].src = "lesk" + (i+1) + ".jpg"
	imagePDB[i] = new Image(112,144)
	imagePDB[i].src = "pesk" + (i+1) + ".jpg"
	}
var newWindow
var newURL
function showStatus(msg) {
	window.status = msg
	return true
}

function makeNewWindow(newURL) {
	if (newWindow) {
		newWindow.close() 
	}
	newWindow = window.open(newURL,"mywindow","width=640,height=500,top=70,left=126,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=yes")
}

function makeSmallWindow(newURL) {
	if (newWindow) {
		newWindow.close() 
	}
	newWindow = window.open(newURL,"mywindow","width=160,height=160,top=10,left=700,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=yes,resizable=no")
}
function closeNewWindow(newURL) {
	if (newWindow) {
		newWindow.close() 
	}
}

//
// format date as dd-mmm-yy
// example: 12-Jan-99
//
function date_ddmmmyy(date)
{
  var d = date.getDate();
  var m = date.getMonth() + 1;
  var y = date.getYear();
 

  // handle different year values 
  // returned by IE and NS in 
  // the year 2000.
  if(y < 100)
    {
	
   	y += 2000;
    }
  
  // could use splitString() here 
  // but the following method is 
  // more compatible
  var mmm = 
    ( 1==m)?'January':( 2==m)?'February':(3==m)?'March':
    ( 4==m)?'April':( 5==m)?'May':(6==m)?'June':
    ( 7==m)?'July':( 8==m)?'August':(9==m)?'September':
    (10==m)?'October':(11==m)?'November':'December';

  return "" +
	mmm+ " "+ (d<10?"0"+d:d) + ", " +
     (y<10?"0"+y:+y);

  
}


//
// get last modified date of the 
// current document.
//
function date_lastmodified()
{
  var lmd = document.lastModified;
  var s   = "Unknown";
  var d1;

  // check if we have a valid date
  // before proceeding
  if(0 != (d1=Date.parse(lmd)))
  {
    s = "" + date_ddmmmyy(new Date(d1));
  }

  return s;
}
function makeArray() {  var args = makeArray.arguments;
  for (var i=0; i<args.length; i++) {    this[i] = args[i];  }
  this.length = args.length;}var pages = new makeArray  ("select...",
   "A Page", "B Page",   "C Page", "D Page ");var urls = new makeArray
  ("main.html",   "a.html", "b.html",   "c.html", "d.html");thisUrl = 0;
urlCt = urls.length - 1;function uberNav(navigation) {
  if(navigation == "backbutton") {    if (thisUrl > 0) {      thisUrl--;
      parent.content.location.href = urls[thisUrl];
      for(i=0;i<pages.length;i++) {
        document.menuform.menu.selectedIndex=thisUrl;      }    }
  } else if (navigation == "nextbutton") {    if(thisUrl < urlCt) {
      thisUrl++;      parent.content.location.href = urls[thisUrl];
      document.menuform.menu.selectedIndex=thisUrl;    }  } else {
    i = document.menuform.menu.selectedIndex;    if(i != 0) {
      parent.content.location.href = urls[i];      thisUrl = i;      }  }}


function loadIndividual(form) {
	var jpgName = form.individual.options[form.individual.selectedIndex].value
	document.thumbnail1.src = jpgName
}
function loadCached(form) {
	var jpgIndex = form.cached.selectedIndex
	document.thumbnail2.src = imageDB[jpgIndex].src
}

function checkTimer() {
	 
	var timeoutID = setTimeout("checkTimer1()",500)
		
	 
}
function checkTimer1() {
	 
		var newIndex = 0
		var jpgName = document.thumbnail2.src
		var jpgIndex = (jpgName.charAt(jpgName.length - 5)) - 1
		if (jpgIndex < imageDB.length - 1) {
			newIndex = jpgIndex + 1
		}
		document.thumbnail2.src = imageDB[newIndex].src
		
		var timeoutID = setTimeout("checkTimer2()",500)
		
		
		
	 
}
function checkTimer2() {
	 
				
		var newMIndex = 0
		var jpgMName = document.thumbnail3.src
		var jpgMIndex = (jpgMName.charAt(jpgMName.length - 5)) - 1
		if (jpgMIndex < imageMDB.length - 1) {
			newMIndex = jpgMIndex + 1
		}
		document.thumbnail3.src = imageMDB[newMIndex].src
		var timeoutID = setTimeout("checkTimer3()",500)
		
		
		
	 
}
function checkTimer3() {
	 
		var newLIndex = 0
		var jpgLName = document.thumbnail4.src
		var jpgLIndex = (jpgLName.charAt(jpgLName.length - 5)) - 1
		if (jpgLIndex < imageLDB.length - 1) {
			newLIndex = jpgLIndex + 1
		}
		document.thumbnail4.src = imageLDB[newLIndex].src
		var timeoutID = setTimeout("checkTimer4()",500)
		
		
		
}
function checkTimer4() {
	 
		var newPIndex = 0
		var jpgPName = document.thumbnail5.src
		var jpgPIndex = (jpgPName.charAt(jpgPName.length - 5)) - 1
		if (jpgPIndex < imagePDB.length - 1) {
			newPIndex = jpgPIndex + 1
		}
		document.thumbnail5.src = imagePDB[newPIndex].src
		var timeoutID = setTimeout("checkTimer1()",500)
		
		
		
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0

eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

if (restore) selObj.selectedIndex=0;

}

function MM_findObj(n, d) { //v3.0

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;

}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0

var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);

}
var delay = 850
var timerId
var maxCount = 0
var currCount = 1
function scrollMsg() {
	// set the number of times scrolling message is to run
	if (maxCount == 0) {
		maxCount = 17 * msg.length
	}
	window.status = msg
	// keep track of how many characters have scrolled
	currCount++
	// shift first character of msg to end of msg
	msg = msg.substring (1, msg.length) + msg.substring (0, 1)
	// test whether we've reached maximum character count
	if (currCount >= maxCount) {
		timerID = 0		// zero out the timer
		window.status = ""	// clear the status bar
		return			// break out of function
	} else {
		// recursive call to this function
		timerId = setTimeout("scrollMsg()", delay)
	}
}
function Show_Stuff(Click_Menu)
// Function that will swap the display/no display for
// all content within span tags
{
if (Click_Menu.style.display == "none")
{
Click_Menu.style.display = "";
}
else
{
Click_Menu.style.display = "none";
}

}