function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
addToStart(externalLinks);

window.name = "Manoir de la Thébline";
function win(fileName,largeur,hauteur) 
	{
  window.open(fileName,'',"width=" + largeur + ",height=" + hauteur +",top=" + (screen.height-hauteur)/2 +",left=" + (screen.width-largeur)/2 +",scrollbars=1, status=0, resizable=1");
  }
function winno(fileName,largeur,hauteur) 
	{
  window.open(fileName,'',"width=" + largeur + ",height=" + hauteur +",top=" + (screen.height-hauteur)/2 +",left=" + (screen.width-largeur)/2 +",scrollbars=0, status=0, resizable=0");
  }


//ouvre en popup l'image passée en parametre
function DoPopUpPath(imgtoload) 
	{
		wPopup = window.open('', 'img_popup', 'width=300, height=100, top='+(screen.height-30)/2+', left='+(screen.width-200)/2+', status=no, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, resizable=yes');
		// On écrit le contenu de la fenêtre popup
		wPopup.document.clear();
		
		wPopup.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml-dtd/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"><head><meta http-equiv="content-Type" content="text/html; charset=utf-8" /><title>Manoir de la Thébline</title>');
		wPopup.document.write('<style type=\"text/css\">\n'+
		'<!--\n'+
		'body {margin:0; padding:0;}\n}'+
		'img {border:0;}\n'+
		'.conteneur{text-align:center; margin:0; padding:0;}\n'+
		'.chargement{visibility:visible;}\n'+
		'.illustration{visibility:hidden; margin:15px 15px 0 15px;}\n'+
		'.fermer{margin:10px 0 20px 0;}\n'+
		'a { font-family:Arial; font-size: 12px; color:#4A1A2C; text-decoration: none;}\n'+
		'a:hover {color:#8E3557; text-decoration: underline;}\n'+
		'--!>\n'+
		'<\/style>');
		
		wPopup.document.write('</head><body  style="background-color:#F7F7F7; margin:0; padding:0; " onLoad="checkSize();">'); 
		// La fonction qui attend que l'image soit chargée et affichée pour redimensionner la fenêtre à la bonne taille
		wPopup.document.write('<script type="text/javascript"> //<![CDATA[\nfunction checkSize() { if(document.images && document.images[1].complete) { w = document.images[1].width+60; h = document.images[1].height+140;alert(screen.height+" "+h); if(h>window.screen.availHeight) {h=window.screen.availHeight}if(w>window.screen.availWidth) w=window.screen.availWidth-150;alert("w "+w+" h "+h);h=Number(h);w=Number(w); self.resizeTo(w,h); self.moveTo((window.screen.width-w)/2, (window.screen.height-h)/2); document.images[0].style.display = "none"; document.images[1].style.visibility = "visible"; window.focus();}else { setTimeout("checkSize()", 250); }}\n //]]></'+'script>');
		wPopup.document.write('<div class="conteneur"><img class="chargement" src="images/chargement.gif" alt="chargement" /><img class="illustration" src="' + imgtoload +'" onclick="javascript:self.close();" title="Cliquez pour fermer la fen&ecirc;tre" alt="" /><br /><a href="javascript:self.close();" title="Cliquez pour fermer la fen&ecirc;tre"><br />Fermer la fen&ecirc;tre</a></div>');
		wPopup.document.write('</body></html>');
		wPopup.document.close();
	}
	
function DoPopUp(imgtoload) 
	{
		var wPopup;
				
		// Si la fenêtre n'existe pas ou est fermée, on la réouvre
		if(!wPopup || wPopup.closed) 
		{
			wPopup = window.open('', 'img_popup', 'width=200, height=100,status=no, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, resizable=yes, top='+(screen.height-350)/2+', left='+(screen.width-400)/2);
		}
	
		// On écrit le contenu de la fenêtre popup
		wPopup.document.clear();
		wPopup.document.write("<html><head><title>Illustration</title>");
		wPopup.document.write("</HEAD>"); 
		// La fonction qui attend que l'image soit chargée et affichée pour redimensionner la fenêtre à la bonne taille
		wPopup.document.write('<script type="text/javascript">\nfunction checkSize() { if(document.images && document.images[1].complete) { w = (document.images[1].width)+12; h = (document.images[1].height)+30; window.resizeTo(w,h); window.moveTo((screen.width-w)/2, (screen.height-h)/2); document.images[0].style.display = "none"; document.images[1].style.visibility = "visible";this.focus(); }else { setTimeout("checkSize()", 250); }}\n</'+'script>');
		
		wPopup.document.write('<script type="text\/javascript">\n'+
		'function resizeWinTo() {\n'+
		'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
		'var oH = document.images[0].height, oW = document.images[0].width;\n'+
		'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
		'window.doneAlready = true;\n'+ //for Safari and Opera
		'var x = window; x.resizeTo( oW + 200, oH + 200 );\n'+
		'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
		'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
		'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
		'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
		'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
		'x.resizeTo( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + ( (oH + 200 ) - myH ) );\n'+
		'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
		'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
		'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
		'}\n'+
		'<\/script>');
		
		wPopup.document.write('<body style="background-color:#F7F7F7; margin:0; padding:0; ">');
		wPopup.document.write('<p style="margin:0; padding:0; font-size:0; overflow:hidden; text-align:center; vertical-align:middle;"><img src="images/chargement.gif" alt="" /><img src="' + imgtoload +'" style="margin:0; padding:0; cursor:pointer; visibility:hidden; vertical-align:middle;" alt="" onLoad="checkSize()" onclick="javascript:self.close();" Title="Cliquez pour fermer la fenetre" alt="Cliquez pour fermer la fenetre"/></p>');
		//wPopup.document.write('<div style="position:absolute;left:0px;top:0px;"><img src="images/chargement.gif" alt="" /><img src="' + imgtoload +'" style="margin:0; padding:0; cursor:pointer; visibility:hidden; vertical-align:middle;" alt="" onLoad="checkSize()" onclick="javascript:self.close();" Title="Cliquez pour fermer la fenetre" alt="Cliquez pour fermer la fenetre"/></div>');
		wPopup.document.write('</body></html>');
		wPopup.document.close();
	}
	
