/* script de controle de presence du COOKIE

necessite d autres script : GRCRI_Init_Base.js,GRCRI_Inhib_Key.js  */

AdhRepWin = null
AdhDocWin = null
tall = null
ExtURL=".html"

function Authentif() {

/* By Pass protection contre UN anti pop_up  */
if ((typeof  SymRealWinOpen) == "object" || (typeof  SymRealWinOpen) == "function" ) {
window.open=SymRealWinOpen;
}

if (AdhRepWin && !AdhRepWin.closed) {
AdhRepWin.close();
}
lochost=""
if (location.hostname != "" ) {
lochost="http://" + location.hostname + "/";
}
lurl = lochost + AUT_Doss_Appli + "/" + "GRCRI_Authent1.html";

trucrep="Authentification";
AdhRepWin = window.open ( lurl, trucrep, 'height=450, width=550, resizable=yes' )

if ( (typeof AdhRepWin) != "object") {
self.location = lochost + AUT_Doss_Appli + "/Aide_bloqueur.html";
} else if ( AdhRepWin.closed) {
self.location = lochost + AUT_Doss_Appli + "/Aide_bloqueur.html";
} else {
AdhRepWin.focus()
/* self.location = lochost + AUT_Pag_Index;    soit ceci */
self.location = lochost + AUT_Doss_Appli + "/" + AUT_Pag_Err;  /* soit cela  */
}

}



function Deconn() {

/* By Pass protection contre UN anti pop_up   */
if ((typeof  SymRealWinOpen) == "object" || (typeof  SymRealWinOpen) == "function" ) {
window.open=SymRealWinOpen;
}

/*
ExpDate= new Date
ExpDate.setDate(ExpDate.getDate()-1)
document.cookie = AUT_Cook_Prfx + "GRCRI=nullAuthent;expires=" + ExpDate.toGMTString() */
/* opener.close() */
/* location.href = AUT_Pag_Index;  */


lochost=""
if (location.hostname != "" ) {
lochost="http://" + location.hostname + "/";
}
self.location = lochost + AUT_Doss_Appli + "/" + "GRCRI_Annul.html";

}

/*  ***** premier controle  */

if (document.cookie == "") {
Authentif()
}
else {
	Lescookies = document.cookie.split("; ")
	for (i=0; i<Lescookies.length; i++) {
		if (Lescookies[i].split("=")[0] == AUT_Cook_Prfx + "GRCRI") {
                  break
		}
	}
		if ( (i == Lescookies.length) || (Lescookies[i].split("=")[0] != AUT_Cook_Prfx + "GRCRI")) {
		Authentif()
		}
}




/* second protection */

lochost=""
if (location.hostname != "" ) {
lochost="http://" + location.hostname + "/";
}

if (document.cookie == "") {
location.href=lochost + AUT_Doss_Appli + "/" + AUT_Pag_Err;
}
else {
  Lescookies = document.cookie.split("; ")
  for (i=0; i<Lescookies.length; i++) {
  	if (Lescookies[i].split("=")[0] == AUT_Cook_Prfx + "GRCRI") {
  	break
        }
  }
  if ( (i == Lescookies.length) || (Lescookies[i].split("=")[0] != AUT_Cook_Prfx + "GRCRI")) {
  location.href=AUT_Pag_Err;
  }
}

if (!window.navigator.cookieEnabled) {
location.href=lochost + AUT_Doss_Appli + "/" + AUT_Pag_Err;
}

