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 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://www2.slotparadijs.com/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 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){};
}
