/** Easyteam
 * Instancie un cookie à partir des paramètres nom/valeur
 *
 * name       Nom du cookie
 * value      Valuer du cookie
 * [expires]  Date d'expiration du cookie (par defaut: fin de la session courante)
 * [path]     Chemin de validité du cookie(par defaut: chemin d'appel du document)
 * [domain]   Domaine de validité du document
 *              (par defaut: domaine d'appel du document)
 * [secure]   Valeur booléene indiquant si la transmission du cookie est sécurisée ou non
 */
function setCookie(name, value, expires, path, domain, secure) {
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/** Easyteam
 * Retourne la valeur d'un cookie à partir du nom de paramètre
 *
 * name Nom du cookie.
 *
 * Returns un string contenant la valeur du cookie,
 *   ou null si le cookie n'existe pas.
 */
function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

/** Easyteam
 *         Supprime le cookie.
 *
 * name      Nom du cookie
 * [path]    Chemin de validité du cookie(Doit être identique au chemin de création du cookie)
 * [domain]  Domaine de validité du cookie (Doit être identique au domaine de création du cookie)
 */
function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}
/** Easyteam
 * Indique si une valeur appartient à un tableau
 *
 * array     Tableau de chaine de caractère
 * val       chaine de caractère recherché dans le tableau
 * Simule la méthode indexOf mais renvoie un booléen
 */
 function  inArray(array, val){
   for (var i=0; array.length; i++){
     if (array[i]==val){
       return true;
       break;
     }
     if (array.length == i)
       break;
            
   }
 }
/** Easyteam
*          Gestion des popUp
* strURL        url de la page
* strType       definit le type de fenêtre
* strHeight     hauteur de la fenêtre
* strWidth      Largeur de la fenêtre 
* srtImagePath  Chemin de l'image à afficher
* strLabel      Libellé de l'image
*/
 var newWin = null;
 var tab= "";
 var shtmb= '<html>'+
			'<title>Galerie photos</title>'+
			'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">'+
			'<link href="/soleil_css/presse.css" rel="stylesheet" type="text/css">'+
			'<body bgcolor="#DFDEDE">';
 var shtme= '</body></html>';
 function closeWin(){
	if (newWin != null){
	if(!newWin.closed)
		newWin.close();
	}
 } 
function popUp(strURL,strType, strHeight, strWidth, srtImagePath, strLabel) {
	closeWin();
	var strOptions="";
	if (strType=="console") strOptions="height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,";
	height="+strHeight+",width="+strWidth";
	newWin = window.open(strURL, 'newWin', strOptions);
	tab= '<table border="1" width ="100%" style="border-collapse: collapse;" bordercolor="#9c9c9c" class="texte">';
	tab+='<tr onclick="window.close();return false;"><td align="center" valign="middle"><img src="'+srtImagePath+'" alt="Fermer"></td></tr>'+
		 '<tr><td align="center" class="ancreht">'+strLabel+'</td></tr></table>';
newWin.document.write(shtmb+tab+shtme);
newWin.focus();
} 

