var win = null;
gameWindow=function(page,name,w,h,features,id)
{
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	var settings = 'height=' + h + ',';
	settings += 'width=' + w + ',';
	settings += 'top=' + wint + ',';
	settings += 'left=' + winl + ',';
	settings += features;
	win = window.open('/showgame/'+id,name,settings);
	win.window.focus();
}

newWindow=function(page,name,w,h,features,id)
{
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	var settings = 'height=' + h + ',';
	settings += 'width=' + w + ',';
	settings += 'top=' + wint + ',';
	settings += 'left=' + winl + ',';
	//settings += 'scrollbars=';
	settings += features;
	win = window.open(page,name,settings);
	win.window.focus();
}



$(document).ready(function(){
	/*
		Makes CURVEY CORNERS WORK FOR HEIGHT DIFFERENCE AS BG IMAGE
	*/

	//For Restaurants Page
	$('.blockheight a img').each(function() {
		$(this).parent('a').height($(this).height());
		$(this).hide();
	});
	
	//Food and drink
	$('.foodheight img').each(function() {
		$(this).parent('.foodheight').height($(this).height());
		$(this).hide();
	});	
	
	
	/*
	*	HOMEPAGE CODE
	*/
	//height fix for rounded corners hack
	$('.homeheight dd').each(function() {
		var imgHeight = $(this).children('a').children('img').height();
		if(imgHeight == 0 || imgHeight == null)imgHeight = 110;
		$(this).children('a').height(imgHeight);
	});	
	$('.homeheight dd a img').hide();

	
	
	
	
	
	
	
	
	/* POPUP EVENT (replacement for target="_blank") */
	//$( ".popup" ).live( "click", function( event ) {
	$( ".popup" ).click(function( event ) { 
		event.preventDefault();
		var sTarget = $( this ).attr( "href" );
		var iWidth = 1024;
		var iHeight = 768;
		var iScrollbars = 2;
		var iLeft = (screen.width)?(screen.width-iWidth)/2:100;
		var iTop = (screen.height)?(screen.height-iHeight)/2:100;
		var sSettings='width='+iWidth+',height='+iHeight+',top='+iTop+',left='+iLeft+',scrollbars='+iScrollbars+',location=yes,directories=no,status=yes,menubar=yes,toolbar=yes,resizable=yes';
		win=window.open( sTarget, "", sSettings );
	} );
	
	
	
	
	
	//SHOP
	
	//Popup message for orders under £25 for free delivery
	/*
	$totalValue = $('#total-cost-hidden').val();
	$currency = $('#currency-hidden').val();
	
	$('#proceed-to-checkout').click(function(){
											 
		if($totalValue < 25)
			if(!confirm("if you spend over " + $currency + "25 then postage is free, still proceed to checkout?"))
			return false;
		return true;
});
	*/
	
});

