/* COOLSPEL JAVASCRIPTS */
Xoffset= 16; // modify these values to ...
Yoffset= 16; // change the popup position.

var old,skn,yyy=-1000,ns4,ns6,ie4;

function init() {
	/*if (top.location == location) {
		var winH=0, winW=0;
		if (navigator.appName=="Netscape") {
	  		winW = window.innerWidth;
	  		winH = window.innerHeight;
	  	}
	 	if (navigator.appName.indexOf("Microsoft")!=-1) {
	 		ie4=true;
	  		winW = document.body.offsetWidth;
	  		winH = document.body.offsetHeight;
	  	}
		
		if (winW<1000 || winH<800) {
			self.resizeTo(screen.availWidth,screen.availHeight);
			self.moveTo(0,0);
		}
	}*/
	//if (top.frames.length!=0) top.location=self.location;
	
	ns4=document.layers;
	ns6=document.getElementById&&!document.all;
	ie4=document.all;
	
	if (ns4)
		skn=document.popup_img;
	else if (ns6)
		skn=document.getElementById("popup_img").style;
	else if (ie4)
		skn=document.all.popup_img.style;
	if(ns4)document.captureEvents(Event.MOUSEMOVE);
	else{
		skn.visibility="visible";
		skn.display="none";
	}
	
	document.onmousemove=get_mouse;
}



function popup(dir) {
	window.open(dir+"vandaag-jarig.html",'a',"width=500, scrollbar=yes,height=270,toolbar=no,location=no,resizable=yes");
	return false;
}

function _popup(msg){
	var c="<TABLE BORDER=1 border=#000000  CELLPADDING=1 CELLSPACING=0 bgcolor=#FFFFFF style='border-collapse:collapse;'><TD ALIGN=center><FONT COLOR=black SIZE=2><img src='/lib/images/"+msg+"'></FONT></TD></TABLE>";
	yyy=Yoffset;
	if(ns4){skn.document.write(c);skn.document.close();skn.visibility="visible";}
	if(ns6){document.getElementById("popup_img").innerHTML=c;skn.display='';}
	if(ie4){document.all("popup_img").innerHTML=c;skn.display='';}
}

function get_mouse(e){
	var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
	skn.left=x+Xoffset+"px";
	var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
	skn.top=y+yyy+"px";
}

function _kill(){
	yyy=-1000;
	if(ns4){skn.visibility="hidden";}
	else if (ns6||ie4)
	skn.display="none";
}

function trug() {
	parent.location='index.php';
}

function agecheck() {
	var d=document.getElementById('age');
	if (d.value=="" || d.value<1900) d.value=2050;
}
function open_game_in_popup(id,b,h) {
	b=b+40;
	h=h+60;
	//w=(screen.width-b)/2;
	//h=(screen.height-h)/2;
	window.open('../lib/redir.php?id='+id+'&o=1','game_popup','height='+h+',width='+b);
}


function resizeToContents () {
	var x=document.getElementById('jarigen');
	var NS = (navigator.appName=="Netscape")?true:false;
 	
    iWidth = (NS)?window.innerWidth:document.body.clientWidth;
    iHeight = (NS)?window.innerHeight:document.body.clientHeight;
    window.resizeBy(x.clientWidth-iWidth,x.clientHeight-iHeight);
}

function zoek (item2) {
	alert(document.getElementById('zoekform').action);
	
	item=document.getElementById('zoekform');
	item.action="?naar="+document.getElementById('naar').value;
}

function showGame() {
	$('game_container').set('text','');
	$('game_container').set('styles',{'height':'0px', 'margin':'0px'});
	$('preloader').set('styles',{'width':orig_w, 'height':orig_h,'visibility':'visible'});
	$('reclame_game_onder').set('styles',{'width':rgo_w, 'height':rgo_h,'visibility':'visible'});
	$('rgo_content').set('styles',{'width':b,'height':h});
}

function preloadImage(_b,_h) {
	if (orig_w==0) {
		orig_w=$('preloader').getStyle('width');
		orig_h=$('preloader').getStyle('height');
		$('preloader').set('styles',{'width':1,'height':1});
		rgo_w=$('reclame_game_onder').getStyle('width');
		rgo_h=$('reclame_game_onder').getStyle('height');
		b=_b;h=_h;
		$('reclame_game_onder').set('styles',{'width':1,'height':1});
	}
	if (x<300) {
		$('loader_img').setStyle('width',x);
		x++;
		timeout=setTimeout('preloadImage()',40);
	} else {
		showGame();
	}
}

function mout(q) {
	q.src=q.src.replace(/overlay/, "button");
}

function mover(q) {
	q.src=q.src.replace(/button/, "overlay");
}

// game preloader
var x=1;
var timeout;
var orig_w=0,orig_h=0,rgo_w,rgo_h,b,h;