var imgLoc = "images/"
var imgExt = ".jpg";
var fileExt = ".htm";

function newImage(arg) {
  if (document.images) {
    rslt = new Image();
    rslt.src = arg;
    return rslt;
  }
}
    
function changeImages() {
  if (document.images) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
    }
  }
}

//IFrame Height Calculator

function calcHeight1()
{
  //find the height of the internal page
  var the_height=
    document.getElementById('the_iframe1').contentWindow.
      document.body.scrollHeight;

  //change the height of the iframe
  document.getElementById('the_iframe1').height=
      the_height;
}

function calcHeight2()
{
  //find the height of the internal page
  var the_height=
    document.getElementById('the_iframe2').contentWindow.
      document.body.scrollHeight;

  //change the height of the iframe
  document.getElementById('the_iframe2').height=
      the_height;
}

function calcHeight3()
{
  //find the height of the internal page
  var the_height=
    document.getElementById('the_iframe3').contentWindow.
      document.body.scrollHeight;

  //change the height of the iframe
  document.getElementById('the_iframe3').height=
      the_height;
}

function calcHeight4()
{
  //find the height of the internal page
  var the_height=
    document.getElementById('the_iframe4').contentWindow.
      document.body.scrollHeight;

  //change the height of the iframe
  document.getElementById('the_iframe4').height=
      the_height;
}

function newWin(url) {
  // url of this function should have the format: "target,URL".
  if (url == "")
    return;
  window.open(url.substring(url.indexOf(",") + 1, url.length), 
	url.substring(0, url.indexOf(",")));
}

function viewEvents(url, name) {
	var win = window.open(url,name,'width=640,height=550,resizable=no,scrollbars=no');
	win.focus();
     }

//Glow Links

function getonme() {
el = event.srcElement ;
if (el.getAttribute("litUp1") != null) {
el.className = "onme1" ;
}
}

function getoffme() {
el = event.srcElement ;
if (el.getAttribute("litUp1") != null) {
el.className = "offme1";
}
}

function getonme2() {
el = event.srcElement ;
if (el.getAttribute("litUp2") != null) {
el.className = "onme2" ;
}
}

function getoffme2() {
el = event.srcElement ;
if (el.getAttribute("litUp2") != null) {
el.className = "offme2";
}
}

//Event0 functions

function changeImage()
{
  mainimage.src = imgLoc + list.options[list.selectedIndex].value + imgExt;
}

function prevImage()
{
	if(list.selectedIndex == 0)
	{
		list.selectedIndex = list.options.length-1;
	}
	else
	{
		list.selectedIndex--;
	}
	changeImage();
}

function nextImage()
{
	if(list.selectedIndex == list.options.length-1)
	{
		list.selectedIndex = 0;
	}
	else
	{
		list.selectedIndex++;
	}
	changeImage();
}

//Event1 functions

function changeImage1()
{
  mainimage1.src = imgLoc + list1.options[list1.selectedIndex].value + imgExt;
}

function prevImage1()
{
	if(list1.selectedIndex == 0)
	{
		list1.selectedIndex = list1.options.length-1;
	}
	else
	{
		list1.selectedIndex--;
	}
	changeImage1();
}

function nextImage1()
{
	if(list1.selectedIndex == list1.options.length-1)
	{
		list1.selectedIndex = 0;
	}
	else
	{
		list1.selectedIndex++;
	}
	changeImage1();
}

//Event2 functions

function changeImage2()
{
  mainimage2.src = imgLoc + list2.options[list2.selectedIndex].value + imgExt;
}

function prevImage2()
{
	if(list2.selectedIndex == 0)
	{
		list2.selectedIndex = list2.options.length-1;
	}
	else
	{
		list2.selectedIndex--;
	}
	changeImage2();
}

function nextImage2()
{
	if(list2.selectedIndex == list2.options.length-1)
	{
		list2.selectedIndex = 0;
	}
	else
	{
		list2.selectedIndex++;
	}
	changeImage2();
}

//Event3 functions

function changeImage3()
{
  mainimage3.src = imgLoc + list3.options[list3.selectedIndex].value + imgExt;
}

function prevImage3()
{
	if(list3.selectedIndex == 0)
	{
		list3.selectedIndex = list3.options.length-1;
	}
	else
	{
		list3.selectedIndex--;
	}
	changeImage3();
}

function nextImage3()
{
	if(list3.selectedIndex == list3.options.length-1)
	{
		list3.selectedIndex = 0;
	}
	else
	{
		list3.selectedIndex++;
	}
	changeImage3();
}

//Event4 functions

function changeImage4()
{
  mainimage4.src = imgLoc + list4.options[list4.selectedIndex].value + imgExt;
}

function prevImage4()
{
	if(list4.selectedIndex == 0)
	{
		list4.selectedIndex = list4.options.length-1;
	}
	else
	{
		list4.selectedIndex--;
	}
	changeImage4();
}

function nextImage4()
{
	if(list4.selectedIndex == list4.options.length-1)
	{
		list4.selectedIndex = 0;
	}
	else
	{
		list4.selectedIndex++;
	}
	changeImage4();
}
