// WOOF!

function preload_nav() {
if(document.images) {
  var ImgArray = new Array();
  for (var i = 0; i < 5; i++) {
    ImgArray[i] = new Image();
  }    
	ImgArray[0].src = "/wgbh/woof/images/nav_tips_over.gif";
	ImgArray[1].src = "/wgbh/woof/images/nav_questions_over.gif";
	ImgArray[2].src = "/wgbh/woof/images/nav_fetch_over.gif";
	ImgArray[3].src = "/wgbh/woof/images/nav_stories_over.gif";
	ImgArray[4].src = "/wgbh/woof/images/nav_about_over.gif";
  }
}

function preload_about_nav() {
if(document.images) {
  var ImgArray = new Array();
  for (var i = 0; i < 4; i++) {
    ImgArray[i] = new Image();
  }    
	ImgArray[0].src = "/wgbh/woof/about/images/nav_series_over.gif";
	ImgArray[1].src = "/wgbh/woof/about/images/nav_descriptions_over.gif";
	ImgArray[2].src = "/wgbh/woof/about/images/nav_schedule_over.gif";
	ImgArray[3].src = "/wgbh/woof/about/images/nav_matty_over.gif";
  }
}

function preload_home_nav() {
if(document.images) {
  var ImgArray = new Array();
  for (var i = 0; i < 5; i++) {
    ImgArray[i] = new Image();
  }    
	ImgArray[0].src = "/wgbh/woof/images/home_tips_over.gif";
	ImgArray[1].src = "/wgbh/woof/images/home_questions_over.gif";
	ImgArray[2].src = "/wgbh/woof/images/home_fetch_over.gif";
	ImgArray[3].src = "/wgbh/woof/images/home_stories_over.gif";
	ImgArray[4].src = "/wgbh/woof/images/home_about_over.gif";
  }
}

function on_nav(imgName, level) {
	var objStr, obj, imgRurl;
	if(document.images) {
		if(level == "0"){
	  		objStr = 'document.' + imgName;
      		obj = eval(objStr);
      		imgRurl = 'images/nav_' + imgName + '_over.gif';
      		obj.src = imgRurl;      		
      		}
      	else if(level == "1"){
	  		objStr = 'document.' + imgName;
      		obj = eval(objStr);
      		imgRurl = '../images/nav_' + imgName + '_over.gif';
      		obj.src = imgRurl;      		
			}
		else if(level == "a"){
	  		objStr = 'document.' + imgName;
      		obj = eval(objStr);
      		imgRurl = 'images/nav_' + imgName + '_over.gif';
      		obj.src = imgRurl;      		
			}
		else if(level == "h"){
	  		objStr = 'document.' + imgName;
      		obj = eval(objStr);
      		imgRurl = 'images/home_' + imgName + '_over.gif';
      		obj.src = imgRurl;      		
			}
	}	    		
}

function off_nav(imgName, level) {
	var objStr, obj, imgRurl;
	if(document.images) {
		if(level == "0"){
	  		objStr = 'document.' + imgName;
      		obj = eval(objStr);      
      		imgRurl = 'images/nav_' + imgName + '.gif';
      		obj.src = imgRurl;
      		} 
      	else if(level == "1"){
	  		objStr = 'document.' + imgName;
      		obj = eval(objStr);      
      		imgRurl = '../images/nav_' + imgName + '.gif';
      		obj.src = imgRurl;
			}
		else if(level == "a"){
	  		objStr = 'document.' + imgName;
      		obj = eval(objStr);      
      		imgRurl = 'images/nav_' + imgName + '_on.gif';
      		obj.src = imgRurl;
			}
		else if(level == "h"){
	  		objStr = 'document.' + imgName;
      		obj = eval(objStr);      
      		imgRurl = 'images/home_' + imgName + '.gif';
      		obj.src = imgRurl;
			}
	}
}

// force tables in  NN to go all the way to the right margin
// by adding a transparent spacer

		function makeIt (num,exception) {
 	 		var browser = navigator.appName;
			 var version = parseInt(navigator.appVersion);
			 var width;
			 // pick location from browser address bar so script can be used at any level 
			 var location = document.location.href.substr(0,document.location.href.indexOf('woof/'));
			 location += 'woof/';	
			 		 
			 if (browser == "Netscape" && version >= '4') {
			 	width = window.innerWidth;
			 	if (num == 'total') {
		 			space = '<img src=' + location + 'images/spacer.gif width=' + width + ' height=1  border=0  alt="" />'; 
		 			return space;
		 		} else if (width <= num) {  
		 			space = '&nbsp;';
		 		} else {
		 			
		 			width = width - num; 
		 			//make sure path to spacer.gif is correct
		 			space = '<img src=' + location + 'images/spacer.gif width=' + width + ' height=1  border=0  alt="" />'; 
		 		}
			 } else if (browser != "Netscape" && num == 'total') {
		 		space = '';
			 } else if (browser !="Netscape" && exception == "IE") {
//				space = '';		 	
				space = '<img src=' + location + 'images/spacer.gif width=' + width + ' height=1  border=0  alt="" />'; 
			 } else {
			 	space = '&nbsp;';
			 }
			 return space;
		}
