
	var lastX = 0;
	var lastY = 0;

// START - FAQ script

	// expandable articles (FAQ)
	function expandCollapse(element){
		image = element.firstChild;
		if(!image.src){
			image = image.nextSibling;
		}
	
		div = element.nextSibling;
		if(div.style == undefined){
			div = div.nextSibling;
		}
		
		if (div.style.display == 'none') {
			div.style.display = 'block';
			image.src = '/bin_images/oben.gif';
		} else {
			div.style.display = 'none';		
			image.src = '/bin_images/rechts.gif';
		}
	} 

	// make them clickable
	// call via: addEvent(window, 'load', function() { collapseableDivs('FAQuestion', 'FAQAnswer') });
	function collapseableDivs(sClickDiv, sCollapseDiv) {
		if (sClickDiv == undefined || sClickDiv == '') sClickDiv = 'FAQuestion';
		if (sCollapseDiv == undefined || sClickDiv == '') sCollapseDiv = 'FAQAnswer';
			
		a = $$('div.'+sClickDiv);
		for (i = 0; i < a.length; i++) {
			a[i].onclick = function() { expandCollapse(this);  };
		}
		
		b = $$('div.'+sCollapseDiv);
		for (i = 0; i < b.length; i++) {
			b[i].style.display = "none";
		}
	}

// END - FAQ script

	
	// attaches an function to an object when event is called 
	// cannot have parameters
	// example: addEvent(window, 'load', doSomething);
	// example: addEvent(window, 'load', function() { doSomething(param, param2); } );
	function addEvent( obj, type, fn ) {
	   if (obj.addEventListener) {
	      obj.addEventListener( type, fn, false );
	   } else if (obj.attachEvent) {
	      obj["e"+type+fn] = fn;
	      obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
	      obj.attachEvent( "on"+type, obj[type+fn] );
	   }
	}

	// closes popup 
	function closeMessage() {
		if(myiframe = document.getElementById('myIframe'))
			myiframe.parentNode.removeChild(myiframe);
		nd();
		nd();
    }
	
	// generates HTML code for Buttons
	function makeButton(button_text, button_action, classnumber, tablealign, submit, button_title){
		if (tablealign == undefined)
			tablealign = 'right';
		if (button_title == undefined)
			button_title = '';
			
		var action = '';
		var text = '';

		if (submit != undefined && submit != false) {
			action = '<input class="button_main'+classnumber+'_submit" style="border:none;" type="submit" name="'+button_title+'" width="100%" value="'+button_text+'" />';
			submit = '_submit';
			button_action = '';
		} else {
			action = '<div nowrap="nowrap" valign="middle" alt="'+button_title+'" title="'+button_title+'">&nbsp;&nbsp;'+button_text+'&nbsp;&nbsp;</div>';
			if (button_action.search('/javascript/') == -1)
				button_action = 'onclick="javascript:document.location.href=\''+button_action+'\';"';
			else
				button_action = 'onclick="'+button_action+'"';
			submit = '';
		}
		
		text=text+'<table class="button_'+classnumber+'" style="border:none; padding:0px; margin:0px;" border="0" cellpadding="0" cellspacing="0" align="'+tablealign+'">';
		text=text+'<tr>';
		text=text+'	<td class="button_left'+classnumber+'" nowrap="nowrap" style="cursor:pointer;" '+button_action+'>&nbsp;</td>';
		text=text+'	<td class="button_main'+classnumber+submit+'" nowrap="nowrap" valign="middle" style="cursor:pointer;" '+ button_action +'>'+action+'</td>';
		text=text+'	<td class="button_right'+classnumber+'" nowrap="nowrap" style="cursor:pointer;" '+button_action+'>&nbsp;</td>';
		text=text+'</tr>';
		text=text+'</table>';
		
		return text;
	}
	
	// Generates HTML code for popup
	function makeMessage(msg_title, msg_text, button_text, button_action, classname, scndbutton_text, scndbutton_action){
		// default values
		if (classname == undefined) classname = '';
		if (button_text != undefined || button_action != undefined) {
			if (button_text == undefined)	button_text = 'OK';
			if (button_action == undefined) button_action = "javascript:closeMessage();";
		}
		if (scndbutton_text != undefined || scndbutton_action != undefined) {
			if (scndbutton_text == undefined) {
				if (GLOBAL_CLOSE_TEXT != undefined)
					scndbutton_text = GLOBAL_CLOSE_TEXT;
				else
					scndbutton_text = 'Close';
			}
			if (scndbutton_action == undefined) scndbutton_action = "javascript:closeMessage();";
		}
		
		if (classname == '' || classname == 'welcome') buttontype = 4;
		else buttontype = 6;

		if (typeof(pagetype) != "undefined" ) { temppt = "affiliate"  } else { temppt = "regular"}

		if ((classname != 'affiliate') && (temppt != "affiliate")) {
			text='';	
			text=text+'<table width="400" border="0" cellpadding="0" cellspacing="0" class="default_popup_window '+classname+'_window">';
			
			text=text+'<tr><td class="default_popup_bar_left '+classname+'_bar_left">&nbsp;</td>';
			text=text+'<td class="default_popup_bar_main '+classname+'_bar_main">';
			text=text+'<img src="grafik/pixel.gif" onclick="javascript:closeMessage();" class="default_popup_closebutton '+classname+'_closebutton" alt="" />';
			text=text+'</td>';
			text=text+'<td class="default_popup_bar_right '+classname+'_bar_right">&nbsp;</td></tr>';
			
			text=text+'<tr><td class="default_popup_main_left '+classname+'_main_left">&nbsp;</td>';
			text=text+'<td class="default_popup_area '+classname+'_area"><p>';
			if (msg_title != undefined && msg_title != '')
				text=text+'<b id="popup_title">'+msg_title+'</b><br/><br/>';
			text=text+msg_text+'</p>';
			text=text+'</td><td class="default_popup_main_right '+classname+'_main_right">&nbsp;</td></tr>';
			
			text=text+'<tr>';
			text=text+'<td class="default_popup_bottom_left '+classname+'_bottom_left">&nbsp;</td>';
			text=text+'<td class="default_popup_bottom_main '+classname+'_bottom_main" align="center">';
			if (scndbutton_action != undefined && scndbutton_text != undefined ) {
				text=text+makeButton(scndbutton_text, scndbutton_action, 5, 'left');
				text=text+makeButton(button_text, button_action, buttontype, 'right');		
			} else if (button_action != undefined && button_text != undefined ) {
				text=text+'<center>'+makeButton(button_text, button_action, buttontype, 'center')+'</center>';
			}
			text=text+'</td><td class="default_popup_bottom_right '+classname+'_bottom_right">&nbsp;</td>';
			text=text+'</tr>';
			text=text+'</table>';
		} else {
			text='';
			text=text+'<table border="0" cellspacing="0" cellpadding="10" width="100%" class="alertwindow">';
		    text=text+'<tr><td class="adbar" align="right"><a href="javascript:closeMessage();">';
			text=text+'<img src="/bin_images/912" border="0" style="position:relative; top:2px;" /></a>&nbsp;';		
			text=text+'</td></tr>';
			
			text=text+'<tr><td class="alertarea '+classname+'_area"><p>';
			if (msg_title != undefined && msg_title != '')
				text=text+'<b id="popup_title">'+msg_title+'</b><br /><br />';
			text=text+msg_text+'</p>';
			text=text+'</td></tr>';
			
			text=text+'<tr><td class="alertbutton '+classname+'_bottom_main" align="center">';
			text=text+'<center>'+makeButton(button_text, button_action, 2, 'center')+'</center>';
			text=text+'</td></tr>';
			
			text=text+'</table>';
			text=text+'<iframe id="myIframe" src="empty.html" width="100%" height="100%" frameborder="0" border="0" style="float:left; border:none; background-color:black; z-index:-1; position:absolute; top:0px; left:0px;"></iframe>';
			return text;
		}
		return text;
	}
	
	// array check
	function isArray(obj) {
	   if (obj == undefined || typeof(obj) != 'object' || obj.constructor.toString().indexOf("Array") == -1)
	      return false;
	   else
	      return true;
	}
	
// START - gallery
	var image_gallery_index;
	var image_gallery_text;
	var image_gallery_pics;
	
	// next button function within gallery popup
	function openpopupnext(step) {
		if (image_gallery_index == undefined)
			image_gallery_index = 0;
		if (step == undefined)
			step = 1;
			
		image_gallery_index += step;
		if (image_gallery_index >= image_gallery_pics.length)
			image_gallery_index = 0;
		if (image_gallery_index < 0)
			image_gallery_index = image_gallery_pics.length-1;
		
		document.getElementById('popup_title').innerHTML = image_gallery_text[image_gallery_index];
		document.getElementById('popup_image').src 		 = image_gallery_pics[image_gallery_index];
		document.getElementById('popup_image').lowsrc	 = image_gallery_pics[image_gallery_index]+"&thumb=1";
	}
	
	// gallery popup
	function openpopup(image, text, idx) {
		if (image != undefined && text != undefined && image != '' && text != '') { // && (isArray(image) && isArray(text)) || (!isArray(image) && !isArray(text))) {
			image_gallery_pics = image;
			image_gallery_text = text;
		} else if (!isArray(image_gallery_pics) || !isArray(image_gallery_text)) {
			image_gallery_pics = new Array('/bin_images/284', '/bin_images/283', '/bin_images/282', '/bin_images/286', '/bin_images/287', '/bin_images/285');
			image_gallery_text  = new Array('Table', 'The Lobby: No Limit', 'The Lobby: Fixed Limit', 'Tournament Lobby', 'Game Statistics', 'Cashier');
		} 
		
		if (idx == undefined)
			idx = 0;
		image_gallery_index = idx;
		
		var content;
		
		if (isArray(image_gallery_pics) && isArray(image_gallery_text)) {
			content = '<img src="'+image_gallery_pics[idx]+'" lowsrc="'+image_gallery_pics[idx]+'&thumb=1" id="popup_image" alt="Screenshot" title="Screenshot" />';
			content = makeMessage(image_gallery_text[idx], content, '&nbsp&nbsp;&gt;&gt;&nbsp;&nbsp;', "javascript:openpopupnext(1);", 'imagepopup', '&nbsp;&nbsp;&lt;&lt;&nbsp;&nbsp;', "javascript:openpopupnext(-1);");
		} else {
			content = '<img src="'+image+'" lowsrc="'+image+'&thumb=1" alt="Click to close" title="Click to close" style="cursor:pointer;" onclick="javascript:closeMessage();" /><br />&nbsp;';
			content = makeMessage(text, content, undefined, undefined, 'imagepopup');
		}
		overlib(content,FULLHTML,STICKY,WRAP, RELX, 220, RELY, 20);
	}
// END - gallery
	
	// changes action within a form and submits it
	function sendAction(form,action){
		document.forms[ form ].elements['action'].value = action;
		document.forms[ form ].submit();
	}
	
	// generates a GET query out of an form
	function makeQuery(f){
		query = '';
		for (var i = 0; i < f.length ; i++) {
			type = f.elements[i].type;
			name = f.elements[i].name;
			switch(type){
				case "select-multiple":
					for(n=0;n<f.elements[i].length;n++){
						if(f.elements[i].options[n].selected)
							query = query + '&' + name + '=' + f.elements[i].options[n].value;
					}
				break;
				case "select-one":
					if(f.elements[i].options != undefined && f.elements[i].options.length != undefined)
						query = query + '&' + name + '=' + f.elements[i].options[ f.elements[i].selectedIndex ].value;
				break;
				case "checkbox":
					if(f.elements[i].checked)
						query = query + '&' + name + '=' + f.elements[i].value;
				break;
				case "radio":
					if(f.elements[i].checked)
						query = query + '&' + name + '=' + f.elements[i].value;
				break;
				case "submit":
				break;
				default:
					query = query + '&' + name + '=' + escape(f.elements[i].value);
				break;
			}
		}
		return query;
	}
		
	/* add/changes or removes a css klass
		a	    defines the action you want the function to perform.
		o	    the object in question.
		c1	    the name of the first class
		c2	    the name of the second class
	*/
	function jscss(a,o,c1,c2) {
		switch (a){
			case 'swap':
			  o.className=!jscss('check',o,c1)?o.className.replace(c2,c1): o.className.replace(c1,c2);
			break;
			case 'add':
			  if(!jscss('check',o,c1)){o.className+=o.className?' '+c1:c1;}
			break;
			case 'remove':
			  var rep=o.className.match(' '+c1)?' '+c1:c1;
			  o.className=o.className.replace(rep,'');
			break;
			case 'check':
			  return new RegExp('\\b'+c1+'\\b').test(o.className)
			break;
		}
	}
	
	//
	function replaceInput(id, name, css) {
	    var newInput = document.createElement("input");
	    newInput.setAttribute('type','password');
	    newInput.setAttribute('id',id);
	    newInput.setAttribute('name',name);
		
	    var pwfield = document.getElementById(id);
	
		//special code to support ie !
		var temp = document.createAttribute("class");
		temp.nodeValue = css;
		newInput.setAttributeNode(temp);
	
	    pwfield.parentNode.appendChild(newInput);
	    pwfield.parentNode.removeChild(pwfield);
	    var newElement = document.getElementById(id);
	    newElement.focus();
	}
	
	// display or hide a dom element
	function setVisible(layer, on) {
		if (on) {
			if (document.getElementById) {
				document.getElementById(layer).style.visibility = 'visible';
				document.getElementById(layer).style.display = 'inline';
			} else if (document.layers) {
				document.layers[layer].visibility = 'show';
				document.layers[layer].display = 'inline';
			} else {
				document.all[layer].style.visibility = 'visible';
				document.all[layer].style.display = 'inline';
			}
		} else {
			if (document.getElementById) {
				document.getElementById(layer).style.visibility = 'hidden';
				document.getElementById(layer).style.display = 'none';
			} else if (document.layers) {
				document.layers[layer].visibility = 'hide';
				document.layers[layer].display = 'none';
			} else {
				document.all[layer].style.visibility = 'hidden';
				document.all[layer].style.display = 'none';
			}
		}
	}
	
// START - Time Script
	// sets the intveral for updating the clock
	function setClockInterval() {
		// reset old timer
		if (clock_timer) {
			clearInterval(clock_timer);
			clock_timer = null;
		}
		
		// only start clock if there is one
		if (document.getElementById("clock") != undefined) {
			clock_timer = setInterval('updateClock('+clock_updates+')', clock_updates );
			updateClock(1);
		}
	}
	
	function updateClock(stepcount) {
		var absolute = clock_currenttime.getTime() + stepcount;
		clock_currenttime.setTime(absolute);
		var currentTime = clock_currenttime;
		
		var currentHours = currentTime.getHours ( );
		var currentMinutes = currentTime.getMinutes ( );
		var currentSeconds = currentTime.getSeconds ( );
		var timeOfDay = ''
		
		// Pad the minutes and seconds with leading zeros, if required
		currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours;
		currentMinutes = ":" + ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
		currentSeconds = ":" + ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
		
		if (clock_12hours == true) {
			// Choose either "AM" or "PM" as appropriate
			timeOfDay = ( currentHours < 12 ) ? " AM" : " PM";
			// Convert the hours component to 12-hour format if needed
			currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
			// Convert an hours component of "0" to "12"
			currentHours = ( currentHours == 0 ) ? 12 : currentHours;
		}
		if (clock_hideseconds)
			currentSeconds = "";
		
		// Compose the string for display
		var currentTimeString = currentHours + currentMinutes + currentSeconds + timeOfDay;
		
		// Update the time display
		if (document.getElementById && document.getElementById("clock") && document.getElementById("clock").firstChild) {
			document.getElementById("clock").firstChild.nodeValue = currentTimeString;
			
		} else if (document.getElementById && document.getElementById("clock")) {
			document.getElementById("clock").innerHTML = currentTimeString;
			
		} else if (document.layers && document.layers.clock){
			document.layers.clock.document.open();
			document.layers.clock.document.write(currentTimeString);
			document.layers.clock.document.close();
			
		} else if (document.all && document.all.clock != undefined && document.all.clock.innerHTML != undefined) {
			document.all.clock.innerHTML = currentTimeString;
			
		} else {
			clearInterval(clock_timer);
			clock_timer = null;
		}
	}
	
// END - Time Script

	
	
/**************************************************
 * dom-drag.js
 * 09.25.2001
 * www.youngpup.net
 * Script featured on Dynamic Drive (http://www.dynamicdrive.com) 12.08.2005
 **************************************************
 * 10.28.2001 - fixed minor bug where events
 * sometimes fired off the handle, not the root.
 **************************************************/

var Drag = {

	obj : null,

	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
	{
		o.onmousedown	= Drag.start;

		o.hmode			= bSwapHorzRef ? false : true ;
		o.vmode			= bSwapVertRef ? false : true ;

		o.root = oRoot && oRoot != null ? oRoot : o ;

		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";
		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

		o.minX	= typeof minX != 'undefined' ? minX : null;
		o.minY	= typeof minY != 'undefined' ? minY : null;
		o.maxX	= typeof maxX != 'undefined' ? maxX : null;
		o.maxY	= typeof maxY != 'undefined' ? maxY : null;

		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;

		o.root.onDragStart	= new Function();
		o.root.onDragEnd	= new Function();
		o.root.onDrag		= new Function();
	},

	start : function(e)
	{
		var o = Drag.obj = this;
		e = Drag.fixE(e);
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		o.root.onDragStart(x, y);

		o.lastMouseX	= e.clientX;
		o.lastMouseY	= e.clientY;

		if (o.hmode) {
			if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;
			if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;
		} else {
			if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
		}

		if (o.vmode) {
			if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;
			if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;
		} else {
			if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
			if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
		}

		document.onmousemove	= Drag.drag;
		document.onmouseup		= Drag.end;

		return false;
	},

	drag : function(e)
	{
		e = Drag.fixE(e);
		var o = Drag.obj;

		var ey	= e.clientY;
		var ex	= e.clientX;
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		var nx, ny;

		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

		if (o.xMapper)		nx = o.xMapper(y)
		else if (o.yMapper)	ny = o.yMapper(x)

		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
		Drag.obj.lastMouseX	= ex;
		Drag.obj.lastMouseY	= ey;

		Drag.obj.root.onDrag(nx, ny);
		return false;
	},

	end : function()
	{
		document.onmousemove = null;
		document.onmouseup   = null;
		Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
									parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
		Drag.obj = null;
	},

	fixE : function(e)
	{
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
};
