var imgLoc = "photos/"
var imgExt = ".jpg";
var fileExt = ".htm";
var sURL = unescape(window.location.pathname);

//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;
}

//Event0 functions

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

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();
}

////////////////////////////////////////////////////////////////

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];
    }
  }
}

function launch(url, name) {
	var win = window.open(url,name,'width=494,height=825,resizable=no,scrollbars=no');
	win.focus();
     }

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

function openNewWin() {     
        var win = window.open("/merrick/",'TheNewpop','width=676,height=744,toolbar=yes,location=no,directories=yes,status=no,menubar=yes,scrollbars=no,resizable=no');
        win.focus();
     }

function refresh()
{
    window.location.href = sURL;
}

