function overlayBoxFunction(changeContent){
	
	//first show the overlay
	document.getElementById('overlayBox').className='opac85';
	//make a choice what to display
	if(changeContent == 'inloggen'){
		//call ajax
		sndreqIncludeLI('login.php');
	}
	//make a choice what to display
	if(changeContent == 'aanmelden'){
		//call ajax
		sndreqIncludeLI('signup.php');
		}
	if(changeContent == 'luisteren'){
		//call ajax
		sndreqIncludeLM('listen-ss1.php');
		}
	if(changeContent == 'forgotPassword'){
		//call ajax
		sndreqIncludeLI('signup.php?getmyPassword=yes');
		}		
		return false
}

function checkInput(){
if(document.getElementById('userInputbox').value == ""){
	document.getElementById('loginMessage').innerHTML = "Je hebt geen gebruikersnaam ingevuld...";
	}
	else if(document.getElementById('passInputbox').value == ""){
		document.getElementById('loginMessage').innerHTML = "Je hebt geen wachtwoord ingevuld...";
		} else {
			sndreqLogin(document.getElementById('userInputbox').value,document.getElementById('passInputbox').value,document.getElementById('rememberMe').checked,document.getElementById('justChecked').value);
			}
}
function checkInputSignUp() {
if(document.getElementById('userInputbox').value == ""){
	document.getElementById('signUpMessage').innerHTML = "Je hebt geen gebruikersnaam ingevuld...";
	}
	else if(document.getElementById('passInputbox').value == ""){
		document.getElementById('signUpMessage').innerHTML = "Je hebt geen wachtwoord ingevuld...";
		}
		else if(document.getElementById('emailInputbox').value == ""){
		document.getElementById('signUpMessage').innerHTML = "Je hebt geen emailadres ingevuld...";
			} else {
				sndreqSignUp(document.getElementById('userInputbox').value,document.getElementById('passInputbox').value,document.getElementById('emailInputbox').value);
				}
}
function checkFPInput() {
if(document.getElementById('fpemailInputbox').value == ""){
		document.getElementById('forgotPasswordMessage').innerHTML = "Je hebt geen emailadres ingevuld...";
			} else {
				sndreqForgotPassword(document.getElementById('fpemailInputbox').value);
				}
}
//check is checkbox is set
function checkCheckbox(){
	if(document.getElementById('rememberMe').checked == true){
		document.getElementById('justChecked').value = "true";
		}
		else
			{
			document.getElementById('justChecked').value = "false";
			//unset cookies, do it with PHP
			sndreqUnsetCookie();
			//clear input boxed
			document.getElementById('userInputbox').value = "";
			document.getElementById('passInputbox').value = "";
			}	
}

//check if images are loaded fully
function IsImageOk(img) {
    // During the onload event, IE correctly identifies any images that
    // weren't downloaded as not complete. Others should too. Gecko-based
    // browsers act like NS4 in that they report this incorrectly.
    if (!img.complete) {
        return false;
		window.alert('not ok');
    }

    // However, they do have two very useful properties: naturalWidth and
    // naturalHeight. These give the true size of the image. If it failed
    // to load, either of these should be zero.
    if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) {
        return false;
    }

    // No other way of checking: assume it's ok.
    return true;
}

var c1=0
var c2=0
var t1
var t2
function timedCount()
{
//
c1=c1+1;
t1=setTimeout("timedCount2()",15);
}
function timedCount2()
{
	//dit gebeurd elke 10seconden

sndreqAutoRefreshLB(); //listenersbox
sndreqAutoRefreshAL(); //amount listeners
sndreqAutoRefreshCM(); //check for messages
c2=c2+1;
t2=setTimeout("timedCount()",9990);

}


var SBc1=0
var SBc2=0
var SBt1
var SBt2
function timedCountSB()
{
//
SBc1=SBc1+1;
SBt1=setTimeout("timedCount2SB()",15);

}
function timedCount2SB()
{
//window.alert('asd');
sndreqAutoRefreshSB(); //shoutbox
SBc2=SBc2+1;
SBt2=setTimeout("timedCountSB()",85000);
}


function checkEnterLogin(e){ //e is event object passed from function invocation
//var characterCode literal character code will be stored in this variable

if(e && e.which){ //if which property of event object is supported (NN4)
e = e
characterCode = e.which //character code is contained in NN4's which property
}
else{
e = event
characterCode = e.keyCode //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
//document.forms[0].submit() //submit the form
checkInput(document.getElementById('userInputbox').value,document.getElementById('passInputbox').value);
return false
}
else{
return true
}

}
function addSmile(code)
{
   var MyElement = document.getElementById("shout");
   MyElement.value += " "+code+" ";

   return true;
}
function windowOpener(windowHeight, windowWidth, windowName, windowUri)
{
    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;

    newWindow = window.open(windowUri, windowName, 'resizable=0,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight);

    newWindow.focus();
    return newWindow.name;
}
function updateDIVbyID(id, message){
	document.getElementById(id).innerHTML = message;
}

 var milisec=0 
 var seconds=4 
function display(){ 

 if (milisec<=0){ 
    milisec=9 
    seconds-=1 

 } 
 if (seconds<=-1){ 
    milisec=0 
    seconds+=1 
 } 
 if(seconds==0){
	 javascript:sndreqContent('','modules/shoutbox_archief.php');
	 document.getElementById('overlayBox').className='invisible'; 
	 seconds=4 
	 return false
 }
 else 
    milisec-=1 
    document.getElementById("countdownResult").innerHTML = 'Dit bericht sluit in '+seconds+' seconden...';
    setTimeout("display()",100) 
} 

var showWhat;
function prestartRDS(sex,milisex){
var secondsz = sex;
var milisecz  = milisex;

if (milisecz<=0){ 
    milisecz=9 
    secondsz-=1 

 } 
 if (secondsz<=-1){ 
    milisecz=0 
    secondsz+=1 
 } 
 if(secondsz==0){
	 //start rds
	 //window.alert('hit that');
	 startRDS();
	 return false
 }
 else 
    milisecz-=1     
	setTimeout("prestartRDS("+secondsz+","+milisecz+")",100) 
}
function startRDS()
{
	if((!showWhat) || (showWhat > 9)){
		showWhat = 0;
	} 
//set all hidden

document.getElementById('rdsDiv0').className='invisibleRDS';
document.getElementById('rdsDiv1').className='invisibleRDS';
document.getElementById('rdsDiv2').className='invisibleRDS';
document.getElementById('rdsDiv3').className='invisibleRDS';
document.getElementById('rdsDiv4').className='invisibleRDS';
document.getElementById('rdsDiv5').className='invisibleRDS';
document.getElementById('rdsDiv6').className='invisibleRDS';
document.getElementById('rdsDiv7').className='invisibleRDS';
document.getElementById('rdsDiv8').className='invisibleRDS';
document.getElementById('rdsDiv9').className='invisibleRDS';

if(showWhat == 0) { document.getElementById('rdsDiv0').className='visibleRDS'; }
if(showWhat == 1) { document.getElementById('rdsDiv1').className='visibleRDS'; }
if(showWhat == 2) { document.getElementById('rdsDiv2').className='visibleRDS'; }
if(showWhat == 3) { document.getElementById('rdsDiv3').className='visibleRDS'; }
if(showWhat == 4) { document.getElementById('rdsDiv4').className='visibleRDS'; }
if(showWhat == 5) { document.getElementById('rdsDiv5').className='visibleRDS'; }
if(showWhat == 6) { document.getElementById('rdsDiv6').className='visibleRDS'; }
if(showWhat == 7) { document.getElementById('rdsDiv7').className='visibleRDS'; }
if(showWhat == 8) { document.getElementById('rdsDiv8').className='visibleRDS'; }
if(showWhat == 9) { document.getElementById('rdsDiv9').className='visibleRDS'; }

//nereidFade('rdsSpan',80,100,5);

showWhat=showWhat+1
prestartRDS(3,0);
}

nereidFadeObjects = new Object();
nereidFadeTimers = new Object();

/* object - image to be faded (actual object, not name);
 * destop - destination transparency level (ie 80, for mostly solid)
 * rate   - time in milliseconds between trasparency changes (best under 100)
 * delta  - amount of change each time (ie 5, for 5% change in transparency)
 */


function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
    if (object != "[object]"){  //do this so I can take a string too
        setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
        return;
    }
        
    clearTimeout(nereidFadeTimers[object.sourceIndex]);
    
    diff = destOp-object.filters.alpha.opacity;
    direction = 1;
    if (object.filters.alpha.opacity > destOp){
        direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;

    if (object.filters.alpha.opacity != destOp){
        nereidFadeObjects[object.sourceIndex]=object;
        nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
}

function startFlash(action) {
	if(action == "activate") {
		document.getElementById('switchRDS').innerHTML = "<a class=\"menuLink\" title=\"Flash uitschakelen\" onClick=\"javascript:startFlash('deactivate');\">&nbsp;~Flash uitschakelen</a>";
		document.getElementById('flashBox').className='visible';
		} else {
			document.getElementById('switchRDS').innerHTML = "<a class=\"menuLink\" title=\"Flash inschakelen\" onClick=\"javascript:startFlash('activate');\">&nbsp;~Flash inschakelen</a>";
			document.getElementById('flashBox').className='invisible';
			}
}
function wwoiSwitch(){
	
	if(document.getElementById('wwoiDiv').className=="visible"){
		document.getElementById('wwoiDiv').className='invisible';
		document.getElementById('wwoiArrow').src = "images/arrow_down.gif";
		} else {
			document.getElementById('wwoiDiv').className='visible';
			document.getElementById('wwoiArrow').src = "images/arrow_up.gif";
			}
}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300,left = 665,top = 275');");
}
function popUpwithScroll(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300,left = 665,top = 275');");
}

//flashing links
var flashlinks=new Array()

function changelinkcolor(){
for (i=0; i< flashlinks.length; i++){
	
var flashtype=document.getElementById? 
flashlinks[i].getAttribute("flashtype")*1 : flashlinks[i].flashtype*1

var flashcolor=document.getElementById? 
flashlinks[i].getAttribute("flashcolor") : flashlinks[i].flashcolor
	
if (flashtype==0){
if (flashlinks[i].style.color!=flashcolor)
flashlinks[i].style.color=flashcolor
else
flashlinks[i].style.color=''
}
else if (flashtype==1){
if (flashlinks[i].style.backgroundColor!=flashcolor)
flashlinks[i].style.backgroundColor=flashcolor
else
flashlinks[i].style.backgroundColor=''
}
}
}
function init(){
var i=0
if (document.all){
while (eval("document.all.flashlink"+i)!=null){
flashlinks[i]= eval("document.all.flashlink"+i)
i++
} 
}
else if (document.getElementById){
while (document.getElementById("flashlink"+i)!=null){
flashlinks[i]= document.getElementById("flashlink"+i)
i++
}
}
setInterval("changelinkcolor()", 1000)
}
if (window.addEventListener)
window.addEventListener("load", init, false)
else if (window.attachEvent)
window.attachEvent("onload", init)
else if (document.all)

window.onload=init
