$().ready(function() {
  $('#playarea').jqm({ajax: '/inc/showgame.php?g=' + $('a.playGame').attr('id'), trigger: 'a.playGame',
					target: $('#playarea div#hiddendiv'),
					modal: true,
					overlay: 80,
					onShow: function(h) {
					/* callback executed when a trigger click. Show notice */
					h.w.css('opacity',1).fadeIn( ); 
						
						// Ajax time
						$(document).everyTime(60000,function(i){
							jQuery.ajax({
							  url: "/inc/getgames.php?field=stillplaying&gid=" + $('a.playGame').attr('id'),
							  cache: false,
							  success: function(html){
								// Do nothing right now
							  }
							})
						})

					
					},
					
					onHide: function(h) {
					h.w.fadeOut("slow",function() { if(h.o) h.o.remove(); });
					jQuery.get('/inc/getgames.php?field=stillplaying&gid='+ 0);
					$(document).stopTime();
					}


  });
  
  $("#playarea").center({
	vertical: false 
  });

	$('#register').jqm({ajax: '/register.php', trigger: 'a.registerlink',
					target: $('#register div#registerhidden'),
					modal: true,
					overlay: 80,
					onShow: function(h) {
					/* callback executed when a trigger click. Show notice */
					h.w.css('opacity',1).fadeIn( ); 
					},
					
					onHide: function(h) {
						h.w.fadeOut("slow",function() { if(h.o) h.o.remove(); });
					}
	});
	
  $("#register").center({
	vertical: false 
  });

});