// BEGIN SWITCH DIV	
// function switchDiv()
//  this function takes the id of a div
//  and calls the other functions required
//  to show that div
//
function switchDiv(div_id)
{
  var style_sheet = getStyleObject(div_id);
  if (style_sheet)
  {
    hideAll();
    changeObjectVisibility(div_id,"visible");
  }
  else 
  {
    alert("sorry, this only works in browsers that do Dynamic HTML");
  }
}

function hideAll()
{
   changeObjectVisibility("slide1","hidden");
   changeObjectVisibility("slide2","hidden");
   changeObjectVisibility("slide3","hidden");     
   changeObjectVisibility("slide4","hidden");
   changeObjectVisibility("slide5","hidden");
   changeObjectVisibility("slide6","hidden");
   changeObjectVisibility("slide7","hidden");     
   changeObjectVisibility("slide8","hidden");
   changeObjectVisibility("slide9","hidden");
   changeObjectVisibility("slide10","hidden");
   changeObjectVisibility("slide11","hidden");     
   changeObjectVisibility("slide12","hidden");
   changeObjectVisibility("slide13","hidden");   
   changeObjectVisibility("slide14","hidden");  
   changeObjectVisibility("slide15","hidden");
   changeObjectVisibility("slide16","hidden");
   changeObjectVisibility("slide17","hidden");     
   changeObjectVisibility("slide18","hidden");
   changeObjectVisibility("slide19","hidden");
   changeObjectVisibility("slide20","hidden");
   changeObjectVisibility("slide21","hidden");     
   changeObjectVisibility("slide22","hidden");
   changeObjectVisibility("slide23","hidden");
   changeObjectVisibility("slide24","hidden");

}

// function getStyleObject(string) -> returns style object
//  given a string containing the id of an object
//  the function returns the stylesheet of that object
//  or false if it can't find a stylesheet.  Handles
//  cross-browser compatibility issues.
//
function getStyleObject(objectId) {
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
	return document.all(objectId).style;
   } 
   else if (document.layers && document.layers[objectId]) { 
	return document.layers[objectId];
   } else {
	return false;
   }
}

function changeObjectVisibility(objectId, newVisibility) {
    // first get a reference to the cross-browser style object 
    // and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	return false;
    }
}

//Browser check (and begin prev next slide script)
var DHTML = (document.getElementById || document.all || document.layers);
if ( !DHTML ) alert('Your browser is not capable of displaying DHTML');
function getObj(name) {
	if (document.getElementById) {
		this.style = document.getElementById(name).style;
	} else
	if (document.all) {
		this.style = document.all[name].style;
	} else
	if (document.layers) {
		this.style = document.layers[name];
	}
}

//Switch elements visible or hidden
function visib(objName, flag) {
	x = new getObj(objName);
	x.style.visibility = (flag) ? 'visible' : 'hidden';
}

//Switch next element visible and previous hidden.
var curImg = 0; // index of the array entry
var lastImg = 0;
function changeSlide ( change ) {
	if (!DHTML) return;
	curImg += change;
	if ( curImg < 0 ) curImg = slides.length-1;
	else
		if ( curImg >= slides.length ) curImg = 0;

	visib(slides[lastImg], false);
	visib(slides[curImg], true);
	lastImg = curImg;
}
//Array containing all element names (== pictures)
slides = new Array( // The id's of the slides
	'slide1',
	'slide2',
	'slide3',
	'slide4',
	'slide5',
	'slide6',
	'slide7',
	'slide8',
	'slide9',
	'slide10',
	'slide11',
	'slide12',
	'slide13',	
	'slide14');

// BEGIN ROLLUNDER SCRIPT

var target = new Array();
var current = 0;
var destination = 0;
var deltaT = 20;
var timerID;

// You were passing 'n' to each method to tell it how far the animation needed to go down.
// That seems like a constant so just set it once and don't pass it in.

var animate_length = 4

if (document.images) {
    nav1on  = new Image(); nav1on.src  = "../image/nav_home.gif";
    nav1off = new Image(); nav1off.src = "../image/nav_home.gif";
    nav2on  = new Image(); nav2on.src  = "../image/nav_portfolio.gif";
    nav2off = new Image(); nav2off.src = "../image/nav_portfolio.gif";
    nav3on  = new Image(); nav3on.src  = "../image/nav_process.gif";
    nav3off = new Image(); nav3off.src = "../image/nav_process.gif";
    nav4on  = new Image(); nav4on.src  = "../image/nav_about.gif";
    nav4off = new Image(); nav4off.src = "../image/nav_about.gif";
    nav5on  = new Image(); nav5on.src  = "../image/nav_links.gif";
    nav5off = new Image(); nav5off.src = "../image/nav_links.gif";
    nav6on  = new Image(); nav6on.src  = "../image/nav_blog.gif";
    nav6off = new Image(); nav6off.src = "../image/nav_blog.gif";
    nav7on  = new Image(); nav7on.src  = "../image/nav_treats.gif";
    nav7off = new Image(); nav7off.src = "../image/nav_treats.gif";
    nav8on  = new Image(); nav8on.src  = "../image/nav_guestbook.gif";
    nav8off = new Image(); nav8off.src = "../image/nav_guestbook.gif";

	for (var i = 0; i < 17; i++) {
	    target[i] = new Image(); target[i].src = "../image/" + i + ".gif";
	}
}

// Now instead of passing in 'n' (now animate_length) pass in the menu item you're showing (1-7). You could actually eliminate a
//  paraemeter by just appending menu_location to derive img1 name, but it's only code clean up that's optional. Did I tell you
// I hate javascript?  Javascript really has nothing to do with Java other than sharing part of the name and a few syntax things.
//  It's just a scripting language - a necessary evil.


function rollOn(img1,menu_location,text){
    window.status = text;
	if (document.images) {
		document.target1.src="../image/0.gif";
		document.target2.src="../image/0.gif";
		document.target3.src="../image/0.gif";
		document.target4.src="../image/0.gif";
		document.target5.src="../image/0.gif";
		document.target6.src="../image/0.gif";
		document.target7.src="../image/0.gif";
		document.target8.src="../image/0.gif";
		document[img1].src=eval(img1 + "on.src");


// Now we tell animate which menu to animate.with menu_location.
		animate(animate_length,menu_location);
	}
}

function rollOff(img1,menu_location){
    window.status = "";
	if (document.images) {
		document[img1].src=eval(img1 + "off.src");
		animate(0,menu_location);
	}
}

function animate(destination,menu_location) {

//  Now we have to do this wierd thing to build a string that gets evaluated into a command that can be used below.
//  Did I tell you I hate Javascaript?

	var v = eval(("document.target" + menu_location).toString());
	if (timerID) clearTimeout(timerID);
	if (current < destination) {
		current++;


//BOB, USE ALERTS TO HELP FIGURE THINGS OUT - BUT YOU KNOW THAT

	//	alert (v);
		v.src=target[current].src;

		// Now we dynamically build the recursive call to animate().

		timerID = setTimeout("animate(" + destination + ", " + menu_location + ")", deltaT);
	} else if (current > destination) {
		current--;
		v.src=target[current].src;
		timerID = setTimeout("animate(" + destination + ", " + menu_location + ")", deltaT);
	}
}


// END ROLLUNDER SCRIPT


function openwindow(theURL,width,height) {
    window.open(theURL,'winName','width=' + width + ',height=' + height + ',resizable=0,scrollbars=0,menubar=0,toolbar=0,location=0,directories=0,status=0');
}

function openwindow2(theURL,width,height) {
    window.open(theURL,'winName','width=' + width + ',height=' + height + ',resizable=0,scrollbars=1,menubar=0,toolbar=0,location=0,directories=0,status=0');
}

function spamless(codelist, description, atagattr) {
    var thiscode, thischar;
    var CodeString = new String(codelist);
    var CodedArray = CodeString.split('|');
    var L = CodedArray.length;
    var AddrDecoded = "";
    for (var x=0; x < L; x++) {
        thiscode = CodedArray[x];
        thischar = String.fromCharCode( thiscode - L );
        AddrDecoded += thischar;
    }
    atagattr = atagattr ? ' ' + atagattr : '';
    if (!description) description = AddrDecoded; // if no description supplied, display email address
    var strOutput = '<a href="mailto:'+AddrDecoded+'"' + atagattr+'>' + description + '</a>';
    document.write(strOutput);
}



<!-- BEGIN PAYPAL JS      Hide JS source from HTML validators
function Dollar (val) {  // force to valid dollar amount
var str,pos,rnd=0;
  if (val < .995) rnd = 1;  // for old Netscape browsers
  str = escape (val*1.0 + 0.005001 + rnd);  // float, round, escape
  pos = str.indexOf (".");
  if (pos > 0) str = str.substring (rnd, pos + 3);
  return str;
}

function ReadForm (obj1) { // process un-named selects
var i,amt,des,obj,pos,val;
  amt = obj1.baseamt.value*1.0;       // base amount
  des = obj1.basedes.value;           // base description
  for (i=0; i<obj1.length; i++) {     // run entire form
    obj = obj1.elements[i];           // a form element
    if (obj.type == "select-one" &&   // just get selects
        obj.name == "") {             // must be un-named
      pos = obj.selectedIndex;        // which option selected
      val = obj.options[pos].value;   // selected value
      pos  = val.indexOf ("@");       // price set?
      if (pos >= 0) amt = val.substring (pos + 1)*1.0;
      pos  = val.indexOf ("+");       // price increment?
      if (pos >= 0) amt = amt + val.substring (pos + 1)*1.0;
      pos  = val.indexOf ("%");       // percent change?
      if (pos >= 0) amt = amt + (amt * val.substring (pos + 1)/100.0);
      if (des.length == 0) des = val;
      else des = des + ", " + val;    // accumulate value
    }
  }
  obj1.item_name.value = des;
  obj1.amount.value = Dollar (amt);
  if (obj1.tot) obj1.tot.value = "$" + Dollar (amt);
}