var iDOM = (document.getElementById ? true : false);
var iIE4 = ((document.all && !iDOM) ? true : false);
var iNS4 = (document.layers ? true : false);
var cookieEnabled = (navigator.cookieEnabled) ? true : false;
function getRef(a){
    if (iDOM) {
        return document.getElementById(a)
    }
    if (iIE4) {
        return document.all[a]
    }
    if (iNS4) {
        return document.layers[a]
    }
}

function song(rad){if(getRef("cancion").value!=""){getRef("music").style.height="45px";getRef("music").innerHTML='<object id="NSPlay" width="100%" height="48"  codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-mplayer2" data="'+getRef("cancion").value+'"><param name="AutoSize" value="false"/><param name="AutoStart" value="true"/><param name="AnimationAtStart" value="true"/><param name="AllowScan" value="true"/><param name="AllowChangeDisplaySize" value="true"/><param name="AutoRewind" value="0"/><param name="Balance" value="0"/><param name="BufferingTime" value="5"/><param name="ClickToPlay" value="true"/><param name="CursorType" value="false"/><param name="CurrentPosition" value="false"/><param name="CurrentMarker" value="0"/><param name="DisplayBackColor" value="false"/><param name="DisplayForeColor" value="16777215"/><param name="DisplayMode" value="1"/><param name="DisplaySize" value="4"/><param name="Enabled" value="true"/><param name="EnableContextMenu" value="1"/><param name="EnablePositionControls" value="true"/><param name="EnableFullScreenControls" value="false"/><param name="EnableTracker" value="true"/><param name="filename" value="'+getRef("cancion").value+'"/><param name="uiMode" value="mini"/><param name="InvokeURLs" value="true"/><param name="Language" value="true"/><param name="Mute" value="false"/><param name="PlayCount" value="1"/><param name="PreviewMode" value="0"/><param name="Rate" value="1"/><param name="SelectionStart" value="-1"/><param name="SelectionEnd" value="-1"/><param name="SendOpenStateChangeEvents" value="true"/><param name="SendWarningEvents" value="true"/><param name="SendErrorEvents" value="true"/><param name="SendKeyboardEvents" value="0"/><param name="SendMouseClickEvents" value="0"/><param name="SendMouseMoveEvents" value="false"/><param name="SendPlayStateChangeEvents" value="true"/><param name="ShowCaptioning" value="false"/><param name="ShowControls" value="1"/><param name="ShowAudioControls" value="1"/><param name="ShowDisplay" value="false"/><param name="ShowGotoBar" value="false"/><param name="ShowPositionControls" value="0"/><param name="ShowStatusBar" value="true"/><param name="ShowTracker" value="1"/><param name="TransparentAtStart" value="true"/><param name="VideoBorderWidth" value="true"/><param name="Volume" value="9"/><param name="VideoBorderColor" value="true"/><param name="VideoBorder3D" value="true"/><param name="Volume" value="9"/><param name="WindowlessVideo" value="true"/></object>'}else{getRef("music").innerHTML='<div class="players"><a href="http://radio.chat-land.org/ecoute'+rad+'.m3u" style="border:none; background:url("cssChatLand/images/sprite.jpg") repeat scroll -45px -147px; display:inline-block; height:36px; width:36px;" title="Ouvrir Radio-chatland avec winamp" target="_blank"></a></div><div class="players"><a href="http://radio.chat-land.org/ecoute'+rad+'.asx" style="border:none; background:url("cssChatLand/images/sprite.jpg") repeat scroll -3px -147px transparent; display:inline-block; height:36px; width:36px;" title="Ouvrir Radio-chatland avec Média player" target="_blank"></a></div><div class="players"><a href="http://radio.chat-land.org/ecoute'+rad+'.ram" style="border:none; background:url("cssChatLand/images/sprite.jpg") repeat scroll -84px -147px; display:inline-block; height:36px; width:36px;" title="Ouvrir Radio-chatland avec Real player" target="_blank"></a></div>';}}

function mettre_pub(){
    if (screen.width <= 1152) {
        getRef("pubHead").innerHTML = '<iframe height="90px" width="468px" align="center" border="0" frameborder="0" scrolling="no" src="http://www.chat-land.org/pub/substitution468_60_pubhaut.htm" ></iframe>'
    }
    if (screen.width >= 1152) {
        getRef("pubHead").innerHTML = '<iframe height="90px" width="720px" align="center" border="0" frameborder="0"  scrolling="no" src="http://www.chat-land.org/pub/substitution728_90_pubhaut.htm" ></iframe>'
    }
}

function mettre_pub2(){
    if (screen.width <= 1152) {
        getRef("pubHead").innerHTML = '<iframe height="135px" width="720px" align="center" border="0" frameborder="0" scrolling="no" src="http://www.chat-land.org/pub/pub_yes_haut_800.php" ></iframe>'
    }
    if (screen.width > 1152) {
        getRef("pubHead").style.height = "135px";
        getRef("headerpubhaut").style.height = "150px";
        getRef("pubHead").innerHTML = '<iframe height="135px" width="720px" align="center" border="0" frameborder="0" scrolling="no" src="http://www.chat-land.org/pub/pub_yes_haut.php" ></iframe>'
    }
}

function checkAdult(){
    ageverif = getRef("age").value;
    if (ageverif >= 18) {
        isAdult = true;
        getRef("pasdesexeblock").innerHTML = pasdesexe;
        getRef("pasdesexeblock").style.visibility = "visible";
        getRef("pasdesexeblock").style.display = "block"
    }
    else {
        isAdult = false;
        getRef("pasdesexeblock").innerHTML = "";
        getRef("pasdesexeblock").style.visibility = "hidden";
        getRef("pasdesexeblock").style.display = "none"
    }
}

function writediv(b, a){
    getRef(a).innerHTML = b
}

function getXhr(){
    var b = null;
    if (window.XMLHttpRequest) {
        b = new XMLHttpRequest()
    }
    else {
        if (window.ActiveXObject) {
            try {
                b = new ActiveXObject("Msxml2.XMLHTTP")
            } 
            catch (a) {
                b = new ActiveXObject("Microsoft.XMLHTTP")
            }
        }
        else {
            alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
            b = false
        }
    }
    return b
}
/*function reload10() { document.location.reload();}
 refreshwin=setInterval("reload10()",60000); */
function connecter(d, b, c, a){
/*
  alert ('L\'accès vip est fermé pour une durée de 5 minutes. \n Vous pouvez, cependant accéder au tchat en tant qu\'invité');
  
  blinkBlink('pseudo');
		window.scrollTo(0,0);
	 refreshwin=setInterval("reload10()",60000);
	return false; 
	*/
    if (getRef(c).checked) {
        var e = "yes"
    }
    login = getRef(d).value;
    pw = getRef(b).value;
    var f = getXhr();
    f.onreadystatechange = function(){
        if (f.readyState == 4 && f.status == 200) {
            response = f.responseText;
            response = response.split("|");
            if (response[0] == 3) {
                writediv('<font style="color:#CC0000; font-size: 12;">Erreur lors de la récupération de vos identifiants</font>', a);
                return false
            }
            if (response[0] == 0) {
                writediv('<font style="color:#CC0000; font-size: 12;">Veuillez vérifier vos identifiants SVP</font><br><a target="_blank" href="vip/password.php">Mot de passe oublié ?</a>', a);
                return false
            }
            if (response[0] == 1) {
                writediv('<font style="color:green; font-size: 12;">Vous êtes maintenant authentifié</font>', a);
                if(response[2]<70)
				document.location = "http://www.chat-land.org/vip/edit.php";
				else
				document.location = "http://" + document.location.host;
                return true
            }
            else {
                writediv("Problème de connexion, veuillez réessayer", a);
                return false
            }
        }
        else {
            writediv('<img src="http://www.chat-land.org/images/PleaseWait.gif" />', a)
        }
    };
    f.open("POST", "./includes/login2.php", true);
    f.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    f.send("passwd=" + pw + "&login=" + login + "&rememberme=" + e)
}

function verifMail(a){
    var b;
    if (texte = file_mail("vip/verifmailfinal.php?Email=" + escape(getRef("email_correction").value))) {
        if (texte == 20) {
            b = "1"
        }
        else {
            if (texte == 21) {
                b = "2"
            }
            else {
                if (texte == 5) {
                    b = "3"
                }
            }
        }
    }
    return b
}

function file_mail(a){
    if (window.XMLHttpRequest) {
        xhr_object = new XMLHttpRequest()
    }
    else {
        if (window.ActiveXObject) {
            xhr_object = new ActiveXObject("Microsoft.XMLHTTP")
        }
        else {
            return (false)
        }
    }
    xhr_object.open("GET", a, false);
    xhr_object.send(null);
    if (xhr_object.readyState == 4) {
        return (xhr_object.responseText)
    }
    else {
        return (false)
    }
}

function blinkExecute(b, a){
    getRef(b).style.backgroundColor = a
}

function blinkBlink(a){
    color1 = "#ff0000";
    color2 = "#ffffff";
    for (i = 0; i < 5; i = i + 2) {
        setTimeout('blinkExecute("' + a + '","' + color1 + '")', i * 500);
        setTimeout('blinkExecute("' + a + '","' + color2 + '")', (i + 1) * 500)
    }
    getRef(a).focus()
}

function blinkBlink2(a){
    color1 = "#ff0000";
    color2 = "#ffffff";
    for (i = 0; i < 5; i = i + 2) {
        setTimeout('blinkExecute("' + a + '","' + color1 + '")', i * 500);
        setTimeout('blinkExecute("' + a + '","' + color2 + '")', (i + 1) * 500)
    }
    //getRef(a).focus()
}
function file(fichier)
     {
     if(window.XMLHttpRequest) // FIREFOX
          xhr_object = new XMLHttpRequest();
     else if(window.ActiveXObject) // IE
          xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
     else
          return(false);
     xhr_object.open("GET", fichier, false);
     xhr_object.send(null);
     if(xhr_object.readyState == 4) return(xhr_object.responseText);
     else return(false);
     }
	 
function checkCockiesStatus(){
    var a = navigator.cookieEnabled;
    if (!a) {
        var b = "0";
        if (getRef("pseudo").value != "" && getRef("login").value == "" && getRef("pw").value == "") {
            window.alert("Veuillez SVP Activer les Cookies dans votre navigateur\npour pouvoir bénificier d'un maximum d'option sur le Tchat");
            window.open("http://www.chat-land.org/ActiverCookies.php", "Aide Chat-land : Comment Activer les cookies", "menubar=no, status=no, scrollbars=yes, menubar=no, width=800, height=600");
            nick = getRef("pseudo").value;
            b = "0";
            file("./traceCookiesProblem.php?nick=" + nick + "&type=" + b);
            return true
        }
        else {
            if (getRef("pseudo").value == "" && getRef("login").value != "" && (getRef("pw").value == "" || getRef("pw").value != "")) {
                window.alert("Veuillez SVP activez les cookies dans votre navigateur\n pour pouvoir vous connecter à votre compte VIP");
                getRef("msgCheckCockies").style.visibility = "visible";
                getRef("msgCheckCockies").style.display = "block";
                nick = getRef("login").value;
                b = "1";
                file("./traceCookiesProblem.php?nick=" + nick + "&type=" + b);
                return false
            }
            else {
                if (getRef("pseudo").value != "" && getRef("login").value != "") {
                    window.alert("Veuillez SVP activez les cookies dans votre navigateur\n pour pouvoir vous connecter à votre compte VIP");
                    getRef("msgCheckCockies").style.visibility = "visible";
                    getRef("msgCheckCockies").style.display = "block";
                    nick = "----";
                    b = "0";
                    file("./traceCookiesProblem.php?nick=" + nick + "&type=" + b);
                    return false
                }
            }
        }
    }
    return true
}

function registerclick(a){
    file("/includes/enregist_pages.php?page=" + a)
}

function redirect(){
    document.location.replace("http://" + document.location.host + "/vip/register.php")
}

function ChangeCountry2(h, c, k, e, l, f){
    var a = h.selectedIndex;
    var b = h.options[a].value;
    var d = [c, k, e];
    var j = [l];
    for (var g = 0; g < d.length; g++) {
        if (b == "France") {
            getRef(d[g]).style.visibility = "visible";
            getRef(d[g]).style.display = "block";
			ChangeDepartement2('departement_invite','region_invite','commune_invite','pseudoForme_2Commune','secours','../vip/getcommunes.php');
		/*	
			var y = region_invite.selectedIndex;			
    		y = region_invite.options[y].value;
			
			var x = commune_invite.selectedIndex;			
    		x = commune_invite.options[x].value;
			
			
	if ((y == "Bretagne" && x == "Côtes-d'Armor") || (y == "Bourgogne" && x == "Côte-d'Or") || (y == "Paris avec la Région" && x == "Val-d'Oise")) {
        getRef(l).style.visibility = "hidden";
        getRef(l).style.display = "none";
        getRef(f).style.visibility = "visible";
        getRef(f).style.display = "block"
    }
    else {
        getRef(f).style.visibility = "hidden";
        getRef(g).style.display = "none";
        getRef(f).style.visibility = "visible";
        getRef(l).style.display = "block"
    }
*/
			
			
        }
        else {
            getRef(d[g]).style.visibility = "hidden";
            getRef(d[g]).style.display = "none"
        }
    }
    for (var g = 0; g < j.length; g++) {
        if (b != "France") {
            getRef(j[g]).style.visibility = "visible";
            getRef(j[g]).style.display = "block";
            getRef(f).style.visibility = "hidden";
            getRef(f).style.display = "none"
        }
        else {
            getRef(j[g]).style.visibility = "hidden";
            getRef(j[g]).style.display = "none"
        }
    }
}

function ChangeRegion2(d, f, a, g, b, c, e){
    var j = d.selectedIndex;
    var h = d.options[j].value;
    GetLocations2(d, f, h, "", b, c, e);
    ChangeDepartement2(getRef(f), a, g, b, c, e)
}

function ChangeDepartement2(e, a, h, b, d, g){
    var f = e.selectedIndex;
    var c = e.options[f].value;
    var j = getRef(a);
    var l = j.selectedIndex;
    var k = j.options[l].value;
    GetLocations2(e, h, k, c, b, d, g)
}

function GetLocations2(r, o, n, c, b, g, j){
    if ((n == "Bretagne" && c == "Côtes-d'Armor") || (n == "Bourgogne" && c == "Côte-d'Or") || (n == "Paris avec la Région" && c == "Val-d'Oise")) {
        getRef(b).style.visibility = "hidden";
        getRef(b).style.display = "none";
        getRef(g).style.visibility = "visible";
        getRef(g).style.display = "block"
    }
    else {
        getRef(g).style.visibility = "hidden";
        getRef(g).style.display = "none";
        getRef(b).style.visibility = "visible";
        getRef(b).style.display = "block"
    }
    var q = r.selectedIndex;
    var f = r.options[q].value;
    var a;
    if (window.XMLHttpRequest) {
        a = new XMLHttpRequest()
    }
    else {
        if (window.ActiveXObject) {
            a = new ActiveXObject("Microsoft.XMLHTTP")
        }
        else {
            return false
        }
    }
    a.open("GET", j + "?region=" + escape(n) + "&departement=" + escape(c), false);
    a.send(null);
    var d;
    if (a.readyState == 4) {
        d = a.responseText.split("#")
    }
    if (!d) {
        return false
    }
    var p = getRef(o);
    var k = p.length;
    while (p.length > 0) {
        p.remove(0)
    }
    var m;
    for (var h = 0; h < d.length; h++) {
        m = document.createElement("option");
        m.value = d[h];
        m.text = d[h];
        try {
            p.add(m)
        } 
        catch (l) {
            p.appendChild(m)
        }
    }
    return true
}

var win = null;
function NewWindow(f, d, b, c, a, e){
    if (e == "random") {
        LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - b)) : 100;
        TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - c) - 75)) : 100
    }
    if (e == "center") {
        LeftPosition = (screen.width) ? (screen.width - b) / 2 : 100;
        TopPosition = (screen.height) ? (screen.height - c) / 2 : 100
    }
    else {
        if ((e != "center" && e != "random") || e == null) {
            LeftPosition = 0;
            TopPosition = 20
        }
    }
    settings = "width=" + b + ",height=" + c + ",top=" + TopPosition + ",left=" + LeftPosition + ",scrollbars=" + a + ",location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";
    win = window.open(f, d, settings);
    win.blur();
    win.focus()
}

function do_script(a){
    NewWindow("http://" + document.location.host + "/topliste/out.php?id=" + a, "win", "1", "1", "no", "autre")
};
<!--
function setCookie( cookieName, cookieValue, expires, path, domain, secure ) {
	var date = new Date();
	date.setTime(date.getTime() + (30 * 60 * 1000));
	document.cookie = cookieName + "=" +escape( cookieValue ) + ";expires=" + date;
}

function getCookie(cookieName) {
  var cookieDataBeg, cookieDataEnd;
  cookieDataBeg = document.cookie.indexOf(cookieName + "=");
  if (cookieDataBeg >= 0) {
    cookieDataBeg += cookieName.length + 1;
    cookieDataEnd = document.cookie.indexOf(";",cookieDataBeg);
    if (cookieDataEnd < 0) cookieDataEnd = document.cookie.length;
    return unescape(document.cookie.substring(cookieDataBeg,cookieDataEnd));
  }
  return null;
}

function checkCookie() {
  var cookData = getCookie('popUnderEI');
  if ( cookData == null ) {
    openSiteUnder();
    setCookie('popUnderEI','true');
  }
}

function openSiteUnder() {
  var siteUnder = window.open('http://market1.the-adult-company.com/pdvtool/?cid=18', 'pucd', 'left=0, top=0, width=' + screen.availWidth + ', height=' + screen.availHeight + ', scrollbars=1');
  siteUnder.blur();
  window.focus();
}
function hideLoader(){getRef('loader').style.visibility="hidden";getRef('loader').style.display="none";}
function showLoader(){getRef('loader').style.visibility="visible";getRef('loader').style.display="block";}
function showHide(){showLoader();setTimeout('hideLoader()',2000);}
//-->
