
/// DEFAULT JS SCRIPT

w33c = (document.getElementById)? true:false;
if (w33c) {
	nsb4 = false;
	ieb4 = false;
}
else if (!w33c) {
	nsb4 = (document.layers)? true:false;
	ieb4 = (document.all)? true:false;
}


if (w33c || ieb4 || nsb4) 	browserOK = true;

if (navigator.userAgent.indexOf("Firefox")!=-1)
	firefox = 1;
else
	firefox = 0;
	
if(location.hostname == "localhost")
	domain = 'localhost/www.postiljon.be/';
else
	domain = location.hostname+"/";

domain =  "http://"+domain;

function con(msg) {
	
	if(!msg)
		msg = "Let op: Weet u dit zeker ?";
        
	if(!confirm("Verwijderen?"))
		return false;
	
	return true;
}

function loadPopup(id) {
		
	if($('popup').visible())
		Effect.Fade('popup',{duration:0.2, queue:'front'});
		
	width = $(id).getStyle('width');
	
	$('popup').update($(id).innerHTML);
	$('popup').insert({bottom: '<div id="clear"></div><div class="close"><a href="#" onclick="Effect.BlindUp(\'popup\', {duration:0.3});">Sluit venster</a></div>'});
	Effect.Appear($('popup'), {queue:'end', duration: 0.5 });
	
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}



function showDiv(div) {
	new Effect.Appear('overlay2', { duration: 0.5, from: 0.0, to: 0.8 });
	var arrayPageSize = getPageSize();
	$("overlay2").setStyle({ width: arrayPageSize[0] });
	$("overlay2").setStyle( { height: arrayPageSize[1] });
	Effect.Grow(div,{duration: 0.3 } );
	new Draggable(div);
}

function closeDiv(div) {
		new Effect.Fade('overlay2', {duration: 0.2 });
		Effect.Fade(div,{duration: 0.2 });
		$(div).update('');
}


function placePicture(id) {
	
	var newImg = new Image();
	newImg.src = $('picture_'+id).src;

	var randomnumber=Math.floor(Math.random()*1500);
	if(randomnumber<800)
		randomnumber = randomnumber+1000;
	
	setTimeout("setPic('"+id+"')",randomnumber);

}

function setPic(id) {
	$('tmp_'+id).hide();
	$('tmp_'+id).update($('pic_'+id).innerHTML+" ");
	Effect.Appear('tmp_'+id, { to : 1 } );	
}

