window.onresize = resizePage;
window.onload = init;

function showAdmin()
{
	bwidth = GetWidth();
	bheight = GetHeight();
	
	boxHeight = 400;
	boxWidth = 700;
	
	document.getElementById("projectSuppl").style.display = "block";
	document.getElementById("projectSuppl").style.top = (bheight - boxHeight ) / 2 +"px";
	document.getElementById("projectSuppl").style.left = (bwidth - boxWidth ) / 2+"px";
	
}

function toggleProjectList(name)
{
	if(document.getElementById(name).style.display == "none") {
		new Effect.BlindDown(name);
	} else {
		new Effect.BlindUp(name);
	}
}

function init()
{
	// Resize page to fit browser window
	resizePage();
	runSlideShow();
	// Populate goals
	//FillGoals();
}

function resizePage()
{
	minSize = false;
	
	// Overall height
	height = GetHeight() - 103 - 85 - 20;
	document.getElementById("middleContent").style.height = height + "px";
	
	width = GetWidth() - 200;
	if(width > 752)
	{
		document.getElementById("container").style.width = width + "px";
		document.getElementById("middleContent").style.width = width + "px";
	}
	else
	{
		width = 752;
		minSize = true;
		document.getElementById("container").style.width = width + "px";
		document.getElementById("middleContent").style.width = width + "px";
	}

	if(GetHeight() < 700)
	{
		document.getElementById("navcontainer").style.fontSize = "10px";
	}

	if(GetHeight() < 600)
	{
		document.getElementById("navcontainer").style.fontSize = "8px";
	}
	
	if(!minSize)
	{
		width = GetWidth() - 325 - 40 - 200;
		document.getElementById("news").style.width = width + "px";
		document.getElementById("events").style.width = width + "px";
		

	}
	else
	{
		width = 385;
		document.getElementById("news").style.width = width + "px";
		document.getElementById("events").style.width = width + "px";
	}
	
			height = GetHeight();
		height = (height - 103 - 85 - 30) / 2;
		document.getElementById("news").style.height = height + "px";
		document.getElementById("events").style.height = height + "px";
}

//Helper functions

function GetHeight()
{
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

  return myHeight;
}

function GetWidth()
{
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

  return myWidth;
}


// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header

// =======================================
// set the following variables
// =======================================

// Set speed (milliseconds)
var slideShowSpeed = 3000

// Duration of crossfade (seconds)
var crossFadeDuration = 10

// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'splashImages/splash1.jpg'
Pic[1] = 'splashImages/splash2.jpg'
Pic[2] = 'splashImages/splash3.jpg'
Pic[3] = 'splashImages/splash4.jpg'
Pic[4] = 'splashImages/splash5.jpg'
Pic[5] = 'splashImages/splash6.jpg'
Pic[6] = 'splashImages/splash7.jpg'
Pic[7] = 'splashImages/splash8.jpg'
Pic[8] = 'splashImages/splash9.jpg'
Pic[9] = 'splashImages/splash10.jpg'
Pic[10] = 'splashImages/splash11.jpg'
Pic[11] = 'splashImages/splash12.jpg'
Pic[12] = 'splashImages/splash13.jpg'



// =======================================
// do not edit anything below this line
// =======================================

var t
var numPics = 9;
var ran_unrounded	= Math.random()*numPics;
var ran_number		= Math.round(ran_unrounded);

var j = 0;
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}

function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()      
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   ran_unrounded	= Math.random()*numPics;
   ran_number		= Math.round(ran_unrounded);

   j = ran_number;
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}
