/* 23.03.2005 - fonctions javascript phototheque KIC */

var speed = 5;
var toptop = 0;

bw = new checkBrowser;
var navok = !bw.macie523 && !bw.macie51 && !bw.macie50;

function init() // Initialisation de la phototheque + test navigateur
{
	if(!navok)
	{
		window.location.href = '404.html';
	}
	else
	{
		div = document.getElementById("cont2");
		contentheight=div.offsetHeight;
		//alert(contentheight);
		div.style.top = 0;
	}
}

/* * * * Fonctions de scrolling des calques * * * */

function scrollup()
{
	toptop = parseInt(div.style.top)-parseInt(speed);
	if(toptop > (268 - contentheight))
	{
		div.style.top= toptop+"px";
		
	}
	moveupvar=window.setTimeout("scrollup()",50);
}
function scrolldown()
{
	toptop = parseInt(div.style.top)+parseInt(speed);
	if(toptop < speed)
	{
		div.style.top= toptop+"px";
		
	}
	movedownvar=window.setTimeout("scrolldown()",50);
}

function goup()
{
	div.style.top = (270 - contentheight)+"px";
}

function godown()
{
	div.style.top = "0px";
}

/* * * * Fin Fonctions de scrolling des calques * * * */

/* * * * Fonction hors scroll * * * */

function phototheque() // Fonction pour lancer la phototheque - a mettre dans le menu MAJ
{
	w		= 700;
	h 		= 600;
	t 	= (screen.height - h)/2;
	l 	= (screen.width - w)/2;
	addwin = window.open('phototheque/','phototheque','width='+w+', height='+h+', top='+t+', left='+l+', menubar=no, scrollbars=no, resizable=no');
	addwin.focus();
}

function trim (chaine) // Enleve les espace de debut et fin de chaine
{
	chaine = unescape(chaine);
	return chaine.replace(/(^\s*)|(\s*$)/g, "");
}

function goUrl(page) // Redirection vers une page php
{
	window.location.href = page+'.php';
}

function detail(img,w,h)
{
	w += 20;
	h += 20;
	t 	= (screen.height - h)/2;
	l 	= (screen.width - w)/2;
	imgUrl = 'maj/phototheque/photos/'+img;
	imgW = window.open(imgUrl,'img','width='+w+', height='+h+', top='+t+', left='+l+', menubar=no, scrollbars=no, resizable=no');
	imgW.focus();
}

/* * * * Fin Fonction hors scroll * * * */