


function ExtractValue(sString, sZone, sNextZone)
{
	this.sString = sString;
	this.sZone = sZone;
	this.sNextZone = sNextZone;
  	   var pos;
	   var rst;
	   var len = sZone.length;
	   pos1 = sString.indexOf(sZone,0);
	   pos1= pos1+ len;
	   rst = sString.slice(pos1,sString.indexOf(sNextZone,pos1));
   return rst;

}


function EncodeString(sString, sAction)
{
  this.sString = sString;
  this.sAction = sAction;
  if (!sString){return;}
  var Rslt=' ';
  var Char2Compare1='  ';

  var ArrayCript =   new Array('01', '02' ,'03', '04', '05',
                               '06', '07' ,'08', '09', '10',
                               '11', '12' ,'13', '14', '15',
                               '16', '17' ,'18', '19', '20',
                               '21', '22' ,'23', '24', '25',
                               '26', '27' ,'28', '29', '30',
                               '31', '32' ,'33', '34', '35',
                               '36', '37' ,'38');
  var ArrayDeCript = new Array('&', '=', '0', '1', '2',
                               '3', '4', '5', '6', '7',
                               '8', '9', 'A', 'B', 'C',
                               'D', 'E', 'F', 'G', 'H',
                               'I', 'J', 'K', 'L', 'M',
                               'N', 'O', 'P', 'Q', 'R',
                               'S', 'T', 'U', 'V', 'W',
                               'X', 'Y', 'Z');


  switch(sAction) {
    case 'C' :
      for(var i=0;i<sString.length;i++){

             Char2Compare1 = sString.substring(i,i+1);
            for(var j=0; j<ArrayDeCript.length;j++){
                if (Char2Compare1==ArrayDeCript[j]){
                  Rslt+= ArrayCript[j];
                  }
            }
         }
    break;
    case 'D' :
         for(var i=0;i<sString.length;i++){

             Char2Compare1 = sString.substring(i,i+2);
             i++;
            for(var j=0; j<ArrayCript.length;j++){
                if (Char2Compare1==ArrayCript[j]){
                  Rslt+= ArrayDeCript[j];
                  }
            }
         }

    break;
    default:
    break;
  }


return Rslt;

}

//-------------------------------------------------------------------//

var myMenu="";
var Request;
var XMLS;
var XMLS1;
var XMLS2;
var XMLLabelType;
var XMLLingua;
var doc1 = document.URL;
doc1 = doc1.toUpperCase();

//test for options of this login
try  {
	if (doc1.indexOf('WWWDSPENVC',0)>=0 || doc1.indexOf('WWWSELENVC',0)>=0 || doc1.indexOf('WWWMAPL8C',0)>=0)  {

		XMLS='N';
		if(srchData["SESSIONID"]!='' && srchData["SESSIONID"]!=undefined){
		var _user = ExtractValue(EncodeString(srchData["SESSIONID"],'D'), '&USERSO=', '&PASSSO=');
		}
		else{
		var _user = ExtractValue(EncodeString(document.getElementById('KEYSO1').value,'D'), '&USERSO=', '&PASSSO=');
		}

		var Request = '&USERSO=' + _user +'&WHICHP=USRADM&REQTOCALL=S2004&JSCOOK&';
		XMLS  	= 	ExecuteRequest1('SocketPGM', Request, 'PARAMETERSFORLOGIN', ' ');
			Request = '&USERSO=' + _user +'&WHICHP=LVLADM&REQTOCALL=S2004&JSCOOK&';
		XMLS1  	= 	ExecuteRequest1('SocketPgm', Request, 'PARAMETERSFORLOGIN', ' ');
		    Request = '&USERSO=' + _user +'&WHICHP=SCREEN&REQTOCALL=S2004&JSCOOK&';
		XMLS2  	= 	ExecuteRequest1('SocketPgm', Request, 'PARAMETERSFORLOGINSCREEN', ' ');

		}
	else {
	//if (!document.getElementById('USERSO') || document.getElementById('USERSO').value=='undefined'){
		var _user = ExtractValue(EncodeString(srchData["SESSIONID"],'D'), '&USERSO=', '&PASSSO=');
	//	}
	//else{_user =document.getElementById('USERSO').value; }
	// requête génèrale
// 	        var Request ='&USERSO=' + _user +'&WHICHP=&REQTOCALL=S2004&JSCOOK&';
// 		var XMLString  = ExecuteRequest1('SocketPGM', Request, 'PARAMETERSFORLOGIN', ' ');
// 		alert(XMLString);
		var Request = '&USERSO=' + _user +'&WHICHP=USRADM&REQTOCALL=S2004&JSCOOK&';
		XMLS  	= 	ExecuteRequest1('SocketPGM', Request, 'PARAMETERSFORLOGIN', ' ');
			Request = '&USERSO=' + _user +'&WHICHP=LVLADM&REQTOCALL=S2004&JSCOOK&';
		XMLS1  	= 	ExecuteRequest1('SocketPgm', Request, 'PARAMETERSFORLOGIN', ' ');
		    Request = '&USERSO=' + _user +'&WHICHP=SCREEN&REQTOCALL=S2004&JSCOOK&';
		XMLS2  	= 	ExecuteRequest1('SocketPgm', Request, 'PARAMETERSFORLOGINSCREEN', ' ');
		    Request = '&USERSO=' + _user +'&WHICHP=TYPETI&REQTOCALL=S2004&JSCOOK&';
		XMLLabelType  	= 	ExecuteRequest1('SocketPgm', Request, 'PARAMETERSFORLOGINSCREEN', ' ');
		    Request = '&USERSO=' + _user +'&WHICHP=TAALCL&REQTOCALL=S2004&JSCOOK&';
		XMLLingua  	= 	ExecuteRequest1('SocketPgm', Request, 'PARAMETERSFORLOGINSCREEN', ' ');

		}
	}
//catch the error of this TRY !!!!!!!!!!!!!!
catch(err)  {
	XMLS='N';
	}


//show the ebilling menu and only this menu because open area
if (typeof openarea == "undefined") { var openarea};
if (openarea=="µ@bE") {
	//set ExternalID to Y for easy access existing functions
    ExternalID=="Y" ;
	if (typeof billpage == "undefined") { var billpage="ebil";billdoc="ebilling"};
	myMenu+='<div class="level1"> '+ebillingtit+'</a></div>' ;
	myMenu+='<div class="level2"><a href=# onclick=menuclick(billdoc,billpage,"showbill")>'+showinvoicetit+'</a></div>' ;
	myMenu+='<div class="level2">'+registertit+'</div>';
	myMenu+='<div class="level3"><a href=# onclick=menuclick(billdoc,billpage,"reqacces")>- '+reqclosedtit+'</a></div>' ;
	myMenu+='<div class="level3"><a href=# onclick=menuclick(billdoc,billpage,"reqemail")>- '+reqemailtit+'</a></div>' ;
	myMenu+='<div class="level3"><a href=# onclick=menuclick(billdoc,billpage,"reqdomicil")>- '+reqdomiciltit+'</a></div>' ;
	}

//show the menu without secured services for direct links to server
if ((ExternalID=="Y" )||(openaccept=="yes")) {
	myMenu+='<div class="level1">'+extratit+'</div>';
	 	if ((servName=='testBD')||(servName=='appBD')||(servName=='prodBD')) {
	myMenu+='<div class="level2"><a href=# onclick=menuclick("contactinfo")>'+inforeqtit+'</a></div>' ;
}
	myMenu+='<div class="level2"><a href=# onclick=openwin("generalcondition","none")>'+gencontit+'</a></div>' ;
	 	if ((servName=='testBD')||(servName=='appBD')||(servName=='prodBD')) {
	myMenu+='<div class="level2"><a href=# onclick=openwin("account","none")>'+reqacctit+'</a></div>' ;
}	}
else {
	//redirect to group site
	if (typeof admin == "undefined") { var admin};
		if ((KeyID.length<20)&&(admin!="ict")&&(openaccept=="no")) {
			//    if (location.hostname=='testservices') {
			//    	  document.location.href="http://test.gls-group.eu"    ;
			//    }
			//    else {
			//    	  document.location.href="http://test.gls-group.eu"    ;
			//    }
		}
	//  else you create a menu where you find the secured services        openwin('trhelp','480','480','100','100')
	else {
		myMenu ='<div class="level1">'+servtit+'</div>';
		//myMenu+='<div class="level2"><a href=# onclick=pgmclick(docdir,"TRACK")>'+advancetit2+'</a></div>' ;
	 	myMenu+='<div class="level2"><a href=# onclick=pgmclick(docdir,"NEWTRACK")>'+advancetit+'</a></div>' ;
		myMenu+='<div class="level2">'+booktit+'</div>' ;
		if (XMLS2 && (XMLS2.substr(3,1)=='3'  || XMLS2.substr(3,1)=='4')) 		{
			myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"FR8")>- '+trsptit+'</a></div>' ;			
			if (XMLS2.substr(3,1)=='4') 		{
			 	if ((servName=='testBD')||(servName=='appBD')||(servName=='prodBD')) {   //  only GLS BD
					myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"XPRS")>- '+xprestit+'</a></div>' ;
				}
			}
        }
		else {
			myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"PARC")>- '+parctit+'</a></div>' ;
			myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"FR8")>- '+fr8tit+'</a></div>' ;
		 	if ((servName=='testBD')||(servName=='appBD')||(servName=='prodBD')) {   //  only GLS BD
				myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"XPRS")>- '+xprestit+'</a></div>' ;
			}
		}
	 	if ((servName=='testBD')||(servName=='appBD')||(servName=='prodBD')) {
			myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"SHIM")>- '+shipmentimport+'</a></div>' ;
		}
	 	if ((servName=='testBD')||(servName=='appBD')||(servName=='prodBD')) {
			myMenu+='<div class="level3"><a href=# onclick=openwin("cargo","none")>- '+cargotit+'</a></div>' ;
		}
		myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"BOOK")>- '+endofdaytit+'</a></div>' ;
		myMenu+='<div class="level3"><a href=# onclick=openwin("quickrefsos","none")>- '+sosqureftit+'</a></div>' ;
		myMenu+='<div class="level2">'+addresstit+'</div>' ;
		myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"DEAL")>- '+addressmanag+'</a></div>' ;
		myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"DEAC")>- '+addressimport+'</a></div>' ;
	 	if ((servName=='testBD')||(servName=='appBD')||(servName=='prodBD')) {
//	 	if ((servName=='testBD')||(servName=='appBD')||(servName=='prodBD')||(servName=='appNL')) {
			myMenu+='<div class="level2"> '+ebillingtit+'</a></div>' ;
			myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"BILL")>- '+ebillinginv+'</a></div>' ;
			myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"BILLEMAIL")>- '+reqemailtit+'</a></div>' ;
			myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"BILLDOMI")>- '+reqdomiciltit+'</a></div>' ;
//			myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"OTBI")>- '+ebillingoth+'</a></div>' ;
		}
		if (XMLS.substr(3,1)=='Y')  {
			myMenu+='<div class="level2">'+admintit +'</div>' ;
			myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"LOGS1")>'+accessLogs1+'</a></div>' ;
//			if (XMLS1.substr(3,1)=='1' || XMLS1.substr(3,1)=='2') {
//				myMenu+='<div class="level3"><a href=# onclick=pgmclick(docdir,"LOGS")>'+accessLogs+'</a></div>' ;
//				}
			}
	 	if ((servName=='testBD')||(servName=='appBD')||(servName=='prodBD')) {
		myMenu+='<div class="level0">&nbsp;</div>';
		myMenu+='<div class="level1">'+extratit+'</div>';
		myMenu+='<div class="level2"><a href=# onclick=menuclick("requestpod_onlin")>'+podreqtit+'</a></div>' ;
		myMenu+='<div class="level2"><a href=# onclick=menuclick("requeststat_onlin")>'+statreqtit+'</a></div>' ;
		myMenu+='<div class="level2"><a href=# onclick=openwin("generalcondition","none")>'+gencontit+'</a></div>' ;
		myMenu+='<div class="level2"><A href=# onclick=menuclick("order_ship_doc")>'+reqdocutit+'</a></div>' ;
}
		} ;
	if (location.hostname=='testservices') {
		myMenu+='<div class="level0">&nbsp;</div>';
//		myMenu+='<div class="level1">Only on test  =>  pgm !!!!</div>';
//		myMenu+='<div class="level2"><a href=# onclick=menuclick("b_track")>'+bastit+'</a></div>' ;
//		myMenu+='<div class="level2"><a href=# onclick=menuclick("requestpod_onlin")>'+podreqtit+'</a></div>' ;
//		myMenu+='<div class="level2"><a href=# onclick=menuclick("requeststat_onlin")>'+statreqtit+'</a></div>' ;
		myMenu+='<div class="level1">Only on test  =>  others !!!!</div>';
//		myMenu+='<div class="level2"><a href=# onclick=openwin("quickrefsos","680","800")>'+sosqureftit+'</a></div>' ;
		myMenu+='<div class="level2"><a href=# onclick=openwin("quickreflink","none")>'+lnkqureftit+'</a></div>' ;
		myMenu+='<div class="level2"><a href=# onclick=openwin("glslink","none")>'+lnkglsqureftit+'</a></div>' ;
		}        ;
}

if (document.getElementById('WHODOESCALL')) {if (srchData["WhoDoesCall"]) {myMenu='    ';}}

document.write(myMenu);



