// 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_dr_hum.gif";
    nav1off = new Image(); nav1off.src = "image/nav_dr_hum.gif";
    nav2on  = new Image(); nav2on.src  = "image/nav_7principles.gif";
    nav2off = new Image(); nav2off.src = "image/nav_7principles.gif";
    nav3on  = new Image(); nav3on.src  = "image/nav_services.gif";
    nav3off = new Image(); nav3off.src = "image/nav_services.gif";
    nav4on  = new Image(); nav4on.src  = "image/nav_conditions.gif";
    nav4off = new Image(); nav4off.src = "image/nav_conditions.gif";
    nav5on  = new Image(); nav5on.src  = "image/nav_specialty.gif";
    nav5off = new Image(); nav5off.src = "image/nav_specialty.gif";
    nav6on  = new Image(); nav6on.src  = "image/nav_faq.gif";
    nav6off = new Image(); nav6off.src = "image/nav_faq.gif";
    nav7on  = new Image(); nav7on.src  = "image/nav_for_new.gif";
    nav7off = new Image(); nav7off.src = "image/nav_for_new.gif";
    nav8on  = new Image(); nav8on.src  = "image/nav_testimonials.gif";
    nav8off = new Image(); nav8off.src = "image/nav_testimonials.gif";
    nav9on  = new Image(); nav9on.src  = "image/nav_links.gif";
    nav9off = new Image(); nav9off.src = "image/nav_links.gif";
    nav10on  = new Image(); nav10on.src  = "image/nav_contact.gif";
    nav10off = new Image(); nav10off.src = "image/nav_contact.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.target9.src="image/0.gif";
		document.target10.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


var gallery = new Array();
gallery[0] = new Array("grid_image_hm1a.jpg","grid_image_hm1b.jpg","grid_image_hm1c.jpg");
gallery[1] = new Array("grid_image_hm2a.jpg","grid_image_hm2b.jpg","grid_image_hm2c.jpg");
gallery[2] = new Array("grid_image_hm3a.jpg","grid_image_hm3b.jpg","grid_image_hm3c.jpg");
gallery[3] = new Array("grid_image1a.jpg","grid_image1b.jpg","grid_image1c.jpg","grid_image1d.jpg");
gallery[4] = new Array("grid_image2a.jpg","grid_image2b.jpg","grid_image2c.jpg","grid_image2d.jpg");

function pickImageFrom(whichGallery)
{
var idx = Math.floor(Math.random() * gallery[whichGallery].length);
document.write('<img src="image/' + gallery[whichGallery][idx] + '">');
}



  
   function showBlock(blockId)
  {
    document.getElementById(blockId).style.display = "block";
  }
  function hideBlock(blockId)
  {
    document.getElementById(blockId).style.display = "none";
  }
  
  
   var win= null;
 function NewWindow(mypage,myname,w,h,scroll){
 var winl = (screen.width-w)/2;
 var wint = (screen.height-h)/2;
 var settings ='height='+h+',';
 settings +='width='+w+',';
 settings +='top='+wint+',';
 settings +='left='+winl+',';
 settings +='scrollbars='+scroll+',';
 settings +='resizable=no';
 win=window.open(mypage,myname,settings);
 if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
 } 

function MM_openBrWindow(theURL,winName,features) { 
 window.open(theURL,winName,features);
 }