// check to make sure site is not contained within a frameset
if (self.parent.frames.length != 0)	top.location = self.document.location;
	
// reload page if in Netscape if resized
if(document.layers){origWidth=innerWidth;origHeight=innerHeight;onresize=function(){if(innerWidth!=origWidth||innerHeight!=origHeight)location.reload()}}

// searches document for object id tags and returns exact reference
function findObj(n,d)
{ var p,i,x
	if(!d)d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length)
	{ d=parent.frames[n.substring(p+1)].document
		n=n.substring(0,p)
	}
	if(!(x=d[n])&&d.all) x=d.all[n]
	if(!(x=d[n])&&d.getElementById) x=d.getElementById(n)
	for (i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n]
	for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=findObj(n,d.layers[i].document)
	return x
}
		
var preloadFlag = false;

// first argument is the status bar message, each two after that is the image id and image source
// the status message mat be omitted, the image extension default is '.gif' unless otherwise specified
// function will not execute unless you place the following in the 'body' tag on your page
// onLoad="preloadImages('btn_example_ov','btn_example_dn');";
function changeImages() {  //v2.0
	if (document.images && preloadFlag) {
		var status = (changeImages.arguments.length%2);
		if (status)
			statusBar(changeImages.arguments[0]);
		else
			statusBar('');
		for (var i=status; i<changeImages.arguments.length; i+=2){
			var argumentI = changeImages.arguments[i+1];
			var ext = argumentI.substring((argumentI.length-4),argumentI.length);
			noExt = (ext==".gif"||ext==".jpg"||ext==".png")?0:1;
			newSrc = (noExt)?argumentI+".gif":argumentI;
			document[changeImages.arguments[i]].src = newSrc;
		}
	}
}		
		
// change the message in the status bar
function statusBar(comment){window.status=comment;return true;}

// preloads any rollover images into an array for changeImages() function
function preloadImages() {
	if (document.images) {
		var ar = new Array();
		for (var i=0; i<preloadImages.arguments.length; i++) {
			var argumentI = preloadImages.arguments[i];
			var ext = argumentI.substring((argumentI.length-4),argumentI.length);
			noExt = (ext==".gif"||ext==".jpg"||ext==".png")?0:1;
			ar[i] = new Image();
			ar[i].src = (noExt)?argumentI+".gif":argumentI;
		}
		preloadFlag = true;
	}
}

// displays either a male or female face on the home page and in the main navigation
function randomFace(pageVar) 
{
	var gender = (Math.random()*10<5)?"man":"woman";
	switch(pageVar) {
		case "splash" :
			preloadFlag = true;
			eval("changeImages('randomface', 'images/rnd_"+gender+"_image1.jpg')");
			break;
		case "home" :
			eval("changeImages('randomface', 'images/rnd_"+gender+"3_image1.gif')");
			eval("changeImages('randomface2', 'images/rnd_"+gender+"3_image2.gif')");
			eval("changeImages('randomface3', 'images/rnd_"+gender+"3_image3.gif')");
			break;
		default :
			eval("changeImages('randomface', '../images/"+gender+"2_image1.gif')");
			eval("changeImages('randomface2', '../images/"+gender+"2_image2.gif')");
			break;
	}
}

