function flash(obj,url,width,height){
	var s='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'">';
	s += '<param name="movie" value="'+url+'" />';
	s += '<param name="quality" value="high" />';
	s += '<param name="menu" value="false" />';
	s += '<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>';
	s += '</object>';
	$(obj).innerHTML = s;
}
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}
function bookmarkLink(txt,title,loc){
	var str = '';
	if(window.sidebar) {
		str = '<a href="#" id="bookmark" onclick="window.sidebar.addPanel(\''+title+'\',\''+loc+'\',\'\')">'+txt+'</a>';
	} else if(window.external) {
		str = '<a href="#" id="bookmark" onclick="window.external.AddFavorite(\''+loc+'\',\''+title+'\')">'+txt+'</a>';
	} else {
		str = 'degokkasten.com (druk <strong>CTRL-D</strong>)';
	}
	document.write(str);
};
function checkEnter(e){
	var characterCode;
	if(e && e.which){
		e = e;
		characterCode = e.which;
	} else {
		e = event;
		characterCode = e.keyCode;
	}
	if(characterCode == 13){
		reloadContent();
	}
}
function colort(){
	it++;
	if(it%2==0){
		$('note_text').style.color = '#FFFFFF';
	} else {
		$('note_text').style.color = org_color;
	}
}
var org_color,timet;
var it = 0;
function reloadContent(){
	var pay 	= [];
	var order 	= '';
	if($F('kw').length && !$('sort_1')){
		document.location.href='/?zoek='+escape($F('kw'));
	} else {
		if($('sort_1').checked){
			order = 'populariteit';
		} else if($('sort_2').checked){
			order = 'laatst-toegevoegd';
		}
		var inputs = $A($('cont_betalen').getElementsByTagName('input'));
		inputs.each(function(o){
			if(o.checked) pay.push(o.id.split('_')[1]);
		});
		$('note_text').innerHTML = 'Het overzicht wordt geladen...';
		if(!org_color){
			org_color = $('note_text').style.color;
		}
		if(!timet){
			timet = setInterval('colort()',50);
			$('note').style.backgroundImage = 'url(/images/note_bg_alert.jpg)';
		}
		new Ajax.Updater('content_holder','http://www3.degokkasten.com/includes/php/content.php?betaal-met='+pay.toString()+'&sorteer-op='+order+'&zoek='+$F('kw'),{parameters:$H().toQueryString(),onComplete:function(r){
			clearInterval(timet);
			timet = false;
			$('note_text').style.color = org_color;
			$('note').style.backgroundImage = 'url(/images/note_bg.jpg)';
			if(r.responseText==''){
				$('note_text').innerHTML = 'Er zijn geen gokkasten gevonden die aan de gestelde criteria voldoen...';
			} else {
				$('note_text').innerHTML = 'Hieronder het overzicht van de <strong>gokkasten</strong> waarmee je kunt betalen met <strong>'+(pay.length==0?'telefoon,ideal,creditcard,telepay':pay.toString())+'</strong>'+(order?(' gesorteerd op <strong>'+order.split('-').join(' ')+'</strong>.'):'.')
			}
		}});
	}
}
var pics = ['game_bg_hover.jpg','new_hover.png','new.png','note_bg_alert.jpg','play_hover.jpg'];
var ref = [];
for(a in pics){
	ref[a] = new Image();
	ref[a].src = 'http://www3.degokkasten.com/images/'+pics[a];
}
function mouseX(evt) {
	if (!evt) evt = window.event; 
	if (evt.pageX) { 
		return evt.pageX; 
	} else if (evt.clientX) {
		return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); 
	} else { 
		return 0;
	}
}
function mouseY(evt) {
	if (!evt) evt = window.event;
	if (evt.pageY) {
		return evt.pageY;
	} else if (evt.clientY) {
		return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	} else { 
		return 0;
	}
}
function follow(evt) {
	$('tip_container').style.display = 'block';
	if ($('tip_container')) {
		var obj 		= $('tip_container').style;
		obj.left 		= (parseInt(mouseX(evt))+15) + 'px';
		obj.top 		= (parseInt(mouseY(evt))+15) + 'px';
	}
}
function showPayDetails(linkObj,id){
	var q = {game_id:id,language:lang};
	$('tip_container').innerHTML = (lang=='nl')?'Laden...':'Loading...';
	new Ajax.Updater('tip_container','http://www4.eurogokkasten.eu/getPayOptions.php',{parameters:$H(q).toQueryString()});
	document.onmousemove = follow;
}
function hidePayDetails(){
	document.onmousemove = null;
	$('tip_container').style.display = 'none';
	$('tip_container').innerHTML = '';
}
function uniqueID(){
	var seed = new String(Math.random()+Math.random());
	return seed.split('.').join('');
}
function playGame(page,width,height){
	var sw = screen.availWidth;	
	var sh = screen.availHeight;
	var l = (sw-width)/2;
	var t = (sh-height)/2;
	var win = window.open(page,'win'+uniqueID(),'width='+width+',height='+height+',left='+l+',top='+t+',resizable=yes,scrollbars=no,location=no,status=no,screenX='+l+',screenY='+t+',');
	win.focus();
}
function getURL(url,win){
	window.open(url,win);
}
function str_replace(searchStr,replaceStr,subjectString){
	return (subjectString.split(searchStr)).join(replaceStr);
}
function queryVarExists(theVar){
	var loc = new String(document.location);
	if(loc.indexOf('?')!=-1){
		var qstring = loc.split('?')[1];
		var vars = qstring.split('&');
		for(var i=0;i<vars.length;i++){
			if(vars[i].substring(0,vars[i].indexOf('=')) == theVar) return true;
		}
		return false;
	} else {
		return false;
	}
}
function getQueryVar(theVar){
	var loc = new String(document.location);
	if(loc.indexOf('?')!=-1){
		var qstring = loc.split('?')[1];
		if(qstring.indexOf('&')!=-1){
			var varSets	= qstring.split('&');
			var varname;
			for(var i=0;i<varSets.length;i++){
				varname = varSets[i].substring(0,varSets[i].indexOf('='));
				if(varname == theVar){
					return varSets[i].substring(varSets[i].indexOf('=')+1,varSets[i].length);
				}
			}
			return null;
		} else {
			if(qstring.substring(0,qstring.indexOf('='))==theVar){
				return qstring.substring(qstring.indexOf('=')+1,qstring.length);
			}
			return null;
		}
	} else {
		return null;
	}
}
function orderBy(type){
	var loc = new String(document.location);
	var newloc;
	if(queryVarExists('order')){
		newloc = str_replace('='+getQueryVar('order'),'='+type,loc);
	} else {
		if(loc.indexOf('?')==-1){
			newloc = loc+'?order='+type;
		} else {
			newloc = loc+'&order='+type;
		}
	}
	window.location.replace(newloc);
}
function getCookie(c_name){
	if(document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name+'=');
		if(c_start!=-1){ 
			c_start=c_start + c_name.length+1; 
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return '';
};
function createCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ){
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
};
function changePayMethod(type){
	var loc = new String(document.location);
	var newloc;
	if(type=='null'){
		newloc = str_replace('pay_method='+getQueryVar('pay_method'),'',loc);
	} else {
		if(queryVarExists('pay_method')){
			newloc = str_replace('='+getQueryVar('pay_method'),'='+type,loc);
		} else {
			if(loc.indexOf('?')==-1){
				newloc = loc+'?pay_method='+type;
			} else {
				newloc = loc+'&pay_method='+type;
			}
		}
	}
	window.location.replace(newloc);
}
function clickCount(type,id){
	var loc = String(document.location.href).split('');
	var u	= '';
	var c 	= 0;
	for(var i=0;i<loc.length;i++){
		if(c==3) break;
		if(loc[i]=='/') c++;
		u += loc[i];
	}
	try{ new Ajax.Request(u+'clickCount.php',{parameters:$H({click_type:type,game_id:id,domain:u}).toQueryString()});} catch(e){};
}