
// break out of frame
if (window != top) top.location.href = location.href;

// declars yrs array to store the years for which events are archived
var EventYrs = new Array();

// Get Object
function getObj(id)
{
	if (document.getElementById)
	{
		return document.getElementById(id);
	}
	else if (document.all)
	{
		return document.all[id];
	}
	else return false;
}

function HideAllYears()
{
	var eventID;
	var eventDiv;
	
	for (var i = 0; i < EventYrs.length; i++)
	{
		eventID = "res"+EventYrs[i];
		eventDiv = getObj(eventID);
		//eventDiv.style.visibility = "hidden";
		if (eventDiv) eventDiv.className = "resyear";
	}
}

function ShowYear(yr)
{
	var eventID;
	var eventDiv;
	
	HideAllYears();	// hide all years
	// show the current year
	
	eventID = "res"+yr;
	eventDiv = getObj(eventID);
	//eventDiv.style.visibility = "visible";
	if (eventDiv) eventDiv.className = "showyear";
}

// Window opener to view feature of kit
function showFeature(featureid)
{
	var featurewin = window.open('kit/featureview.php?featureid='+featureid,'f_viewer','width=420,height=600');
}

// image gallery - swap image
function swapImage(imageurl)
{
	if (window.document.images)
		window.document.images['mainimage'].src = imageurl;
}

// swap image
function swapImageID(imageurl,imageid)
{
	if (window.document.images)
		window.document.images[imageid].src = imageurl;
}

function playClip(clipID)
{
	window.location = "peakukgallery.php?content=video&clip="+clipID;
}

function fetchArticle()
{
	window.location = "peakuknews.php?article="+jartid[curarticle];
}

// Div Writer Script
function writeDiv(text,elemid)
{
	if (document.getElementById)
	{
		x = document.getElementById(elemid);
		x.innerHTML = text;
	}
	else if (document.all)
	{
		x = document.all[elemid];
		x.innerHTML = text;
	}
}
// end DivWriter
	
// Typewriter Script for section heading
var typeTime;

function typewriter(num)
{
	num++;
	var fulltext = jartheadline[curarticle];
	var artdate = jartdate[curarticle];
	// generate output string
	outText = fulltext.substring(0, num);
	if (num>fulltext.length)
		outText = outText+"<br /><span style=\"font-size:9px;\">"+artdate.substring(0, num-fulltext.length)+"</span>";
	// output the string
	writeDiv(outText,'headline');
	// end condition and timed call
	if (num < (fulltext.length+artdate.length)) typeTime = setTimeout("typewriter("+num+")",50);
	else typeTime = setTimeout("showNews()",3000);
}
// end Typewriter
function showNews()
{
	if (curarticle<3) curarticle++;
	else curarticle=0;
	// call typewriter to output news
	typewriter(0);	
}


// Team Page Expanding Lists Scripts

// Function to hide all the team lists
function hideAllTeamLists(ignore)
{
	// grab all unordered lists
	var u = document.getElementById('content').getElementsByTagName('ul');
	
	for(i=0;i<u.length;i++){
		// hide all unordered lists with 'teamlist' class
		if((u[i].className == 'teamlist')&&(u[i].id != 'team'+ignore)){
			u[i].style.display = 'none';
		}
	}
}

function toggleTeamList(teamid)
{
	//check current status of this team list
	var cur = document.getElementById('team'+teamid);
	
	if (cur.style.display == 'none') cur.style.display = 'block'
	else cur.style.display = 'none'
	
	// hide all other team members
	hideAllTeamLists(teamid);
}

// End Team Page Scripts
