// JavaScript Document
/*
var uid = new Date().getTime();
	var flashProxy = new FlashProxy(uid, '/js/JavaScriptFlashGateway.swf');
	function gotoPage(pageId) {
	  	document.location='index.php?pageId='+pageId;
	}
	


function changeFontSize(inc)
{
	tags=Array('p','h1','h2','h3');
	for(t=0;t<tags.length;t++) {
	  var p = document.getElementsByTagName(tags[t]);
	  for(n=0; n<p.length; n++) {
		if(p[n].style.fontSize) {
		   var size = parseInt(p[n].style.fontSize.replace("px", ""));
		} else {
		   var size = 12;
		}
		p[n].style.fontSize = size+inc + 'px';
	   }
	}
}
*/



var allPicts=new Array();
var mt;

function switchPict(url,fromLink) {
	//alert(allPicts+"///"+url);
	t=url.split('|');
	url=t[0];
	h=t[1];
	if(fromLink>=0) {
		currentPict=fromLink;
		//stopAutoPlay();
	}
	document.getElementById('pict').src="/datas/"+url;
	
	for(i=0;i<allPicts.length;i++) {
		if(i!=fromLink) {
			document.getElementById('ne'+i).className='';
		}
	}
	if(currentPict) {
		document.getElementById('ne'+fromLink).className='current';
	}
	else {
		document.getElementById('ne0').className='current';
	}
	if(h<348) {
		document.getElementById('pict').style.marginTop=((348-h)/2)+'px';
	}
	else {
		document.getElementById('pict').style.marginTop='';
	}
}

function startAutoPlay() {
	autoPlay=true;
	checkPlaying();
	if(currentPict==undefined) {
		currentPict=0;	
	}
	if(allPicts) {
	if(currentPict>=allPicts.length) {
			currentPict=0;
	}
	
	}
	allPicts=document.getElementById('allPicts').value.split(',');
	
		switchPict(allPicts[currentPict],currentPict);
		autoPlay=true;
		currentPict++;
		mt=setTimeout(startAutoPlay,3000);
	
	
}
function stopAutoPlay() {
	//alert('rr');
	if(mt) {
		
		clearTimeout(mt);
	}
	autoPlay=false;	
	checkPlaying();
}

function checkPlaying() {
	if(autoPlay==false) {
		document.getElementById('play').className='';
		document.getElementById('stop').className='current';	
	}
	else {
		document.getElementById('play').className='current';
		document.getElementById('stop').className='';	
	}
}


function hideAll() {
	var allAnswers=document.getElementById('answers').value.split(',');
	//alert(document.getElementById('answers').value);
	for(i=0;i<allAnswers.length;i++) {
		document.getElementById('answer'+allAnswers[i]).style.display='none';
	}
}


function showArrow(id) {
	document.getElementById('mainArrow').style.visibility='hidden';
	for(i=1;i<100;i++) {
		if(document.getElementById('arrow'+i)) {	
			document.getElementById('arrow'+i).src='/medias/bullet.png';
		}
	}
	document.getElementById('arrow'+id).src='/medias/arrow_green.gif';
	
}
