/*<![CDATA[*/

/* #_# DETECT NAVIGATOR TYPE ===================================================
============================================================================= */
var nuA   = navigator.userAgent;

var M2    = (nuA.indexOf("Mozilla/2") != -1);
var M3    = (nuA.indexOf("Mozilla/3") != -1);
var M4    = (nuA.indexOf("Mozilla/4") != -1);
var M5    = (nuA.indexOf("Mozilla/5") != -1);

var OP    = (nuA.indexOf("Opera") != -1);
var OP3   = (nuA.indexOf("Opera/3") != -1) && M3;
var OP35  = (nuA.indexOf("Opera/3") != -1) && M4;
var OP36  = (nuA.indexOf("Opera 3") != -1) && M4;
var OP4   = (nuA.indexOf("Opera 4") != -1) || (nuA.indexOf("Opera/4") != -1);
var OP5   = (nuA.indexOf("Opera 5") != -1) || (nuA.indexOf("Opera/5") != -1);
var OP6   = (nuA.indexOf("Opera 6") != -1) || (nuA.indexOf("Opera/6") != -1);
var OP7   = (nuA.indexOf("Opera 7") != -1) || (nuA.indexOf("Opera/7") != -1);
var OP8   = (nuA.indexOf("Opera 8") != -1) || (nuA.indexOf("Opera/8") != -1);
var OP9   = (nuA.indexOf("Opera 9") != -1) || (nuA.indexOf("Opera/9") != -1);

var IE    = (nuA.indexOf("MSIE") != -1) && !OP;
var IE3   = (nuA.indexOf("MSIE 3") != -1);
var IE4   = (nuA.indexOf("MSIE 4") != -1);
var IE50  = (nuA.indexOf("MSIE 5.0") != -1) && !OP;
var IE55  = (nuA.indexOf("MSIE 5.5") != -1) && !OP;
var IE60  = (nuA.indexOf("MSIE 6.0") != -1) && !OP;
var IE70  = (nuA.indexOf("MSIE 7.0") != -1) && !OP;

var GECKO = (nuA.indexOf("Gecko") != -1);
var MOZ   = GECKO && (nuA.indexOf("Netscape") == -1) &&
            (nuA.indexOf("Firefox") == -1);
var MOZ1  = MOZ && (nuA.indexOf("rv:1") != -1);

var FF    = (nuA.indexOf("Firefox") != -1);
var FF10  = (nuA.indexOf("Firefox/1.0") != -1);
var FF15  = (nuA.indexOf("Firefox/1.5") != -1);
var FF20  = (nuA.indexOf("Firefox/2.0") != -1);

var NN    = (navigator.appName == "Netscape") && !OP && !MOZ;
var NN2   = NN && M2;
var NN3   = NN && M3;
var NN4   = NN && M4;
var NN6   = (nuA.indexOf("Netscape6") != -1);
var NN7   = (nuA.indexOf("Netscape/7") != -1);
var NN8   = (nuA.indexOf("Netscape/8") != -1);

// #_# CREATE POPUPWINDOW  2 =================================================== //
// Om popup te openen
//   <a href="deze-url" onClick="return popitup('deze-url','Breed','Hoog','scroll Yes/No')">Open popup</a>
// <a href="NEW-Training.php" onClick="return popitup('NEW-Training.php','400','600','No')">Open popup</a>
// Om popup te sluiten
// <a href="javascript:if (newwindow) newwindow.close()">Sluit popup.</a>
function popitup(url,Breed,Hoog,Scroll,naam)
{
    VanafLinks = (screen.width)? (screen.width-Breed) /2 : 0;
    VanafLinks = VanafLinks;
	VanafBoven = (screen.height)?(screen.height-Hoog)/2 : 0;
    instellingen = 'width='+Breed+',height='+Hoog+',top='+VanafBoven+',left='+VanafLinks+', scrollbars=' + Scroll;
    naam=window.open(url,naam,instellingen);
	if (window.focus) {naam.focus()}
	return false;
}


// #_# Double klik for top page: Timer ========================================= //
var goto_top_type = -1;
var goto_top_itv = 0;
function goto_top_timer() {
    var y = goto_top_type == 1 ? document.documentElement.scrollTop : document.body.scrollTop;
    //alert(y);
    var moveby = 20; // set this to control scroll seed. minimum is fast

    y -= Math.ceil(y * moveby / 100);
    if (y < 0)
    y = 0;

    if (goto_top_type == 1)
    document.documentElement.scrollTop = y;
    else
    document.body.scrollTop = y;

    if (y == 0) {
        clearInterval(goto_top_itv);
        goto_top_itv = 0;
    }
}
// #_# Double klik for top page: goto top ====================================== //
function goto_top() {
    if (goto_top_itv == 0) {
        if (document.documentElement && document.documentElement.scrollTop)
        goto_top_type = 1;
        else if (document.body && document.body.scrollTop)
        goto_top_type = 2;
        else
        goto_top_type = 0;

        if (goto_top_type > 0)
        goto_top_itv = setInterval('goto_top_timer()', 25);
    }
}
// #_# Double klik for top page: Call goto top ================================= //
function dblclick() {
	goto_top();
}
if (document.layers) {
	document.captureEvents(Event.ONDBLCLICK);
}
document.ondblclick=dblclick;

// #_# Swap an images on the same place  ======================================= //
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }

// BLOCK MOUSE ACTIONS ========================================================= //
    if(window.event)
        document.captureEvents(Event.MOUSEUP);
    if(getCookie("Moderator")!= "Yes")
    {
        // No content menu ========================================================= //
        function nocontextmenu(){
            event.cancelBubble = true
            event.returnValue = false;
            return false;
        }
        document.oncontextmenu = nocontextmenu;

        function disableselect(e){
            return false
        }

        function reEnable(){
            return true
        }

        document.onselectstart=new Function ("return false")
        if (window.sidebar){
            document.onmousedown=disableselect
            document.onclick=reEnable
        }
     }
// END BLOCK MOUSE ACTIONS ===================================================== //

// No right click ============================================================== //
function disableRightClick(e)
{
    if(getCookie("Moderator")!= "Yes")
    {
          var message = "Right click don't works...\n\n                           ....but XanGo works fine!!!    ";

          if(!document.rightClickDisabled) // initialize
          {
            if(document.layers)
            {
              document.captureEvents(Event.MOUSEDOWN);
              document.onmousedown = disableRightClick;
            }
            else document.oncontextmenu = disableRightClick;
            return document.rightClickDisabled = true;
          }
          if(document.layers || (document.getElementById && !document.all))
          {
            if (e.which==2||e.which==3)
            {
              alert(message);
              return false;
            }
          }
          else
          {
            alert(message);
            return false;
          }
    }
}
disableRightClick();


// #_# REPLACE ENTERS IN FORM TO <br>  ========================================= //
function ReplRN(f){
    f.bzkrbcht.value = f.bzkrbcht.value.replace(/\r\n/g, "<br>");
}

// #_# Maand beschrijving ophalen ============================================== //
function GetMonth(Mnd){
    switch(Mnd)
	{
		case 1:
			return "januari";
			break;
		case 2:
			return "februari";
			break;
		case 3:
			return "maart";
			break;
		case 4:
			return "april";
			break;
		case 5:
			return "mei";
			break;
		case 6:
			return "juni";
			break;
		case 7:
			return "juli";
			break;
		case 8:
			return "augustus";
			break;
		case 9:
			return "september";
			break;
		case 10:
			return "oktober";
			break;
		case 11:
			return "november";
			break;
		case 12:
			return "december";
			break;
		}
}

// #_# VALIDATE SPAMCODE ================================================= //
function validatespamcode(f){
    var temp;
    var usrenter;
    usrenter = false;
    temp = f.spamcode.value.toUpperCase();
    lang = temp.length;
    if(temp.indexOf("\r\n") > -1){
        usrenter = true;
        temp = temp.replace(/\r\n/g, "");
    }
    if(temp.indexOf("\r") > -1){
        usrenter = true;
        temp = temp.replace(/\r/g, "");
    }
    if(temp.indexOf("\n") > -1){
        usrenter = true;
        temp = temp.replace(/\n/g, "");
    }
    if(lang > 5){
        temp = temp.substr(0,5);
    }
    f.spamcode.value = temp
    lang = temp.length;
    if(lang == 5 && usrenter == true ) {
        f.contact.focus();
    }
}

function moderatoracces(){
    if(getCookie("Moderator")== "Yes"){
        setCookie("Moderator","No", new Date(2222,12,31));
        alert("Moderator modus turned OFF!");
    }else{
        var myDate = new Date();
        var myYear = myDate.getFullYear();
        var myMonth = myDate.getMonth()+1;
        var myDay = myDate.getDate();
        setCookie("Moderator","Yes", new Date(myYear,myMonth,myDay));
        alert("Moderator modus activated for: "+myDay+"-"+myMonth+"-"+myYear+"!");
    }

}
function GetAccessTest(){
    var EndDateTest = getCookie('AccessTest');
    var myDate = new Date();
    var myYear = myDate.getFullYear();
    var myMonth = myDate.getMonth()+1;
    var myDay = myDate.getDate();
    myYear = myYear*10000;
    myMonth = myMonth * 100;
    var CurDate = myYear+myMonth+myDay;
    if(CurDate <= EndDateTest){
        alert('Curdate <= EnddateTest');
    }
}

function SetAccessTest(){
        var EndAccesDate = getdateplus10();
        var StringEndAccesDate  = EndAccesDate.toString();
        var myYear = StringEndAccesDate.substr(0,4);
        var myMonth = StringEndAccesDate.substr(4,2);
        var myDay = StringEndAccesDate.substr(6,2);
        setCookie("AccessTest", EndAccesDate , new Date(myYear,myMonth,myDay));
        alert("End Access date test: "+StringEndAccesDate+" ");
}

function SetAccessStudie(){
        var EndAccesDate = getdateplus10();
        var StringEndAccesDate  = EndAccesDate.toString();
        var myYear = StringEndAccesDate.substr(0,4);
        var myMonth = StringEndAccesDate.substr(4,2);
        var myDay = StringEndAccesDate.substr(6,2);
        setCookie("AccessStudie", EndAccesDate , new Date(myYear,myMonth,myDay));
        alert("End Studie date test: "+StringEndAccesDate+" ");
}

function SetAccessXanth(){
        var EndAccesDate = getdateplus10();
        var StringEndAccesDate  = EndAccesDate.toString();
        var myYear = StringEndAccesDate.substr(0,4);
        var myMonth = StringEndAccesDate.substr(4,2);
        var myDay = StringEndAccesDate.substr(6,2);
        setCookie("AccessXanth", EndAccesDate , new Date(myYear,myMonth,myDay));
        alert("End Studie date test: "+StringEndAccesDate+" ");
}

function getdateplus10(){
    var myDate = new Date();
    var myYear = myDate.getFullYear();
    var myMonth = myDate.getMonth()+1;
    var myDay = myDate.getDate();
    myDay = myDay + 9;

    if(myDay > 31){
        if(myMonth == 1 || myMonth == 3 || myMonth == 5 || myMonth == 7 || myMonth == 8 || myMonth == 10 || myMonth == 12){
            myDay = myDay - 31;
            myMonth = myMonth + 1;
            if(myMonth >12){
                myMonth = myMonth - 12;
                myYear = myYear +1;
            }
        }
    }

    if(myDay > 30){
        if(myMonth == 4 || myMonth == 6 || myMonth == 9 || myMonth == 11 || myMonth == 10 || myMonth == 12){
            myDay = myDay - 30;
            myMonth = myMonth + 1;
        }
    }

    if(myDay > 28){
        if(myMonth == 2){
            myDay = myDay - 28;
            myMonth = myMonth + 1;
        }
    }
    myYear = myYear*10000;
    myMonth = myMonth * 100;

     return myYear+myMonth+myDay;
}

// #_# cookiefunctie: cookie schrijven ========================================= //
//aanroepen met: setCookie('cookienaam','cookiewaarde',new Date(jaar,maand,dag));//
function setCookie(name, value, expires) {
var deCookie = name + "=" + escape(value);
    if(expires){
        expires= expires.toGMTString();
        deCookie += "; path=/";
        deCookie += "; expires=";
        deCookie += expires;
    }
    document.cookie = deCookie;
}

// #_# cookiefunctie: cookie lezen ============================================= //
// aanroepen met: var cookiewaarde = getCookie('cookienaam'); ================== //
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else begin += 2;
        var end = document.cookie.indexOf(";", begin);
        if (end == -1)
        end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}

// #_# cookiefunctie: cookie wissen ============================================ //
// aanroepen met: delCookie('cookienaam'); ===================================== //
function delCookie(name){
    expires = new Date(1970,1,1);
    expires = expires.toGMTString();
    deCookie = name
    deCookie += "=delete; expires=";
    deCookie += expires;
    document.cookie = deCookie;
}

/*]]>*/
