function selectBanner(imgPath)
{
	document.imax = 28;
	document.r = Math.floor(document.imax*Math.random());
	
	var banniere = document.getElementById('banniere');
	var img = document.createElement('img');
		img.setAttribute('src', imgPath + 'bannieres/' + document.r + '.jpg');
		img.setAttribute('width', 530);
		img.setAttribute('height', 151);
		img.setAttribute('alt', '');
		img.setAttribute('title', "Double-cliquez pour voir d'autres bannières !");
		img.ondblclick = function(){ changeBanner(imgPath, this) }
	banniere.appendChild(img);
}
function selectButtons(pathModifier, imgPath)
{
	var boutons = document.getElementById('boutons');
	var a1 = document.createElement('a');
		a1.setAttribute('href', pathModifier + 'forum/viewforum.php?id=15');
		a1.setAttribute('title', 'Releases Requiem en téléchargement direct !');
		a1.setAttribute('target', '_blank');
	var a2 = document.createElement('a');
		a2.setAttribute('href', pathModifier + 'tracker/');
		a2.setAttribute('title', 'Toutes nos releases en bittorrent');
	var a3 = document.createElement('a');
		a3.setAttribute('href', pathModifier + 'irc/');
		a3.setAttribute('title', 'Infos XDCC et Chan IRC');
	var imga = document.createElement('img');
		imga.setAttribute('src', imgPath + 'transparent.gif');
		imga.setAttribute('width', 11);
		imga.setAttribute('height', 28);
	var imgb = imga.cloneNode(false);
	var img1 = document.createElement('img');
		img1.setAttribute('height', 28);
		img1.setAttribute('width', 144);
		img1.setAttribute('id', 'boutonsimg1');
		img1.setAttribute('alt', a1.getAttribute('title'));
		img1.setAttribute('src', imgPath + 'boutons/' + document.r + '_ddl_base.png');
		img1.setAttribute('class', 'boutonsimg'); img1.setAttribute('className', 'boutonsimg');
		img1.onmouseover = function(){ this.src= imgPath + "boutons/" + document.r + "_ddl_over.png"; this.style.borderColor='#FFFFFF' };
		img1.onmouseout	 = function(){ this.src= imgPath + "boutons/" + document.r + "_ddl_base.png"; this.style.borderColor='#F2F0EF' };
	var img2 = document.createElement('img');
		img2.setAttribute('height', 28);
		img2.setAttribute('width', 144);
		img2.setAttribute('id', 'boutonsimg2');
		img2.setAttribute('alt', a2.getAttribute('title'));
		img2.setAttribute('class', 'boutonsimg'); img2.setAttribute('className', 'boutonsimg');
		img2.setAttribute('src', imgPath + 'boutons/' + document.r + '_bittorrent_base.png');
		img2.onmouseover = function(){ this.src= imgPath + "boutons/" + document.r + "_bittorrent_over.png"; this.style.borderColor='#FFFFFF' };
		img2.onmouseout	 = function(){ this.src= imgPath + "boutons/" + document.r + "_bittorrent_base.png"; this.style.borderColor='#F2F0EF' };
	var img3 = document.createElement('img');
		img3.setAttribute('height', 28);
		img3.setAttribute('width', 144);
		img3.setAttribute('id', 'boutonsimg3');
		img3.setAttribute('alt', a3.getAttribute('title'));
		img3.setAttribute('src', imgPath + 'boutons/' + document.r + '_irc_base.png');
		img3.setAttribute('class', 'boutonsimg'); img3.setAttribute('className', 'boutonsimg');
		img3.onmouseover = function(){ this.src= imgPath + "boutons/" + document.r + "_irc_over.png"; this.style.borderColor='#FFFFFF' };
		img3.onmouseout	 = function(){ this.src= imgPath + "boutons/" + document.r + "_irc_base.png"; this.style.borderColor='#F2F0EF' };
	a1.appendChild(img1);
	a2.appendChild(img2);
	a3.appendChild(img3);
	boutons.appendChild(a1);
	boutons.appendChild(imga);
	boutons.appendChild(a2);
	boutons.appendChild(imgb);
	boutons.appendChild(a3);
}
function changeBanner(imgPath, obj)
{
	var src; var bouton; var x;
	var rback=document.r.toString();
	document.r = ++document.r%document.imax;
	obj.setAttribute('src', imgPath + 'bannieres/' + document.r + '.jpg');
	for(i=1;i<=3;i++)
	{
		bouton = document.getElementById('boutonsimg'+i);
		src = bouton.getAttribute('src');
		bouton.setAttribute('src', imgPath + "boutons/" + document.r + src.substr(src.lastIndexOf(rback)+rback.length));
	}
}
function preloadImages(imgPath) {
	var d=document;
	if(d.images){
		if(!d.p) d.p = new Array(); var i, j = d.p.length;
		a = new Array('design_301_topmenu_index_over.gif', 'design_301_topmenu_projets_over.gif', 'design_301_topmenu_team_over.gif', 'design_301_topmenu_avancement_over.gif', 'design_301_topmenu_aide_over.gif', 'design_301_bittorrent_over.gif');
		if(document.r!=undefined) a.push('boutons/' + document.r + '_ddl_over.png','boutons/' + document.r + '_bittorrent_over.png','boutons/' + document.r + '_irc_over.png');
		for(i=0; i<a.length; i++) { d.p[j] = new Image(); d.p[j++].src = imgPath + a[i]; }
	}
}

var wdw = undefined;
function showScreen(pathModifier, image, l_size, h_size)
{
	if(screen.availHeight<h_size-40)
	{
		scrollable="yes";
		h_size=screen.availHeight-40;
		l_size+=20;
	}
	else if(screen.availWidth<l_size-5)
	{
		scrollable="yes";
		l_size=screen.availWidth-5;
		h_size+=20;
	}
	else scrollable="no";
	
	if(wdw!=undefined && !wdw.closed) wdw.close();
	wdw = window.open(pathModifier + "projets/screen.php?screen=" + image,"RequiemImgWdw","height="+(h_size+4)+", width="+(l_size+4)+", menubar=no, resizable=no, scrollbars="+scrollable+", status=no, toolbar=no, target=_blank");
	wdw.focus();
	return false;
}

function getStyle(obj,style){
	if (obj.currentStyle) return obj.currentStyle[style];
	else if (window.getComputedStyle) return document.defaultView.getComputedStyle(obj,null).getPropertyValue(style);
}

function adjustIFrameSize(height)
{
	var iframeElement = document.getElementById('last_rlz');
	var level1 = document.getElementById('level1');
	if(height===false)
	{
		iframeElement.height = 260;
		level1.style.height = '470px';
	}
	else
	{
		iframeElement.height = Number(iframeElement.height)+height;
		level1.style.height = parseInt(getStyle(level1, 'height')) + height + 'px';
	}
}

// Remplacement basique de getElementById
if(!(document.getElementById)) if(document.all) document.getElementById = function(id) { return document.all[id]; }; else if(document.layers) document.getElementById = function(id) { return document.layers[id]; };