function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		nav_home009 = newImage("images/interface/nav_home-09.gif");
		nav_adopt011 = newImage("images/interface/nav_adopt-11.gif");
		nav_assistance013 = newImage("images/interface/nav_assistance-13.gif");
		nav_events015 = newImage("images/interface/nav_events-15.gif");
		nav_stories017 = newImage("images/interface/nav_stories-17.gif");
		nav_about_us019 = newImage("images/interface/nav_about_us-19.gif");
		nav_contact021 = newImage("images/interface/nav_contact-21.gif");
		nav_rainbow023 = newImage("images/interface/nav_rainbow-23.gif");
		preloadFlag = true;
	}
}

<!-- Idea by:  Nic Wolfe (Nic@TimelapseProductions.com) -->
<!-- Web URL:  http://fineline.xs.mw -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=200,left = 312,top = 184');");
}
// End -->

function popUp2(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=200,height=200,left = 412,top = 284');");
}
function popUp3(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=200,height=150,left = 412,top = 284');");
}


function JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
// by E Michael Brandt of ValleyWebDesigns.com - Please leave these comments intact.
// version 3.0.4  

	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("photos.html","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="Click screen to close" >'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	}
}


/*new pop up window page for stories*/

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



/*old....POP UP WINDOWS FOR STORIES PAGE*/

//function for pop-up windows this includes an opportunity for text in each pop up window
window.name="main";
	function openwindow(desc,text)
    {                           
	var OpenWindow=window.open("", "HappyTails", config="scrollbars=yes,width=300,height=500,top=0,left=440,screenX=0,screenY=440");
    OpenWindow.document.writeln("<HTML>  <HEAD>  <TITLE> "  + desc + " </TITLE>  </HEAD>");
    OpenWindow.document.writeln("<BODY bgcolor='white' >");
    OpenWindow.document.writeln("<center><img src=images/happy/" + desc + ".jpg>");
	OpenWindow.document.writeln("<p>" + text +"</p></HTML>");    
	OpenWindow.document.writeln("<a href='' onClick='self.close()'><img src=images/close.jpg border=0></a><p>"); 
     }





// This script was supplied free by Hypergurl 
// http://www.hypergurl.com 
<!-- 
// JavaScript to interpolate random images 
//into a page. 
var ic = 6; // Number of alternative images 
var xoxo = new Array(ic);   // Array to hold filenames 
xoxo[0] = "images/random/painting6.jpg"; 
xoxo[1] = "images/random/painting1.jpg"; 
xoxo[2] = "images/random/painting2.jpg"; 
xoxo[3] = "images/random/painting3.jpg"; 
xoxo[4] = "images/random/painting4.jpg"; 
xoxo[5] = "images/random/painting5.jpg"; 
function pickRandom(range) 
{ if (Math.random) 
return Math.round(Math.random() * (range-1)); else { var now 
= new Date(); return (now.getTime() / 1000) % range; } } 
// Write out an IMG tag, using a randomly-chosen image name. 
var choice = pickRandom(ic); 
// --> 


function mask(end,middle,start){
	var one ='mai';
	var two='lto:';
	//start,middle,end,subject;
	var putogether= one+two+start+middle+end;
	document.location=eval('"'+putogether+'"');
	window.status=putogether;
}


//image swap...for puppy

dog1= new Image
dog1.src="../images/interface/col_right_bottom.gif"

dog2= new Image
dog2.src="../images/interface/col_right_bottom_over.gif"

function change(a,b)
{
document[b].src= eval(a + ".src")
}


// Comma separated list of images to rotate
var imgs = new Array('images/oscar/pic1.jpg','images/oscar/pic2.jpg','images/oscar/pic3.jpg','images/oscar/pic4.jpg');
// delay in milliseconds between image swaps 1000 = 1 second
var delay = 3000;
var counter = 0;

function preloadImgs(){
  for(var i=0;i<imgs.length;i++){
    MM_preloadImages(imgs[i]);
  }
}

function randomImages(){
  if(counter == (imgs.length)){
    counter = 0;
  }
  MM_swapImage('rotator', '', imgs[counter++]);
  setTimeout('randomImages()', delay);
}
