/**
 * @author Russ
 */

// pages *****************************************************************
var pages = new Array();
pages[0] = new page("Home","index");
pages[1] = new page("About","about");
pages[2] = new page("Calendar","calendar");
pages[3] = new page("Gallery","gallery");
pages[4] = new page("Animation","animation");
pages[5] = new page("Awards","awards");
pages[6] = new page("Press","press");
pages[7] = new page("Sponsors","sponsors");
pages[8] = new page("Contact","contact");

// page definition *******************************************************
function page(name,address)
{
this.name=name;
this.address=address+".php";
}

// scrolling code ******************************************************************
var header_x = 0;
function skip()
{
	header_x = header_x - 50;
	document.getElementById('header').style.backgroundPosition = 
	header_x+"px 0px" ;
}
var scrollSpeed = 0;
var actualScrollSpeed = 0;
var pause = false;
function startScroll() 
{
	if (scrollSpeed != 0) {return;}
	scrollSpeed = 1;	
	//console.log("startscrolling set to 1");
}
function scroller()
{
	if (!pause) {
		if (actualScrollSpeed < scrollSpeed) {actualScrollSpeed++;}
		else if (actualScrollSpeed > scrollSpeed) {actualScrollSpeed--;}
		header_x = header_x - actualScrollSpeed;
		document.getElementById('header').style.backgroundPosition = header_x+"px 0px" ;
	}
	scrollTimer = setTimeout('scroller()', 15);
}
function stopScroll()
{
	scrollSpeed = 0;
	//console.log("stopscroll");
}
function pauseScroll()
{
	pause = !pause;
}
function setScrollSpeed(number)
{
	scrollSpeed = number;
	//console.log("setscrolling set to "+number);
}


// writing html macros **********************************************************************

function writeGallery() 
{
	document.writeln("<h1>Image Gallery</h1>");
	
	var years = new Array();
	var i;
	for (i=2008; i>=2006;i--) {
		years[years.length] = i+"";
	}
  years[years.length] = "Older";
	
	var y;
	for (y in years) {
		document.writeln("<div class=\"galleryYear\">\
    <a class=\"galleryYear\" href=\"gallery.php?year="+years[y]+"\"><img src=\"gallery"+years[y]+"/tb/001.gif\" />\
    "+years[y]+"</a></div>");
	}
	
}

function writeLinks(thisPageName)
{
	document.write("<div class=\"links\"> \n\
	<ul class=\"links\">");
	
	var i;
	for (i in pages)
	{
		document.write("<li class=\"");
		if (thisPageName == pages[i].name)	{
			document.write("current\">"+pages[i].name);
		} else {
			document.write("links\"><a class=\"links\" href=\""+pages[i].address+"\">"+pages[i].name+"</a>");
		}
		
		document.writeln("</li>");
	}
	//link to new site
	document.write("<li class=\"links\"> <a class=\"links\" href=\"http://66.198.105.201/2\"> New Site (In Progress) </a> </li>");
	//<li class="links"> <a class="links" href="hello.html"> New Site </a> </li>
	
	document.write("</ul> \n\
	</div>");
	
	
}
function writeHeader()
{
	document.write("<div id=\"header\" class=\"header\" onClick=\"pauseScroll()\" onMouseOver=\"startScroll();\" onMouseOut=\"stopScroll();\"> \n\
	<img class=\"top_logo\" src=\"images/GRT_white_trans.png\" alt=\"Gunn Robotics Team\" /> \n\
	<div class=\"rewind\" onMouseOver=\"setScrollSpeed(-15);\"> \<\< Rewind </div> \n\
	<div class=\"forward\" onMouseOver=\"setScrollSpeed(15);\"> Fast Forward \>\> </div>\n\
	</div>");
	scroller();
}
function writeFooter()
{
	document.writeln(" \
	<div class=\"footer\"> \n\
	<ul> \n\
	<li class=\"footer\">GRT is proudly sponsored by <a href=\"sponsors.php\"><img border=0 src=\"images/ASUSsmallLogo.jpg\" /></a></li> \n\
	<li class=\"footer\">Copyright &#169; 2006-2010 Russell Chou, Dan Li, Ian Henderson, Sam Neff and the Gunn Robotics Team.  All Rights Reserved.  </li> <br> \n\
	<li class=\"footer2\"> Best viewed in Mozilla Firefox with Normal font size. Requires Javascript. </li> \n\
  </ul> \n\
  </div>");
}
// Lorenz you can add your name AFTER you put in real work, ie 8-10 hours in 3-5 updates, not before.



