
$(document).ready(function(){
	$('#dvNews-list').cycle({ 
    fx:     'scrollRight', 
    timeout: 6000, 
    delay:  -2000, 
    pause: 1,
    pager:'#news_nav'
	});
});

$(document).ready(function(){
	$("#featured > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 7000, true);
});
	var headline_count;
	var headline_count2;
	var headline_count3;
	
	var current_headline=0;
	var current_headline2=0;
	var current_headline3=0;

$(document).ready(function(){
	headline_count = $("div.headline").size();
	headline_count2 = $("div.headline2").size();
	headline_count3 = $("div.headline3").size();
	
	$("div.headline:eq("+current_headline+")").css('top', '5px');
	$("div.headline2:eq("+current_headline2+")").css('top', '5px');
	$("div.headline3:eq("+current_headline3+")").css('top', '5px');
	
 	setInterval(headline_rotate,6000); //time in milliseconds
});


function headline_rotate() {
 old_headline = current_headline % headline_count;
 old_headline2 = current_headline2 % headline_count2;
 old_headline3 = current_headline3 % headline_count3;
 
 new_headline = ++current_headline % headline_count;
 new_headline2 = ++current_headline2 % headline_count2;
 new_headline3 = ++current_headline3 % headline_count3;
 
 $("div.headline:eq(" + old_headline + ")").css('top', '210px');
 $("div.headline2:eq(" + old_headline2 + ")").css('top', '210px');
 $("div.headline3:eq(" + old_headline3 + ")").css('top', '210px');
 
 $("div.headline:eq(" + new_headline + ")").show().animate({top: 5},"slow");
 $("div.headline2:eq(" + new_headline2 + ")").show().animate({top: 5},"slow");
 $("div.headline3:eq(" + new_headline3 + ")").show().animate({top: 5},"slow");
} 

$(document).ready(function(){
	setInterval(GetDateTime,1000);
});	
	
var curr_bg="";
function GetDateTime()
{
  	var DateTime =  new Date();
  	var month = DateTime.getMonth() + 1;
	var day = DateTime.getDate();
	var year = DateTime.getFullYear();
	var hours = DateTime.getHours();
	var minutes = DateTime.getMinutes();
	var curr_time='0';
		
	if (minutes < 10)
		minutes = "0" + minutes;

	if(hours>12)
	  curr_time=(hours-12) + ":" + minutes;
	else  
	  curr_time=hours + ":" + minutes;
	  
	if(hours > 11)
		curr_time=curr_time+" PM";
	else 
		curr_time=curr_time+" AM";
		
	Element('mytime').innerHTML=month + "/" + day + "/" + year+"  "+curr_time;	
	ChangeBodyBackground(hours)
}

function ChangeBodyBackground(hr)
{

		if(hr>4 && hr<12)
		{
           if(curr_bg!='am')
           {
		 	   Element('dvBody').style.background='#3d3d3d url(images/content/am-bg.png) no-repeat';
		 	   curr_bg='am';
	 	   }
		}
		else if(hr>=12 && hr<=18)
		{
			 if(curr_bg!='nn')
			 {
		        Element('dvBody').style.background='#3d3d3d url(images/content/nn-bg.png) no-repeat';
		        curr_bg='nn';
		        
	        }
	    }
		else if(hr<=4 || hr>18)
		{
			 if(curr_bg!='pm')
			 {
		    	Element('dvBody').style.background='#3d3d3d url(images/content/pm-bg.png) no-repeat'; 
		    	curr_bg='pm';
	    	}
	    }
		else 
		{ 
		   Element('dvBody').style.background='#3d3d3d url(images/content/nn-bg.png) no-repeat';  
		   curr_bg=''; 
	    }
}

