function statut(text) {
if (window.defaultStatus) window.defaultStatus ='DOMAINE TINEL-BLONDELET - Pouilly - Sancerre'
}

var isMinIE5 = (navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0
var isMinIE6 = (navigator.appVersion.indexOf("6.") >= 0) ? 1 : 0
var isMoz    = ( navigator.appName =='Netscape' )


function getdElement(d,nm) {
  if(nm == '') return null;
  return d.getElementById?d.getElementById(nm):(d.all?d.all(nm):null)
}
function getElement(nm) { return getdElement(document,nm) }

function set800() {
 if (screen.availWidth) { if (screen.availWidth>800) window.resizeTo(800,600)  }
}

function montre(id) {
 for (var i = 1; i<=10; i++) {
   var d =getElement('smenu'+i)
	if (d) if (i!=id){ d.style.display='none';}
 }
 d = getElement(id)
 if (d) d.style.display='block'
}

function montre2(id) {
 for (var i = 1; i<=10; i++) {
   var d = getElement('smenu'+i)
	if (d) if (i!=id) d.style.display='none'
 }
 d = getElement('smenu'+id)
 if (d) d.style.display='block'
}

function setOn(no){
	setOff(no)
	var item=getElement('mnu'+no)
	if (item) item.className='mnuON'
}
function setOff(no){
 for ( var i=1; i<12; i++){
	var item=getElement('mnu'+i)
	if (item){ if (no!=i) item.className='mnuOFF' }
 }
}

function load() {
	if (document.images) {
		this.length=preload.arguments.length;
		for (var i=0;i<this.length;i++) {
			this[i+1]=new Image();
			this[i+1].src=preload.arguments[i];
		}
	}
}
function preload() {
// Cette fonction charge dans le cache toutes les images passées en paramètre
	var mesImages=new load("COMMUN/images/cadre/puce_tra.gif","COMMUN/images/cadre/coin_hg.gif","COMMUN/images/cadre/coin_hd.gif","COMMUN/images/cadre/coin_bd.gif","COMMUN/images/cadre/coin_bg.gif","COMMUN/images/plateau/picto_choisir.gif","COMMUN/images/plateau/picto_recherche.gif","COMMUN/images/plateau/picto_panier.gif")
}


var nouveau;
function photo(nom, width, height){
 z(nom,height);
}
function pop(nom, width, height){
 if (nouveau) {	if ( !nouveau.closed ) nouveau.close(); }
 nouveau =window.open(nom,'photo','height='+height+',width='+width+', scrollbars=yes, status=no,toolbar=no,menubar=no,location=no')
}

function correctPNG(id) { //id= z_image
  var item=document.getElementById(id);
  if (item){
    var imgs=item.getElementsByTagName('img');
    for(var i=0; i<imgs.length; i++) {
     var img = imgs[i]
     var imgName = img.src.toUpperCase()
     if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){
       var imgID = (img.id) ? "id='" + img.id + "' " : ""
       var imgClass = (img.className) ? "class='" + img.className + "' " : ""
       var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
       var imgStyle = "display:inline-block;" + img.style.cssText
       if (img.align == "left") imgStyle = "float:left;" + imgStyle
       if (img.align == "right") imgStyle = "float:right;" + imgStyle
       if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
       var strNewHTML = "<span " + imgID + imgClass + imgTitle
           + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
           + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
           + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
       img.outerHTML = strNewHTML
       i = i-1
       }
  }}
}

function z(src,h){
   var item=document.getElementById('z_image');       if (item) item.parentNode.removeChild(item);
   var item=document.getElementById('z_conteneur');   if (item) item.parentNode.removeChild(item);
   var item=document.getElementById('z_ombre');       if (item) item.parentNode.removeChild(item);
   if (typeof src != 'string') return;
    isIE6=(navigator.appVersion.indexOf('MSIE 6.')>0);
    var main=document.getElementById('main');
    var body = document.body || body;
    h =  h || 10;
    hh = parseInt( document.body.clientHeight || body.clientHeight);
    hhm = parseInt(main.clientHeight);

    var div = document.createElement('div');
        div.setAttribute('id','z_ombre');
        with (div.style) {
              position='absolute'; left='0'; top='1%'; width='100%'; height='100%'; zIndex='998';
        }
        //div.setAttribute('onclick','z()'); div.onclick =z; // pour IE
        if (hhm>hh) {   // barre de scrolling !
           div.setAttribute('style','height:'+(hhm+3)+'px'); div.style.height=(hhm+3)+'px'; // pour IE
        }
        else div.setAttribute('style','height:'+hh+'px'); div.style.height=hh+'px';
        div=body.insertBefore(div,null);
        if (hhm>hh) div.style.height=(hhm+3)+'px';

    var div = document.createElement('div');
        div.setAttribute('id','z_conteneur');
        with (div.style) {
              position='absolute'; left='0'; top='0'; width='100%'; zIndex='999';
              textAlign='center'; cursor='pointer';
        }
        div.setAttribute('onclick','z()'); div.onclick =z; // pour IE
        div.setAttribute('title','FERMER');
        div.innerHTML='<img id="z_image" src="'+src+'" Xheight="'+h+'" alt="" title=""/><img src="../themes/style/images/close.gif" alt="FERMER" id="z_close"/>';
        div=body.insertBefore(div,null);

    var img=document.getElementById('z_image');
    if (img) {
        with (img.style) {
              position='relative'; left='0'; top='0'; margin='0 auto'; zIndex='1000';
        }
       img.style.marginTop=parseInt((hh-h)/2)+'px';
       img.onload= function (){
                isIE6=1;//(navigator.appVersion.indexOf('MSIE 6.')>0);
                var img=document.getElementById('z_image'); h=parseInt(img.height);
                hh = ((isIE6) ? (h+100) : document.body.clientHeight)-h;
                var sctop = document.documentElement.scrollTop || document.scrollTop || 0;
                if (img) {
                  img.style.marginTop=(sctop+(parseInt(hh/2)))+'px';
                  w=parseInt(img.width);
                  var imgclose=document.getElementById('z_close');
                  imgclose.style.marginTop=(-1+sctop+(parseInt(hh/2)))+'px';
                  imgclose.style.marginLeft=((w/2)+1-00)+'px'; //((w/2)+1-10)+'px';
                }
       }
    }
    //div.focus();
 }


function stopError() { return true; }
 
window.onerror = stopError;
window.onload=init;

function init(){
  setHeight();
  statut();
  var item = getElement('body')
  if (item) item.onresize=setHeight
  /*
  for (var i=1; i<10; i++) {
      var iitem = getElement('i'+i);
      if (item) item.onload= Ani1('i'+i)
  }
  */
}


/*------------------------------ */
/*  retailler le DIV en hauteur  */
function setHeight(){  //alert('resize')
  var item = getElement('main')
  if (item) {
    //alert( item.offsetHeight );
    var h = parseInt( item.offsetHeight )-128
    if (h>1){
      getElement('page').style.height=h+'px';
      getElement('menu').style.height=h+'px';
      getElement('bgmenu').style.height=h+'px';
    }
    //alert( h )
  }
}

  function initAni() {
    for (var i=1; i<20; i++) Ani1('i'+i)
  }
  function Ani1(no) {
     var item = getElement(no);
     if (item) {
       if (item.filters)  {             if (item.filters.length>0) {
         item.filters(0).Apply();
         item.filters(0).Play();
         
       }       }
     }
  }
  function Ani2(no) {
     var item = getElement(no);
     if (item) {
       //item.style = 'filter: progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=10);'
       if (item.filters)  {
             if (item.filters.length>0) item.filters(0).Apply();
             if (item.filters.length>0) item.filters(0).Play();
       }
     }
  }



/*------------------------------ */
/*       diapo haut gauche       */

var laphoto=0;
var clic=0;
var lphotos;

function incPhoto(){
 var element = getElement('logo')
 if (element){
	 laphoto++; if (laphoto==lphotos.length) {
		laphoto=1
		//if (element.filters(0).motion=='out') element.filters(0).motion='in'; else element.filters(0).motion='out'
	}
	 if (element.filters) if (element.filters.length>0) element.filters(0).Apply();
	 element.style.backgroundImage ='url('+lphotos[laphoto].src+')'	//rep+'/'+laphoto+'.jpg';
	 if (element.filters) if (element.filters.length>0) element.filters(0).Play();
	 clic=window.setTimeout("incPhoto()", 5000);
 }
}
function initPhoto(nb,rep){
 //rep='../images/diaporama/'
 //nb=7;
 if (nb>0){
	lphotos = new Array;
	for (var i=1; i<=nb; i++){
		lphotos[i] = new Image;
		lphotos[i].src = rep+''+i+'.jpg'
	}
	clic=window.setTimeout("incPhoto()", 10)
 }
}

/*------------------------------ */



