var MostRecent = new Array;
var PreviousMostRecent = new Array;

/*function ShowRecentPlays(){
	var div1 = document.getElementById('last24hoursrestofplaylist')
		div1.style.display = 'block'
	}*/
	
function isInteger(s)
{
    return Math.ceil(s) == Math.floor(s);
}

function UpdateCheck(a){

	function RunUpdateCheck() {
		if(document.getElementById(a+'pastplay1')) {
			MostRecent[a] = document.getElementById(a+'pastplay1').innerHTML;
			if (!PreviousMostRecent[a]) {
				PreviousMostRecent[a] = "Initial"
				}
			if (MostRecent[a] != PreviousMostRecent[a]) {

if (runnumber != 1) {
var container = $("#"+a+"pastplay1");
  container .change
		(
      function() 
      { 
        $(".background", container).stop().animate({opacity:1});
      }/*,
	        // fade background div out when cursor enters, 
      function() 
      { 
        $(".background", this).stop().animate({opacity:0}); 
      }*/
	  )
    // allow positioning child div relative to parent
    .css('position', 'relative')
    // create and append background div 
    // (initially visible, obscuring parent's background)
    .append( $("<div>")
      .attr('class', 'background')
      .css({
        backgroundColor:'gold',
        position: 'absolute',
        top:0,
        left:0,
        zIndex:-1,
        width:container.width(), 
        height:container.height()
      }) 
    );
	$(".background", container).stop().animate({opacity:0},10000); 
}
		runnumber = runnumber+1;	
		
				//$("#"+a+"pastplay1").({'background-color': 'transparent' }, 1200)
			    //$("#"+a+"pastplay1").glow('gold',2000,24);
				//new Effect.Highlight(a+'pastplay1',{duration:5, endcolor: '#efefef'});
				}
			PreviousMostRecent[a] = MostRecent[a];
//			TempVar = document.getElementById("testid").innerHTML
//			document.getElementById("testid").innerHTML = TempVar + PreviousMostRecent[a];
			}
		}
	setTimeout(RunUpdateCheck, 500);
	}

function LoadFeed(updatediv,feed,limit,updateaction) {

if (isInteger(limit) && limit > 0) {
		limit = '&limit='+limit;
}
else {
		limit = '';
		}

$.PeriodicalUpdater('/wp-content/themes/wjcu/scripts/list.php?feed='+feed+limit, {method: 'get', minTimeout: 10000, maxTimeout: 10000, onSuccess: function () {eval(updateaction);}}, function(data) {theid = document.getElementById(updatediv); theid.innerHTML = data;eval(updateaction);});

}

/*
for (i=0;i<=2;i++) {
	Limit = '';
	if(Feedlimits[i] != 0) {
		Limit = '&limit='+Feedlimits[i];
		}
	ThisUpdater = "new Ajax.PeriodicalUpdater(Feeds["+i+"],'/wp-content/themes/wjcu/scripts/list.php?feed='+Feeds["+i+"]+Limit, {method: 'get', frequency: 10, decay: 1, onSuccess: function() {   new UpdateCheck(Feeds["+i+"]);  }});"
	eval(ThisUpdater);
	}
	
	*/
