var closebuttonstatus = 'yes';
$(document).ready(function() {
	if (athome==true) {
		setTimeout("gotohome();",4000);
	}
	$('.hidefaq').hide();
	$('#telefoon').click(function(){
		$('#message').hide();
		setTimeout("$('#content').fadeIn(250);",400);
		$('#telefoon').animate({
			width: '755px',
			height: '413px',
			marginTop: '20px'
		}, 500 );
		$('#supercontainer').css('background-image','url(images/buttonbarbg.png)');
		$('#menu').css('visibility','visible');
	});
	$('.submenu').hide();
	$('#content a[href*=.pdf]').each(function(){
		this.innerHTML+=' (pdf)';
	});
	$('#content a[href*=.PDF]').each(function(){
		this.innerHTML+=' (pdf)';
	});
	$('#content a:not(img)').each(function(){ // waarom werkt dit niet :(
		if (this.href.indexOf('atreem.com')==-1 && this.href.indexOf('http://')!=-1) {
			//this.className='external';
		}
	});
	//$('.button > a').mouseover(function(){
	//	if (location.href!=this) { location.href=this; } // blergh
	//});
	$('#content a[href*=.flv]').each(function(){
		var x = this.href;
		this.onclick=function(){
			$('#content').fadeOut();
			$('#video').fadeIn();
			$('#video').attr('href',x);
			flowplayer('video', {src: "flowplayer-3.1.3.swf", wmode: 'opaque'});
			$('#closeimage').show();
			$('#closebutton').show();
			closebuttonstatus = 'yes';
		}
		this.href='javascript:void(0)';
	});
	$('#content a[href*=.gif]').each(function(){
		var x = this.href;
		this.onclick=function(){
			$('#content').fadeOut();
			$('#video').fadeIn();
			$('#video').attr('href',x);
			$('#video').html('<img src="'+x+'" width="515" height="350" alt="" />');
			$('#closeimage').show();
			$('#closebutton').show();
			closebuttonstatus = 'no';
		}
		this.href='javascript:void(0)';
	});
	$('#content a[href*=.mp3]').each(function(){
		var x = this.href;
		this.onclick=function(){
			$('#content').fadeOut();
			$('#video').fadeIn();
			$('#video').attr('href',x);
			flowplayer('video', {plugins: { audio: { url: 'flowplayer.audio.swf' } } ,  src: "flowplayer-3.1.3.swf"});
			$('#closeimage').show();
			$('#closebutton').show();
			closebuttonstatus = 'yes';
		}
		this.href='javascript:void(0)';
	});
	$('#content a[href*=.jpg] img').parent().facebox();
	$('#content a[href*=.gif] img').parent().facebox();
	$('#content a[href*=.png] img').parent().facebox();
	//$('a[rel*=facebox]').facebox();
	
	if (home) { return; }
	if (zoomin || big) {
		zoom();
/*		$('#menu a').each(function(){
			if (this.href.indexOf('?')==-1) {
				this.href+='?z';
			}
		});
*/
	} else if (zoomout || small) {
		zoomout();
	}
});

function hidevideo() {
	$('#closebutton').hide();
	$('#closeimage').hide();
	$('#content').fadeIn();
	$('#video').hide();
	if (closebuttonstatus=='yes') {
		$f().stop();
	}
}

function zoomout() {
	$('#content').css('width','900px');
	$('#content').css('height','650px');
	$('#content').css('marginLeft','0px');
	$('#content').css('marginTop','0px');
	$('#content').animate({
		width: '485px',
		height: '338px',
		marginLeft: '221px',
		marginTop: '33px',
		borderWidth: '0px'
	}, newsspeed);
	$('#logo').hide();
	$('#logo').fadeIn(newsspeed);
}

function zoom() {
	$('#content').animate({
		//border: '3px solid #FFF',
		width: '900px',
		height: '650px',
		//paddingLeft: '200px',
		marginLeft: '0px',
		marginTop: '0px'
	}, newsspeed);
	$('#logo').fadeOut(newsspeed);
}

function gotohome() {
	$('#telefoon').animate({
		width: '755px',
		height: '413px',
		marginTop: '20px'
	}, 500 );
	$('#message').hide();
	setTimeout("$('#content').fadeIn(250);",400);
	$('#supercontainer').css('background-image','url(images/buttonbarbg.png)');
	$('#menu').css('visibility','visible');
}

function menuhover(id) {
	if (document.getElementById('submenu'+id).style.display!='none') {
		return;
	}
	$('.submenu').hide();
	$('.submenunohide').hide();
	$('#submenu'+id).fadeIn(250,function() {
		$('.submenu').hide();
		$('.submenunohide').hide();
		$('#submenu'+id).show();
	});
}
