function statut(text) {
 if (window.defaultStatus) window.defaultStatus ='Vins de Pouilly'
 //if(self.name==top.name) { location.href="index.html" }
}

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


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.availHeigh) { if (screen.availHeight>=600) window.resizeTo(800,600)  }
}

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 preloadImages(){
// onload="preloadImages('images/m1.gif', ... , 'images/m42.gif')"
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=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];}}
}

var nouveau;
/* if (nouveau) {	if ( !nouveau.closed ) nouveau.close(); }
 nouveau =window.open('','photo','height='+height+',width='+width+',status=no,toolbar=no,menubar=no,location=no');
 nouveau.document.write('<html><head><title>Pouilly</title></head><body onLoad="window.focus();" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#ffffff" onclick="window.close()" scroll="no"><center><img src="'+nom+'" style="cursor:hand;" border="0" alt=""></center></body></html>');
}*/
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 photo(src,h,titre){
 function closef(id){  l=arguments.length; for (var i=0;i<l;i++) { var item=document.getElementById(arguments[i]); if (item) item.parentNode.removeChild(item);}    }
	closef('z_conteneur','z_ombre');
	if (typeof src != 'string') return;
	if ((typeof titre=='string')&&(titre.length>1)){}else { titre=false; }
	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='0'; width='100%'; zIndex='998'; }
		div.style.height=((hhm>hh)?hhm:hh)+'px'; 
		div=body.insertBefore(div,null);

	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','photo()'); div.onclick =photo; // pour IE
		div.setAttribute('title','FERMER');
		div.innerHTML='<span id="z_span" style=""><img id="z_image" src="'+src+'" alt="" title=""/><img src="/themes/style/images/'+((isIE6)?'close.gif':'closebox.png')+'" alt="FERMER" id="z_close" style="position:absolute;z-index:1001;"/></span>';
		div=body.insertBefore(div,null);

	if (titre){
		var div = document.createElement('div');
		div.setAttribute('id','z_titre');
		with (div.style) {
			position='absolute'; left='0'; bottom='1px'; width='100%'; //zIndex='999';
			textAlign='center'; cursor='pointer'; overflow='hidden';
			div.setAttribute('onclick','z()'); div.onclick =z; // pour IE
		}
		div.innerHTML='<b>'+titre+'</b>';
		var tmp=document.getElementById('z_span');
		if (tmp) tmp.insertBefore(div,null);
	}

	var img=document.getElementById('z_image');
	if (img) {
		with (img.style){ position='relative'; left='0'; top='0'; margin='0 auto'; }
		with (img.parentNode.style){ position='relative'; left='0'; top='0'; margin='0 auto'; zIndex='1000'; textAlign='right'; }
		if (titre) img.setAttribute('title',titre);
		var image=document.getElementById('z_image');
		img.onload= function(){
			isIE6=(navigator.appVersion.indexOf('MSIE 6.')>0);
			h=parseInt(this.height); w=parseInt(this.width);
			var image=document.getElementById('z_image');
			var sctop = document.documentElement.scrollTop || document.scrollTop || 0;
			if (image) {
				var span=document.getElementById('z_span');
				h=image.offsetHeight;
				hh= ((isIE6)?(h+100):document.documentElement.clientHeight)-h;
				if(navigator.appName == 'Netscape')
					hh= (window.innerHeight)-h;
				hh=hh/2;
				span.style.top=(sctop+hh)+'px';
				span.style.height=h+'px';
				var imgclose=document.getElementById('z_close');
				imgclose.style.bottom=''+(+h-15)+'px';
				imgclose.style.left=''+(image.offsetWidth-15)+'px';
				imgclose.style.visibility='visible';
				image.style.visibility='visible';
			}
		}
	}
}


function stopError() { return true; }

window.onerror = stopError;
window.onload=statut;




