//---------------------------------------------- Globales
var lastColor = null;
var winPopup = null;
var imagesPath = "/images/";

//---------------------------------------------- Fonctions
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}

function setColor(itemMenu, i) {
// i = 0, 1 ou 2 pour respectivement espace perso, notre offre, services en ligne
// i = 3 pour le menu Cardibox
	lastColor = itemMenu.style.backgroundColor;
	switch (i) {
		case 0:	itemMenu.style.backgroundColor = "#FCFCFC"; break;
		case 1:	itemMenu.style.backgroundColor = "#E4E9F0"; break;
		case 2:	itemMenu.style.backgroundColor = "#F4EFE6"; break;
		case 3:	itemMenu.style.backgroundColor = "#DEDDE2"; break;
		default: break;
	}
}

function restoreColor(itemMenu) {itemMenu.style.backgroundColor = lastColor;}

var winPopup = null;
function openPopup(){
	theURL = "http://marketing.gfa.generali.fr/euro_plus3/";
	openPopup(theURL);
}

function openPopup(theURL){
	w = 600;
	h = 430;
	leftPos = (screen.width) ? (screen.width-w)/2 : 0;
	topPos = (screen.height) ? (screen.height-h)/2 : 0;

	openPopup (theURL, w, h, 'no', 'no');
}

function openPopup(theURL, w, h, scrollingYesNo, resizeYesNo){
	leftPos = (screen.width) ? (screen.width-w)/2 : 0;
	topPos = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+topPos+',left='+leftPos+',scrollbars='+scrollingYesNo+', resizable='+resizeYesNo+'';
	winPopup = window.open(theURL, "winPopup", settings);
	if(winPopup != null) winPopup.focus();
}

function highlightButtonStyle1(item, s) { // s=1 : onMouseOver; s=0 : onMouseOut
	switch (s) {
	case 0 :
		item.style.borderColor = "#666666";
		item.style.color = "#FFFFFF";
		break;
	case 1 :
		item.style.borderColor = "#990000";
		item.style.color = "#FED898";
		break;
	default: break;
	}
}

function switchFlow() {
	if(oContent.style.overflow == "auto"){
		oContent.style.overflow = "visible";
		oLib.innerText = "mode affichage complet";
		btSwitchFlow.alt = "Basculer vers mode d'affichage réduit";
		btSwitchFlow.src = imagesPath+"flhaut.gif";
		return false;
	}
	if(oContent.style.overflow == "visible"){
		oContent.style.overflow = "auto";
		oLib.innerText = "mode affichage réduit";
		btSwitchFlow.alt = "Basculer vers mode d'affichage complet";
		btSwitchFlow.src = imagesPath+"flbas.gif";
		return false;
	}
}

function fen(a,b,c) {window.open(a,b,c);}

// Statistiques Estat
function Marqueur(marq1,marq2,marq3) {
    this.marq1 = marq1;
    this.marq2 = marq2;
    this.marq3 = marq3;
}

// Constantes chaînes passées par les animations FLASH ("découvrons vos besoins" ...) pour redirection
function GoURL(sURL) {
 switch (sURL) {
	case "decouverte_besoins" :
		window.open ("/decouvronsbesoins.html", "Besoins","width=620, height=365, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no");
		break;	
	case "exel" :
		window.opener.location.href = "/produit.jsp?shortcut=exel";
		self.close();
		window.opener.focus();
		break;
	case "preference" :
		window.opener.location.href = "/produit.jsp?shortcut=preference";
		self.close();
		window.opener.focus();
		break;
	case "phi" :
		window.opener.location.href = "/produit.jsp?shortcut=phi";
		self.close();
		window.opener.focus();
		break;
	case "atollprevoyance" :
		window.opener.location.href = "/produit.jsp?shortcut=atollprevoyance";
		self.close();
		window.opener.focus();
		break;
	case "atollsante" :
		window.opener.location.href = "/produit.jsp?shortcut=atoll";
		self.close();
		window.opener.focus();
		break;
	case "temporaireemprunteur" :
		window.opener.location.href = "/produit.jsp?shortcut=temporaireemprunteur";
		self.close();
		window.opener.focus();
		break;
	case "vieentiere" :
		window.opener.location.href = "/produit.jsp?shortcut=vieentiere";
		self.close();
		window.opener.focus();
		break;
	case "temporairedeces" :
		window.opener.location.href = "/produit.jsp?shortcut=temporairedeces";
		self.close();
		window.opener.focus();
		break;
	case "laretraite" :
		window.opener.location.href = "/produit.jsp?shortcut=laretraite";
		self.close();
		window.opener.focus();
		break;
	case "retraite" :
		window.location.href = "/produit.jsp?shortcut=retraite";
		break;
	case "banniere_home" :
		window.location.href = "/produit.jsp?shortcut=atoll";
		break;
	default:break;
 }
}

function openPhiGrandPa() {
	document.location.href = "/produit.jsp?shortcut=phi";
}

function openCredit0AGV() {
	document.location.href = "/produit.jsp?shortcut=creditauto";
}

