
//	script pour ajouter un bouton de fermeture de la fenêtre

var couleurboutonfermer = "green" ;
var couleurboutonfermeractif = "lime" ;
var couleurtextboutonfermer = "yellow" ;
var couleurtextboutonfermeractif = "white" ;

// -------------------------------------------------------------------------------
//	action fermeture de la fenêtre
// -------------------------------------------------------------------------------

function fermerfenetre2 () {
	if (parent.top) {
		parent.close () ;
	}
	else {
		window.close () ;
	}
}

// -------------------------------------------------------------------------------
//	activation / désactivation du bouton
// -------------------------------------------------------------------------------

function desactiveboutonfermer2 (lien) {
	lien.style.background = couleurboutonfermer ;
	lien.style.color = couleurtextboutonfermer ;
}

function activeboutonfermer2 (lien) {
	lien.style.background = couleurboutonfermeractif ;
	lien.style.color = couleurtextboutonfermeractif ;
}
// -------------------------------------------------------------------------------
//  Cookie Functions -- "Night of the Living Cookie" Version (25-Jul-96)
//  Written by:  Bill Dortch, hIdaho Design <bdortch@hidaho.com>
// -------------------------------------------------------------------------------
    
//  "Internal" function to return the decoded value of a cookie
    function getCookieVal (offset) {
      var endstr = document.cookie.indexOf (";", offset);
      if (endstr == -1)
        endstr = document.cookie.length;
      return unescape(document.cookie.substring(offset, endstr));
    }

//  Function to return the value of the cookie specified by "name".
//    name -    String object containing the cookie name.
//    returns - String object containing the cookie value,
//              or null if the cookie does not exist.
//
    function GetCookie (name) {
      var arg = name + "=";
      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 to create or update a cookie.
//    name - String object containing the cookie name.
//    value - String object containing the cookie value.  May contain
//         any valid string characters.
//    [expires] - Date object containing the expiration data of the cookie.  If
//         omitted or null, expires the cookie at the end of the current session.
//    [path] - String object indicating the path for which the cookie is valid.
//         If omitted or null, uses the path of the calling document.
//    [domain] - String object indicating the domain for which the cookie is
//         valid. If omitted or null, uses the domain of the calling document.
//    [secure] - Boolean (true/false) value indicating whether cookie
//         transmission requires a secure channel (HTTPS).  
//
//  The first two parameters are required.  The others, if supplied, must
//  be passed in the order listed above.  To omit an unused optional field,
//  use null as a place holder.  For example, to call SetCookie using name,
//  value and path, you would code:
//
//      SetCookie ("myCookieName", "myCookieValue", null, "/");
//
//  Note that trailing omitted parameters do not require a placeholder.
//
//  To set a secure cookie for path "/myPath", that expires after the
//  current session, you might code:
//
//      SetCookie (myCookieVar, cookieValueVar, null, "/myPath", null, true);
//
    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" : "");
    }

//  Function to delete a cookie. (Sets expiration date to start of epoch)
//    name -   String object containing the cookie name
//    path -   String object containing the path of the cookie to delete.
//             This MUST be the same as the path used to create the cookie, or
//             null/omitted if no path was specified when creating the cookie.
//    domain - String object containing the domain of the cookie to delete.
//             This MUST be the same as the domain used to create the cookie, or
//             null/omitted if no domain was specified when creating the 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";
      }
    }

// -------------------------------------------------------------------------------
//	création du compteur
// -------------------------------------------------------------------------------

function creer_compteur (num) {
	document.writeln ("<div align=center><center>") ;
	document.write ("<table width='260'>") ;
	document.write ("<tr><td align=center>") ;

	if (GetCookie ("login")) {
	    document.write ("<font face=Arial size=2>Visiteurs: &nbsp;&nbsp;&nbsp;</font>") ;
//	    document.write ("<img src=http://www.cbl-belfort.com/admin/compter.php?nom=cr2&num=" + num + ">") ;
	    document.write ("<img src=../../../admin/compter.php?nom=cr2&num=" + num + ">") ; // &img=def.gif
	}
	else {
	    document.write ("<img src=../../../admin/compter.php?nom=cr2&num=" + num + "&img=def.gif>") ;
	}
	document.write ("</td></tr>") ;
	document.write ("</table>") ;
	document.writeln ("</center></div>") ;
}

// -------------------------------------------------------------------------------
//	routine de création du bouton
// -------------------------------------------------------------------------------

function makeboutonfermer2 () {

//	définition du style de bouton

	document.writeln ("<style type='text/css'>");

	document.write ("td.boutonfermer2 {");
	document.write (" font-family: Comic Sans MS;");
	document.write (" font-size: 17px;");
	// document.write (" font-weight: bold;");
	document.write (" color: " + couleurtextboutonfermer + ";");
	document.write (" border: 1px solid black;");
	document.write (" background-color: " + couleurboutonfermer + ";");
	document.write (" cursor:hand;") ;
	document.writeln ("}");

	document.writeln ("</style>");

//	espacement

	document.writeln ("<div align=center><center>") ;
	document.writeln ("<table border=0 width=600>") ;
	document.writeln ("<tr>") ;
	document.writeln ("<td>&nbsp; </td>") ;
	document.writeln ("</tr>") ;
	document.writeln ("</table>") ;
	document.writeln ("</center></div>") ;

//	création du bouton

	document.writeln ("<div align=center><center>") ;
	document.writeln ("<table width='260'>") ;
	document.writeln ("<tr>") ;

	document.writeln ("<td></td>") ;
	document.write ("<td align=center width=100") ;
	document.write (" onMouseOver='activeboutonfermer2(this)'") ;
	document.write (" onMouseOut='desactiveboutonfermer2(this)'") ;
	document.write (" onClick='fermerfenetre2()'") ;
	document.write (" class='boutonfermer2'>") ;
	document.writeln ("Fermer</td>") ;

	document.writeln ("<td></td>") ;

	document.writeln ("</tr>") ;
	document.writeln ("</table>") ;
	document.writeln ("</center></div>") ;
}

makeboutonfermer2 () ;


