var error=0;
var adult=LireCookie('adult');
var warn=1;
// alert('adult='+adult);

if (!adult && warn) {
    warning('fr');
}

function woc(store,cat) {
    if(!error) {
        if(store=="se") {
            top.location='/?store=se';
		} else if(store=="ps") {
            var p;
            if(cat!=false) {
                p='http://www.placedusexe.com/Php/partfam.php?part=pa292&fam='+cat;
            } else if(top.ref!=false) {
                p='http://www.placedusexe.com/Php/art.php?num='+cat+'&part=pa292';
            } else {
                p='http://www.placedusexe.com/Php/part.php?part=pa292&lang=FR';
            }
            var wc=window.open(p,'','toolbar=no,location=no,width='+screen.availWidth+',height='+screen.availHeight);
        } else {
            var wc=window.open('http://www.concorde.fr/boutik/index.asp?ID=82720','','toolbar=no,location=no,width='+screen.availWidth+',height='+screen.availHeight);
        }
    }
	return true;
}

function warning(lang) {
  var msg  = new Array;
  msg['fr'] = "ATTENTION : SITE PORNOGRAPHIQUE RESERVE AUX MAJEURS DE PLUS DE 18 ANS\n\n" + 
              "Ce site Internet est réservé à un public majeur et averti et est conforme\n" + 
              "à toutes les règlementations françaises en vigueur. Il contient des textes,\n" + 
              "des photos et des vidéos classées X qui peuvent être choquantes pour\n" + 
              "certaines sensibilités. \n\n" + 
              "CLIQUEZ SUR OK POUR CONTINUER, ANNULER POUR QUITTER.\n\n";
  msg['es'] = "ATENCIÓN : SITIO PORNOGRAFICO RESERVADO PARA MAYORES DE 18 AÑOS\n\n" + 
              "Este sitio internet está reservado a un público mayor y conciente y está en conformidad\n" + 
              "con todas las reglamentaciones francesas en vigor. Contiene textos,\n" + 
              "fotos y videos clasificados X que pueden ser chocantes para\n" + 
              "ciertas sensibilidades. \n\n" + 
              "HAGA CLICK SOBRE OK PARA CONTINUAR,O ANULAR PARA ABANDONAR.\n\n";
  msg['it'] = "ATTENZIONE : SITO PORNOGRAFICO RISERVATO AD UN PUBBLICO MAGGIORENE DI PIU' DI 18 ANNI\n\n" + 
              "Questo sito Internet é riservato ad un pubblico maggiorenne e consenziente ed é conforme\n" + 
              "alla legislazione francese in vigore. Contiene dei testi,\n" + 
              "delle foto e dei videos classificati X che possono urtare certe\n" + 
              "sensibilità ed sopratutto vietato ai minori. \n\n" + 
              "CLICCATE OK PER CONTINUARE, ANNULLA PER USCIRE.\n\n"
  msg['en'] = "WARNING: PORNOGRAPHIC WEBSITE--STRICTLY PROHIBITED TO ANYONE UNDER 18\n\n" + 
              "This site is strictly reserved for a mature and cautioned audience as required\n" + 
              "by current law. This site contains X rated text, photographic and video images\n" + 
              "which might be found offensive.  \n\n" + 
              "CLICK OK TO ENTER, CANCEL TO LEAVE.\n\n"; 
  if (! confirm(msg[lang])) { error = 1;}
  else {
    date=new Date;
    date.setTime(date.getTime()+(1*24*60*60*1000));
	EcrireCookie("adult", "1", date);
	adult=LireCookie("adult");
  }
}

function EcrireCookie(nom, valeur) {
    var argv=EcrireCookie.arguments;
    var argc=EcrireCookie.arguments.length;
    var expires=(argc > 2) ? argv[2] : null;
    var path=(argc > 3) ? argv[3] : null;
    var domain=(argc > 4) ? argv[4] : null;
    var secure=(argc > 5) ? argv[5] : false;
    document.cookie=nom+"="+escape(valeur)+
    ((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
    ((path==null) ? "" : ("; path="+path))+
    ((domain==null) ? "" : ("; domain="+domain))+
    ((secure==true) ? "; secure" : "");
}

function getCookieVal(offset) {
    var endstr=document.cookie.indexOf (";", offset);
    if (endstr==-1) endstr=document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr)); 
}

function LireCookie(nom) {
    var arg=nom+"=";
    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; 
}
