var ie= document.all ? 1 : 0
var  enableScroll = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >3)) 
if(enableScroll)
{	var tScroll;
	var curPos = 0;
}

var site = "http://hallucinez.free.fr/";
var site2 = "/";

function vers_droite(pas)
{
	if(enableScroll)
	{
	curPos += pas;
	window.scroll(curPos,0);
	tScroll = window.setTimeout("vers_droite("+pas+");", 1);
	}
}	

function vers_gauche(pas)
{
	if(enableScroll)
	{
	curPos -= pas;
	window.scroll(curPos,0);
	tScroll = window.setTimeout("vers_gauche("+pas+");", 1);
	}
}

function vers_haut(pas)
{
	if(enableScroll)
	{
	curPos -= pas;
	window.scroll(0,curPos);
	tScroll = window.setTimeout("vers_haut("+pas+");", 1);
	}
}

function vers_bas(pas)
{
	if(enableScroll)
	{
	curPos += pas;
	window.scroll(0,curPos);
	tScroll = window.setTimeout("vers_bas("+pas+");", 1);
	}
}

function dir_gauche()
{
	if(enableScroll)
	{
	window.scroll(0,0);
	curPos=0;
	}
}

function dir_droite()
{
	if(enableScroll)
	{
	window.scroll(1075,0);
	curPos=1075;
	}
}

function dir_haut(page)
{
	if(enableScroll)
	{
	window.document.location.href=page;
	}
}

function dir_bas(page)
{
	if(enableScroll)
	{
	window.document.location.href=page;
	}
}

function stop() {
clearTimeout(tScroll);
}

function changer_frame(page,image1,image2) {
document.maframe.window.location.href = "/commun/includes/php/"+page;
fgauche.src="/commun/images/communes/"+image1;
fdroite.src="/commun/images/communes/"+image2;
}

function image_suivante(max,film,rep) {
image = document.photo.src;
no_image = image.substring(image.lastIndexOf("_"));
no_image = no_image.substring(1,no_image.length);
no_image = no_image.substring(0,no_image.indexOf(".",1));
no_image = Number(no_image);
if (no_image==max) {no_image=1;} else {no_image = no_image+1;};
image2 = site+"commun/images/rubriques/"+rep+"/petites/"+film+"_"+no_image+".jpg";
document.photo.src = image2;
}

function image_precedente(max,film,rep) {
image = document.photo.src;
no_image = image.substring(image.lastIndexOf("_"));
no_image = no_image.substring(1,no_image.length);
no_image = no_image.substring(0,no_image.indexOf(".",1));
no_image = Number(no_image);
if (no_image==1) {no_image=max;} else {no_image = no_image-1;};
image2 = site+"commun/images/rubriques/"+rep+"/petites/"+film+"_"+no_image+".jpg";
document.photo.src = image2;
}

function popup_image(titre,largeur,hauteur) {
image = document.photo.src;
image = image.substring(image.lastIndexOf("/"));
image = site+"commun/images/rubriques/grandecran/grandes"+image;
window.open(site2+"commun/includes/php/afficher_image.php?fic="+image+"&titre="+titre,"popup","width="+largeur+",height="+hauteur+",scrollbars=yes");
}

function popup_jt(fic) {
window.open(site2+"front/talents/"+fic,"popup","width=500,height=500,scrollbars=yes");
}

function afficher_image(serveur,film,rep) {
image = document.photo.src;
image = image.substring(image.lastIndexOf("/"));
image = image.substring(1,image.length);
document.location.href = site2+"front/grandecran/view.php?fic="+image+"&film="+film+"&rep2="+rep;
}

function redir_frame(groupe,nombre,tri) {
//if (groupe=="") {groupe = document.form1.groupe.options[document.form1.groupe.selectedIndex].value;}
if (groupe=="") {groupe = document.form1.groupe.value;} else {document.form1.groupe.value = groupe;}
if (nombre=="") {nombre = document.form1.nombre.options[document.form1.nombre.selectedIndex].value;}
//if (tri=="") {tri = document.form1.tri.options[document.form1.tri.selectedIndex].value;}
if (tri=="") {tri = document.form1.tri.value;} else {document.form1.tri.value = tri;}
document.maframe.window.document.location.href = "/commun/includes/php/critiques.php?groupe="+groupe+"&nombre="+nombre+"&tri="+tri;
}

function redir_frame_ajout(film) {
document.maframe.window.document.location.href = "/commun/includes/php/critiques.php?ajouter=1&groupe=2&film="+film;
}

//FONCTIONS DE CONTROLE DES FORMULAIRES

function verif_ajouter_critiques() {

var chp1 = document.form_pdv.post_nom.value;
var chp2 = document.form_pdv.post_email.value;
var chp3 = document.form_pdv.post_message.value;
var chp4 = document.form_pdv.post_note.options[document.form_pdv.post_note.selectedIndex].value;

if ((chp1=="") || (chp3=="") || (chp4=="-1")) {
	 		 alert("Vous devez obligatoirement compléter les champs suivants :\n- votre nom\n- votre message\n- votre note de 0 à 5");
	     return false;
} else {
			 return true;
} 

}

function verif_ajouter_opinion() {

var chp1 = document.form_pdv.post_nom.value;
var chp2 = document.form_pdv.post_email.value;
var chp3 = document.form_pdv.post_titre.value;
var chp4 = document.form_pdv.post_message.value;

if ((chp1=="") || (chp3=="") || (chp4=="")) {
	 		 alert("Vous devez obligatoirement compléter les champs suivants :\n- votre nom\n- un titre\n- votre message");
	     return false;
} else {
			 return true;
} 

}

function verif_recherche() {

var chp1 = document.form_search.critere.value;
taille = chp1.length;
if (taille<4) {alert("Votre critère doit comporter 4 caractères au minimum");} else {document.form_search.method = "get";document.form_search.action = "/commun/includes/php/recherche.php";document.form_search.submit();}

}


function modifier_form(nom_form,nom_champ,param) {
document.forms(nom_form).elements(nom_champ).value = document.forms(nom_form).elements(nom_champ).value + param; 
}