﻿/*
OUVERTURE DES LIENS DANS UNE NOUVELLE FENETRE
rel="external"
http://www.sitepoint.com/article/standards-compliant-world
--------------------------------------------------------- */

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";
 }
}
window.onload = externalLinks;


/*
POPUP MENU DE MES ACTIVITES PRECEDENTES
http://www.allhtml.com/articles/detail/319
------------------------------------------*/
function Selection(formulaire){     
	if (formulaire.Liste.selectedIndex != 0)       
	location.href = formulaire.Liste.options[formulaire.Liste.selectedIndex].value;
	} 

/*
POPUP
------------------------------------------------------------*/
 function openWindow(url, name, w, h) {
  popupWin = window.open(url, name, 'toolbar=no,menubar=no,scrollbars=no,resizable=no,width='+w+',height='+h+',left=5,top=10');
}

 /*
 function popup(url, titre, largeur, hauteur, scroll)
  {
  window.open(url, titre, 'width=' + largeur + ', height=' + hauteur + ', scrollbars=' + scroll);
  }
  */
  
//---------------
//----- LIBRAIRIE GENERIQUE
//http://ditch.developpez.com/javascript/compatibilite/

function checkBrowser()
{	
	this.ver=navigator.appVersion;
	this.dom=document.getElementById?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie55=((this.ver.indexOf("MSIE 5.5")>-1 || this.ie6) && this.dom)?1:0;
	this.ie5=((this.ver.indexOf("MSIE 5")>-1 || this.ie5 || this.ie6) && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.ie4plus=(this.ie6 || this.ie5 || this.ie4);
	this.ie5plus=(this.ie6 || this.ie5)
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns5);
	return this;
}
			
bw = new checkBrowser();
			
if (!document.getElementById) 
{
document.getElementById = getObjectById;
}
			
function getObjectById(ID) 
{
	var obj;
	if (bw.dom)
		return document.getElementById(ID);
	else if (bw.ie4)
		return document.all(ID);
	else if (bw.ns4)
		return eval('document.' + ID);
}
			
function getObjectByIdParent(ID) 
{
	var obj;
	if (bw.dom)
		return parent.document.getElementById(ID);
	else if (bw.ie4)
		return parent.document.all(ID);
	else if (bw.ns4)
		return eval('parent.document.' + ID);
}

function cancelBubble(netEvent) 
{
    if (document.all) 
    {
        window.event.cancelBubble = true;
    } 
    else 
    {
        netEvent.cancelBubble = true;
    }
}




/*
POPUP FLASH SOUNDSLIDES
-----------------------------------------------------------------*/
var myWindow;
function openFlash(winurl, winwidth, winheight) {
	myWindow = window.open(winurl, winurl, "width=" +winwidth + ",height="+winheight + ",resizable");
	myWindow.focus();
	}
	
	
/*Center Browser window */
function ald_OpenBrWindow(theURL, winName, features, myWidth, myHeight, isCenter)
{
	var ald_win = null;
	var settings;
	settings = 'width='+myWidth+',height='+myHeight;
	
	if(isCenter)		// Position in center of window
	{
		var myLeft = (screen.width) ? (screen.width-myWidth)/2 : 0;
		var myTop = (screen.height) ? (screen.height-myHeight)/2 : 0;
		
		settings +=',left='+myLeft+',top='+myTop;
	}
	
	if(features!='') settings +=','+features;		// add features passed as argument
	ald_win = window.open(theURL,winName,settings);
}

/*
GESTION FORMULAIRES
Then you add the following onclick, onblur events to your field. (Shown in bold):
<input type="text" name="myfield" value="default text" onclick="clickclear(this, 'default text')" onblur="clickrecall(this,'default text')" />
-------------------------------------------------------------------*/
function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}


