function AfficherImage(img) { Image1= new Image();  Image1.src=(img);  Control(img); } 
function Control(img) {  if((Image1.width!=0)&&(Image1.height!=0)) {    VoirImage(img);  }  else {    fonction="Control('"+img+"')";    intervalle=setTimeout(fonction,20);  } } 
function VoirImage(img) {  
largeur=Image1.width+20;  hauteur=Image1.height+20;  
var top=(screen.height-hauteur)/2;
var left=(screen.width-largeur)/2;
proprietes="width="+ largeur +",height="+ hauteur+",top="+top+",left="+left;  
win=window.open(img,"",proprietes); }

AlphaChars = "ôéàçèâîïùabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ .@,-_";
NumChars = "0123456789";
HexaChars = "ABCDEFabcdef";

function popUp(url,h,l)
{
	var top=(screen.height-h)/2;
	var left=(screen.width-l)/2;
	proprietes="width="+ l +",height="+ h+",top="+top+",left="+left;  
	win=window.open(url,"",proprietes+",scrollbars=yes");
}



function checkValue(champ, typ)
{
 
 erreur=false;
 if (champ.value != '')
 {
	 result = CheckField(champ.value,typ)
	 if (result!=true)
		{	if (typ=='DAT' && result!=false)
				{champ.value = result}
			else {erreur=true
			}
		}
	}
else erreur=true
if (erreur) {
alert("Une erreur est détectée sur le champ "+champ.name+' --- '+champ.value)
champ.focus()
}
else return true

	
}

function IsMail(Data)
{
	alias=Data.split("@")[0] !=null
	domain=Data.split("@")[1] !=null
	if (domain) suffix=Data.split("@")[1].split(".")[1] !=null
	if (!alias || !domain || !suffix) {return false;}
	
	// Vérifie s'il n'y a pas de caractères interdits dans le nom de l'utilisateur.
	var ch;
	for (i = 0; i < alias.length; i++) {
		ch = (alias.substring(i, i + 1)).toLowerCase();
		if (!(((ch >= "a") && (ch <= "z")) || 
			((ch >= "0") && (ch <= "9")) ||
			(ch == "_") || (ch == "-") || (ch == "."))) {
				return false;
		}
	}
	
	// Vérifie s'il n'y a pas de caractères interdits dans le nom de domaine
	for (i = 0; i < domain.length; i++) {
		ch = (domain.substring(i, i + 1)).toLowerCase();
		if (!(((ch >= "a") && (ch <= "z")) || 
			((ch >= "0") && (ch <= "9")) ||
			(ch == "_") || (ch == "-") || (ch == "."))) {
				return false;
		}
	}
	
	return true
}

function IsNumeric(Data) {
	var It = true;
	var c;
	for (var x = 0; x < Data.length; x++)
		if (It) {
			c = Data.charAt(x);
			It = ( NumChars.indexOf(c) != -1);
		}
	return It;
}

function IsDecimal(Data) {
	var It = true;
	var virgule = false;
	var c;
	c = Data.charAt(0);	
	It = (  (AlphaChars.indexOf(c) != -1) || (NumChars.indexOf(c) != -1) || (c == "+") || (c=="-") );
	for (var x = 1; x < Data.length; x++)
		if (It) {
			c = Data.charAt(x);
			if ( (c==".") || (c == ",") )
				if (virgule) 
					It = false;
				else {
					It = true;
					virgule = true;
				}
			else
				It = (  (AlphaChars.indexOf(c) != -1) || (NumChars.indexOf(c) != -1) );
		}
	return It;
}

function IsAlphaNumeric(Data) {
	var It = true;
	var c;
	for (var x = 0; x < Data.length; x++)
		if (It) {
			c = Data.toLowerCase().charAt(x);
			It = (  (AlphaChars.indexOf(c) != -1) || (NumChars.indexOf(c) != -1) );
		}
	return It;
}

function IsHexa(Data) {
	var It = true;
	var c;
	for (var x = 0; x < Data.length; x++)
		if (It) {
			c = Data.charAt(x);
			It = (  (HexaChars.indexOf(c) != -1) || (NumChars.indexOf(c) != -1) );
		}
	return It;
}

function IsSome(Data) {if (Data.length==0) {return false} else {return true};}

function IsAlpha(Data) {
	var It = true;
	if (Data.length==0) It=false;
	var c;
	for (var x = 0; x < Data.length; x++)
		if (It) {
			c = Data.charAt(x);
			It = ( AlphaChars.indexOf(c) != -1);
		}
	return It;
}

function CheckField(Data,Format) {
	var exact = false;
	if (Data.length > 0) {
		if (Format == "NUM")
			exact = IsNumeric(Data);
		if (Format == "TXT")
			exact = IsAlphaNumeric(Data);
		if (Format == "PCT")
			exact = IsDecimal(Data);
		if (Format == "DEC")
			exact = IsDecimal(Data);
		if (Format == "HEXA")
			exact = IsHexa(Data);
		if (Format == "ALPHA")
			exact = IsAlpha(Data);
		if (Format == "DAT")
			exact = IsDate(Data);
		if (Format == "MAIL")
			exact = IsMail(Data);
		if (Format == "SOME")
			exact = IsSome(Data);

	}
	return exact;
}
  
function jsStringReplacejsCheckDate(strOriginal , strFind, strReplace)  {
  var intPos = 0;
  var intLen = strFind.length;
  intPos = strOriginal.indexOf(strFind);
  while (intPos != -1) {
    strOriginal = strOriginal.substring(0, intPos) + strReplace + strOriginal.substring(intPos+intLen, strOriginal.length);
    intPos = strOriginal.indexOf(strFind);
  };
  return strOriginal;
}
function jsTestCeiljsCheckDateFormat(Nbre)  {
 if (Nbre==Math.ceil(Nbre)) {
    return true; 
 } else { 
    return false;
 }
}
function jsStringReplacejsCheckDateFormat(strOriginal , strFind, strReplace)  {
  var intPos = 0;
  var intLen = strFind.length;
  intPos = strOriginal.indexOf(strFind);
  while (intPos != -1) {
    strOriginal = strOriginal.substring(0, intPos) + strReplace + strOriginal.substring(intPos+intLen, strOriginal.length);
    intPos = strOriginal.indexOf(strFind);
  };
  return strOriginal;
}
function jsCheckDateFormat(strDate, strFormat)  {
 var D;
 var M;
 var Y;
 var div4;
 var div100;
 var div400;
 var bTest = false;
  bTest = false;  if ((strFormat=='dd.mm.yyyy') || (strFormat=='dd.mm.yy') || (strFormat=='mm.dd.yyyy') || (strFormat=='mm.dd.yy') || (strFormat=='d.m.yyyy') || (strFormat=='d.m.yy') || (strFormat=='m.d.yyyy') || (strFormat=='m.d.yy'))
  {    bTest = true;    strDate = jsStringReplacejsCheckDateFormat(strDate, '.', '/');
    strFormat = jsStringReplacejsCheckDateFormat(strFormat, '.', '/');
  }  if (!bTest && ((strFormat=='dd-mm-yyyy') || (strFormat=='dd-mm-yy') || (strFormat=='mm-dd-yyyy') || (strFormat=='mm-dd-yy') || (strFormat=='d-m-yyyy') || (strFormat=='d-m-yy') || (strFormat=='m-d-yyyy') || (strFormat=='m-d-yy')))
  {    bTest = true;    strDate = jsStringReplacejsCheckDateFormat(strDate, '-', '/');
    strFormat = jsStringReplacejsCheckDateFormat(strFormat, '-', '/');
  }  if (!bTest && ((strFormat=='ddmmyyyy') || (strFormat=='mmddyyyy') || (strFormat=='ddmmyy') || (strFormat=='mmddyy')))
  {    strDate = strDate.substring(0, 2) + '/' + strDate.substring(2, 4) +  '/' + strDate.substring(4, strDate.length);
    strFormat = strFormat.substring(0, 2) + '/' + strFormat.substring(2, 4) +  '/' + strFormat.substring(4, strFormat.length);
  } p1 = strDate.indexOf('/');
 p2 = strDate.lastIndexOf('/');
 LenY = strDate.length - p2 - 1;
 bTest = false;  if ((strFormat=='dd/mm/yy') || (strFormat=='d/m/yy'))
  {    bTest = true;    D = parseFloat(strDate.substring(0,p1));
    M = parseFloat(strDate.substring(p1+1,p2));
    Y = parseFloat(strDate.substring(p2+1,strDate.length));
    if (LenY!=2) {Y=-1;} 
  }  if (!bTest && ((strFormat=='mm/dd/yy') || (strFormat=='m/d/yy')))
  {    bTest = true;    M = parseFloat(strDate.substring(0,p1));
    D = parseFloat(strDate.substring(p1+1,p2));
    Y = parseFloat(strDate.substring(p2+1,strDate.length));
    if (LenY!=2) {Y=-1;} 
  }  if (!bTest && ((strFormat=='mm/dd/yyyy') || (strFormat=='m/d/yyyy')))
  {    bTest = true;    M = parseFloat(strDate.substring(0,p1));
    D = parseFloat(strDate.substring(p1+1,p2));
    Y = parseFloat(strDate.substring(p2+1,strDate.length));
    if (LenY!=4) {Y=-1;} 
  }  if (!bTest && ((strFormat=='dd/mm/yyyy') || (strFormat=='d/m/yyyy')))
  {    bTest = true;    D = parseFloat(strDate.substring(0,p1));
    M = parseFloat(strDate.substring(p1+1,p2));
    Y = parseFloat(strDate.substring(p2+1,strDate.length));
    if (LenY!=4) {Y=-1;} 
  }  if (!bTest)
  {    D = parseFloat(strDate.substring(0,p1));
    M = parseFloat(strDate.substring(p1+1,p2));
    Y = parseFloat(strDate.substring(p2+1,strDate.length));
    if (LenY!=4) {Y=-1;} 
  }
 if ((D==0)||!jsTestCeiljsCheckDateFormat(D)) {D=-1;}
 if ((M==0)||!jsTestCeiljsCheckDateFormat(M)||(M>=13)) {M=-1;}
 if (!jsTestCeiljsCheckDateFormat(Y)) {Y=-1;}
 if (Y==0) {Y=2000;}
 div4=jsTestCeiljsCheckDateFormat(Y/4);
 div100=jsTestCeiljsCheckDateFormat(Y/100);
 div400=jsTestCeiljsCheckDateFormat(Y/400);
 if ((Y>=0) && (Y<=9999)) { 
   if ((M==1)||(M==3)||(M==5)||(M==7)||(M==8)||(M==10)||(M==12)) {
     if ((D>0)&&(D<=31)) { 
       return true;
     } else { return false; }
   }
   if ((M==4)||(M==6)||(M==9)||(M==11)) {
     if ((D>0)&&(D<=30)) { 
       return true; 
     } else { return false; }
   }
   if (M==02) {1
     if ((div4)&&!(div100)||(div400)) {
       if ((D>0)&&(D<=29)) {
         return true; 
       } else { return false; }
     } else {
       if ((D>0)&&(D<=28)) {
         return true; 
       }else { return false; }
     } 
   } else { return false; }
 } else { return false; }
 return true;
}
function IsDate(strDate)  {
 strDate = jsStringReplacejsCheckDate(strDate, '.', '/');
 strDate = jsStringReplacejsCheckDate(strDate, '-', '/');
 if (strDate.indexOf('/')==-1)
   { 
   if (strDate.length == 6)
     strDate = strDate.substring(0, 2) + '/' + strDate.substring(2, 4) + '/' + strDate.substring(4, 6);
   else if (strDate.length==8)
     strDate = strDate.substring(0, 2) + '/' + strDate.substring(2, 4) + '/' + strDate.substring(4, 8);
   }
 if ((jsCheckDateFormat(strDate, 'dd/mm/yy')) || (jsCheckDateFormat(strDate, 'dd/mm/yyyy')) || (jsCheckDateFormat(strDate, 'mm/dd/yy')) || (jsCheckDateFormat(strDate, 'mm/dd/yyyy')))
   return strDate;
 else {
   return false;
  };
}


function ajaxLoader(url,id) {
new Ajax.Updater(id, url, {asynchronous:false});
}

function ajaxLoaderOLD(url,id)
{	if (document.getElementById) 
			{
				// debug : document.getElementById(id).innerHTML=url
				var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();}
			if (x){
				x.onreadystatechange = function()
				{
				if (x.readyState == 4 && x.status == 200){
				//debug : alert(x.responseText);
				el = document.getElementById(id);el.innerHTML = x.responseText;}
				}
				x.open("GET", url, true);
				x.send(null);
				}
}

function swapdesc(id)
{
	trs=document.getElementsByTagName("DIV")
	for (i=0;i<trs.length;i++)
	{
		if (trs[i].id.substr(4)=='desc') {trs[i].style.display="none"}
	}
	if (document.getElementById('desc'+id).style.display=="block") {document.getElementById('desc'+id).style.display="none"} else {document.getElementById('desc'+id).style.display="block"}
}

// --------- script 2008
function showPopup(loc) {
	document.getElementById('popup').style.display="block"
	new Effect.Move('popup', {x:$(loc).cumulativeOffset().left-100, y: $(loc).cumulativeOffset().top-400, mode: 'absolute' });
	}

google.load("maps", "2.x");
function showGMaps(loc,lat,lng,nom)
{		
			document.getElementById('gMap').style.display="block"
			new Effect.Move('gMap', {x:$(loc).cumulativeOffset().left-100, y: $(loc).cumulativeOffset().top-400, mode: 'absolute' });
		var map = new google.maps.Map2(document.getElementById('map'));    
			map.addControl(new GSmallMapControl());
			map.addControl(new GMapTypeControl());
			var point=new google.maps.LatLng(lat,lng)
			map.setCenter(point, 14);  
		 	var marker = new GMarker(point);
      map.addOverlay(marker);
	  toTop('gMap')
}
	
function hidePopup() {
	document.getElementById('popup').style.display="none"
	}

function swapOperate()
{
	document.getElementById('ident').style.display="none"
	document.getElementById('operate').style.display="block"
}

function saveMbrForm()
{
$$('.field').each(function(f){f.value=htmlentities(f.value)})

ajaxLoader('srv.asp?'+$('frmMbr').serialize()+'&dt='+Date(),'popup')
}

function htmlentities (string, quote_style) {
    // Convert all applicable characters to HTML entities  
    // 
    // version: 905.1002
    // discuss at: http://phpjs.org/functions/htmlentities
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: nobbler
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // -    depends on: get_html_translation_table
    // *     example 1: htmlentities('Kevin & van Zonneveld');
    // *     returns 1: 'Kevin &amp; van Zonneveld'
    // *     example 2: htmlentities("foo'bar","ENT_QUOTES");
    // *     returns 2: 'foo&#039;bar'
    var histogram = {}, symbol = '', tmp_str = '', entity = '';
    tmp_str = string.toString();
    
    if (false === (histogram = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {
        return false;
    }
    
    for (symbol in histogram) {
        entity = histogram[symbol];
        tmp_str = tmp_str.split(symbol).join(entity);
    }
    
    return tmp_str;
}

function get_html_translation_table(table, quote_style) {
    // Returns the internal translation table used by htmlspecialchars and htmlentities  
    // 
    // version: 905.3122
    // discuss at: http://phpjs.org/functions/get_html_translation_table
    // +   original by: Philip Peterson
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: noname
    // +   bugfixed by: Alex
    // +   bugfixed by: Marco
    // +   bugfixed by: madipta
    // +   improved by: KELAN
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // %          note: It has been decided that we're not going to add global
    // %          note: dependencies to php.js. Meaning the constants are not
    // %          note: real constants, but strings instead. integers are also supported if someone
    // %          note: chooses to create the constants themselves.
    // *     example 1: get_html_translation_table('HTML_SPECIALCHARS');
    // *     returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
    
    var entities = {}, histogram = {}, decimal = 0, symbol = '';
    var constMappingTable = {}, constMappingQuoteStyle = {};
    var useTable = {}, useQuoteStyle = {};
    
    // Translate arguments
    constMappingTable[0]      = 'HTML_SPECIALCHARS';
    constMappingTable[1]      = 'HTML_ENTITIES';
    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
    constMappingQuoteStyle[2] = 'ENT_COMPAT';
    constMappingQuoteStyle[3] = 'ENT_QUOTES';

    useTable       = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS';
    useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT';

    if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') {
        throw new Error("Table: "+useTable+' not supported');
        // return false;
    }

    // ascii decimals for better compatibility
    entities['38'] = '&amp;';
    if (useQuoteStyle !== 'ENT_NOQUOTES') {
        entities['34'] = '&quot;';
    }
    if (useQuoteStyle === 'ENT_QUOTES') {
        entities['39'] = '&#039;';
    }
    entities['60'] = '&lt;';
    entities['62'] = '&gt;';

    if (useTable === 'HTML_ENTITIES') {
        entities['160'] = '&nbsp;';
        entities['161'] = '&iexcl;';
        entities['162'] = '&cent;';
        entities['163'] = '&pound;';
        entities['164'] = '&curren;';
        entities['165'] = '&yen;';
        entities['166'] = '&brvbar;';
        entities['167'] = '&sect;';
        entities['168'] = '&uml;';
        entities['169'] = '&copy;';
        entities['170'] = '&ordf;';
        entities['171'] = '&laquo;';
        entities['172'] = '&not;';
        entities['173'] = '&shy;';
        entities['174'] = '&reg;';
        entities['175'] = '&macr;';
        entities['176'] = '&deg;';
        entities['177'] = '&plusmn;';
        entities['178'] = '&sup2;';
        entities['179'] = '&sup3;';
        entities['180'] = '&acute;';
        entities['181'] = '&micro;';
        entities['182'] = '&para;';
        entities['183'] = '&middot;';
        entities['184'] = '&cedil;';
        entities['185'] = '&sup1;';
        entities['186'] = '&ordm;';
        entities['187'] = '&raquo;';
        entities['188'] = '&frac14;';
        entities['189'] = '&frac12;';
        entities['190'] = '&frac34;';
        entities['191'] = '&iquest;';
        entities['192'] = '&Agrave;';
        entities['193'] = '&Aacute;';
        entities['194'] = '&Acirc;';
        entities['195'] = '&Atilde;';
        entities['196'] = '&Auml;';
        entities['197'] = '&Aring;';
        entities['198'] = '&AElig;';
        entities['199'] = '&Ccedil;';
        entities['200'] = '&Egrave;';
        entities['201'] = '&Eacute;';
        entities['202'] = '&Ecirc;';
        entities['203'] = '&Euml;';
        entities['204'] = '&Igrave;';
        entities['205'] = '&Iacute;';
        entities['206'] = '&Icirc;';
        entities['207'] = '&Iuml;';
        entities['208'] = '&ETH;';
        entities['209'] = '&Ntilde;';
        entities['210'] = '&Ograve;';
        entities['211'] = '&Oacute;';
        entities['212'] = '&Ocirc;';
        entities['213'] = '&Otilde;';
        entities['214'] = '&Ouml;';
        entities['215'] = '&times;';
        entities['216'] = '&Oslash;';
        entities['217'] = '&Ugrave;';
        entities['218'] = '&Uacute;';
        entities['219'] = '&Ucirc;';
        entities['220'] = '&Uuml;';
        entities['221'] = '&Yacute;';
        entities['222'] = '&THORN;';
        entities['223'] = '&szlig;';
        entities['224'] = '&agrave;';
        entities['225'] = '&aacute;';
        entities['226'] = '&acirc;';
        entities['227'] = '&atilde;';
        entities['228'] = '&auml;';
        entities['229'] = '&aring;';
        entities['230'] = '&aelig;';
        entities['231'] = '&ccedil;';
        entities['232'] = '&egrave;';
        entities['233'] = '&eacute;';
        entities['234'] = '&ecirc;';
        entities['235'] = '&euml;';
        entities['236'] = '&igrave;';
        entities['237'] = '&iacute;';
        entities['238'] = '&icirc;';
        entities['239'] = '&iuml;';
        entities['240'] = '&eth;';
        entities['241'] = '&ntilde;';
        entities['242'] = '&ograve;';
        entities['243'] = '&oacute;';
        entities['244'] = '&ocirc;';
        entities['245'] = '&otilde;';
        entities['246'] = '&ouml;';
        entities['247'] = '&divide;';
        entities['248'] = '&oslash;';
        entities['249'] = '&ugrave;';
        entities['250'] = '&uacute;';
        entities['251'] = '&ucirc;';
        entities['252'] = '&uuml;';
        entities['253'] = '&yacute;';
        entities['254'] = '&thorn;';
        entities['255'] = '&yuml;';
    }
    
    // ascii decimals to real symbols
    for (decimal in entities) {
        symbol = String.fromCharCode(decimal);
        histogram[symbol] = entities[decimal];
    }
    
    return histogram;
}

function html_entity_decode( string, quote_style ) {
    // Convert all HTML entities to their applicable characters  
    // 
    // version: 905.1002
    // discuss at: http://phpjs.org/functions/html_entity_decode
    // +   original by: john (http://www.jd-tech.net)
    // +      input by: ger
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Onno Marsman
    // +   improved by: marc andreu
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // -    depends on: get_html_translation_table
    // *     example 1: html_entity_decode('Kevin &amp; van Zonneveld');
    // *     returns 1: 'Kevin & van Zonneveld'
    // *     example 2: html_entity_decode('&amp;lt;');
    // *     returns 2: '&lt;'
    var histogram = {}, symbol = '', tmp_str = '', entity = '';
    tmp_str = string.toString();
    
    if (false === (histogram = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {
        return false;
    }

    // &amp; must be the last character when decoding!
    delete(histogram['&']);
    histogram['&'] = '&amp;';

    for (symbol in histogram) {
        entity = histogram[symbol];
        tmp_str = tmp_str.split(entity).join(symbol);
    }
    
    return tmp_str;
}

dj = new Date()
jrs = ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi']
ms = ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Aout','Septembre','Octobre','Novemembre','Décembre']
ddj = jrs[dj.getDay()]+' '+dj.getDate()+' '+ms[dj.getMonth()]
function switchview(cible){if (cible.style.display=='none') {cible.style.display='block'} else {cible.style.display='none'}}

function popEdit(table,key,id,t){w=window.open("editHTML.asp?table="+table+"&key="+key+"&id="+id+"&t="+t,"w","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=770, height=500")}
function popupH(url) {w=670;h=530;w=window.open(url,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=1, resizable=no, copyhistory=no, width="+w+", height="+h)}

function EcrireCookie(nom, valeur)
{
var argv=EcrireCookie.arguments;
var argc=EcrireCookie.arguments.length;
var expires=(argc > 2) ? argv[2] : null;
var path='/' //(argc > 3) ? argv[3] : null;
var domain=null //''//(argc > 4) ? argv[4] : null;
var secure=(argc > 5) ? argv[5] : false;
document.cookie=nom+"="+escape(valeur)+
((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
((path==null) ? "" : ("; path="+path))+
((domain==null) ? "" : ("; domain="+domain))+
((secure==true) ? "; secure" : "");
}
function getCookieVal(offset)
{

var endstr=document.cookie.indexOf (";", offset);
if (endstr==-1) endstr=document.cookie.length;
return unescape(document.cookie.substring(offset, endstr)); 
}
function LireCookie(nom)
{
var arg=nom+"=";
var alen=arg.length;
var clen=document.cookie.length;
var i=0;
while (i<clen)
{

var j=i+alen;
if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
i=document.cookie.indexOf(" ",i)+1;
if (i==0) break;


}
return null; 
}
function EffaceCookie(nom)
{
date=new Date;
date.setFullYear(date.getFullYear()-1);
EcrireCookie(nom,'',date); 
}

function videSelect() {
EffaceCookie('datas')
location.reload()
}


// fonctions caddie
function addAdr(AdrId,AdrNom,motif,actid,raceid,dpt,rid,pid,motcle)
{
	actid=(actid)?actid:''
	raceid=(raceid)?raceid:''
	dpt=(dpt)?dpt:''
	rid=(rid)?rid:0
	pid=(pid)?pid:''
	motcle=(motcle)?motcle:''
// recharche Cookie
datas = LireCookie("datas")
datas = (datas) ? datas : ''
if (datas.indexOf(AdrId+'|'+AdrNom)==-1)
{
	if (datas!='') datas+=','
	if (datas.split(',').length>15)	{alert('Vous avez atteint votre quota de 15 adresses, désolé.');return}
	
	datas+=AdrId+'|'+AdrNom+'|'+motif+'|'+actid+'|'+raceid+'|'+dpt+'|'+rid+'|'+pid+'|'+motcle
	EcrireCookie("datas",datas)
	if (document.getElementById("frmSelect")) document.getElementById("frmSelect").nbd.value=datas.split(',').length
	if (document.getElementById("nbInPanier")) document.getElementById("nbInPanier").value=datas.split(',').length
}
else {alert('Adresse déjà sélectionnée') }
}

function suppAdr(AdrId)
{
datas = LireCookie("datas")
tmp = datas.split(',')
datas=''
EffaceCookie("datas")
for (a=0;a<tmp.length;a++)
{
adr = tmp[a].split("|")
if (adr[0]!=AdrId) addAdr(adr[0],adr[1],adr[2])
}
location.reload()
}

function goUrl(cid) {var tmp=new Ajax.Request('srv.asp',{method:'post',parameters:{p:'goUrl',centreid:cid}})}