
// Javascript related to Topics page

// controller for showing/hiding Points of View
function toggleControllerPOVBox(numPOV)  {
	toggleShowBlockElement(currentPOVnumBox);
	currentPOVnumBox='POVnumBox_'+numPOV; 
	toggleShowBlockElement('POVnumBox_'+numPOV);
}
																							
// set current POVnumBox
var currentPOVnumBox = 'POVnumBox_1';

function startRotatePovs(){
	povRotateIntervalId = window.setInterval("rotatePovs()", 10000); 
	document.getElementById('POVcopyBox').onmouseover = quitRotatePovs;
}

function quitRotatePovs(){
	window.clearInterval(povRotateIntervalId);
	document.getElementById('POVcopyBox').onmouseover = null;
}
function rotatePovs(){
	//figure out next
	var current = parseInt(currentPOVnumBox.substring(currentPOVnumBox.indexOf('_') +1,currentPOVnumBox.length));
	if (current < parseInt(maxPOV)) var next =  current + 1;
	else var next = 1;
	toggleControllerPOVBox(next);	
}
function killRotationAndToggle(numPov){
	quitRotatePovs();
	toggleControllerPOVBox(numPov);
}

// show/hide layer
function chgClass(thisId)
{
	var thatValue = document.getElementById(thisId);

	if (thatValue.className == 'closed')
	{
		thatValue.className = 'open';
	}
	else if (thatValue.className == 'open')
	{
		thatValue.className = 'closed';
	}
}


// shows the stat mediafile
function renderStatLink( mediafilename ) 
{  
	//calculate and set where to show
	
	var ih = document.getElementById('statistic_imgholder');
	var yScroll;
	
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}
	

	//handle images

	var nav = new String(navigator.userAgent);
	if (/gif|jpg$/.test(mediafilename)){
		
		var mf = document.getElementById('statistic_mediafile2');
		mf.style.top = (yScroll) + 'px';
		chgClass('statistic_mediafile2');
		var s = "document.getElementById('statistic_imgholder').innerHTML = '<img src=\"/docs/39721679-D072-1E84-7BBABAB0E4E3D497/Statistics/"  + mediafilename + "\"/>'";
		setTimeout(s,50);
	} else if (/Safari/.test(nav)) { //html in safari
		location.href = '/docs/39721679-D072-1E84-7BBABAB0E4E3D497/Statistics/'  + mediafilename ;
	} else {//html in other browsers
		var mf = document.getElementById('statistic_mediafile2_if');
		mf.style.top = (yScroll) + 'px';
		chgClass('statistic_mediafile2_if');
		document.getElementById('statistic_imgholder_if').src = "/docs/39721679-D072-1E84-7BBABAB0E4E3D497/Statistics/"  + mediafilename;
	}

		
}
function compl(m){
	alert(m);
}

// shows the interactive mediafile
function renderInteractiveLink( mediafilename ) 
{  
	document.getElementById('interactive_mediafile').src = '/docs/39721679-D072-1E84-7BBABAB0E4E3D497/Statistics/' + mediafilename;
	chgClass('interactive_layer');
}