// Fichier Javascript

self.focus();

function getRefToDivMod( divID, oDoc ) { // sous fonction de Ventanita()
  if( !oDoc ) { oDoc = document; }
  if( document.layers ) {
    if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
      for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
        y = getRefToDivMod(divID,oDoc.layers[x].document); }
      return y; } }
  if( document.getElementById ) { return oDoc.getElementById(divID); }
  if( document.all ) { return oDoc.all[divID]; }
  return document[divID];
}

function Ventanita(Largeur,Titre,SousTitre,Contenu) {

// Search Parcourt une chaîne de caractères à l'aide d'une expression régulière. 
// Retourne -1 quand l'expression régulière ne concorde pas. Si elle concorde, la position de la première occurrence est renvoyée.
  var resultat = Contenu.search(/admin.php+/);
  if(resultat != -1)	// ie si Contenu contient "admin.php"
  		{var x = window.open(Contenu,'windowName','width=500,height=250,resizable=1');
		}
  else 	{var x = window.open(Contenu,'windowName','width=500,height=400,resizable=1');
		}
  if (!x.opener) x.opener = self;
  if( !x ) { return true; }
  if(resultat == -1)	// ie si Contenu ne contient pas "admin.php"
	 	{
		Text = '<html><head><title>'+Titre+'<\/title>';
		Text += '<style type="text\/css">' +
					'body {' +
							'font-family: Trebuchet MS, verdana, Arial; ' +
							'font-size: small;' +
							'}' +
					'div.corps_popup	{' +
							'background-color: #DFE7EA;  ' +
							//'width: 500px; ' +
							//'border: 1px solid; ' +
							//'border-color: #6A8599; ' + 
							'margin: 5px; ' +
							'font-size: 12px; ' +
							'padding: 5px; ' +
							'}' +
					'div.corps_texte	{' +
							'margin-left: 40px; ' +
							'padding: 0px; ' +
							'}' +
					'h1.pop2 {' +
							'color: #B1A36C;  ' +
							'font-size: 110%; ' +
							'margin-bottom: 15px; ' +
							'}' +
					'h1.pop1 {' +
							'color: #6A8599;  ' +
							'font-size: 150%; ' +
							'letter-spacing: 6px;' +
							'font-weight: 500; ' +
							'margin-top: 10px; ' +
							'margin-bottom: 15px;' + 
							'}' +
					'div.separation	{' +
							'margin-bottom: 20px; ' +
							'background-color: #ACC5CF;  ' +
							'width: 100%; ' +
							'Height: 2px; ' +
							'}' +
					'#c1 {' +
							'color: #333333;  ' +
							'background-color: #ffffff;  ' +
							'border: 1px solid; ' +
							'border-color: #6A8599; ' + 
							'margin-top: 2px; ' +
							'}' +
					'<\/style>';
		Text += '<\/head><body">';
		Text += '<div style="position:absolute;left:0px;top:0px;display:table;width:'+Largeur+'px;" ' + 'id="myID">'; 
		Text += '<DIV align="center"><DIV class="corps_popup">';
		Text += '<H1 class="pop1" align="center">' + Titre + '<\/H1>';
		Text += '<DIV class="separation""><img src="xmedia/espace.gif" width="60" height="2" alt=""><\/DIV>';
		Text += '<H1 class="pop2" align="left">' + SousTitre + '<\/H1>';
		Text += '<DIV class="corps_texte" align="left">' + Contenu + '<BR><BR><\/div>';
		Text += '<form name="formus"><input type="button" id="c1" style="width:auto;height:auto;font-weight:bold;font-size:105%;" value="Fermer" onClick="self.close()"><\/form>';
		Text += '<\/DIV><\/DIV>' + '<\/div>' + '<\/body><\/html>';
		x.document.open();
		x.document.write(Text);
		x.document.close();
		}
  var Hauteur = getRefToDivMod( 'myID', x.document ); if( !Hauteur ) { return false; }
  var Hauteur = Hauteur.clip ? Hauteur.clip.height : Hauteur.offsetHeight; if( !Hauteur ) { return false; }
  x.resizeTo( Largeur + 200, Hauteur + 200 );
  var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;
  if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }
  else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }
  else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }
  if( window.opera && !document.childNodes ) { myW += 16; }
x.resizeTo( Largeur = Largeur + ( ( Largeur + 200 ) - myW ), Hauteur = Hauteur + ( (Hauteur + 200 ) - myH ) );
  var scW = screen.availWidth ? screen.availWidth : screen.width;
  var scH = screen.availHeight ? screen.availHeight : screen.height;
  x.moveTo(Math.round((scW-Largeur)/2),Math.round((scH-Hauteur)/2));
  if( x.focus ) { x.focus(); }
  return false; 
}

function getPassword(page) {
    WinId = window.open(page,'newwin','width=500,height=300,top=350,left=150');
    if (!WinId.opener) WinId.opener = self;

    Text = '<html><head><title>Mot de passe<\/title>\n';
    Text += '<link rel="stylesheet" type="text/css" href="format.css"><\/head>\n';
    Text += '<body class="infos" onload="self.focus();document.formmdp.motdepasse.focus()">\n';
    Text += 'Choisissez une option : <br><br>\n';
    string = "<?php pxInfo('url'); ?>";
    Text += '<a href="' + string + 'manager/login.php" target="interface"><B>Gerer le contenu du site</B></a>\n';
    Text += '<center><br>Entrez votre mot de passe<br><br>\n';
    Text += '<center><br>Entrez votre mot de passe<br><br>\n';
    Text += '<center><br>Entrez votre mot de passe<br><br>\n';
    Text += '<center><br>Entrez votre mot de passe<br><br>\n';
    Text += '<form name="formmdp"\n';
    Text += 'onSubmit="self.close(); opener.location=\'des_\' + this.motdepasse.value + \'.html\'">\n';
    Text += '<input type="password" name="motdepasse">\n';
    Text += '<input type="submit" value="Acc&egrave;s" onClick=submit>\n';
    Text += '<\/form>\n';
    Text += '<\/center><\/body><\/html>\n';
    //WinId.document.open();
    //WinId.document.write(Text);
    //WinId.document.close();
}


function fenetre(titre,soustitre,texte) 
{
fenetre1=window.open('','fenetre1','width='+530+',height='+350+',top=90,left=0,menubar=no,scrollbars=no,status=no,resizable=1');

if  (texte == 'instructions enregistrement') 
		   {texte = 'Pour enregistrer cette page : <UL><LI>Allez dans le menu de votre navigateur,<\/LI>'
			texte += '<LI>Selectionnez "Fichier / Enregistrer sous ...",<\/LI>'
			texte += '<LI>Assurez vous d`enregistrer la page au format HTML.<\/LI><\/UL>'
			}
    Text = '<html><head><title>' + titre + '<\/title>';
    Text += '<link rel="stylesheet" type="text/css" href="xmedia/theme/style.css"><\/head>';
    Text += '<body onload="self.focus()"><DIV align="center"><DIV class="corps_popup" align="left">';
    Text += '<H1 class="pop1" align="right">' + titre + '<\/H1>';
    Text += '<DIV class="separation"><img src="xmedia/espace.gif" width="60" height="2" alt=""><\/DIV>';
    Text += '<H1 class="pop2" align="left">' + soustitre + '<\/H1>';
    Text += texte;
    Text += '<\/DIV><\/DIV><\/body><\/html>';
    fenetre1.document.open();
    fenetre1.document.write(Text);
    fenetre1.document.close();
}

function hiLite(imgName,imgObjName) // *Magic Buttons*www.pagetutor.com*use this script freely*
{
if (document.images) {document.images[imgName].src = eval(imgObjName + ".src");}
}

function ListeCatSecondaires()       // verifier si cette fonction est utilisee
{
var fraction = location.search.substring(1);
var slash = fraction.indexOf('/');
var cat_courante = fraction.substring(slash+1,slash+6);
alert (cat_courante);

contenu = '<?php pxCategoriesAdultes("<ul>%s</ul>"); ?>';

document.write(contenu);

}

function etal_fenetre(L,H) 
{
var Lf;
var Hf;
window.moveTo (0,0);
if (L=='max') {Lf=screen.availWidth} else {Lf=parseFloat(L)};
if (H=='max') {Hf=screen.availHeight} else {Hf=parseFloat(H)};
window.resizeTo (Lf,Hf);
}


