/////////////////////////////////////////////////////////////////////////////////////

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";
 }
}

/////////////////////////////////////////////////////////////////////////////////////

function changeGallery(choice) {
document.getElementById( "divGalleryVideo" ).style.display = "none";
document.getElementById( "divGalleryVideo" ).innerHTML = "";
document.getElementById( "divGalleryImage" ).style.display = "block";
document.galleryImage.src = eval(choice + ".src");
}

function changeVideo(choice, link)
{
	document.getElementById( "divGalleryImage" ).style.display = "none";
	
	var m_strVideo = "<EMBED SRC=\"" + choice + "\" width=\"320\" height=\"240\" type=\"video/quicktime\" pluginspage=\"http://www.quicktime.apple.com/download/\" cache=\"true\" controller=\"true\" loop=\"false\" autoplay=\"true\" scale=\"tofit\">";
	
	if (link) {
	m_strVideo += "<br /><br /><p><a href='" + link + "' class='fancy'>T&#233;l&#233;charger la vid&#233;o sur votre ordinateur</a></p>";
	}
	if( !isQTInstalled() )
	    m_strVideo += "<br /><br />You do not have Apple Quicktime. Please download Quicktime at: <a href=\"http://www.quicktime.apple.com/download/\" class=\"pink\" target=\"_blank\">http://www.quicktime.apple.com/download/</a>";
	
	document.getElementById( "divGalleryVideo" ).innerHTML = m_strVideo;
	document.getElementById( "divGalleryVideo" ).style.display = "block";
} // changeVideo

function isQTInstalled() {
	var qtInstalled = false;
	qtObj = false;
	if (navigator.plugins && navigator.plugins.length) {
		for (var i=0; i < navigator.plugins.length; i++ ) {
         var plugin = navigator.plugins[i];
         if (plugin.name.indexOf("QuickTime") > -1) {
			qtInstalled = true;
         }
      }
	} else {
		execScript('on error resume next: qtObj = IsObject(CreateObject("QuickTimeCheckObject.QuickTimeCheck.1"))','VBScript');
		qtInstalled = qtObj;
	}
	return qtInstalled;
}

/////////////////////////////////////////////////////////////////////////////////////

window.onload = externalLinks;
