var imgLoc = "photos/"
var imgExt = ".jpg";
var fileExt = ".htm";
var VBS = false;
var SubjectLine='Take a look at this web page I found, '+top.document.title; 
var BodyText='You can see this page at: '+top.location.href;

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

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

var panes = new Array();

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=350,height=600,resizable=no,scrollbars=no');
	win.focus();
     }

function viewPhotosWide(url, name) {
	var win = window.open(url,name,'width=680,height=600,resizable=no,scrollbars=no');
	win.focus();
     }

function prePrint()
{
	if (window.print) window.print();
	else if (VBS) printIt();
	else alert('This script does not work in your browser');
}

function eligible(theForm)
{
  
  if (theForm.search.value == "")
  {
    alert("Please input a Book Title, Author, ISBN# or Category to complete your Search.");
    theForm.search.focus();
    return (false);
  } 
}

function fnChange(){
   d4.value+=oCats.options[oCats.selectedIndex].text + "\n";
}

function wait(delay){
string="pauseforalert("+delay+");";
setTimeout(string,delay);
}

function pauseforalert(delay){
       alert("Thank you for your interest in Savas Beatie titles.\n\nWe're sorry, but an SB representative is either helping\nsomeone else or not currently available.\n\nIn order to expedite your inquiry, please email your\nquestion by clicking the EMAIL ME link above, and we will\n get back with you as soon as possible.\n\nOr, if you need immediate assistance,\ncall 1-916-941-6896 (PST, 9:00 a.m. – 4:00 p.m.).\n\nThank you.");
}

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

//Print Page

function printpage() {
window.print();  
}


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

//IFrame Height Calculator

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

  //change the height of the iframe
  document.getElementById('the_iframe').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 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 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(",")));
}