$(function(){
var winnersLoader_Path = '../content/images/ajax-loader.gif';
var progressiveLoader__Path = '../content/images/progressive-loader.gif';

/****************************** Sidebar Winners START ********************************************************/ 
$.ajax({
type:"GET",url:"../proxy.php?url=bigwinners.xml",dataType:"xml",beforeSend:function(){
	$('#mainPageWinners').html('<div id="winnersLoader"><center><img src="'+winnersLoader_Path+'"/><br/>Loading...</center></div>');},
success:function(xml){
	$('#mainPageWinners').empty();
	$('#mainPageWinners').prepend('<div id="topWinner"></div>');
	$('#topWinner').after('<div id="topWinnerPrint" style="padding-top:10px;">Top Winners</div>');
    $('#topWinnerPrint').after('<table border="0" cellpadding="6" cellspacing="0" id="latestWinnersRows"></table>');
	var topWinnerAlias=$(xml).find('TopWinner').find('topwinneralias').text();
	var topWinnerAmount=$(xml).find('TopWinner').find('topwinneramount').text();
	var topWinnerHTML='<span id="topWinnerAlias">'+topWinnerAlias+'</span>';
	topWinnerHTML+='<br/>';
	topWinnerHTML+='<span id="topWinnerAmount">&pound;'+topWinnerAmount+'</span>';
	$('#topWinner').html(topWinnerHTML);$('#latestWinnersRows').empty();
	var i=0;
	$(xml).find('winner').each(function(){
	 var rowWinnerAlias=$(this).find('alias').text();
     var rowWinnerAmount=$(this).find('amount').text();
	 var winnerRowHTML='<tr>';
	 if(i!=3){winnerRowHTML+='<td class="whiteUnderLine"><div class="rowWinnerAlias">'+rowWinnerAlias+'</div></td>';winnerRowHTML+='<td       class="whiteUnderLine"><div class="rowWinnerAmount">&pound;'+rowWinnerAmount+'</div></td>';
    }else{
	winnerRowHTML+='<td><div class="rowWinnerAlias">'+rowWinnerAlias+'</div></td>';
	winnerRowHTML+='<td><div class="rowWinnerAmount">&pound;'+rowWinnerAmount+'</div></td>';}
	winnerRowHTML+='</tr>';$('#latestWinnersRows').append(winnerRowHTML);i++;if(i==4)return false;
	});},
	
error:function(){$('#latestWinnersRows').html('<center>Unable to load winners.</center>');}});
/****************************** Sidebar Winners END ********************************************************/ 

/****************************** Progressive Jackpots START ****************************************************/
$.ajax({type:"GET",url:"../proxy.php?url=http://bingogs.bingosys.net/extGetCurrentStats.php?NW=MoonBingo",dataType:"xml",beforeSend:function(){
$('#Progressive75Value,#Progressive90Value').html('<img style="margin-top:4px;" src="'+progressiveLoader__Path+'" />');},success:function(xml){
var xmlRoot = $(xml).find('CURRENTSTATS');var progressive75 = xmlRoot.attr('progressive75');var progressive90 = xmlRoot.attr('progressive90');$('#Progressive75Value,#Progressive90Value').empty();$('#Progressive75Value').html('&pound;'+progressive75);$('#Progressive90Value').html('&pound;'+progressive90);},error:function(){$('#Progressive75Value,#Progressive90Value').html('Updating...');}});
/****************************** Progressive Jackpots END ****************************************************/ 
/********************************* ToolTips START *************************************************************/
//$('a[title]').qtip({style:{ name:'cream',tip:true}});
//$('img[alt]').qtip({style:{ name:'cream',tip:true}});
//$('input[title]').qtip({style:{ name:'cream',tip:true}});
/********************************* ToolTips END *************************************************************/
});//close function
/*********************************** FUNCTIONS ********************************************************/
/********************************* Social Share Start *************************************/
function socialShare(trackerUrl,contentMessage){$('#Facebook_Share,#Twitter_Share,#Bebo_Share').click(function(){var shareTo = $(this).attr('shareTo');
switch(shareTo){case 'Facebook' :shareWindow('http://www.facebook.com/sharer.php?u='+trackerUrl);break;case 'Twitter' :shareWindow('http://twitter.com/home?status='+contentMessage+' '+trackerUrl+'');break;	case 'Bebo' :shareWindow('http://www.bebo.com/c/share?Url='+trackerUrl+'&Title='+contentMessage+'');break;}/*switch*/ return false;});}
function shareWindow(url){window.open(url,'socialWindow',"menubar=0,resizable=0,width=580,height=450");}
/********************************* Social Share End ***********************************************/
/*********************************** FUNCTIONS ********************************************************/
