if (top.location != self.location) {
	top.location = "./index.php";
}

if (document.getElementById) {
	GBL_std_browser = true;
} else {
	GBL_std_browser = false;
	if (document.all) {
		document.getElementById=function () {
			if (typeof document.all[arguments[0]] != "undefined") {
				return document.all[arguments[0]];
			} else {
				return null;
			}
		}
	} else if (document.layers) {
		document.getElementById=function () {
			if (typeof document[arguments[0]] != "undefined") {
				return document[arguments[0]];
			} else {
				return null;
			}
		}
	}
}

function affichePopup_FJS(eltCourant) {
	document.getElementById(eltCourant).style.visibility = "visible";
}

function effacePopup_FJS(eltCourant) {
	document.getElementById(eltCourant).style.visibility = "hidden";
}

function changeDestination_FJS() {
	var idx_dest = document.FORM_dest.LIST_idx.value;
	if (idx_dest != -1) {
		document.location.href = './page.php?dest=' + idx_dest;
	}
}

function ouvreCalendrier_FJS() {
	parametre_fenetre = "width=850,height=800,toolbar=no,status=no,scrollbars=yes,resizable=yes,left=0,top=0";
    nouvelle_fenetre = window.open("./calendrier.php","CalendarWindow",parametre_fenetre);
}

function ouvreNewsletter_FJS() {
	parametre_fenetre = "width=850,height=800,toolbar=no,status=no,scrollbars=yes,resizable=yes,left=0,top=0";
    nouvelle_fenetre = window.open("./newsletter.php","NewsletterWindow",parametre_fenetre);
}

function ouvreFuturVoyage_FJS() {
	parametre_fenetre = "width=850,height=800,toolbar=no,status=no,scrollbars=yes,resizable=yes,left=0,top=0";
    nouvelle_fenetre = window.open("./next.php","NextWindow",parametre_fenetre);
}

function ouvreAdminCal_FJS() {
	parametre_fenetre = "width=850,height=800,toolbar=no,status=no,scrollbars=yes,resizable=yes,left=0,top=0";
    nouvelle_fenetre = window.open("./set_cal.php","AdminWindow",parametre_fenetre);
}

function ouvreAdminMsg_FJS() {
	parametre_fenetre = "width=930,height=800,toolbar=no,status=no,scrollbars=yes,resizable=yes,left=0,top=0";
    nouvelle_fenetre = window.open("./admin_msg.php","AdminWindow",parametre_fenetre);
}

function ouvrePhotosDePlongee_FJS(pageSub) {
	parametre_fenetre = "width=860,height=870,toolbar=no,status=no,scrollbars=yes,resizable=yes,left=0,top=0";
	nouvelle_fenetre = window.open("../../photo-sub/"+pageSub,"PlongeeWindow",parametre_fenetre);
}

function chargeImagesDiaporama_FJS() {
	var idx_img = 0;
	var poubelle = new Image();
	while (idx_img < GBL_nb_derniere_photo) {
		poubelle.src = TAB_nom_photo[idx_img];
		idx_img = idx_img + 1;
	}
}

function affichePhotoDe_FJS() {
	var idx_img = parseInt(document.FORM_photo_de.LIST_idx.value);
	if (idx_img != -1) {
		affichePhotoManuel_FJS(idx_img);
		document.FORM_photo_de.LIST_idx.options[0].selected = true;
	}
}

function selectModeDiaporama_FJS() {
	var delai_auto = parseInt(document.FORM_mode.LIST_mode.value);
	if (delai_auto > 0) {
		timeout_object = window.setTimeout("afficheAutoPhotoSuivante_FJS();",delai_auto);
	} else if (delai_auto == -1) {
		document.location.href = './page.php?dest=' + GBL_destination + '&mode=CONTACT';
	}
}

function affichePhotoNumero_FJS() {
	var valeur_entree = document.FORM_num_photo.ENT_num.value;
	if (valeur_entree.length > 0) {
		var idx_photo = parseInt(valeur_entree);
		var test_num = "<" + idx_photo + ">";
		if (test_num != "<NaN>") {
			if (idx_photo >= 1) {
				if (idx_photo <= GBL_nb_derniere_photo) {
					erreur_detectee = false;
					affichePhotoManuel_FJS(idx_photo - 1);
				} else {
					window.alert("La valeur doit être inférieure ou égale à " + GBL_nb_derniere_photo + " !");
				}
			} else {
				window.alert("La valeur doit être supérieur ou égale à 1 !");
			}
		} else {
			window.alert('La valeur "' + valeur_entree + '" ne convient pas !');
		}
	}
}

function affichePhotoSuivante_FJS() {
	var idx_photo = GBL_idx_photo_courrante + 1;
	if (idx_photo >= GBL_nb_derniere_photo) {
		idx_photo = 0;
	}
	affichePhotoManuel_FJS(idx_photo);
}

function affichePhotoPrecedente_FJS() {
	var idx_photo = GBL_idx_photo_courrante - 1;
	if (idx_photo < 0) {
		idx_photo = GBL_nb_derniere_photo - 1;
	}
	affichePhotoManuel_FJS(idx_photo);
}

function affichePhotoManuel_FJS(idxPhoto) {
	if (document.FORM_mode) {
		document.FORM_mode.LIST_mode.options[0].selected=true;
	}
	changePhoto_FJS(idxPhoto);
}

function afficheAutoPhotoSuivante_FJS() {
	var delai_auto = parseInt(document.FORM_mode.LIST_mode.value);
	if (delai_auto > 0) {
		var nb_photo = GBL_idx_photo_courrante + 1;
		if (nb_photo >= GBL_nb_derniere_photo) {
			nb_photo = 0;
	   	}
		changePhoto_FJS(nb_photo);
	}
	selectModeDiaporama_FJS();
}

function copiePhoto_FJS() {
	document.getElementById("IMG_DIAPO").src = TAB_nom_photo[GBL_idx_photo_courrante];
	document.getElementById("IMG_DIAPO").width = TAB_largeur_photo[GBL_idx_photo_courrante];
	document.getElementById("IMG_DIAPO").height = TAB_hauteur_photo[GBL_idx_photo_courrante];
	document.getElementById("TXTS_DIAPO_" + GBL_idx_photo_courrante).style.visibility = "visible";
}

function changePhoto_FJS(idxPhoto) {
	var idx_photo_prec = GBL_idx_photo_courrante;
	document.getElementById("TXTS_DIAPO_" + idx_photo_prec).style.visibility = "hidden";
	GBL_idx_photo_courrante = idxPhoto;
	var img_load = new Image();
	img_load.onLoad = copiePhoto_FJS();
	img_load.src = TAB_nom_photo[GBL_idx_photo_courrante];
}

function copieZoom_FJS() {
	document.getElementById("IMG_CONTACT").src = TAB_nom_photo[GBL_idx_photo_courrante];
	if (TAB_largeur_photo[GBL_idx_photo_courrante] > 1000) {
		document.getElementById("IMG_CONTACT").width = 1000;
		document.getElementById("ZOOM_P").style.visibility = "visible";
	} else {
		document.getElementById("IMG_CONTACT").width = TAB_largeur_photo[GBL_idx_photo_courrante];
	}
	document.getElementById("MASQUE2").style.visibility = "visible";
	GBL_status_zoom = 0;
}

function changeZoom_FJS(idxPhoto) {
	GBL_idx_photo_courrante = idxPhoto;
	var img_load = new Image();
	img_load.onLoad = copieZoom_FJS();
	img_load.src = TAB_nom_photo[idxPhoto];
	document.getElementById("MASQUE1").style.visibility = "visible";
}

function zoomPlus_FJS() {
	GBL_status_zoom = GBL_status_zoom  + 200;
	var largeur_photo = 1000 + GBL_status_zoom;

	if (TAB_largeur_photo[GBL_idx_photo_courrante] > largeur_photo) {
		document.getElementById("IMG_CONTACT").width = largeur_photo;
		document.getElementById("ZOOM_P").style.visibility = "visible";
	} else {
		document.getElementById("IMG_CONTACT").width = TAB_largeur_photo[GBL_idx_photo_courrante];
		document.getElementById("ZOOM_P").style.visibility = "hidden";
	}
	document.getElementById("ZOOM_M").style.visibility = "visible";
}

function zoomMoins_FJS() {
	GBL_status_zoom = GBL_status_zoom  - 200;
	var largeur_photo = 1000 + GBL_status_zoom;
	document.getElementById("IMG_CONTACT").width = largeur_photo;
	if (GBL_status_zoom == 0) {
		document.getElementById("ZOOM_M").style.visibility = "hidden";
	}
	document.getElementById("ZOOM_P").style.visibility = "visible";
}

function fermerZoom_FJS() {
	document.getElementById("MASQUE1").style.visibility = "hidden";
	document.getElementById("MASQUE2").style.visibility = "hidden";
	document.getElementById("ZOOM_P").style.visibility = "hidden";
	document.getElementById("ZOOM_M").style.visibility = "hidden";
}

function afficheVideo_FJS() {
	var idx_video = parseInt(document.FORM_photo_de.LIST_idx.value);
	if (idx_video != -1) {
		document.location.href = './page.php?dest=' + GBL_destination + '&mode=VIDEO&planche=' + idx_video;
	}
}

function afficheRecit_FJS() {
	var idx_video = parseInt(document.FORM_photo_de.LIST_idx.value);
	if (idx_video != -1) {
		document.location.href = './page.php?dest=' + GBL_destination + '&mode=RECIT&planche=' + idx_video;
	}
}

function afficheFondEcran_FJS(idxLotPhoto,idxTaille,idxPhotoA,idxPhotoB) {
	var idx_lot_photo = parseInt(document.FORM_lot_photo.LIST_idx.value);
	var idx_taille = parseInt(document.FORM_taille_ecran.LIST_idx.value);
	var idx_photo_A = parseInt(document.FORM_photo.LIST_idxA.value);
	var idx_photo_B = idxPhotoB;
	if (idx_lot_photo == -1) {
		idx_lot_photo = idxLotPhoto;
	} else {
		idx_photo_A = 0;
		idx_photo_B = 1;
		idxPhotoA = 0;
		idxPhotoB = 1;
	}
	if (idx_taille == -1) {
		idx_taille = idxTaille;
	}
	if (idx_photo_A == -1) {
		idx_photo_A = idxPhotoA;
	}
	if (idxTaille > 1) {
		idx_photo_B = parseInt(document.FORM_photo.LIST_idxB.value);
		if (idx_photo_B == -1) {
			idx_photo_B = idxPhotoB;
		}
	} else {
		idx_photo_B = 1;
	}
	if ((idx_lot_photo != -1) || (idx_taille != -1) || (idx_photo_A != -1) || (idx_photo_B != -1)) {
		document.location.href = './other.php?mode=SCREEN&L=' + idx_lot_photo + '&T=' + idx_taille + '&A='+ idx_photo_A + '&B=' + idx_photo_B;
	}
}

function ouvreFondEcran_FJS(idxLotPhoto,idxTaille,idxPhotoA,idxPhotoB) {
	fond_href = "./screenwall.php?L=" + idxLotPhoto + "&T=" + idxTaille + "&A="+ idxPhotoA + "&B=" + idxPhotoB;
	parametre_fenetre = "width=800,height=600,toolbar=no,status=no,scrollbars=yes,resizable=yes,left=0,top=0";
    nouvelle_fenetre = window.open(fond_href,"ScreenWallWindow",parametre_fenetre);
}

