

function lampPos() {
		
	var lH = 679; 					// Lamp Height

	if (Browser.Engine.trident)
	{
		tM = 0; 				// Top Margin is zero in IE.
	}
	else
	{
		tM = 45; 				// Top Margin
	}

	var lD = $('lamp');				// Lamp Div


	var fP = $('footer').getPosition().y;		// footer pos
	var fH = 52 + 90; 				// footer height + padding.

	var wH = window.getSize().y;			// Window Height
	var useH;


	// Get the position in the window...
	var lp = (wH - lH) + (getScroll().y) - tM;


	// Get the pos relative to the footer.
	var ftP = ((fP + fH) - lH) - tM;


	// figure out what height to use..
	if (lp>ftP)
	{
		useH = lp;
	}
	else
	{
		useH = ftP;
	}



	if (useH > 0) {
		lD.setStyles({
			'top':useH
		});
	}
}


function htp()
{
	if ($('howtoplayul'))
	{
		$('howtoplayul').setStyles({'display': 'block'});
		var lis = $$('ul#howtoplayul li');
		var nextPos = 0;
		var curPos = 0;
		var count = 0;
		lis.each(function(item) {
			if (count != 0)
			{
				item.setStyles({'display': 'none'});
			}
			
			count++;
		});
		
		
		
		
		$('leftLink').addEvent('click', function() {
			if ( (curPos-1) >= 0)
			{
				nextPos = curPos - 1;
			}
			else
			{
				nextPos = (lis.length -1);
			}

			lis[curPos].setStyles({'display': 'none'});
			lis[nextPos].setStyles({'display': 'block'});
			
			curPos = nextPos;
			
			lampPos();
			
		});
		
		
		
		$('rightLink').addEvent('click', function() {
			if ( (curPos+1) <= (lis.length-1))
			{
				nextPos = curPos + 1;
			}
			else
			{
				nextPos = 0;
			}

			lis[curPos].setStyles({'display': 'none'});
			lis[nextPos].setStyles({'display': 'block'});
			
			curPos = nextPos;
			
			lampPos();
			
		});
				
	}
	
	
	
}

function fnOpen(sHtml) {
	var nWidth = 768;
	var nHeight = 550;
	var nLeftPos = (screen.width) ? (screen.width/2)-(nWidth/2) : 0;
	var nTopPos = (screen.height) ? (screen.height-nHeight)/2 : 0;
	var sFeatures = "width="+nWidth+", height="+nHeight+", left="+nLeftPos+", top="+nTopPos+", status=0, location=0, scrollbars=no, resizable=0, menubar=0";
	newwindow = window.open(sHtml,"pop",sFeatures);
	if (window.focus) {newwindow.focus()}
	return false;
}


window.addEvents({
	'domready': function() {
		if ($('howtoplayul'))
		{
			$('howtoplayul').setStyles({'display': 'none'});
		}
		lampPos();
		htp();
	},
	'resize': function() {
		lampPos();
	}
});

