// Script accueil. Défilement texte
var blank = "../../pics/fonds/blank.gif";
topedge = 400;  // location of news box from top of page
leftedge = 68;  // location of news box from left edge
boxheight = 44;  // height of news box
boxwidth = 300;  // width of news box
scrollheight = 180; // total height of all data to be scrolled
function scrollnews(cliptop) {
if (document.layers) {
newsDiv = document.news;
newsDiv.clip.top = cliptop;
newsDiv.clip.bottom = cliptop + boxheight;
newsDiv.clip.left = 0;
newsDiv.clip.right = boxwidth + leftedge;
newsDiv.left = leftedge;
newsDiv.top = topedge - cliptop;
}
else {
newsDiv = news.style;
newsDiv.clip = "rect(" + cliptop + "px " + (boxwidth + leftedge) + "px " + (cliptop + boxheight) + "px 0px)";
newsDiv.pixelLeft = leftedge;
newsDiv.pixelTop = topedge - cliptop;
}
cliptop = (cliptop + 1) % (scrollheight + boxheight);
newsDiv.visibility='visible';
setTimeout("scrollnews(" + cliptop + ")", 100);
}


// Script partenaires. Secoue texte
var rector=3
var stopit=0 
var a=1
function init(which){
stopit=0
shake=which
shake.style.left=0
shake.style.top=0
}
function rattleimage(){
if ((!document.all&&!document.getElementById)||stopit==1)
return
if (a==1){
shake.style.top=parseInt(shake.style.top)+rector
}
else if (a==2){
shake.style.left=parseInt(shake.style.left)+rector
}
else if (a==3){
shake.style.top=parseInt(shake.style.top)-rector
}
else{
shake.style.left=parseInt(shake.style.left)-rector
}
if (a<4)
a++
else
a=1
setTimeout("rattleimage()",50)
}
function stoprattle(which){
stopit=1
which.style.left=0
which.style.top=0
}


// Script epices. defilement pics
var interval = 4.5; // delay between rotating images (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 1000;
var image_index = 0;
image_list = new Array();
image_list[image_index++] = new imageItem("../../../../pics/rubriques/epices/pics-epices/e1.jpg");
image_list[image_index++] = new imageItem("../../../../pics/rubriques/epices/pics-epices/e2.jpg");
image_list[image_index++] = new imageItem("../../../../pics/rubriques/epices/pics-epices/e3.jpg");
image_list[image_index++] = new imageItem("../../../../pics/rubriques/epices/pics-epices/e4.jpg");
image_list[image_index++] = new imageItem("../../../../pics/rubriques/epices/pics-epices/e5.jpg");
image_list[image_index++] = new imageItem("../../../../pics/rubriques/epices/pics-epices/e6.jpg");
var number_of_image = image_list.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
image_index = generate(0, number_of_image-1);
}
else {
image_index = (image_index+1) % number_of_image;
}
var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}
function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "rotateImage('"+place+"')";
setTimeout(recur_call, interval);
}


// Script dreamw. Remplacmt pics
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v3.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; }
}

// Script dreamw. Regions
var t=0

function liste(form1) {
t=(form1.list.selectedIndex +1);

if (t==1){MM_showHideLayers('alsace','','show');}
if (t==2){MM_showHideLayers('aquitaine','','show');}
if (t==3){MM_showHideLayers('auvergne','','show');}
if (t==4){MM_showHideLayers('bourgogne','','show');}
if (t==5){MM_showHideLayers('bretagne','','show');}
if (t==6){MM_showHideLayers('centre','','show');}
if (t==7){MM_showHideLayers('champard','','show');}
if (t==8){MM_showHideLayers('corse','','show');}
if (t==9){MM_showHideLayers('franchcont','','show');}
if (t==10){MM_showHideLayers('ildef','','show');}
if (t==11){MM_showHideLayers('langrouss','','show');}
if (t==12){MM_showHideLayers('limousin','','show');}
if (t==13){MM_showHideLayers('lorraine','','show');}
if (t==14){MM_showHideLayers('midipyr','','show');}
if (t==15){MM_showHideLayers('nordpasdeca','','show');}
if (t==16){MM_showHideLayers('bassenor','','show');}
if (t==17){MM_showHideLayers('hautenor','','show');}
if (t==18){MM_showHideLayers('paysdel','','show');}
if (t==19){MM_showHideLayers('picardie','','show');}
if (t==20){MM_showHideLayers('poitouchar','','show');}
if (t==21){MM_showHideLayers('paca','','show');}
if (t==22){MM_showHideLayers('rhonealp','','show');}
if (t==23){MM_showHideLayers('martinique','','show');}
if (t==24){MM_showHideLayers('guadeloupe','','show');}
if (t==25){MM_showHideLayers('reunion','','show');}
if (t==26){MM_showHideLayers('guyane','','show');}
if (t==27){MM_showHideLayers('nouvcal','','show');}
}

function cache(scene){
  MM_showHideLayers('scene','','hide','corse','','inherit','alsace','','inherit','aquitaine','','inherit','auvergne','','inherit','bourgogne','','inherit','bretagne','','inherit','centre','','inherit','champard','','inherit','corse','','inherit','franchcont','','inherit','ildef','','inherit','langrouss','','inherit','limousin','','inherit','lorraine','','inherit','midipyr','','inherit','nordpasdeca','','inherit','bassenor','','inherit','hautenor','','inherit','paysdel','','inherit','picardie','','inherit','poitouchar','','inherit','paca','','inherit','rhonealp','','inherit','martinique','','inherit','guadeloupe','','inherit','reunion','','inherit','guyane','','inherit','nouvcal','','inherit');
}

// Script dreamw. Formulaires
function efface(name)
{
eval ( that = document.forms[0].elements [name]);
if ( (name == 'nom') || (name == 'email') || (name == 'ville') || (name == 'remarques') )
{
that.value = '';
}
else return false;
}

function verif(f){
 	var vide="";var msg;
 	for (var i = 0 ; i< f.length; i++){
 	var e= f.elements[i];
 	if ((e.type =="text") || (e.type=="textarea")){
 	if (e.value == null || e.value =="" || e.value=="ex : Marie Laitue" || e.value=="ex : marie.laitue@wanadoo.fr"
 	|| e.value=="ex : Paris" || e.value=="utile" || e.value=="ex : je trouve que ce site est agréable mais qu'il manque de contenu.") { vide += "\n"+e.name; continue}
 	}
 	}
 	if (!vide) return true;
 	msg=" Problemes \n ";
 	msg+="Remplissez les champs suivants avant d'envoyer le formulaire :"+vide+"\n";
 	alert (msg); return false;
 	}