﻿function openWindow(page)
{
	if (page.indexOf("http") == 0)
	{	
		var pageTracker = _gat._getTracker("UA-2132028-2");
		pageTracker._initData();
		pageTracker._trackPageview("external/" +page);
	}
        window.open(page,"_blank");
}
function hideAllPopup(prefix,numberOfPopups)
{

	for (y=1;y<=numberOfPopups;y++)
	{
		showpopup(prefix + y);
	}
}
//more correctly togglepopup, changed from earlier ajax version to work with hidden table rows
//works for the case studies & news sections only		

function showpopup(id)
{

try
{
	var csLink = document.getElementById( id + "link");
	var csText = document.getElementById(id );
	var csTech = document.getElementById( id + "b");
	var visi = "table-row";
	var linkText = "Less";
		if (csText.style.display == "table-row" ||csText.style.display =="" )
		{
		visi = "none";
		linkText = "More";
		}

	csLink.innerHTML = linkText;
	csText.style.display = visi;
	csTech.style.display = visi;
}
catch (e)
{

}	
	//do some tracking
	  //	var pageTracker = _gat._getTracker("UA-2132028-2");
	//	pageTracker._initData();
	//	pageTracker._trackPageview(id+".cs");
}
function showNice(newid, oldid)
{
	var oldNice=document.getElementById("nice" + oldid);
	var newNice=document.getElementById("nice" + newid);
	oldNice.style.display = "none";
	newNice.style.display = "inline";
	//reset timers
	clearInterval(clearRef);
    clearRef = window.setInterval("nextNice()",TimeToFade );

}
var currentNice = 1;
var maxNice = 9;
var TimeToFade = 10000.0;
var clearRef;

function nextNice()
{
	oldNice = currentNice;
	currentNice = currentNice + 1;
	if (currentNice > maxNice)
		{
			currentNice = 0;
		}
	showNice(currentNice, oldNice);
}
function previousNice()
{
	oldNice = currentNice;
	currentNice = currentNice - 1;
	if (currentNice < 0 )
		{
			currentNice = maxNice;
		}
	showNice(currentNice, oldNice);
}
function initNice()
{
	var oldNice = currentNice;
	currentNice = Math.floor(Math.random()*10);
	 showNice(currentNice, oldNice);
}

