<!--
//*******************************************************
var i_server_stop_updates = 360000; // 6 mins
//var i_server_stop_updates = 7000; // 10 sec


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function preload_images()
	{
	MM_preloadImages('/game/images/spacer.gif','/game/images/loading-icon.gif');
	}
	
function showLoadingIcon(argImageName)
	{
	MM_swapImage(argImageName,'','/game/images/loading-icon.gif',1)
	}

function hideLoadingIcon(argImageName)
	{
	MM_swapImage(argImageName,'','/game/images/spacer.gif',1)
	}

function goBalanceTotal()
	{
	var ourInterval = setInterval('getBalanceTotal()', 60000);
	}
	
function getBalanceTotal()
	{
	var theDiv = document.getElementById('user_balance');
	var sOldText = theDiv.innerHTML;
	var sNewValue = ASP.nav_ascx.GetBalanceTotal().value;
	if (sNewValue.length > 0)
		{
		theDiv.innerHTML = 'Balance...';
		var ourSetTimeout = setTimeout('setBalanceTotal("'+ sOldText +'","'+ sNewValue +'")', 1000);
		}
	}

function setBalanceTotal(argOldValue, argNewValue)
	{
	var theDiv = document.getElementById('user_balance');
	theDiv.innerHTML = argNewValue;
	if (argOldValue != argNewValue)
		{
		new Effect.Highlight('user_balance_cell',{duration:1,startcolor:'#ffffff', endcolor:'#2d4660'});
		}
	}
	
function getTimeLeft(argDateEnd,argDateNow)
	{
	var s_return = '';
	var i_a_day = 1000*60*60*24;
	var i_a_hour = 1000*60*60;
	var i_a_minute = 1000*60;
	var i_a_second = 1000;
	
	if (argDateEnd.length <= 0)
		s_return = 'Not Set';
	else
		{
		var d_date_end = new Date(argDateEnd);
		var d_date_now = new Date(argDateNow);
		
		if (d_date_end <= d_date_now)
			s_return = 'Betting Closed';
		else
			{
			i_bet_time_left_diff = (d_date_end - d_date_now);
			var i_days = (i_bet_time_left_diff / i_a_day)
			var i_hours = (i_bet_time_left_diff / i_a_hour)
			var i_minutes = (i_bet_time_left_diff / i_a_minute)
			var i_seconds = (i_bet_time_left_diff / i_a_second)
			
			if (i_days < 1)
				{
				if (i_hours < 1)
					{
					if (i_minutes < 1)
						{
						s_return = 'sec '+ Math.floor(i_seconds);
						}
					else // if (i_minutes < 1)
						s_return = Math.floor(i_minutes) + 1 +' Minute(s)';
					}
				else  // if (i_hours < 1)
					s_return = Math.floor(i_hours) + 1 +' Hour(s)';
				}
			else // if (i_days < 1)
				s_return = Math.floor(i_days) + 1 +' Day(s)';
			} // if (d_date_end <= d_date_now)
		} // if (s_date_end.length <= 0)

	return s_return;
	}
	
//***************************************************
//*** SHOW USER
function showUser(argUserID)
	{
	alert('Not ready yet.\n\nOn the to-do list.');
	}
	
//***************************************************
//*** CHECK FOR ALERTS

var intervalBetAlertNotification;
var countAlertNotification = 0;

//***************************************************
//*** DO BET CHECK UPDATE
function doCheckForAlerts()
	{
//	intervalBetAlertNotification = setInterval("checkForAlert()", 4000);
	}

function checkForAlert()
	{
	if (countAlertNotification < 600)
		{
		var theDivMessage = document.getElementById('bet_notification_message_details');
		
		var s_alert_notification_message = ASP.footer_ascx.GetAlertNotificationMessage().value;
		var s_old_alert_message = '';
		
		s_old_alert_message = theDivMessage.innerHTML;

		s_alert_notification_message = s_alert_notification_message.replace('\n','');
		s_old_alert_message = s_old_alert_message.replace('\n','');
		
		s_alert_notification_message = s_alert_notification_message.toLowerCase()
		s_old_alert_message = s_old_alert_message.toLowerCase()

		if ((s_alert_notification_message != s_old_alert_message) && s_alert_notification_message != '')
			{
			theDivMessage.innerHTML = s_alert_notification_message;
			Effect.SlideDown('bet_notification_message',{duration:1.0});
			setTimeout("Effect.SlideUp('bet_notification_message',{duration:1.0});",6000);
			}
		

		var theDivBet = document.getElementById('bet_notification_bet_details');
		var s_alert_notification_bet = ASP.footer_ascx.GetAlertNotificationBet().value;
		var s_old_alert_bet = ''; 

		s_old_alert_bet = theDivBet.innerHTML;

//		alert('====================\n'+ s_alert_notification_bet +'\n====================\n'+ s_old_alert_bet);

		if (s_alert_notification_bet.toLowerCase() != s_old_alert_bet.toLowerCase() && s_alert_notification_bet != '')
			{
			theDivBet.innerHTML = s_alert_notification_bet;
			Effect.SlideDown('bet_notification_bet',{duration:1.0});
			setTimeout("Effect.SlideUp('bet_notification_bet',{duration:1.0});",6000);
			}
		countAlertNotification++;
		}
	else
		{
		clearInterval(intervalBetAlertNotification);
		}
	}
	
	
//-->