﻿var curseur;
var page;
var gnHstList;
var gnCurrHstPos;
var evenement;

maxZoom=4
minZoom=.5
baseZoom=1.05
baseRatio=1

var nIconNum;
nIconNum = 1;

var expdate = new Date();
expdate.setTime (expdate.getTime() + (365 * 24 * 60 * 1000)); // One year from now 

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;
  }
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
}

function showMe(){
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.theLayer.visibility="show";
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");

function golist(){
var str_href = Access.location.href.toLowerCase();
if (str_href.search("kernel") > 0){
	var url = '../Exploit/'+gsFName+'/pdf/'+lib_lang+'/'+gsFName+'.pdf'
}else{
	var url = './pdf/'+gsFName+'.pdf'
}
    dnl=window.open(url,'apercu','toolbar = no, menubar = yes, personalbar = yes, resizable = yes');
//dnl.print();
}

function RefreshVisu(grandeur){
NaVs();
Access.getElementById('ifra_thumbnail').style.width = grandeur+"px";
}
	
function ShowThumbNail() {
	document.write('<table cellspacing=0 cellpadding=0 width="1" border="0">');
	for(var i = 0;i < Cata.length; i++)
	{
var multth = Cata[i][1].split(",");
var multlk = Cata[i][2].split(",");
for(var j = 0;j < multth.length; j++)
	{
	document.write('<tr><td width="1"><a href="javascript:goPage(' + i + ');"><img border="0" src="' + multth[j] + '"></a></td></tr>');
	document.write('<tr><td>' + multlk[j] + '</td></tr>');
	}
		
	}
	document.write('</table>');
}

function dwnld(url,typ) {
//if(browser.isIE){
//    dnl=window.open(url,'','status = no, scrollbars=no, resize=no, toolbar = no, menubar = no, personalbar = no, resizable = no');
//    dnl.resizeTo(1,1);
//    dnl.location.reload();
//    dnl.blur();
//    dnl.document.execCommand('SaveAs');
//    dnl.close();
//}

    var multurl = url.split(",");
    var tst = 0;
for(var i = 0;i < multurl.length; i++)
	{
	if(multurl[i] != ""){
	tst = tst+1;
	memo = i;
	}
	}
	
if(browser.isIE && multurl.length > 1 && tst > 1){
	dnl = window.open('','','toolbar = no, menubar = no, personalbar = no, resizable = yes, scrollbars=yes, width=150, height=400');
	dnl.document.writeln("<HTML><HEAD>");
	dnl.document.writeln("<style type=\"text/css\">"); 
var str_href = Access.location.href.toLowerCase();
if (str_href.search("kernel") > 0){
	dnl.document.writeln("    @import url(\"../Exploit/"+gsFName+"/css/thumbnail.css\");");
}else{
	dnl.document.writeln("    @import url(\"librairies/css/thumbnail.css\");");
}
	dnl.document.writeln("    </style>");

	dnl.document.writeln("</HEAD><BODY>");
	
var multth = Cata[eval(top.window.document.getElementById('curseur').value)][1].split(",");
var multlk = Cata[eval(top.window.document.getElementById('curseur').value)][2].split(",");

	switch (typ)
	{
	  case 'pdf':
		var message = MSGacrobat;
	    break;
	  case 'xls':
		var message = MSGxls;
	    break;
	  case 'doc':
		var message = MSGdoc;
	    break;
	}
		
	dnl.document.writeln("<table cellspacing=\"0\" cellpadding=\"0\" width=\"1\" border=\"0\">");
	for(var i = 0;i < multurl.length; i++)
	{
	if(multurl[i] != ""){
var str_href = Access.location.href.toLowerCase();
if (str_href.search("kernel") > 0){
	var th = multth[i];
}else{
	var th = multth[i].replace('../','./');
}	
	dnl.document.writeln("<tr><td width=\"1\"><a href=\"#\" OnClick=\"window.open('" + multurl[i] + "','','toolbar = no, menubar = yes, personalbar = yes, resizable = yes');\"><img border=\"0\" src=\"" + th + "\" alt=\"" + message +"\"></a></td></tr>");
	dnl.document.writeln("<tr><td>" + multlk[i] + " : " + message  + "<br><br></td></tr>");
	}
	}
	dnl.document.writeln("</table>");
	 
	dnl.document.writeln("</BODY></HTML>");
}else{
if(tst == 1){
	window.open(multurl[memo],'','toolbar = no, menubar = yes, personalbar = yes, resizable = yes');
}else{
for(var i = 0;i < multurl.length; i++)
	{
	if(multurl[i] != ""){
	window.open(multurl[i],'','toolbar = no, menubar = yes, personalbar = yes, resizable = yes');
	}
	}
}
}
 
 //  if(!i || i==0){
//    var i = 0;
//    dnl=window.open('','apercu','toolbar = no, menubar = yes, personalbar = yes, resizable = yes');
//    dnl.location.href=multurl[0];
//    i = i+1
//   }

//if(multurl.length > 0){
//if(multurl[i]){
//if(confirm('Fichier Suivant ?')){
//    dnl.location.href=multurl[i];
//    i = i+1;
//}else{
//return;
//}}else{
//return;
//}}
}

function goacrobat() {

    dwnld(Cata[eval(top.window.document.getElementById('curseur').value)][3],'pdf');
    
}

function goxls() {

    dwnld(Cata[eval(top.window.document.getElementById('curseur').value)][5],'xls');
    
}

function godoc() {

    dwnld(Cata[eval(top.window.document.getElementById('curseur').value)][6],'doc');
    
}

function PrintProcess(){

NaVs('pop');

	var printid = eval(top.window.opener.window.top.window.document.getElementById('Entitie').value);
if(printid == "-1"){var tst=1; var printid=0;}
var multpg = Cata[eval(top.window.opener.window.top.window.document.getElementById('PrintList').value)][0].split(",");
var multid = Cata[eval(top.window.opener.window.top.window.document.getElementById('PrintList').value)][4].split(",");
var multla = Cata[eval(top.window.opener.window.top.window.document.getElementById('PrintList').value)][7].split(",");
var multha = Cata[eval(top.window.opener.window.top.window.document.getElementById('PrintList').value)][8].split(",");
var la;
var ha;
//alert(printid);
//for(var j = 0;j < multpg.length; j++)

if (Access2.getElementById('swf')){

if(multla[printid] != ""){la = eval(multla[printid]);}else{la = eval(gsFL);}
if(multha[printid] != ""){ha = eval(multha[printid]);}else{ha = eval(gsFH);}

var rt = eval(700/la);
//alert(eval(la*rt));
//alert(eval(ha*rt));

top.window.document.getElementById('image').innerHTML=GetFlash(multpg[printid],eval(la*rt),eval(ha*rt),'pop');
setTimeout("SizeW('swf');",100);

}else{

top.window.document.getElementById('image').innerHTML = '<img border="0" name="chksize" src="' + multpg[printid] + '" style="position: relative; left: 0; top: 0; width:100%;">';
setTimeout("SizeW();",100);
}

top.window.opener.window.top.window.document.getElementById('Entitie').value = eval(printid+1);

setTimeout("window.print();",300);
if(tst == 1){
setTimeout("whosnext();",10000);
}
}

function SizeW(med){
if(med == "swf"){
top.window.resizeTo(700,1019);
}else{
top.window.resizeTo(541,788);
}
}

function whosnext(){
NaVs('pop');
var printid = eval(top.window.opener.window.top.window.document.getElementById('Entitie').value);
var multpg = Cata[eval(top.window.opener.window.top.window.document.getElementById('PrintList').value)][0].split(",");

if(printid < multpg.length){
PrintProcess();
}else{
return;
}

}

function ResetMain()
{
    //Ecriture du cookie => Applicatif 
    commande = GetCookie (gsFName);
    
    if ((commande == null) || (commande.length < 1))
    {
	    SetCookie(gsFName,"", expdate, "/");
    }
    
    //Remise à 0 du calcul d'affichage (première page à 100%)
    top.window.document.getElementById('curseur').value = 0;
    top.window.document.getElementById('ratio').value = baseRatio;

    //reseter la combo zoom si elle existe
    //Afficher la page
    iImg();
    NaVs();
    
    if(Access.getElementById('dropdown1'))
    {
        pgcombo();
        Access.getElementById('dropdown1').selectedIndex = 0;
    }
    
    if(Access.getElementById('T1'))
    {
        Access.getElementById('T1').value = MSGrech;
    }
    
    //OF
    //Reset postit
    f_gopostit();
}

function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    top.window.document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}    

function SetCookie (name,value,expires,path,domain,secure) {
  top.window.document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = top.window.document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (top.window.document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = top.window.document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}

function goa_basket(){
	//alert ("valeur en cours = " + lgcom);
	valtoadd = top.window.document.getElementById('curseur').value
	if (valtoadd >=0){
		value = GetCookie(gsFName);
		
		if (value == null || value.length<1)
		 	{value =  "_"+valtoadd+"_"}
		else
			{

		zeval="_"+valtoadd+"_"
		dedans=value.indexOf(zeval)
		//alert(dedans+"  "+value+" uuu "+zeval)
		if (dedans>=0) {
			alert(MSGin2bask)
			return false;
			}

		value = value + "$_" + valtoadd+"_";}
		SetCookie(gsFName,value,expdate,  "/");
		alert(MSGaddbask);
		gov_basket(1);
	}
}

function getCookieVal (offset) {
  var endstr = top.window.document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = top.window.document.cookie.length;
  return unescape(top.window.document.cookie.substring(offset, endstr));
}

function URLDecode(psEncodeString) 
{
  // Create a regular expression to search all +s in the string
  var lsRegExp = /\+/g;
  // Return the decoded string
  return unescape(String(psEncodeString).replace(lsRegExp, " ")); 
}

var ar_chr = new Array();
for (var i=1;i<=255;i++)	ar_chr[i]=unescape('%' + i.toString(16));
	    
function ar_C2ASCII(c) {
	for (var i=1;i<=255;i++) {
		if (ar_chr[i] == c)	return i;
	}
	return c;
}

function urlencode(text){
	var tmp = '';
	var n, i;
	for (i=0; i<text.length; i++){
		n=ar_C2ASCII(text.charAt(i));
		if (n<=38 || (n>=58 && n<=64) || (n>=122 && n<=191)) tmp += '%' + n.toString(16)
			else tmp += text.charAt(i);
	}
	return tmp;
}



function EcrirePage()
{
    NaVs();
    reg = new RegExp('%20','g');

    var host;
    var fic;
    //alert(Access.location.href);
    var str_href = Access.location.href.toLowerCase();
    if (str_href.search("kernel") > 0)
    {
        host =  Access.location.href.substr(0, str_href.search("kernel"));
        //alert(Cata[eval(top.window.document.getElementById('curseur').value)][3].replace("../",""));
    }
    else
    {
        host =  Access.location.href.substr(0, Access.location.href.search(gsFName));
        //alert(Cata[eval(top.window.document.getElementById('curseur').value)][3].replace("./",""));
    }

    commande = GetCookie (gsFName);
    concat = MSGmsgbask+"<br><br>";
    if ((commande == null) || (commande.length < 1))
    {
        //concat = concat+"<tr><td width='780'><p align='center'><font face='Arial' size='2'>" + "<br><br>Vous n'avez rien enregistré" + "</font></td></tr>";
    }
    else
    {
        commande = commande.replace(reg," ");
        ligne = commande.split("$");

        nblignes = ligne.length;

        var str_href = Access.location.href.toLowerCase();
        if (str_href.search("kernel") > 0)
        {
            var relativ = "../Exploit/"+gsFName+"/";
        }
        else
        {
            var relativ = "../";
        }

        for (i=1;i <= nblignes; i++)
        { 
            lenum=0
            element = ligne[i-1].split("_");
            //   alert(element[1])
            nref = element[1];
            
            //OF
            if (GetCookie('cata') == 2)
            {
                nref = parseInt((parseInt(nref) + 1) / 2);
            }
            if (nref == -1)
            {
                nref = 0;
            }
            
            //alert(host);
                       
            concat = concat+"<center><table cellspacing='0' cellpadding='0' width='1' border='0'><tr>";

            var multpg = Cata[nref][1].split(",");
            var multlk = Cata[nref][2].split(",");
            var multfi = Cata[nref][3].split(",");
            var multid = Cata[nref][4].split(",");

            for(var j = 0;j < multpg.length; j++)
            {
                //OF
                //Postit
                //concat = concat+"<td align='center'><a href='javascript:goPage(" + nref + ");'><img src='" + multpg[j] + "'></a></td>";
                concat = concat + "<td align='center'><table border='0' cellpadding='0' cellspacing='0'><tr><td><a href='javascript:goPage(" + nref + ");'><img src='" + multpg[j] + "'></td><td style='vertical-align:top;'><div style='width:18px;'>";
                if (GetCookie('n_' + multid[j]) != null && GetCookie('n_' + multid[j]) != '')
                {
                    concat = concat + "<a href='javascript:goPage(" + nref + ");'><img src='post-it/post_it_panier.png'/></a>";
                }
                concat = concat + "</div></td></tr></table></td>";
            }

            concat = concat+"</tr><tr>";
            for(var j = 0;j < multpg.length; j++)
            {
                concat = concat+"<td align='center'>"+multlk[j]+"</td>";
            }
            concat = concat+"</tr><tr>";
            
            for(var j = 0;j < multpg.length; j++)
            {
                fic="";
                var str_href = Access.location.href.toLowerCase();
                if (str_href.search("kernel") > 0)
                {
                    fic = host+multfi[j].replace("../","");
                }
                else
                {
                    fic = host+gsFName+multfi[j].replace("./","/");
                }

                concat = concat+"<td align='center'><br>"
                concat = concat+"<a href=javascript:goprint(" + (nref) + "," + j + ")><img src='"+relativ+"mes_images/imprimer.gif' alt='"+MSGprint+"'></a><img src='"+relativ+"img/sep_0_1.gif'>";

                //OF
                //Mail postit
                //concat = concat+"<a href=mailto:?Subject="+urlencode(MSGsubmel)+"&amp;body="+urlencode(MSGbodmel).replace("\\r","%0D")+"%20%0A%0D"+urlencode(fic)+"><img src='"+relativ+"mes_images/envoyer.gif' alt='"+MSGmelbask+"'></a><img src='"+relativ+"img/sep_0_1.gif'>";
                concat = concat + "<a href=mailto:?Subject="+urlencode(MSGsubmel)+"&amp;body="+urlencode(MSGbodmel).replace("\\r","%0D")+"%20%0A%0D"+urlencode(fic)

                if (GetCookie('n_' + multid[j]) != null && GetCookie('n_' + multid[j]) != '')
                {
                    concat = concat + "%20%0A%0D" + urlencode(GetCookie('n_' + multid[j])).replace("\\r","%0D");
                }
                concat = concat + "><img src='"+relativ+"mes_images/envoyer.gif' alt='"+MSGmelbask+"'></a><img src='"+relativ+"img/sep_0_1.gif'>";

                concat = concat+"<a href=javascript:SL(" + (i-1) + ")><img src='"+relativ+"mes_images/suprimer.gif' alt='"+MSGdelbask+"'></a>"; 
                concat = concat+"</td>";
            }

            concat = concat+"</tr></table></center><br><br>";
            
        }
    }
    // concat = concat+"</table>"; 
    Access3.getElementById('blist').innerHTML = concat; 
}



function Search() {
NaVs();
achercher=Access.getElementById("T1").value
//alert(Access.nav.achercher)
//searchname = "recherche.htm"
//alert (searchname)
if (Access.getElementById("T1").value=="") {
	alert("Entrez une valeur à rechercher");
	//return true;
	}
if (Access.getElementById("T1").value!="") {
	//parent.main.location=searchname
	//document.mypk.submit();
	gorech(1);
	}
}


//NS4 = (document.layers) ? true : false;
function checkEnter(event)
{
NS4 = false;
	var code = 0;
	if (NS4)
		code = event.which;
	else
		code = event.keyCode;
	if (code==13) {
		Search();
		}
}

function SL(nm) // supprime ligne nm
{
 valeur = GetCookie(gsFName);
 
 value = "";
 if (nm == 0)
     {
         if (nblignes == 1) DeleteCookie(gsFName,"/");
         if (nblignes > 1)
             {   value = ligne[1];
             for (i = (nm + 2); i < nblignes; i++)
                 {value = value + "$" + ligne[i];}
             }        
     }
 
 if (nm > 0)
     {   value = ligne[0];

     if (nblignes > 1)
             {
             //alert ("deb nb > 1");
             for (j=1; j < nm; j++)
                 {
                     value = value + "$" + ligne[j];
                     //alert("prem partie : j =  "+ j);
                     //alert("nblignes " + nblignes);    
             //alert(nm + 1);    
             }
             for (k=nm+1; k<nblignes; k++)
                 {
                     value = value + "$" + ligne[k];
                     //alert("2 partie : k =  "+ k);
                 }
             }
         }
 if (value != null) SetCookie(gsFName,value,expdate, "/");
 
// alert();
 
EcrirePage();
}


//OF
//Téléchargements
function godl()
{
    NaVs();
    var str_href = Access.location.href.toLowerCase();
 
    if (str_href.search("kernel") > 0)
    {
        window.open('downloads.asp?id=' + id + '&id_lang=' + id_lang, '', 'scrollbars=yes, width=510, height=400');
    }
    else
    {
        window.open('templates/downloads.htm', '', 'scrollbars=yes, width=510, height=400');
    }
}


//OF
//Gestion postit
var boo_clicencours = false;
var int_origine_x = 0;
var int_origine_y = 0;
var int_position_x = 0;
var int_position_y = 0;
var int_x = 0;
var int_y = 0;
var boo_netscape = false;
var int_max_char = 23;
var int_max_ligne = 10;

if (navigator.appName.substring(0,8) == "Netscape")
{
    boo_netscape = true;
}

//OF
//Mouse down
function boutonPresse()
{
    int_origine_x = int_x - int_position_x;
    int_origine_y = int_y - int_position_y;
    boo_clicencours = true;
}

//OF
//Mouse up
function boutonRelache()
{
    boo_clicencours = false;
    
    //Reset opacité
    parent.document.getElementById("post-it").style.opacity = 1;
    parent.document.getElementById("post-it").style.MozOpacity = 1;
    parent.document.getElementById("post-it").style.KhtmlOpacity = 1;
    parent.document.getElementById("post-it").style.filter = 'alpha(opacity=100)';
}

//OF
//Mouse move
function deplacementSouris(e)
{
    int_x = (boo_netscape) ? e.screenX : event.screenX; + parent.document.body.scrollLeft;
    int_y = (boo_netscape) ? e.screenY : event.screenY; + parent.document.body.scrollTop;

    if (boo_clicencours && parent.document.getElementById)
    {
        int_position_x = int_x - int_origine_x;
        int_position_y = int_y - int_origine_y;
        parent.document.getElementById("post-it").style.left = int_position_x;
        parent.document.getElementById("post-it").style.top = int_position_y;
    
        //Réduction opacité
        parent.document.getElementById("post-it").style.opacity = 0.8;
        parent.document.getElementById("post-it").style.MozOpacity = 0.8;
        parent.document.getElementById("post-it").style.KhtmlOpacity = 0.8;
        parent.document.getElementById("post-it").style.filter = 'alpha(opacity=80)';
    }
}

//OF
if (boo_netscape)
{
    document.captureEvents(Event.MOUSEMOVE);
}

document.onmousemove = deplacementSouris;

//OF
//Assigne post-it
function assign_postit()
{
    if (isIE)
    {
        document.getElementById('haut').style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'post-it/ombre_haut.png\', sizingMethod=\'scale\')';
        document.getElementById('gauche').style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'post-it/ombre_gauche.png\', sizingMethod=\'scale\')';
        document.getElementById('gauche_2').style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'post-it/ombre_gauche_2.png\', sizingMethod=\'scale\')';
        document.getElementById('droite').style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'post-it/ombre_droite.png\', sizingMethod=\'scale\')';
        document.getElementById('droite_2').style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'post-it/ombre_droite_2.png\', sizingMethod=\'scale\')';
        document.getElementById('bas').style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'post-it/ombre_bas.png\', sizingMethod=\'scale\')';
        document.getElementById('bas_2').style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'post-it/ombre_bas_2.png\', sizingMethod=\'scale\')';
    }
    else
    {
        document.getElementById('haut').style.backgroundImage = 'url(post-it/ombre_haut.png)';
        document.getElementById('haut').style.backgroundRepeat = 'no-repeat';
        document.getElementById('haut').style.backgroundPosition = 'bottom';
        document.getElementById('gauche').style.backgroundImage = 'url(post-it/ombre_gauche.png)';
        document.getElementById('gauche').style.backgroundRepeat = 'no-repeat';
        document.getElementById('gauche_2').style.backgroundImage = 'url(post-it/ombre_gauche_2.png)';
        document.getElementById('gauche_2').style.backgroundRepeat = 'no-repeat';
        document.getElementById('droite').style.backgroundImage = 'url(post-it/ombre_droite.png)';
        document.getElementById('droite').style.backgroundRepeat = 'no-repeat';
        document.getElementById('droite_2').style.backgroundImage = 'url(post-it/ombre_droite_2.png)';
        document.getElementById('droite_2').style.backgroundRepeat = 'no-repeat';
        document.getElementById('bas').style.backgroundImage = 'url(post-it/ombre_bas.png)';
        document.getElementById('bas').style.backgroundRepeat = 'no-repeat';
        document.getElementById('bas_2').style.backgroundImage = 'url(post-it/ombre_bas_2.png)';
        document.getElementById('bas_2').style.backgroundRepeat = 'no-repeat';
    }
}

//OF
//Calcul du nombre de lignes
function get_nb_lignes(obj_field, int_maxchar)
{
    var int_char = 0;
    var int_lignes = 1;
    
    for (var int_cnt = 0; int_cnt < obj_field.value.length - 1; int_cnt++)
    {
        if (obj_field.value.charAt(int_cnt) != '\n')
        {
            int_char++;
        }
        else
        {
            int_char = int_lignes * int_maxchar;
        }
        int_lignes = Math.floor(int_char / int_maxchar) + 1;
    }
    
    return(int_lignes);
}

//OF
//Limitation taille de caractère
function textLimit(obj_field, int_maxligne, int_maxchar)
{
    var int_lignes = get_nb_lignes(obj_field, int_maxchar);

    //Nombre caractères
    if (obj_field.value.replace('\n', '').length >= int_maxligne * int_maxchar)
    {
        obj_field.value = obj_field.value.substring(0, int_maxligne * int_maxchar);
    }

    //Nombre lignes
    while (int_lignes > int_maxligne)
    {
        obj_field.value = obj_field.value.substring(0, obj_field.value.length - 1);
        int_lignes = get_nb_lignes(obj_field, int_maxchar);
    }
        
    //Access4.getElementById('div_reduire').innerHTML = obj_field.value.length;
}

//OF
//Réduction/agrandissement
function resize()
{
    var obj_note = document.getElementById('note');
    var obj_postit = parent.document.getElementById('ifra_postit');

    //Réduction
    if (obj_postit.offsetHeight > 91)
    {
        obj_note.style.display = 'none';

        NaVs();
        Access4.getElementById('img_agrandir').style.display = 'block';
        Access4.getElementById('img_reduire').style.display = 'none';
        Access4.getElementById('div_reduire').style.zIndex = 0;
        Access4.getElementById('div_agrandir').style.zIndex = 1;
        
        Access4.getElementById('centre').style.height = 50;
        Access4.getElementById('gauche').style.display = 'none';
        Access4.getElementById('droite').style.display = 'none';
        Access4.getElementById('gauche_2').style.display = 'block';
        Access4.getElementById('droite_2').style.display = 'block';
        Access4.getElementById('bas_2').style.display = 'block';
        
        obj_postit.style.height = 91;
    }
    //Agrandissement
    else
    {
        NaVs();
        
        Access4.getElementById('img_reduire').style.display = 'block';
        Access4.getElementById('img_agrandir').style.display = 'none';
        Access4.getElementById('div_agrandir').style.zIndex = 0;
        Access4.getElementById('div_reduire').style.zIndex = 1;
        
        Access4.getElementById('centre').style.height = 290;
        Access4.getElementById('bas_2').style.display = 'none';
        Access4.getElementById('gauche_2').style.display = 'none';
        Access4.getElementById('droite_2').style.display = 'none';
        Access4.getElementById('gauche').style.display = 'block';
        Access4.getElementById('droite').style.display = 'block';
        
        obj_postit.style.height = 330;
        obj_note.style.display = 'block';
        obj_note.focus();
    }            
}

//OF
//Fonction qui change le contenu d'une div
function change_content(var_id, str_html)
{
    if (top.window.document.getElementById(var_id) != null)
    {
        top.window.document.getElementById(var_id).innerHTML = str_html;
    }
}

//OF
//Fonction permettant de connaître la position d'un objet
//par rapport au bord gauche de la page.
//Cet objet peut être à l'intérieur d'un autre objet.
function getLeft(MyObject)
{
    if (MyObject.offsetParent)
    {
        return(MyObject.offsetLeft + getLeft(MyObject.offsetParent));
    }
    else 
    {
        return(MyObject.offsetLeft);
    }
}

//OF
//Fonction permettant de connaître la position d'un objet
//par rapport au bord haut de la page.
//Cet objet peut être à l'intérieur d'un autre objet.
function getTop(MyObject)
{
    if (MyObject.offsetParent)
    {
        return(MyObject.offsetTop + getTop(MyObject.offsetParent));
    }
    else
    {
        return (MyObject.offsetTop);
    }
}

//OF
//Gestion marque-pages
function gomarquepages(int_offset)
{
    var int_nb_pages = Catan.length;
    var str_marque_pages = '';
    var obj_coin;
    var obj_page;
    var int_coin_index;
    var int_curseur;
    var int_page;
    var int_cata;
    var int_page_pos;
    var str_contenu;
    var str_pos;
    
    if (int_offset == null)
    {
        int_offset = 0;
    }

    //Position    
    NaVs();
    int_curseur = top.window.document.getElementById('curseur').value;
    int_cata = GetCookie("cata");
    
    if ((int_cata == 1) || (int_cata == null))
    {
        int_coin_index = 0;
    }
    else if (int_cata == 2)
    {
        int_page = parseInt((int_curseur * 2) - 1);

        if (int_page == -1)
        {
            int_page = 0;
        }

        if ((int_page == 0) || (int_nb_pages % 2 == 0 && int_page == int_nb_pages - 1) || !Cata[Catan[int_page]])
        {
            int_coin_index = 0;
        }
        else
        {
            if (Cata[Catan[int_page]][2].indexOf(',') == -1)
            {
                int_coin_index = 0;
            }
            else
            {
                int_coin_index = 1;
            }
        }
    }

    obj_coin = Access2.getElementById('cd_' + int_coin_index);
    obj_page = top.window.document.getElementById('ifra_viewver');
    obj_div_thumb = Access.getElementById('thumbnail');
    obj_ifra_thumb = top.window.document.getElementById('ifra_thumbnail');
    
    if (top.window.document.getElementById('marque_pages') != null)
    {
        top.window.document.getElementById('marque_pages').style.left = getLeft(obj_coin) + obj_coin.width + int_offset + getLeft(obj_page);
        top.window.document.getElementById('marque_pages').style.top = getTop(obj_page);
    }
       
    //Contenu
    for (var int_cnt_page = 0; int_cnt_page < int_nb_pages; int_cnt_page++)
    {
        if ((GetCookie('n_' + int_cnt_page) != null) && (GetCookie('n_' + int_cnt_page) != ''))
        {
            str_marque_pages = str_marque_pages + '<div style="border-width:0px; border-color:#000000; border-style:solid; cursor:pointer; width:36px; height:27px; text-align:center; font-family:Lucida Console; color:#494949; font-size:11px; padding-top:5px; ';
            if (isIE)
            {
                str_marque_pages = str_marque_pages + 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'templates/post-it/fond_post-it_mini.png\', sizingMethod=\'scale\');" ';
            }
            else
            {
                str_marque_pages = str_marque_pages + 'background-image:url(templates/post-it/fond_post-it_mini.png); background-repeat:no-repeat;" ';
            }
            
            if (int_cata == 2)
            {
                str_pos = Cata[Catan[int_cnt_page]][2].split(',')[1 - int_cnt_page % 2];
            }
            else
            {
                str_pos = Cata[int_cnt_page][2];
            }
            
            int_page_pos = str_pos.toLowerCase().indexOf(str_libelle_page.toLowerCase() + ' ', 0);
            if (int_page_pos > -1)
            {
                str_contenu = str_pos.substring(int_page_pos + str_libelle_page.length + 1) + '&nbsp;';
            }
            else
            {
                str_contenu = '<img src="pixel.gif" width="100%" height="100%" alt="' + str_pos + '"/>';
            }
            
            //str_marque_pages = str_marque_pages + 'onclick="if (GetCookie(\'cata\') == 2) {gopgdbl(); gopostit();} goPage(Catan[' + int_cnt_page + ']);">' + str_contenu + '</div>';
            //str_marque_pages = str_marque_pages + 'onclick="if (GetCookie(\'cata\') == 2) {gopgdbl(); gopostit();} goPage(' + int_cnt_page + ');">' + str_contenu + '</div>';
            str_marque_pages = str_marque_pages + 'onclick="if (GetCookie(\'cata\') == 2) {gopgdbl();} gopostit1(); goPage(' + int_cnt_page + ');">' + str_contenu + '</div>';
        }
    }
    change_content('marque_pages', str_marque_pages);
}


//OF
//Click bouton postit
function gopostit()
{
    showpostit();
    f_gopostit();
}


//OF
//Montre et va au post-it tout le temps
function gopostit1()
{
    showpostit1();
    f_gopostit();
}


//OF
//Affichage du post-it
function showpostit()
{
    NaVs();
    
    //Montrer
    if (Access.getElementById('post-it').style.display == 'none')
    {
        Access.getElementById('post-it').style.display = 'block';
        Access.getElementById('post-it').focus();
        if (Access4.getElementById('note').style.display != 'none')
        {
            Access4.getElementById('note').focus();
        }
    }
    //Cacher
    else
    {
        Access.getElementById('post-it').style.display = 'none';
        window.focus();
    }
}


//OF
//Montre post-it tout le temps
function showpostit1()
{
    NaVs();
    
    //Montrer
    if (Access.getElementById('post-it').style.display == 'none')
    {
        Access.getElementById('post-it').style.display = 'block';
        Access.getElementById('post-it').focus();
        if (Access4.getElementById('note').style.display != 'none')
        {
            Access4.getElementById('note').focus();
        }
    }
}


//OF
//Chargement du contenu des postit
function f_gopostit()
{
    var int_curseur = top.window.document.getElementById('curseur').value;
    var int_page;
    var str_note = null;
    
    if (GetCookie('cata') == 2)
    {
        int_page = parseInt((int_curseur * 2) - 1);
        //Désactiver post-it
        if (Access.getElementById('postit_0') != null)
        {
            Access.getElementById('postit_0').style.display = 'none';
        }
    }
    else
    {
        int_page = int_curseur;
        //Activer post-it
        if (Access.getElementById('postit_0') != null)
        {
            Access.getElementById('postit_0').style.display = 'block';
        }
    }
    
    if (int_page == -1)
    {
        int_page = 0;
    }

    str_note = GetCookie('n_' + int_page);
    NaVs();
    if (str_note != null)
    {
        if (Access4 != null)
        {
            if (Access4.getElementById('note') != null)
            {
                Access4.getElementById('note').value = str_note;
            }
        }
    }
    else
    {
        if (Access4 != null)
        {
            if (Access4.getElementById('note') != null)
            {
                Access4.getElementById('note').value = '';
            }
        }
    }
}

//OF
//Enregistre le contenu du postit dans le cookie
function savepostit()
{
    var int_curseur = top.window.document.getElementById('curseur').value;
    var int_page;
    var str_note = document.getElementById('note').value;
    var int_offset;
    
    if (GetCookie("cata") == 2)
    {
        int_page = parseInt((int_curseur * 2) - 1);
    }
    else
    {
        int_page = int_curseur;
    }
    
    if (int_page == -1)
    {
        int_page = 0;
    }
    SetCookie('n_' + int_page, str_note);
    
    if (Access.getElementById('thumbnail').style.display == 'block')
    {
        NaVs();
        if (Access3.location.href.search("thumbnail.htm") != -1)
        {
            int_offset = 152;
        }
        else if (Access3.location.href.search("panier.htm") != -1)
        {
            int_offset = 280;
        }
        Access3.location.reload();
    }
    else
    {
        int_offset = 0;
    }
    goPage(int_page);
    gomarquepages(int_offset);
}

//OF
//Variables cata
var boo_cata_switched = false;
var int_cnt_cata_switched = 0;

//OF
//Fonctions de switch page simple/double
function gopgdbl()
{
    var int_page;
    var int_curseur;
    
    NaVs();
    var str_href = Access.location.href.toLowerCase();
 
    //Ne peut pas fonctionner dans l'outil à cause des cookies
    if (str_href.search("kernel") > 0)
    {
        alert('Cette fonction fonctionne dans le livrable uniquement');
        return false;
    }
        
    int_curseur = eval(top.window.document.getElementById('curseur').value);
    int_cnt_cata_switched++;
    
    //Simple -> double
    if (GetCookie("cata") == 1)
    {
        SetCookie("cata", 2);
        int_page = parseInt((int_curseur + 1) / 2);
        
        //Image
        if (Access.getElementById('pgdbl_0') != null)
        {
            Access.getElementById('pgdbl_0').innerHTML = '<a href="#" onclick="gopgdbl();"><img src="' + gpgdblImg[0] + '" border="0"></a>';
        }
        
        //Désactiver post-it
        Access.getElementById('postit_0').style.display = 'none';
        Access.getElementById('post-it').style.display = 'none';
        window.focus()
    }
    
    //Double -> simple
    else if ((GetCookie("cata") == 2) || (GetCookie("cata") == null))
    {
        SetCookie("cata", 1);
        int_page = parseInt((int_curseur * 2) - 1);
        
        //Image
        if (Access.getElementById('pgdbl_0') != null)
        {
            Access.getElementById('pgdbl_0').innerHTML = '<a href="#" onclick="gopgdbl();"><img src="' + gpgdblImg[1] + '" border="0"></a>';
        }
        
        //Cas de la première page
        if (int_page == -1)
        {
            int_page = 0;
        }
        
        //Activer post-it
        Access.getElementById('postit_0').style.display = 'block';
    }
    boo_cata_switched = false;
    goPage(int_page);
    boo_cata_switched = true;
    
    if (Access.getElementById('thumbnail').style.display == 'block')
    {
        Access3.location.reload();
    }
}


function goPage(i)
{   
    //OF
    //Gestion changement de page après switch
    var boo_inc = false;

    if (i == '#')
    {
        i = 0;
    }
    
    if (boo_cata_switched == true)
    {
        //Double -> simple
        if (GetCookie("cata") == 1)
        {
            if (int_cnt_cata_switched % 2 == 1)
            {
                boo_inc = (i % 2 == 0) && (Catan[i] % 2 == 0);
                i = parseInt((eval(i) * 2) - 1);
                
                if ((int_cnt_cata_switched >= 1) && (boo_inc == true))
                {
                    i++;
                }
                
                //Cas de la première page
                if (i == -1)
                {
                    i = 0;
                }
            }
        }
        //Simple -> double
        else if ((GetCookie("cata") == 2) || (GetCookie("cata") == null))
        {
            if (int_cnt_cata_switched % 2 == 1)
            {
                i = parseInt((eval(i) + 1) / 2);
            }
        }
    }
    
    
    NaVs();
    switch (ThumbMod)
    {
    case 'ifr':
        top.window.document.getElementById('curseur').value = i;
        break;
    case 'pop':
        window.opener.window.top.window.document.getElementById('curseur').value = i;
        break;
    }
    top.window.document.getElementById('evenement').value = "goPage";

    if (document.location.href.search("index") > 0)
    {
        var rel = "./templates/";
    }
    else
    {
        var rel = "./";
    }

    var str_href = Access.location.href.toLowerCase();
    if (str_href.search("kernel") > 0)
    {
        Access2.location.href = 'transition.asp?id=' + id + '&id_lang=' + id_lang;
    }
    else
    {
        Access2.location.href = rel + 'transition.htm';
    }
    
    //OF
    //Reload post-it
    f_gopostit();
}

function goPage_vroom() {
switch (ThumbMod)
{
  case 'ifr':
	iImg();
    break;
  case 'pop':
	iImg('pop');
    break;
}
}

function F5(fram)
{
    NaVs();  
    var str_href = Access.location.href.toLowerCase();
    if (str_href.search("kernel") > 0)
    {
        Access2.location.href = 'transition.asp?id=' + id + '&id_lang=' + id_lang;
    }
    else
    {
        //if(fram != "1" && isIE){
        if(fram != "1")
        {
            Access2.location.href = './templates/transition.htm';
        }
        else
        {
            Access2.location.href = 'transition.htm';
        }
    }
}

function gorew() {
top.window.document.getElementById('evenement').value = "gorew";
F5();
}

function gorew_vroom() {
	top.window.document.getElementById('curseur').value = 0;
	iImg();
}

function gofwd() {
top.window.document.getElementById('evenement').value = "gofwd";
F5();
}

function gofwd_vroom() {
	top.window.document.getElementById('curseur').value = Cata.length-1;
	iImg();
}

function gonext(fram) {
NaVs();
top.window.document.getElementById('evenement').value = "gonext";
F5(fram);
}

function gonext_vroom() {
	top.window.document.getElementById('curseur').value = eval(top.window.document.getElementById('curseur').value)+1;
	iImg();
}

function goprev(fram) {
NaVs();
top.window.document.getElementById('evenement').value = "goprev";
F5(fram);
}

function goprev_vroom() {
	top.window.document.getElementById('curseur').value = eval(top.window.document.getElementById('curseur').value)-1;
	iImg();
}

function goret() {
NaVs();
top.window.document.getElementById('evenement').value = "goret";
F5();
}

function goret_vroom() {
	gnCurrHstPos = eval(top.window.document.getElementById('gnCurrHstPos').value);
	gnHstList = top.window.document.getElementById('gnHstList').value;
var malist;
malist = gnHstList.split(",");
	gnCurrHstPos = gnCurrHstPos - 1;
	top.window.document.getElementById('curseur').value = malist[gnCurrHstPos];
	top.window.document.getElementById('gnCurrHstPos').value = gnCurrHstPos;
	iImg("",1);
}

function goava() {
NaVs();
top.window.document.getElementById('evenement').value = "goava";
F5();
}

function goava_vroom() {
	gnCurrHstPos = eval(top.window.document.getElementById('gnCurrHstPos').value);
	gnHstList = top.window.document.getElementById('gnHstList').value;
var malist;
malist = gnHstList.split(",");
	gnCurrHstPos = gnCurrHstPos + 1;
	top.window.document.getElementById('curseur').value = malist[gnCurrHstPos];
	top.window.document.getElementById('gnCurrHstPos').value = gnCurrHstPos;
	iImg("",1);
}

function Iota(){
if (top.window.document.getElementById('evenement').value){
var IO = top.window.document.getElementById('evenement').value+'_vroom'

eval(IO)();

}

top.window.document.getElementById('evenement').value = "";

}

function switchB(){
switch (curseur)
	{
	  case 0:
if (Access.getElementById('rew_0') != null){Access.getElementById('rew_0').innerHTML = "<img src='"+grewImg[1]+"' border='0'>";}
if (Access.getElementById('prev_0') != null){Access.getElementById('prev_0').innerHTML = "<img src='"+gprevImg[1]+"' border='0'>";}
if (Access.getElementById('fwd_0') != null){Access.getElementById('fwd_0').innerHTML = "<a href='#' onClick='JavaScript:gofwd(); return false'><img src='"+gfwdImg[0]+"' border='0' alt=\""+gfwdImg[2]+"\"></a>";}
if (Access.getElementById('next_0') != null){Access.getElementById('next_0').innerHTML = "<a href='#' onClick='JavaScript:gonext(); return false'><img src='"+gnextImg[0]+"' border='0' alt=\""+gnextImg[2]+"\"></a>";}
	    break;
//gNextImg gFwdImg
	  case Cata.length-1:
if (Access.getElementById('rew_0') != null){Access.getElementById('rew_0').innerHTML = "<a href='#' onClick='JavaScript:gorew(); return false'><img src='"+grewImg[0]+"' border='0' alt=\""+grewImg[2]+"\"></a>";}
if (Access.getElementById('prev_0') != null){Access.getElementById('prev_0').innerHTML = "<a href='#' onClick='JavaScript:goprev(); return false'><img src='"+gprevImg[0]+"' border='0' alt=\""+gprevImg[2]+"\"></a>";}
if (Access.getElementById('fwd_0') != null){Access.getElementById('fwd_0').innerHTML = "<img src='"+gfwdImg[1]+"' border='0'>";}
if (Access.getElementById('next_0') != null){Access.getElementById('next_0').innerHTML = "<img src='"+gnextImg[1]+"' border='0'>";}
	    break;

	  default:
if (Access.getElementById('rew_0') != null){Access.getElementById('rew_0').innerHTML = "<a href='#' onClick='JavaScript:gorew(); return false'><img src='"+grewImg[0]+"' border='0' alt=\""+grewImg[2]+"\"></a>";}
if (Access.getElementById('prev_0') != null){Access.getElementById('prev_0').innerHTML = "<a href='#' onClick='JavaScript:goprev(); return false'><img src='"+gprevImg[0]+"' border='0' alt=\""+gprevImg[2]+"\"></a>";}
if (Access.getElementById('fwd_0') != null){Access.getElementById('fwd_0').innerHTML = "<a href='#' onClick='JavaScript:gofwd(); return false'><img src='"+gfwdImg[0]+"' border='0' alt=\""+gfwdImg[2]+"\"></a>";}
if (Access.getElementById('next_0') != null){Access.getElementById('next_0').innerHTML = "<a href='#' onClick='JavaScript:gonext(); return false'><img src='"+gnextImg[0]+"' border='0' alt=\""+gnextImg[2]+"\"></a>";}
	   break;
	}

if (Access.getElementById('ret_0') != null){
Access.getElementById('ret_0').innerHTML = "<img src='"+gretImg[1]+"' border='0'>";
if (gnCurrHstPos > 1){Access.getElementById('ret_0').innerHTML = "<a href='#' onClick='JavaScript:goret(); return false'><img src='"+gretImg[0]+"' border='0' alt=\""+gretImg[2]+"\"></a>";}
}

malist = gnHstList.split(",");
if (Access.getElementById('ava_0') != null){
Access.getElementById('ava_0').innerHTML = "<img src='"+gavaImg[1]+"' border='0'>";
if (eval(gnCurrHstPos+1) < malist.length){Access.getElementById('ava_0').innerHTML = "<a href='#' onClick='JavaScript:goava(); return false'><img src='"+gavaImg[0]+"' border='0' alt=\""+gavaImg[2]+"\"></a>";}
}

var multxl = Cata[curseur][5].split(",");
var tst = 0;
for(var i = 0;i < multxl.length; i++){if(multxl[i] != ""){tst = tst+1;}}
if (Access.getElementById('xls_0') != null){
if(tst > 0){
Access.getElementById('xls_0').innerHTML = "<a href='#' onClick='JavaScript:goxls(); return false'><img src='"+gxlsImg[0]+"' border='0' alt=\""+gxlsImg[2]+"\"></a>";
}else{
Access.getElementById('xls_0').innerHTML = "<img src='"+gxlsImg[1]+"' border='0'>";
}}

var multdc = Cata[curseur][6].split(",");
var tst = 0;
for(var i = 0;i < multdc.length; i++){if(multdc[i] != ""){tst = tst+1;}}
if (Access.getElementById('doc_0') != null){
if(tst > 0){
Access.getElementById('doc_0').innerHTML = "<a href='#' onClick='JavaScript:godoc(); return false'><img src='"+gdocImg[0]+"' border='0' alt=\""+gdocImg[2]+"\"></a>";
}else{
Access.getElementById('doc_0').innerHTML = "<img src='"+gdocImg[1]+"' border='0'>";
}}

}

function pgcombo() {
NaVs();
p = new Option();
p.text = new String(MSGgopg);
p.value = "#";

Access.getElementById('dropdown1').options[0] = p;

var asc = 1;
	for(var i = 0;i < Cata.length; i++)
	{
var multlk = Cata[i][2].split(",");
for(var j = 0;j < multlk.length; j++)
	{
//document.writeln('<OPTION VALUE="'+i+'">' + multlk[j] + '</option>');

p = new Option();
p.text = new String(multlk[j].replace(/&#44;/g,','));
p.value = i;
Access.getElementById('dropdown1').options[asc] = p;
asc = asc+1;
	}
	}
}

function NavRef(pg)
{
    i = 0;
    while (Catan[i] != pg)
    {
        i++;
    }
    return i;
}

function iImg(k,nomove,relod)
{
    //this.options[this.selectedIndex].value
	if (k == 'pop')
	{
	    NaVs('pop');
	    curseur = eval(top.window.opener.top.window.document.getElementById('curseur').value);
	    NavRef();
	    Access.getElementById('dropdown1').selectedIndex = eval(NavRef(curseur)+1);

        if (relod != 1)
        {
	        gnCurrHstPos = eval(top.window.opener.top.window.document.getElementById('gnCurrHstPos').value);
	        gnHstList = top.window.opener.top.window.document.getElementById('gnHstList').value;
        }
	}
    else
    {
	    NaVs();
	    curseur = eval(top.window.document.getElementById('curseur').value);

	    if (Access.getElementById('dropdown1'))
	    {
	        if (Catan.length == 0) //OF : NavRef boucle infinie si Catalogue vide => exit
	        {
	            return false;
	        }
    	    Access.getElementById('dropdown1').selectedIndex = eval(NavRef(curseur) + 1);
        }

        if (relod != 1)
        {
	        gnCurrHstPos = eval(top.window.document.getElementById('gnCurrHstPos').value);
	        gnHstList = top.window.document.getElementById('gnHstList').value;
        }
    }

    if (relod != 1)
    {
	    if (nomove != 1)
	    {	
            gnCurrHstPos = gnCurrHstPos + 1;
        }

	    if (nomove != 1)
	    {      	
            var malist;
            malist = gnHstList.split(",");
            var i = 0;
            gnHstList = "";
            while (i < gnCurrHstPos)
            {
	            if (malist[i])
	            {
	                gnHstList  = gnHstList + "," + malist[i];
	            }
	            i = i + 1;
            }
            gnHstList = gnHstList + "," + curseur;
	    }

	    if (k == 'pop')
	    {
	        top.window.opener.top.window.document.getElementById('gnCurrHstPos').value = gnCurrHstPos;
	        if (nomove != 1)
	        {
	            top.window.opener.top.window.document.getElementById('gnHstList').value = gnHstList;
	        }
	    }
	    else
	    {
	        top.window.document.getElementById('gnCurrHstPos').value = gnCurrHstPos;
	        if (nomove != 1)
	        {
	            top.window.document.getElementById('gnHstList').value = gnHstList;
	        }
	    }
        switchB();
    }

    var multpg = Cata[curseur][0].split(",");
    var multla = Cata[curseur][7].split(",");
    var multha = Cata[curseur][8].split(",");
    var vrac;
    var la;
    var ha;
    var swf;
    vrac = '<table cellspacing="0" cellpadding="0" width="1" border="0"><tr>';

    for (var i = 0; i < multpg.length; i++)
	{
        vrac = vrac + '<td width="1" nowrap>';
        vrac = vrac + Struct(i);
        //if(multpg[i].search("swf") > 0){
        //swf = 1;
        //var boo_show = true;
        //if(multla[i] != "") {
    	    //la = eval(multla[i]);
	        //boo_show = false;
        //} else la = eval(gsFL);
        //if(multha[i] != "") ha = eval(multha[i]);
        //else ha = eval(gsFH);
        //vrac = vrac+GetFlash(multpg[i],la,ha,k);
        //vrac = vrac+(boo_show?'<img src="pixel.gif" OnLoad=\'RevSiz("' + i + '","' + top.window.document.getElementById('ratio').value + '","' + eval(la*top.window.document.getElementById('ratio').value) + '","' + eval(ha*top.window.document.getElementById('ratio').value) + '");fnLoadCngs(' + i + ');\'>':'');
        if(multpg[i].search("swf") > 0)
        {
            swf = 1;
            if (multla[i] != "")
            {
                la = eval(multla[i]);
            }
            else
            {
                la = eval(gsFL);
            }
            if (multha[i] != "")
            {
                ha = eval(multha[i]);
            }
            else
            {
                ha = eval(gsFH);
            }
            vrac = vrac + GetFlash(multpg[i], la, ha, k);
            vrac = vrac + '<img src="pixel.gif" OnLoad=\'RevSiz("' + i + '","' + top.window.document.getElementById('ratio').value + '","' + eval(la*top.window.document.getElementById('ratio').value) + '","' + eval(ha*top.window.document.getElementById('ratio').value) + '");fnLoadCngs(' + i + ');\'>';
            //	RevSiz(multpg[i],top.window.document.getElementById('ratio').value,la,ha);
            //fnLoadPngs(Access2.getElementById('cg_'+i));
            //fnLoadPngs(Access2.getElementById('cd_'+i));
        }
        else
        {
            vrac = vrac+'<img src="' + multpg[i] + '" id="pg_' + i + '" OnLoad=\'SuperSizeMe(' + i + ',"' + k + '");\'>';
        }

        //vrac = vrac+'<map name="Map">';
        //vrac = vrac+'  <area shape="rect"  coords="5,8,332,226" href="#" alt="sqdsq">';
        //vrac = vrac+'</map>';
        vrac = vrac+'</td>';
	}
	
    vrac = vrac+'</tr></table>';	
    vrac = vrac+'<span id="map"></span>';

    if (swf == 1)
    {
        vrac = vrac + '<span id="swf"></span>';
    }
    //	alert(vrac);
    // OnLoad="SuperSizeMe('+k+');"
    //    NumPg();
    //Access2.getElementById('basket').style.display = "none";

    Access2.getElementById('code').innerHTML = '';
    var str_href = Access.location.href.toLowerCase();
    if (str_href.search("kernel") > 0)
    {
	    inc("../Exploit/" + gsFName + "/html/" + lib_lang + "/" + curseur + ".js");
    }
    else
    {
	    inc("../html/" + curseur + ".js");
    }

    Access2.getElementById('image').style.display = "block";
    Access2.getElementById('image').innerHTML = vrac;
    
    //OF
    //Reload postit
    f_gopostit();
}


function Struct(i)
{
struct = '';
struct = struct+'<div style="position:absolute; z-index:11">';
struct = struct+'<table id="cdp_'+i+'" border="0" cellspacing="0" cellpadding="0">';
struct = struct+'<tr><td id="cell_'+i+'" colspan="2">&nbsp;</td></tr>';
struct = struct+'<tr>';
struct = struct+'<td align="left" valign="bottom"><img border="0" src="cg2.png" id="cg_'+i+'" style="visibility:hidden;"></td>';
struct = struct+'<td align="right" valign="bottom"><img border="0" src="cd2.png" id="cd_'+i+'" style="visibility:hidden;"></td>';
struct = struct+'</tr>';
struct = struct+'</table></div>';

struct = struct+'<div style="position:absolute; z-index:12"> <img border="0" src="pixel.gif" usemap="#Map" id="ray_'+i+'"></div>';

return struct;
}

/* jsHandler.js */
function inc(filename)
{
var body = Access2.getElementsByTagName('body').item(0);
script = Access2.createElement('script');
script.src = filename;
script.type = 'text/javascript';
body.appendChild(script)
}

function SuperSizeMe(itm,k) {
	if(k == 'pop'){
	top.window.opener.top.window.document.getElementById('hauteur').value = Access2.getElementById('pg_'+itm).height;
	Access2.getElementById('pg_'+itm).height = window.opener.top.window.document.getElementById('hauteur').value*window.opener.top.window.document.getElementById('ratio').value;
	RevSiz(itm,window.opener.top.window.document.getElementById('ratio').value,Access2.getElementById('pg_'+itm).width,Access2.getElementById('pg_'+itm).height);
	fnLoadCngs(itm);
	}else{
	top.window.document.getElementById('hauteur').value = Access2.getElementById('pg_'+itm).height;
	Access2.getElementById('pg_'+itm).height = top.window.document.getElementById('hauteur').value*top.window.document.getElementById('ratio').value;
	RevSiz(itm,top.window.document.getElementById('ratio').value,Access2.getElementById('pg_'+itm).width,Access2.getElementById('pg_'+itm).height);
	fnLoadCngs(itm);
}


}

function RevSiz(itm,ratio,l,h) {

	Access2.getElementById('cg_'+itm).height = 58*ratio;
	Access2.getElementById('cg_'+itm).width = 58*ratio;
	Access2.getElementById('cg_'+itm).style.width = eval(58*ratio) + "px";
	Access2.getElementById('cg_'+itm).style.height = eval(58*ratio) + "px";
	
	Access2.getElementById('cd_'+itm).height = 58*ratio;
	Access2.getElementById('cd_'+itm).width = 58*ratio;
	Access2.getElementById('cd_'+itm).style.width = eval(58*ratio) + "px";
	Access2.getElementById('cd_'+itm).style.height = eval(58*ratio) + "px";


	Access2.getElementById('cell_'+itm).height = eval(h-eval(58*ratio));

	Access2.getElementById('cdp_'+itm).height = h;
	Access2.getElementById('cdp_'+itm).width = l;

	Access2.getElementById('ray_'+itm).height = h;
	Access2.getElementById('ray_'+itm).width = l;

shape= '';
if(MapNav == "Vrai"){
shape = shape+'<map name="Map">';
if(curseur > 0){shape = shape+'  <area alt="'+gprevImg[2]+'" shape="rect" coords="0,0,' + eval(l/2) + ',' + h + '" href="JavaScript:goprev(\'1\');">';}
if(curseur < eval(Cata.length-1)){shape = shape+'  <area alt="'+gnextImg[2]+'" shape="rect" coords="' + eval(l/2) + ',0,' + l + ',' + h + '" href="JavaScript:gonext(\'1\');">';}
shape = shape+'</map>'
}
// onClick='JavaScript:gonext(); return false'><img src='"+gnextImg[0]+"' border='0' alt=\""+gnextImg[2]+"\">

	Access2.getElementById('map').innerHTML = shape;
	
	//OF
    //Activer marque pages
    var int_offset
    if (Access.getElementById('thumbnail').style.display == 'block')
    {
        NaVs();
        if (Access3.location.href.search("thumbnail.htm") != -1)
        {
            int_offset = 152;
        }
        else if (Access3.location.href.search("panier.htm") != -1)
        {
            int_offset = 280;
        }
    }
    else
    {
        int_offset = 0;
    }
    gomarquepages(int_offset);
}

function fnLoadCngs(i) {
if(!Access2.getElementById('cg_'+eval(i-1))){
fnLoadPngs(Access2.getElementById('cg_'+i));
}
if(!Access2.getElementById('cd_'+eval(i+1))){
fnLoadPngs(Access2.getElementById('cd_'+i));
}
}

function fnLoadPngs(img) {
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);

//	for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
//		if (itsAllGood && img.src.match(/\.png$/i) != null) {
		if (itsAllGood) {
			var src = img.src;
			img.style.width = img.width + "px";
			img.style.height = img.height + "px";
			img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')"
			img.src = "pixel.gif";
		}
		//alert(Coin2Pg);
if(Coin2Pg == "Vrai"){
		img.style.visibility = "visible";
	}
}

function GetFlash(fic,lf,hf,k){
var rt;
if(k == 'pop'){
rt = 1;
}else{
rt = eval(top.window.document.getElementById('ratio').value);
}

flash = '';
if(k == 'pop'){

	var isMacIE = false;
	
	if(navigator.appName == "Microsoft Internet Explorer" && navigator.platform == "MacPPC") {
		isMacIE = true;
	}

flash = flash+'<object id="software_object" name="'+fic+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + eval(lf*rt) + '" height="' + eval(hf*rt) + '">';
flash = flash+'<param name="movie" value="'+fic+'" />';
flash = flash+'<param name="quality" value="high" />';
flash = flash+'<param name="menu" value="0" />';
flash = flash+'<param name="bgcolor" value="#FFFFFF" />';
flash = flash+'<param name=FlashVars value="loc=en_US&isMacIE=' + isMacIE + '" />';
flash = flash+'<embed id="solutions_object" name="'+fic+'" type="application/x-shockwave-flash" src="'+fic+'" flashvars="loc=en_US&isMacIE=' + isMacIE + '" quality="high" bgcolor="#FFFFFF" menu="0" width="' + eval(lf*rt) + '" height="' + eval(hf*rt) + '" pluginspage="http://www.macromedia.com/go/getflashplayer_fr">';
flash = flash+'</embed>';
flash = flash+'</object>';
}else{
flash = flash+'<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
flash = flash+'        codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + eval(lf*rt) + '" height="' + eval(hf*rt) + '">';
flash = flash+'  <PARAM NAME="flash_component" value="ImageViewer.swc" />';
flash = flash+'  <PARAM NAME="movie" VALUE="'+fic+'" />';
flash = flash+'  <PARAM NAME="bgcolor" VALUE="#ffffff" />';
flash = flash+'  <PARAM NAME="quality" VALUE="best" />';
flash = flash+'  <PARAM NAME="menu" VALUE="true" />';
flash = flash+'  <PARAM NAME="salign" VALUE="L" />';
flash = flash+'  <PARAM NAME="wmode" VALUE= "Transparent" />';
flash = flash+'  <PARAM NAME="FlashVars" value="flashlet={imageLinkTarget:\'_blank\',captionFont:\'Verdana\',titleFont:\'Verdana\',showControls:true,frameShow:false,slideDelay:5,captionSize:10,captionColor:#333333,titleSize:10,transitionsType:\'Random\',titleColor:#333333,slideAutoPlay:false,imageURLs:[\'img1.jpg\',\'img2.jpg\',\'img3.jpg\'],slideLoop:false,frameThickness:2,imageLinks:[\'http://macromedia.com/\',\'http://macromedia.com/\',\'http://macromedia.com/\'],frameColor:#333333,bgColor:#FFFFFF,imageCaptions:[]}" />';

flash = flash+'  <EMBED src="'+fic+'" ';
flash = flash+'         bgcolor="#ffffff" ';
flash = flash+'         quality="best" ';
flash = flash+'         menu="true" ';
flash = flash+'         salign="L" ';
flash = flash+'         wmode="Transparent" ';
flash = flash+'         flashvars="flashlet={imageLinkTarget:\'_blank\',captionFont:\'Verdana\',titleFont:\'Verdana\',showControls:true,frameShow:false,slideDelay:5,captionSize:10,captionColor:#333333,titleSize:10,transitionsType:\'Random\',titleColor:#333333,slideAutoPlay:false,imageURLs:[\'img1.jpg\',\'img2.jpg\',\'img3.jpg\'],slideLoop:false,frameThickness:2,imageLinks:[\'http://macromedia.com/\',\'http://macromedia.com/\',\'http://macromedia.com/\'],frameColor:#333333,bgColor:#FFFFFF,imageCaptions:[]}" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" ';
flash = flash+'         width="' + eval(lf*rt) + '" height="' + eval(hf*rt) + '" ';
flash = flash+'         swLiveConnect="true" ';
flash = flash+'         TYPE="application/x-shockwave-flash" ';
flash = flash+'         PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">';
flash = flash+'  </EMBED></OBJECT>';
}

  
  //document.writeln(flash);
  return flash;
  //alert(flash);
}

function push2page() {
	//NaVs();
	//alert();
	//setTimeout("alert(Access.page.height)",100);
	//alert(Access.page.height);
}

function gozoomout(){
	top.window.document.getElementById('ratio').value = top.window.document.getElementById('ratio').value/baseZoom;
ImgRatio()
}

function gozoom100(){
	top.window.document.getElementById('ratio').value = baseRatio;
ImgRatio();
}

function gozoomin(){
	top.window.document.getElementById('ratio').value = top.window.document.getElementById('ratio').value*baseZoom;
ImgRatio()
}

function zoomchange(ratio) {
//alert(ratio);
//alert(top.window.document.getElementById('hauteur').value);
NaVs();
	top.window.document.getElementById('ratio').value = ratio;
	Access2.pg_prem.height = top.window.document.getElementById('hauteur').value*top.window.document.getElementById('ratio').value;
}

function ImgRatio() {
NaVs();
var i;
i = 0;
if (Access2.getElementById('swf')){
iImg('','',1);
}else{
while(Access2.getElementById('pg_'+i))
	{
//	alert(top.window.document.getElementById('hauteur').value*top.window.document.getElementById('ratio').value);
	Access2.getElementById('pg_'+i).height = top.window.document.getElementById('hauteur').value*top.window.document.getElementById('ratio').value;
	RevSiz(i,top.window.document.getElementById('ratio').value,Access2.getElementById('pg_'+i).width,Access2.getElementById('pg_'+i).height);
i++;
	}
}
}

function cZoom(led) {
tst = led.split;
cbo = new Array(); 
cbo = led.split(",");

	   document.writeln('<SELECT NAME="valzoom" onChange="zoomchange(this.value); return false">');
	   document.writeln('<OPTION VALUE=1 selected>Zoom</option>');   
	for(var i = 0;i < cbo.length; i++)
	{
	   document.writeln('<OPTION VALUE="' + cbo[i]/100 + '">' + cbo[i] + '%</OPTION>');
	}
	   document.writeln('</SELECT>');
}

function nNsep() {
   document.write('<img src="' + nSepImg + '" border=0  >');
}

function nNrew(alt) {
   document.write('<a href="#" onClick="JavaScript:gorew(); return false"><img src="' + gRewImg[nIconNum] + '" border=0   name="rew" alt="' + alt + '"></a>');
}

function nNprev(alt) {
   document.write('<a href="#" onClick="JavaScript:goprev(); return false"><img src="' + gPrevImg[nIconNum] + '" border=0   name="prev" alt="' + alt + '"></a>');
}

function nNnext(path,alt) {
   document.write('<a href="#" onClick="JavaScript:gonext(); return false"><img src="' + gNextImg[nIconNum] + '" border=0   name="next" alt="' + alt + '"></a>');
}

function nNfwd(alt) {
   document.write('<a href="#" onClick="JavaScript:gofwd(); return false"><img src="' + gFwdImg[nIconNum] + '" border=0   name="fwd" alt="' + alt + '"></a>');
}

function nNvignettes(path,alt) {
  document.write('<a href="#" onClick="JavaScript:govignettes(\'' + ThumbMod + '\'); return false"><img src="' + path + '" name="thu" border=0  alt="' + alt + '"></a>');
}

function nNacrobat(path,alt) {
  document.write('<a href="#" onClick="goacrobat(); return false"><img src="' + path + '" name="pdf" border=0  alt="' + alt + '"></a>');
}

function nNprint(path,alt) {
  document.write('<a href="#" onClick="goprint(); return false"><img src="' + path + '" name="print" border=0  alt="' + alt + '"></a>');  
}

function nNa_basket(path,alt) {
  document.write('<a href="#" onClick="javaScript:goa_basket(); return false;"><img src="' + path + '" name="addPanier" border=0  alt="' + alt + '"></a>');
}

function nNv_basket(path,alt) {
 document.write('<a href="#" onClick="javaScript:gov_basket(); return false;"><img src="' + path + '" name="viewPanier" border=0  alt="' + alt + '"></a>');
}

function search() {
NaVs();
tofind=Access.getElementById("T1").value;
//document.write("<head>")
//document.write("</head>")
//document.write("<body>")

accStr="âêîôûàèiouaéiouâêïöü";
noAcc="aeiouaeiouaeiouaeiou";

lacc=accStr.length-1
lnacc=noAcc.length-1 

 nbPages= rech.length - 1;
 decal=0
 lav=50
 lap=50
 txtC=tofind
 n=1
 nbl=0;
 isTable=0;
 isData=false
 isFound=false

             buffer = "";
             buffer = buffer+"<table width=100%>";

 for (j=1;j<=nbPages;j++) {
 // att : fonction récursive
 //alert("passage en haut");
     n=j;
     spy=false
     srL=rech[j].toLowerCase()
     srlNoAcc=srL

     for (pk=0;pk<=lacc;pk++) {
         zf=pk+1;
         src=new RegExp(accStr.substring(pk,zf),"g")
         rpl = noAcc.substring(pk,zf)
         srlNoAcc=srlNoAcc.replace(src,rpl);
         }

     txtCL=txtC.toLowerCase()
     txtCLnoAcc=txtCL

     for (pk=0;pk<=lacc;pk++) {
         zf=pk+1;
         src=new RegExp(accStr.substring(pk,zf),"g")
         rpl = noAcc.substring(pk,zf)
         txtCLnoAcc=txtCLnoAcc.replace(src,rpl);
         }

     a=srlNoAcc.search(txtCLnoAcc)
     //alert(j+"  "+n+"  "+a);
     if (a>-1) {
         isFound=true
         isTable++;
         if (isTable==1) {
             buffer = buffer+"<table width=100%>";
                         }

         isData=true; // il y a des infos
         ll=txtC.length
         //alert(ll)
         avant=a-lav

         if (avant<0) avant=0;
         apres=a + ll + lap

         if (apres >rech[j].length) apres = rech[j].length;
         part1="<font size=1 face='Arial, Helvetica, Verdana'>"+rech[j].substring(avant,a)
         part2="<b><span style='background-color: #99FF66'>"+rech[j].substring(a,a+ll)+"</span></b>"
         part3=rech[j].substring(a+ll,apres)

         //alert(part3)
         rech[j]=rech[j].substring(a+ll)
         j=n-1
         spy=true;

         }

         if (spy==true) {
             nbl++;
             realPage=(j+1+decal).toString()
//alert(numImg)
	
             if (nbl==1) {

                 buffer = buffer+"<tr>";

var multpg = Cata[Catan[eval(j+1)]][1].split(",");
var multlk = Cata[Catan[eval(j+1)]][2].split(",");
var multid = Cata[Catan[eval(j+1)]][4].split(",");

                 buffer = buffer+"<tr><td><br>";	
//

 buffer = buffer+"<table cellspacing='0' cellpadding='0' width='1' border='0'><tr>";

for(var k = 0;k < multpg.length; k++)
	{
	if(eval(multid[k]) == eval(j+1)){	
 buffer = buffer+"<td align='center'><a href='javascript:goPage(" + Catan[eval(j+1)] + ");'>"+multlk[k]+"</a></td>";
	}
	}

 buffer = buffer+"</tr><tr>";
for(var k = 0;k < multpg.length; k++)
	{
	if(eval(multid[k]) == eval(j+1)){	
 buffer = buffer+"<td align='center'><a href='javascript:goPage(" + Catan[eval(j+1)] + ");'><img src='" + multpg[k] + "' border='0'></a></td>";
	}
	}
 buffer = buffer+"</tr></table>";
 //
                 buffer = buffer+"</td></tr><tr><td>";

                 buffer = buffer+"</tr><tr><td>";	
                 concat= part1 + part2 + part3
                 tablo=concat.split(" ")
                 lt=tablo.length
                 nl="... "

                 if(tablo[0].toLowerCase()==txtCL || tablo[0].toLowerCase()==txtCLnoAcc ) nl=nl+tablo[0];
                 //for (pk=1;pk<(lt-1);pk++) {nl=nl+tablo[pk]+" "}

                 for (pk=0;pk<lt;pk++) {nl=nl+tablo[pk]+" "}
                 buffer = buffer+nl  +"...<br>";
                 }

             if (nbl>1) {
                 concat= part1 + part2 + part3
                 tablo=concat.split(" ")
                 lt=tablo.length
                 nl="... "
                 //if(tablo[0].toLowerCase()==txtCL || tablo[0].toLowerCase()==txtCLnoAcc ) nl=nl+tablo[0];
                 //for (pk=1;pk<(lt-1);pk++) {nl=nl+tablo[pk]+" "}

                 for (pk=0;pk<lt;pk++) {nl=nl+tablo[pk]+" "}
                 buffer = buffer+nl  +"...<br>";
                     }   
                 }

         if(j==n) {
             nbl=0;
             buffer = buffer+"</td></tr>";
             }

     //alert(a)

     }

     if (isFound==false){
     buffer = buffer+"<tr><td><b>"+txtC+" : </b>"+MSGemprech+"</td></tr>";
         }

     if (j>nbPages) buffer = buffer+"<tr><td>&nbsp;</td></tr></table>";

Access3.getElementById('blist').innerHTML = buffer;
 }
