﻿var winX=250, winY=250;

function NewWindow(url,h,w){
var NewWindows;
var property = "resizeable=no,toolbar=no,scrollbars=yes,status=no,directories=no,location=no, height:" + h + "px, width:" + w + "px"
	NewWindows=window.open(url,"",property);
}
function ejs_img_fx(img){	
	if(img && img.filters && img.filters[0]){
		img.filters[0].apply();
		img.filters[0].play();
	}
}
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 PopUp(url, width, height, impression) { 
    if (impression=="0") {
    window.open(url, "_blank", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width="+width+",height="+height+",left="+winX+",top="+winY+"");
    }
    else 
    {window.open(url, "_blank", "toolbar=yes,location=yes,resizable=yes,status=yes,menubar=yes,scrollbars=yes,width="+width+",height="+height+",left="+winX+",top="+winY+"");
    }
} 
function img_animaux()
 {
    document.write('<img id="image1" src="images/photo_a_1' + parseInt( Math.random() * 6 ) + '.jpg" alt="Concours des Animaux" />');
 } 
function img_vins()
 {
    document.write('<img id="image2" src="images/photo_v_1' + parseInt( Math.random() * 4 ) + '.jpg" alt="Concours des Vins" />');
 }
function img_produits()
 {
    document.write('<img id="image3" src="images/photo_p_1' + parseInt( Math.random() * 7 ) + '.jpg" alt="Concours des Produits" />');
 } 
function checkNb()
 {
        with (document.forms[0])  {
            nb = elements.length;
            for (i=0;i<nb;i++)    {   
                if (elements[i].name != undefined)   {       
                    if (elements[i].name.lastIndexOf('T_NB_MEDAILLES')!=-1) {   
                        if (elements[i].value == '') {
                            alert('Pas de médailles !');
                            return false;                            
                        } else {
                            if (parseInt(elements[i].value) > 400) {
                                if (confirm('Il y a plus de 400 médaillés potentiels pour votre recherche.\nNous vous encourageons à modifier cette dernière.\nToutefois, souhaitez-vous continuer ?'))
                                       {return true;} 
                                else {return false;}
                            }
                        }
                    }
                }
            }
        }
 } 
 
var blocactif = '0';
function affiche_bloc (num) {
    var obj=document.getElementById('bloc' + blocactif);
    if (obj.style.display=='')
    {   blocactif ='';
        obj.style.display='none';
    }
    var obj2=document.getElementById('bloc' + num);
    if (obj2.style.display=='none')
    {   obj2.style.display='';
        blocactif =num;   }
    /*images */
    if (num!=0)
    {   document.getElementById('col1').className="divcolonne_gris"
        document.getElementById('col2').className="divcolonne_gris"
        document.getElementById('col3').className="divcolonne_gris"
        document.getElementById('col' + blocactif).className="divcolonne"
    } else
    {   document.getElementById('col1').className="divcolonne"
        document.getElementById('col2').className="divcolonne"
        document.getElementById('col3').className="divcolonne"
    }
}
