function musicPopup() {
	var width  = 464;
	var height = 364;
	var left   = (screen.width  - width)/2;
	var top    = ((screen.height - height)/4)*3;
	var params = 'width='+width+', height='+height;
	params += ', top='+top+', left='+left;
	params += ', directories=no';
	params += ', location=no';
	params += ', menubar=0';
	params += ', resizable=0';
	params += ', scrollbars=0';
	params += ', status=0';
	params += ', toolbar=0';
	newMusicWin=window.open("music.html",'musicWindow', params);
}
 
 function myspacePopup(){
	 var width  = 800;
	 var height = 500;
	 var left   = (screen.width  - width)/2;
	 var top    = (screen.height - height)/2;
	 var params = 'width='+width+', height='+height;
	 params += ', top='+top+', left='+left;
	 params += ', directories=no';
	 params += ', location=no';
	 params += ', menubar=1';
	 params += ', resizable=1';
	 params += ', scrollbars=1';
	 params += ', status=1';
	 params += ', toolbar=1';
	 newMyspaceWin=window.open("http://www.myspace.com/waituntildusk",'myspaceWindow', params);
 } 
 
var picMax=2;

 function pic_note(max) {
 var rand_num = Math.floor(Math.random()*max)+1;
 return rand_num;
 }
 
 function wisdomFind() {
 var wisdom_max=wisdoms.length;
 var rand_num = Math.floor(Math.random()*wisdom_max);
 return rand_num;
}

function picturesFind() {
 var rand_num = Math.floor(Math.random()*coverPhotosNumber);
 return rand_num;
}

function jumpToDiv(which) {
//var saying = wisdomFind();
if (which==music)
	{
		musicPopup(); 
	}
else if (which==myspace)
	{
		myspacePopup();
	}
else
	{
		document.getElementById("innerContainer").innerHTML=which;
	}
if (which==band)
	{
		setMembers();
		document.getElementById('bandPageImage').src="images/b"+pic_note(bandPagePhotosNumber)+".png"; setMembers();
	}
if (which==home)
	{
		document.getElementById("actualWisdom").innerHTML=wisdoms[wisdomFind()];
		document.getElementById("coverPhoto").src="images/c"+(picturesFind()+1)+".png";
	}	
}

function gameInfo(name, width, height ) {
    this.name = name;
    this.height = height;
    this.width = width;
}

var numberOfgameChoices=gameInformation.length/3;
var gameChoices=new Array();

for (i=0; i <numberOfgameChoices; i++)
{
	gameInfo[i]=new gameInfo(gameInformation[i*3],gameInformation[i*3+1],gameInformation[i*3+2]);
}

function findGame(name){
if (name=="Please select a game to play...")
	return("");
for (i=0; i <numberOfgameChoices; i++)
{
	if (gameInfo[i].name==name)
	{
		var height=gameInfo[i].height;
		var width=gameInfo[i].width;
		return ("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='"+width+"' height='"+height+"' id='movie' align=''> <param name='movie' value='games/"+name+".swf'> <embed src='games/"+name+".swf' quality='high' width='"+width+"' height='"+height+"' name='movie' align='' type='application/x-shockwave-flash' plug inspage='http://www.macromedia.com/go/getflashplayer'></object>");
	}
}
return("<p class=\"center\">Game not found. Please choose again.</p>");
}


function bandInfo (name, bands, books, movies, tv,teams) {
	this.name=name;
	this.bands=bands;
	this.books=books;
	this.movies=movies;
	this.tv=tv;
	this.teams=teams;
}

var chris, kevin, sean;

function setMembers(){
chris=new bandInfo("Chris","<li>Coldplay</li><li>Muse</li><li>RadioHead</li>","<li>Anne Rice</li>","<li>Martin Scorsese</li><li>Fear and Loathing in Las Vegas</li><li>Very Bad Things</li>","<li>History Channel</li><li>Discovery Channel</li>","<li>New York Yankees</li><li>Washington Redskins</li>");
kevin=new bandInfo("Kevin","<li>Miles Davis</li><li>Johnny Cash</li><li>Bob Dylan</li>","<li>William Kennedy</li><li>Frank McCourt</li><li>Dr. Seuss</li>","<li>Kevin Smith</li><li>Blues Brothers</li><li>Crash</li>","<li>Kevin does not own a TV</li>","<li>New York Yankees</li><li>Dallas Cowboys</li>");
sean=new bandInfo("Sean","<li>Death Cab for Cutie</li><li>The Killers</li><li>Nick Drake</li>","<li>Richard Bach</li><li>Kurt Vonnegut</li><li>Dan Brown</li>","<li>Jean-Pierre Jeunet</li><li>Wes Anderson</li><li>The Matrix</li>","<li>Lost</li><li>The O.C.(RIP)</li><li>SpongeBob Squarepants</li>","<li>Boston Red Sox</li><li>New England Patriots</li>");
}

function showBandMember (which, obj) {
var pictureToChange="images/"+which+".jpg";
document.getElementById('nameTag').innerHTML = obj.name;
document.getElementById('nameTag').style.visibility='visible';
document.getElementById('chrisHeading2').style.visibility='hidden';
document.getElementById('kevinHeading2').style.visibility='hidden';
document.getElementById('seanHeading2').style.visibility='hidden';
document.getElementById('chrisHeading1').style.visibility='visible';
document.getElementById('kevinHeading1').style.visibility='visible';
document.getElementById('seanHeading1').style.visibility='visible';
document.getElementById('favoritesDiv').style.visibility='visible';
document.getElementById('member').src="images/"+which+".jpg";
document.getElementById('memberPhoto').style.visibility='visible';
document.getElementById(which+"Heading1").style.visibility='hidden';
document.getElementById(which+"Heading2").style.visibility='visible';
document.getElementById('memberBands').innerHTML = obj.bands;
document.getElementById('memberBooks').innerHTML = obj.books;
document.getElementById('memberMovies').innerHTML = obj.movies;
document.getElementById('memberTV').innerHTML = obj.tv;
document.getElementById('memberTeams').innerHTML = obj.teams;
}

function manipulateDiv(which) {
var path=document.getElementById(which+"Sign").src
var sign=path.substring(path.length-8,path.length);
if (sign=="plus.gif")
{
document.getElementById(which+"Cell").style.visibility='visible';
document.getElementById(which+"Sign").src="images/dash.gif";
}
else
{
document.getElementById(which+"Cell").style.visibility='hidden';
document.getElementById(which+"Sign").src="images/plus.gif";
}
}

var numberOfpicChoices=picInformation.length/2;
//var picChoices=new Array();
var picNum, current;
imageObj = new Image();
var pic=new Array();
var i;

function setPictureDiv (){
	document.getElementById('picContainerImage').src=pic[0];
	document.getElementById('picButtons').style.visibility="visible";
	current=1;
	document.getElementById('picCaption').innerHTML="Picture: "+current+" of "+picNum;	
}

function findPic(name){
	for (i=0; i <numberOfpicChoices; i++)
	{
		if (picInformation[i*2]==name) {
			picNum=picInformation[i*2+1];
			i=numberOfpicChoices;
		}
	}
	var oldEvt = window.onload;
	for (i=0;i<picNum;i++) {
		pic[i] = "photos/"+name+'/p_'+(i+1)+'.jpg';
		imageObj.src=pic[i];
	}
	window.onload = setPictureDiv();
}

function findPhotos(which)
{
	document.getElementById('picButtons').style.visibility="hidden";	
	if ((which=="")||(which=="Please select an event to view..."))
	{
	document.getElementById('picContainerImage').src="photos/trans.png";
	document.getElementById('picCaption').innerHTML= "";
	document.getElementById('picButtons').style.visibility="hidden";
	return;
	}
	else
	{
	document.getElementById('picContainerImage').src="photos/loading.gif";
	document.getElementById('picCaption').innerHTML= "<font color='red'>Loading...</font>";
	findPic(which); 
	}
	return;
}

function picChange(direction) {
	if (direction=="up") {
		if (current== picNum)
			current=1;
		else
		    current=current+1;
	}
	else {		
	if (current== 1)
			current=picNum;
		else
		    current=current-1;
	}	
	document.getElementById('picContainerImage').src=pic[current-1];
	document.getElementById('picCaption').innerHTML="Picture: "+current+" of "+picNum;
}

function manipulateEventDiv(which) {
var path=document.getElementById(which+"Sign").src
var sign=path.substring(path.length-8,path.length);
if (sign=="plus.gif")
{
document.getElementById(which+"Cell").style.display='block';
document.getElementById(which+"Sign").src="images/dash.gif";
}
else
{
document.getElementById(which+"Cell").style.display='none';
document.getElementById(which+"Sign").src="images/plus.gif";
}
}

var loadPics=new Array();
var counter=0;
var a,b;
for (a=0; a <numberOfpicChoices; a++) {
	for (b=0;b<picInformation[a*2+1];b++) {
		loadPics[counter]=new Image();
		loadPics[counter].src="photos/"+picInformation[i*2]+'/p_'+(b+1)+'.jpg';
		counter=counter+1;
	}
}