//##### Tools #####
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}


//##### Plaats info adres in contact blokje #####

function displayMail(a) {
	var start = '&#109;&#97;&#105;&#108;&#116;&#111;&#58;';
	switch (a) {
	  case 1:  var address = '&#105;&#110;&#102;&#111;'; break;
	  case 2:  var address = '&#115;&#99;&#104;&#111;&#108;&#101;&#110;'; break;
	  case 3:  var address = '&#98;&#101;&#115;&#116;&#117;&#117;&#114;'; break;
	  case 4:  var address = '&#116;&#114;&#97;&#105;&#110;&#105;&#110;&#103;'; break;
 	  default: var address = '&#119;&#101;&#98;&#109;&#97;&#115;&#116;&#101;&#114;';
	}
	var domain = '&#122;&#101;&#105;&#108;&#107;&#97;&#109;&#112;&#46;&#110;&#101;&#116;';
	document.write('<a href="'+start+address+'&#64;'+domain+'">');
	document.write(address+'&#64;'+domain);
	document.write('<\/a>');
}


//##### Gastenboek scroll widget ######

var intColour = 200;
var intCounter = -1;
var strElement = "rightguestbookIN";

function fadingText(){
	if(intColour>0) {
		intColour -= 10;
		document.getElementById(strElement).style.color="rgb("+intColour+","+intColour+","+intColour+")";
		setTimeout("fadingText()",20);
	}
	else
		intColour=200;
}

function changeText(){
	intCounter++;
	if (location.hostname.indexOf('zeilkamp.net')>0) {
		msgText = '<b>'+arrMessages[intCounter][0]+'</b> schreef:<br />'+arrMessages[intCounter][1];
	} else {
		msgText = arrMessages[intCounter][1]+' ('+arrMessages[intCounter][0]+')';
	}
	document.getElementById(strElement).innerHTML = msgText;
	fadingText();
	if (intCounter==4) intCounter=-1;
	setTimeout("changeText()",4000);
}

addLoadEvent(changeText);

//##### URL functies ######

function go(sPage){
	document.location.href = sPage;
}

function pop(strPage) {
	window.open(strPage,'_blank','scrollbars=1,width=750,height=700,resizable=yes');
}

//##### Gastenboek beheer ######

function report(intMessage) {
	if (confirm('Weet je zeker dat je de webmaster op de hoogte wilt stellen van dit bericht?')) {
		new Request.JSON({url: 'gastenboek_beheer.asp?mod=report&id='+intMessage, method: 'get', onSuccess: displayResponse}).send();
		//new Ajax('gastenboek_beheer.asp?mod=report&id='+intMessage,{method: 'get', onComplete: function(responseText){alert(responseText)}}).request();
		$('gb'+intMessage+'head').addClass('hidden');
		$('gb'+intMessage+'body').addClass('hidden');
	}
}

function feature(intMessage) {
	new Request.JSON({url: 'gastenboek_beheer.asp?mod=feature&id='+intMessage, method: 'get'}).send();
	$('gb'+intMessage+'head').getElements('a.feature').removeClass('feature').addClass('done');
}

function unfeature(intMessage) {
	if (confirm('Weet je zeker dat je de dit bericht wilt verwijderen uit de zijbalk?')) {
		new Request.JSON({url: 'gastenboek_beheer.asp?mod=unfeature&id='+intMessage, method: 'get', onSuccess: displayResponse}).send();
		$('gb'+intMessage+'head').getElements('a.unfeature').removeClass('unfeature').addClass('done');
	}
}

//##### Fotoalbum #####

function albumlijst() {
	if (confirm('Weet je zeker dat je de albumlijst wilt bijwerken?\n\nDit heeft alleen zin als je net nieuwe foto\'s online hebt gezet.')) {
		new Request.JSON({url: 'foto_beheer.asp', method: 'get', onSuccess: displayResponse}).send();
		//new Ajax('foto_beheer.asp',{method: 'get', onComplete: function(responseText){alert(responseText);location.reload()}}).request();
	}
}

function displayResponse(data) {
	alert(data.msg);
}



/*








a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z



















*/
