// unless otherwise indicated, all code is Copyrighted by Kenny Liu 2001, All rights reserved.
// popup graphic script
var valentinecaption = "Pretty sweet, huh?";
var zerowingcaption = "This is hilarious!!!";

function opener(image,width,height,caption) {

	picture=window.open("","picture","scrollbars=yes,status=yes,width="+width+",height="+height);
	picture.document.write("<HEAD><TITLE>LOADING...PLEASE WAIT</title></head>");
	picture.document.write("<body text='#FFFFFF' bgcolor='#000000' link='#99FFFF'>");
	picture.document.write("<a href='javascript:close()'><img border='0' align='left' src='http://www.kennyliu.com/images/goback.jpg'></a><img align='right' src='http://www.kennyliu.com/images/copyright.gif'><br><hr>");

	picture.document.write("<center><span style='font-family: verdana; font-size: 10px; color: white; text-align: center'>");
	picture.document.write(caption+"</span>");
	picture.document.write("<p><a href='javascript:close()'><img border='0' src='http://www.kennyliu.com/popperpix/"+image+"'><br><hr><span style=\"font-size: 9px; color: gray; font-family: verdana\"'>Click on the picture to return...</span></a>");

}





//DO ROLLOVER ONLY IF BROWSER IS 3.0 and ABOVE (and not IE3)
// Mods Copyright 2000 Kenny Liu
// I stole this code from Eric (http://www.echeng.com) who wrote this:
// I stole this code from my friends Ben and Ardith over at Akimbo Design.
// They're awesome... check them out: http://www.akimbodesign.com

	var homeindex = 0;
	var selfindex = 1;
	var workindex = 2;
	var playindex = 3;
	var guestbookindex = 4;

	var vers= navigator.appVersion.charAt(0);
	if ((navigator.appName.indexOf("Explorer")>1) & (vers == 3)){vers=2}//if ie3, set to no-rollover
	if (vers >=3){
		//PRELOAD ROLLOVER IMAGES
		home_off = new Image();
		home_on = new Image();
		self_off = new Image();
		self_on = new Image();
		work_off = new Image();
		work_on = new Image();
		play_off = new Image();
		play_on = new Image();
		guestbook_off = new Image();
		guestbook_on = new Image();
		
		home_off.src="http://www.kennyliu.com/images/home_off.jpg";
		home_on.src="http://www.kennyliu.com/images/home_on.jpg";
		self_off.src="http://www.kennyliu.com/images/self_off.jpg";
		self_on.src="http://www.kennyliu.com/images/self_on.jpg";
		work_off.src="http://www.kennyliu.com/images/work_off.jpg";
		work_on.src="http://www.kennyliu.com/images/work_on.jpg";
		play_off.src="http://www.kennyliu.com/images/play_off.jpg";
		play_on.src="http://www.kennyliu.com/images/play_on.jpg";
		guestbook_off.src="http://www.kennyliu.com/images/guestbook_off.jpg";
		guestbook_on.src="http://www.kennyliu.com/images/guestbook_on.jpg";
	}

function doRollover(arrayNum,graphicName){
	if (vers >=3){
		document.images[arrayNum].src=eval(graphicName+"_on.src");
	}
}

function doRestore(arrayNum,graphicName){
	if (vers >=3){
		document.images[arrayNum].src=eval(graphicName+"_off.src");	
	}
}


// browswer sniffing
var agt = navigator.userAgent.toLowerCase();
var ie = (agt.indexOf("msie") != -1); // sets ie to true if user is using IE
var major = parseFloat(navigator.appVersion);

// script to rollover descriptions

function restore() {desc.innerHTML="<img src='http://www.kennyliu.com/images/buffer.gif'>";}
function computerstext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>I am a digital boy with digital toys.<br><br>Welcome to my digital world."}
function guitartext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>A page dedicated to the least expensive of the stringed instruments."}
function musictext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>Music, plain and simple."}
function gallerytext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>A collection of pictures.<br><br>A visual documentary.<br><br>Are your eyes hard up for some entertainment?  I\'m sorry but you won\'t find any here, but come on in anyways!"}
function linktext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>When you get a chance, check out some of these links!"}
function ppttext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>Why would anyone put up a compilation of all their PowerPoint presentations?<br><br>To better the world, I suppose."}
function medtext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>The wild, wild world of medicine.<br><br>Enter at your own risk."}
function researchtext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>My research interests."}
function pubstext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>If you're really bored, you can peruse my contributions to the scientific community."}
function biotext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>Meet the mastermind.<br>Meet the weirdo.<br>Enter the kenny."}
function cvtext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>Want a good laugh?<br>Take a peek at my <i>curriculum vitae</i>."}
function musingstext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>Just a page full of the quotes, stories, and thoughts that get me through life."}
function whytext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>Why do I waste my time with this web site thing?"}
function brainstormtext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>Kinda like, umm...., creative writing or something, you know?"}
function hardatworktext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>For everyone who ever wondered what it was really like to be a surgical resident, you can read about it right here."}
function sobstext() {desc.innerHTML="<p style='margin-left: 5px; margin-top: 20px'>I\'ve heard of streams of consciousness, but streams of <i>bullshit</i>??!"}

//randomize home page saying
var numoflogos = 6 - 1;
var logoindex = 0; // sets logo switching for other pages
if ((ie) || (major >= 5)) {logoindex = 8;}
else logoindex = 10;
var indexlogoindex = 0; // sets logo switching for index page
if ((ie) || (major >= 5)) {indexlogoindex = 10;}
else {indexlogoindex = 12;}

// preload images
boredom = new Image;
mediocrity = new Image;
ennui = new Image;
youllbesorry = new Image;
maximallylame = new Image;
gustywinds = new Image;

boredom.src="http://www.kennyliu.com/images/boredom.jpg";
mediocrity.src="http://www.kennyliu.com/images/mediocrity.jpg";
ennui.src="http://www.kennyliu.com/images/ennui.jpg";
youllbesorry.src="http://www.kennyliu.com/images/youllbesorry.jpg";
maximallylame.src="http://www.kennyliu.com/images/maximallylame.jpg";
gustywinds.src="http://www.kennyliu.com/images/gustywinds.jpg";

logoArray = new Array(6);
logoArray[0] = boredom.src;
logoArray[1] = mediocrity.src;
logoArray[2] = ennui.src;
logoArray[3] = youllbesorry.src;
logoArray[4] = maximallylame.src;
logoArray[5] = gustywinds.src;

function getRandomIndexLogo() {
	if (vers >= 3) {
		document.images[indexlogoindex].src=logoArray[returnrandom(numoflogos)];
	}
}

function getRandomLogo() {
	if (vers >= 3) {
		document.images[logoindex].src=logoArray[returnrandom(numoflogos)];
	}
}


//randomize kennyliu letters
var letterindex = 0;
if ((ie) || (major >= 5)) {letterindex = 7;}
else letterindex = 9;

var numofletters = 6; // 7 - 1

//preload
k = new Image;
e = new Image;
n = new Image;
y = new Image;
l = new Image;
i = new Image;
u = new Image;

k.src="http://www.kennyliu.com/images/k.jpg";
e.src="http://www.kennyliu.com/images/e.jpg";
n.src="http://www.kennyliu.com/images/n.jpg";
y.src="http://www.kennyliu.com/images/y.jpg";
l.src="http://www.kennyliu.com/images/l.jpg";
i.src="http://www.kennyliu.com/images/i.jpg";
u.src="http://www.kennyliu.com/images/u.jpg";

// array to hold letters
letterArray = new Array(6);
letterArray[0] = k.src;
letterArray[1] = e.src;
letterArray[2] = n.src;
letterArray[3] = y.src;
letterArray[4] = l.src;
letterArray[5] = i.src;
letterArray[6] = u.src;

function getRandomLetter() {
	if (vers >= 3) {
		document.images[letterindex].src=letterArray[returnrandom(numofletters)];
	}
}


function returnrandom(num) {
	var number = (Math.random() * num);
	return Math.round(number);
}
