function switchPage(which) {
	if (which == 1) {
		location.href = document.work.selection.options[document.work.selection.options.selectedIndex].value;
	} else if (which == 2) {
		location.href = location.href.substr(0,location.href.lastIndexOf("?"))+"?id="+document.work.item.options[document.work.item.options.selectedIndex].value;
	}
}

function picSel(which,big) {
	document.getElementById('picBig').src = eval('pic'+big+'.src');
	document.getElementById('caption').innerHTML = captions[big];
	i = 1;
	while (document.getElementById('thumb'+i)) {
		document.getElementById('thumb'+i).className = "pic";
		i++;
	}
	which.className = "picSel";
}

function picOver(which) {
	if (which.className != "picSel")
		which.className = "picOn";
}

function picOut(which) {
	if (which.className != "picSel")
		which.className = "pic";
}

function resize(pg) {
	if (pg == "lg") {
		parent.document.getElementById('cont').style.height = '570px';
	} else {
		parent.document.getElementById('cont').style.height = '365px';
	}
}

function navImageOn(theimg) {
	if (theimg != navOn) {
		imageOn(theimg);
	}
}

function navImageOff(theimg) {
	if (theimg != navOn) {
		imageOff(theimg);
	}
}

function imageStay(theimg) {
	imageClear(navOn);
	navOn = theimg;
	imageOn(theimg);
	if (theimg != 'navBio') {
		callIt('Bio');
	} else {
		callIt('Awards');
	}
}

function swapCallout() {
	if (document['callout'].src.indexOf('calloutBio.jpg') > 0) {
		imageStay('navBio');
		frames['cont'].location.href = 'bio.php';
	} else {
		imageStay('navWork');
		frames['cont'].location.href = 'awards.php';
	}
}

function callIt(which) {
	document['callout'].src = 'images/callout' + which + '.jpg';
}

function intImageOn(theimg) {
	if (theimg != interviewOn) {
		imageOn(theimg);
	}
}

function intImageOff(theimg) {
	if (theimg != interviewOn) {
		imageOff(theimg);
	}
}

function intImageStay(theimg) {
	thenum = theimg.split('_');
	thenum = thenum[1];
	imageClear(interviewOn);
	interviewOn = theimg;
	document['interviewHead'].src = 'images/interview' + thenum + '.gif';
	imageOn(theimg);
}

function imageClear(which) {
	if (which) {
		imageOff(which);
	}
}

function imageOn(theimg) {
	if (load == "yes") {
		if (document.images) {
			document[theimg].src = eval(theimg + "On.src");
		}
	}
}

function imageOff(theimg) {
	if (load == "yes") {
		if (document.images) {
			document[theimg].src = eval(theimg + ".src");
		}
	}
}

var initialdelay = 100;
var downscroll = "";
var upscroll = "";

function stopScroll() {
	clearTimeout(downscroll);
	clearTimeout(upscroll);
	scrollspeed = 0;
}

function downScroll() {
	if (document.all) {
		dataobj = document.frames['content'].window.document.getElementById('info');
	} else {
		dataobj = document.getElementById('content').contentDocument.getElementById('info');
	}
	scrollspeed = 3;
	setTimeout("getdataheight()", initialdelay);
}

function upScroll() {
	if (document.all) {
		dataobj = document.frames['content'].window.document.getElementById('info');
	} else {
		dataobj = document.getElementById('content').contentDocument.getElementById('info');
	}
	scrollspeed = 3;
	setTimeout("getdataheightUp()", initialdelay);
}

function getdataheight() {
	thelength=dataobj.offsetHeight;
	if (thelength==0)
		setTimeout("getdataheight()",10);
	else
		clearTimeout(upscroll);
		downDiv();
}

function getdataheightUp() {
	thelength=dataobj.offsetHeight;
	if (thelength==0)
		setTimeout("getdataheightUp()",10);
	else
		clearTimeout(downscroll);
		upDiv();
}

function downDiv() {
	frameheight = document.getElementById('content').style.height;
	if (parseInt(dataobj.style.top) < (thelength*(-1)+parseInt(frameheight))) {
		scrollspeed = 0;
		clearTimeout(downscroll);
	} else {
		dataobj.style.top = parseInt(dataobj.style.top) - scrollspeed + "px";
	}
	downscroll = setTimeout("downDiv()",40);
}

function upDiv() {
	if (parseInt(dataobj.style.top) >= 0) {
		scrollspeed = 0;
		clearTimeout(upscroll);
	} else {
		dataobj.style.top = parseInt(dataobj.style.top) + scrollspeed + "px";
	}
	upscroll = setTimeout("upDiv()",40);
}

function tog(thing) {
	if (thing) {
		if (document.layers) {
			if (document.eval(thing).display == 'none') { document.eval(thing).display='block'; } else { document.eval(thing).display='none'; }
		} else {
			if (document.getElementById(thing).style.display == 'none') { document.getElementById(thing).style.display='block'; } else { document.getElementById(thing).style.display='none'; }
		}
	}
}

function openMedia(movietype,which) {
	window.open('media.php?id='+which+'&movietype='+movietype,'media','width=350,height=250,scrollbars=no,location=no,menubar=no,resizable=no,status=no,toolbar=no');
}
