var si;
function sluit(id){
new Effect.BlindUp(id,{duration:1});
}

function sluituit(ih){
if (ih!='verzoek'){sluit('verzoek');vz.stop();}
if (ih!='histor'){sluit('histor');hs.stop();}
if (ih!='info'){sluit('info');is.stop();}
if (ih!='sponsor'){sluit('sponsor');clearInterval(si);}
if (ih!='gboek'){sluit('gboek');}
if (ih!='luister'){sluit('luister');}
if (ih!='foto'){sluit('foto');}
if (ih!='prog'){sluit('prog');ps.stop();}
if (ih!='team'){sluit('team')}
if (ih!='chat'){sluit('chat');cz.stop();}
if (ih!='av'){sluit('av');}
if (ih!='links'){sluit('links');}
if (ih!='agenda'){sluit('agenda');}
}

vz = new Ajax.PeriodicalUpdater('verzoek1','verzoek1.php?vn=1',{frequency:10,decay:1.2});
function verzk(){
sluituit('verzoek');
new Effect.BlindDown('verzoek',{duration:1});
$('verzoekje').vnummer.value='';
$('verzoekje').vverzoek.value='';
vz.start();
}

hs = new Ajax.PeriodicalUpdater('histor1','histor1.php',{frequency:12,decay:1.2});
function histo(){
sluituit('histor');
new Ajax.Updater('histor','histor.php');
new Effect.BlindDown('histor',{duration:1});
hs.start();
}

is = new Ajax.PeriodicalUpdater('info','info.php',{frequency:20});
function info(){
sluituit('info');
new Ajax.Updater('info','info.php');
new Effect.BlindDown('info',{duration:1});
is.start();
}

function spons(){
sluituit('sponsor');
new Ajax.Updater('sponsor','sponsor.php?d=32');
new Effect.BlindDown('sponsor',{duration:1});
i=0;
si=setInterval('spswap()',8000);
}

function gboek(){
sluituit('gboek');
new Ajax.Updater('gboek','gboek.php');
new Ajax.Updater('gboek1','gboek3.php');
new Effect.BlindDown('gboek',{duration:1});
}

function luist(){
sluituit('luister');
new Ajax.Updater('luister','luister.php');
new Effect.BlindDown('luister',{duration:1});
}

function links(){
sluituit('links');
new Ajax.Updater('links','links.php');
new Effect.BlindDown('links',{duration:1});
}

function foto(){
sluituit('foto');
new Ajax.Updater('foto','foto.php?vn=1&mp=0');
new Effect.BlindDown('foto',{duration:1});
}

ps = new Ajax.PeriodicalUpdater('prog','prog.php',{frequency:300});
function progr(){
sluituit('prog');
new Ajax.Updater('prog','prog.php?d=34');
new Effect.BlindDown('prog',{duration:1});
ps.start();
}

function team(){
new Ajax.Updater('team','team.php?d=34');
new Effect.BlindDown('team',{duration:1});
}

cz = new Ajax.PeriodicalUpdater('chat1','chat1.php?d=2',{frequency:4,decay:1.1});
function chat(){
new Ajax.Updater('chat','chat.php?d=34');
new Effect.BlindDown('chat',{duration:1});
cz.start();
}

function av(){
new Ajax.Updater('av','av.php?d=34');
new Effect.BlindDown('av',{duration:1});
}

function agenda(){
new Ajax.Updater('agenda','agenda.php?d=34');
new Effect.BlindDown('agenda',{duration:1});
}

function saveVerzoek(){
new Ajax.Request('verzoek2.php',{method:'post',parameters:Form.serialize('verzoekje')});
$('verzoek1').innerHTML = "<br /><br />Bedankt voor uw verzoekje.<br />( Als uw naam is ingevuld )";
setTimeout("new Ajax.Updater('verzoek1','verzoek1.php?d=35');",3000);
$('verzoekje').vnummer.value = '';
$('verzoekje').vverzoek.value = '';
}

function verzwis(wisv){
new Ajax.Request('verzoek2.php',{method:'get',parameters:'wis='+ wisv});
$('verzoek1').innerHTML = "<br /><br />Het verzoekje is gewist.";
setTimeout("new Ajax.Updater('verzoek1','verzoek1.php?d=34');",3000);
}

function leegnaam(){
if ($('verzoekje').vnaam.value == '-verplicht-'){
$('verzoekje').vnaam.value = '';
this.style.color='black';
}
}

function leegboek(){
if (document.gastboek.gnaam.value == '-verplicht-'){
$('gastboek').gnaam.value = '';
$('gastboek').gnaam.style.color='black';
}
}

t=1;
function dagtogg(wd){
for (t=0;t<=6;t++){
dn="dag"+t;
if (dn != wd){
new Effect.Shrink(dn,{duration:0.4});
} else {
new Effect.toggle(wd,'slide',{duration:1.0});
}
}
}

Event.observe(window,'load',function(){Event.observe('vnaam','click',leegnaam)});
Event.observe(window,'load',function(){Event.observe('marq','click',histo)});

function klur(dag,kl){
$(dag).style.background = 'url("'+kl+'.png")';
}

function fotonaam(fid){
tft=document.images.length-10;
fotonaam1(fid);
new Effect.BlindDown('fotogr',{duration:1.0});
}

function fotonaam1(fid){
var fcijf=parseFloat(fid.replace("foto", ''));
var corr=Math.floor((fcijf-1)/30)+1;
fc=fcijf+1;
fci=fcijf-1;
if (fc>(30*corr)){
fc=30*corr-29;
}
if (fc>(tft+30*(corr-1))){
fc=1;
}
if (fci<(30*corr-29)){
fci=30*corr;
}
if (fci>(tft+30*(corr-1))){
fci=tft;
}
var ft=$(fid).title;
if (ft){
$('fototxt').innerHTML = ft;
new Effect.BlindDown('fototxt',{duration:1.0});
} else {
$('fototxt').innerHTML = '';
new Effect.BlindUp('fototxt',{duration:0.5});
}
$('fotogr').innerHTML = '<img src='+$(fid).src+' id=dum><br /><a href=javascript:fotonaam1(\'foto'+fci+'\');>Vorige</a> - Foto '+fcijf+' - <a href=javascript:fotonaam1(\'foto'+fc+'\');>Volgende</a>';
Event.observe('dum','click',fotokl);
}

function fotokl(){
new Effect.BlindUp('fototxt',{duration:0.5});
new Effect.BlindUp('fotogr',{duration:0.9});
}

function fotoupd(var1,var2){
if (var2==99){
$('fotokader').innerHTML = '<iframe src=http://www.streamteamhaulerwijk.nl/fupload.php width=540px height=390px scrolling=no frameborder=0 ALLOWTRANSPARENCY></iframe>';
} else {
new Ajax.Updater('foto','foto.php?vn='+var1+'&mp='+var2);
}
}

function gboekschr(){
new Ajax.Updater('gboek1','gboek3.php');
new Effect.BlindDown('gboek1',{duration:1});
}

function greaktie(re){
new Ajax.Updater('gboek1','gboek4.php?re='+re);
new Effect.BlindDown('gboek1',{duration:1});
}

function gsluit(){
new Ajax.Request('gboek2.php',{method:'post',parameters:Form.serialize('gastboek')});
$('gboek1').innerHTML = "<br /><br /><br /><br />Bedankt voor uw bericht.<br />( Als uw naam is ingevuld )";
setTimeout("new Ajax.Updater('gboek2','gboek1.php?d=34');",1200);
setTimeout("sluit('gboek1');",5000);
}

function gsluit1(rk){
new Ajax.Request('gboek5.php',{method:'post',parameters:Form.serialize('gastboek')+'&re='+rk});
setTimeout("new Ajax.Updater('gboek2','gboek1.php?d=24');",1200);
setTimeout("sluit('gboek1');",100);
}

function gwis(gw){
var x=window.confirm("Bericht verwijderen ?")
if (x){
new Ajax.Request('gboek5.php',{method:'post',parameters:'gw='+gw});
setTimeout("new Ajax.Updater('gboek2','gboek1.php?d=24');",1200);
setTimeout("sluit('gboek1');",100);
}
}

function invoeg(Smiley){ 
var edit;
var HuidigeTekst = $('gastboek').gbericht.value;
edit = HuidigeTekst+Smiley+" ";
$('gastboek').gbericht.focus();
$('gastboek').gbericht.value=edit;
$('gastboek').gbericht.focus();
return;
}

function gbhoog(gp){
new Ajax.Updater('gboek2','gboek1.php?gp='+gp);
}

function txtupd(tx){
$('boven2').innerHTML=tx;
}

function txtup1(){
$('boven2').innerHTML='StreamTeam Haulerwijk';
}

function tgroot(nm){
if (imgr(nm)<45){
new Effect.Scale(nm,300,{scaleMode:{originalHeight:40,originalWidth:40},scaleFromCenter:'true'});
}
if (imgr(nm)>45){
exui(nm+'1');
tkl(nm);
}
if (nm!='jaap' && imgr('jaap')>45){tkl('jaap');exui('jaap1');}
if (nm!='janneke' && imgr('janneke')>45){tkl('janneke');exui('janneke1');}
if (nm!='max' && imgr('max')>45){tkl('max');exui('max1');}
if (nm!='janny' && imgr('janny')>45){tkl('janny');exui('janny1');}
if (nm!='robert' && imgr('robert')>45){tkl('robert');exui('robert1');}
if (nm!='wilma' && imgr('wilma')>45){tkl('wilma');exui('wilma1');}
if (nm!='jakob' && imgr('jakob')>45){tkl('jakob');exui('jakob1');}
if (nm!='hinke' && imgr('hinke')>45){tkl('hinke');exui('hinke1');}
if (nm!='erwin' && imgr('erwin')>45){tkl('erwin');exui('erwin1');}
if (nm!='tornado' && imgr('tornado')>45){tkl('tornado');exui('tornado1');}
if (nm!='vrijbuit' && imgr('vrijbuit')>45){tkl('vrijbuit');exui('vrijbuit1');}
if (nm!='johan' && imgr('johan')>45){tkl('johan');exui('johan1');}
}
function imgr(gt){
var hg = $(gt).clientHeight;
return hg;
}
function tkl(nn){
new Effect.Scale(nn,33,{scaleMode:{originalHeight:120,originalWidth:120}});
}
function exin(ei){
new Effect.Appear(ei);
}
function exui(ej){
new Effect.Fade(ej);
}

function spgroot(sp){
new Effect.Scale(sp,100);
}

var divs_to_fade = new Array('a1','a2','a3','a4','a5','a6','a7','a8','a9','a10','a11','a12','a13','a14','a15','a16');
var ln=divs_to_fade.length;
var i = 0;
function spswap() {
Effect.SlideUp(divs_to_fade[i],{duration:2});
i++;
if (i == ln) i = 0;
Effect.SlideDown(divs_to_fade[i],{duration:2});
}

function leegchat(){
if (document.chat.cnaam.value == '-verplicht-'){
document.chat.cnaam.value = '';
document.chat.cnaam.style.color='black';
}
}

function savechat(){
new Ajax.Request('chat2.php',{method:'post',parameters:Form.serialize('chat')});
setTimeout("new Ajax.Updater('chat1','chat1.php?d=34');",1000);
document.chat.cbericht.value = '';
setTimeout("new Effect.Highlight('chat41',{startcolor:'#ffff44',endcolor:'#5871ca'});",1200);
}

function voeg(Smiley){ 
var edit;
var HuidigeTekst = document.chat.cbericht.value;
edit = HuidigeTekst+Smiley+" ";
document.chat.cbericht.focus();
document.chat.cbericht.value=edit;
document.chat.cbericht.focus();
return;
}

function vidkl(){
new Effect.Scale('video',25,{scaleX:false,scaleY:true,scaleMode:{originalHeight:326,originalWidth:400}});

}

function vidgr(){
new Effect.Scale('video',400,{scaleX:false,scaleY:true,scaleFrom:100});}

function stopvid(){
setTimeout("$('av2').innerHTML='';",1000);
}

function ilnk(vn){
new Ajax.Updater('link2','link1.php?vn='+vn);
}