// fonction de zappage d'images
function newImage(arg)
{
	if (document.images)
	{
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages()
{
	if (preloadFlag) {	
		for (i=0; i<(changeImages.arguments.length/2); i++)	{
			document.images[changeImages.arguments[i * 2]].src = "../general/" + (changeImages.arguments[(i * 2) + 1]) + ".gif";
		}
	}
}

// pour la home
function changeImageshom()
{
	if (preloadFlag) {	
		for (i=0; i<(changeImageshom.arguments.length/2); i++)	{
			document.images[changeImageshom.arguments[i * 2]].src = "general/" + (changeImageshom.arguments[(i * 2) + 1]) + ".gif";
		}
	}
}

function preloadImages() {
	if (document.images) {
		suiteL_o = newImage("../general/suite_on_L.gif");
		suiteR_o = newImage("../general/suite_on_R.gif");
		actu_o = newImage("../general/menu/actuH_on.gif");
		agenda_o = newImage("../general/menu/agendaH_on.gif");
		aparaitre_o = newImage("../general/menu/aparaitreH_on.gif");
		avant_o = newImage("../general/menu/avantPremH_on.gif");
//		humanoclub_o = newImage("../general/menu/humanoclubH_on.gif");
//		humanotalk_o = newImage("../general/menu/humanotalkH_on.gif");
//		goodies_o = newImage("../general/menu/goodiesH_on.gif");
		deja_o = newImage("../general/menu/dejaH_on.gif");
		humanoscope_o = newImage("../general/menu/humanoscopeH_on.gif");
		infos_o = newImage("../general/menu/infosH_on.gif");
//		memoires_o = newImage("../general/menu/memoiresH_on.gif");
		nouveautes_o = newImage("../general/menu/nouveautesH_on.gif");
		zoom_o = newImage("../general/menu/zoomH_on.gif");
		blogGig_o = newImage("../general/menu/blogGigH_on.gif");
		blogHum_o = newImage("../general/menu/bloghumH_on.gif");		
		preloadFlag = true;
	}
}

var preloadFlag = false;

// section pour les menu horizontaux
var indMenu=0;
var titre1S = "menu/actuH";
var titre2S = "menu/nouveautesH";
var titre3S = "menu/humanoscopeH";
var titre4S = "menu/humanoclubH";
tm = setTimeout('', 200);

function ssMenu(id, com)
{
	clearTimeout(tm);
	if (ie) {
		cible=eval("document.all.ssMenu" + id);
	}
	if (com) {
		if (ie) {
			cible.style.visibility = "visible";
		} else {
			document.getElementById('ssMenu'+id).style.visibility = 'visible';
		}
		changeImages("titre" + id, eval("titre" + id + "S") + "_on");
		indMenu = id;
		tm = setTimeout('retireMenu();', 4000);
	}
	else	{	
		if (ie) {
			cible.style.visibility = "hidden";
		} else {
			document.getElementById('ssMenu'+id).style.visibility = 'hidden';
		}
		changeImages("titre" + id, eval("titre" + id + "S"));
		indMenu = 0;
	}
}

function retireMenu()
{
	if (indMenu != 0)	{
		ssMenu(indMenu, false);
	}
}

var indDest = "";

function ouvrePopup(dest, type)
{
	if ((type == 3) || (type == 4))
	{
		indScroll = "no";
		posX = 200;
		posY = 100;
		largeur = 300;
		hauteur = 300;
		url = dest;
	}
	else if (type == 1)
	{	// pour les couvs de catalogue
		indScroll = "no";
		posX = 10;
		posY = 10;
		largeur = 400;
		hauteur = 450;
		indDest = "catal/" + dest;
		url = "pop_couvs.html";
	}
	else if (type == 2)
	{	// pop up generale
		indScroll = "no";
		posX = 200;
		posY = 100;
		largeur = 400;
		hauteur = 450;
		indDest = dest;
		url = "pop_couvs.html";
	}
	else if (type == 5)
	{
		posX = 200;
		posY = 100;
		winPopup = window.open(dest, "Fiches", "scrollbars=yes,resizable=yes,left=" + posX + ",top=" + posY);
		return;
	}
	else if (type == 6)
	{	// pour les articles de presse
		indScroll = "no";
		posX = 10;
		posY = 10;
		largeur = 400;
		hauteur = 450;
		indDest = "presse/" + dest;
		url = "pop_couvs.html";
	}
	winPopup = window.open(url, "Fiches", "resizable=no,left=" + posX + ",top=" + posY + ",width=" + largeur + ",height=" + hauteur + ",scrollbars=" + indScroll);
}

function ferme()
{
	close();
}

function decache()
{
	if (ie) {
		parent.document.all.descrCache.style.visibility="hidden";
	} else {
		parent.document.getElementById('descrCache').style.visibility="hidden";
	}
}

//detection de browser

ns=false;
ie=false;
ge=false;
op=false;

function detectBrowser()
{
	navigator.OS		= '';
	navigator.version	= 0;
	navigator.org		= '';
	navigator.family	= '';

	var platform;
	if (typeof(window.navigator.platform) != 'undefined')
	{
		platform = window.navigator.platform.toLowerCase();
		if (platform.indexOf('win') != -1)
			navigator.OS = 'win';
		else if (platform.indexOf('mac') != -1)
			navigator.OS = 'mac';
		else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
			navigator.OS = 'nix';
	}

	var i = 0;
	var ua = window.navigator.userAgent.toLowerCase();
	if (ua.indexOf('opera') != -1)
	{
		i = ua.indexOf('opera');
		navigator.family	= 'opera';
		navigator.org		= 'opera';
		navigator.version	= parseFloat('0' + ua.substr(i+6), 10);
		op = true;
	}
	else if ((i = ua.indexOf('msie')) != -1)
	{
		navigator.org		= 'microsoft';
		navigator.version	= parseFloat('0' + ua.substr(i+5), 10);
		ie = true;
		if (navigator.version < 4)
			navigator.family = 'ie3';
		else
			navigator.family = 'ie4'
	}
	else if ((i = ua.indexOf('gecko')) != -1)
	{
		i = ua.lastIndexOf('/')
		navigator.version = parseFloat('0' + ua.substr(i+1), 10);
		navigator.family = 'gecko';
		ge = true;

		if (ua.indexOf('netscape') != -1)
			navigator.org = 'netscape';
		else if (ua.indexOf('compuserve') != -1)
			navigator.org = 'compuserve';
		else
			navigator.org = 'mozilla';
	}
	else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))
	{
	    var is_major = parseFloat(navigator.appVersion);
	    ns=true;
    
		if (is_major < 4)
			navigator.version = is_major;
		else
		{
			i = ua.lastIndexOf('/')
			navigator.version = parseFloat('0' + ua.substr(i+1), 10);
		}
		navigator.org = 'netscape';
		navigator.family = 'nn' + parseInt(navigator.appVersion);
	}
	else if ((i = ua.indexOf('aol')) != -1 )
	{
		// aol
		navigator.family	= 'aol';
		navigator.org		= 'aol';
		navigator.version	= parseFloat('0' + ua.substr(i+4), 10);
	}

}

detectBrowser();

//fin detection de browser
// redirige vers la page de frame si ce n'est pas une frame (pour contourner les liens directs)
var refUrl = top.window.document.location.href;
refPage = refUrl.substring(refUrl.lastIndexOf('/') + 1);

if (refPage.substring(0, 2) == "f_")
	{
	newLocation = refUrl.substring(0, refUrl.lastIndexOf('/') + 1) + refPage.substring(2);
//	setTimeout('top.window.document.location.href = "' + newLocation + '";', 10); 	
}
