onload = init;

function init()
{
	tabImages = getElementsByClass('showImage');
	for (i = 0; i < tabImages.length ; i++)
	{
		tabImages[i].onclick = showImage;
	}
	
	tabVideos = getElementsByClass('showVideo');
	for (i = 0; i < tabVideos.length ; i++)
	{
		tabVideos[i].onclick = showVideo;
	}
	
	tabSounds = getElementsByClass('showSound');
	for (i = 0; i < tabSounds.length ; i++)
	{
		tabSounds[i].onclick = showSound;
	}
	
}

function openHidden(el)
{
	cibles = getElementsByClass('hiddenText'); 
	for (i = 0; i < cibles.length; i++)
		{
	        cibles[i].style.display = 'none'; 
		}
	document.getElementById(el).style.display = 'block';
}

function showImage()
{
	document.getElementById('video').style.display = 'none';
	document.getElementById('image').src=this.href;
	return false;
}

function showVideo()
{
	HTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="478" height="480">';
	HTML += '<param name="movie" value="/PLAYERS/video.swf?file='+ this.href +'" />';
	HTML += '<param name="quality" value="high" />';
	HTML += '<embed src="/PLAYERS/video.swf?file='+ this.href +'" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="478" height="480"></embed>';
	HTML += '</object>';
	document.getElementById('video').innerHTML = HTML;
	document.getElementById('video').style.display = 'block';
	return false;
}

function showSound()
{
	HTML = '<object id="playerSound" type="application/x-shockwave-flash"';
	HTML += 'data="/PLAYERS/sound.swf?son=' + this.href + '" width="478" height="20">';
	HTML += '<param name="movie" value="/PLAYERS/sound.swf?son=' + this.href + '" />';
	HTML += '</object>';
	
	
	document.getElementById('video').innerHTML = HTML;
	document.getElementById('video').style.display = 'block';
	
	return false;
}

function getElementsByClass(searchClass, node, tag) {
	var classElements = new Array();
	if ( node == null ) node = document;
	if ( tag == null ) tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}


