var timer1;
var timer2;

$(document).ready(function () { 

  if (jqueryItemExist($('#coming-txt'))) {	  
    initComingSoon();
  }

  if (jqueryItemExist($('#prog-img'))) {	  
    initProg();
  }


  $(".tweet").tweet({
    username: "Endeavourbiz",
    join_text: "auto",
    avatar_size: null,
    count: 1,
    auto_join_text_default: "",
    auto_join_text_ed: "we",
    auto_join_text_ing: "we were",
    auto_join_text_reply: "we replied to",
    auto_join_text_url: "we were checking out",
    loading_text: "loading tweets..."
  });


});


function initProg() {
	
  timer1 = setInterval('slideProg()', 7000);
  $('#prog-img ul li:eq(0)').addClass('firstli');	
  
}


function initComingSoon() {
	
  timer2 = setInterval('slideComingSoon()', 7000);
  $('#coming-txt ul li:eq(0)').addClass('firstli');

}


function slideComingSoon() {

  var current;
  var next;

  current = $('#coming-txt ul li:eq(0)');
  next = $('#coming-txt ul li:eq(1)');
  $('#coming-txt ul').append(current);
  
  next.fadeIn(1000);
  current.fadeOut(1000);
  
}


function slideProg() {

  var current;
  var next;

  current = $('#prog-img ul li:eq(0)');
  next = $('#prog-img ul li:eq(1)');
  $('#prog-img ul').append(current);
  
  next.fadeIn(1000);
  current.fadeOut(1000);
  
}



function jqueryItemExist(jitem) {
	return (jitem.length == 0) ? false : true; 
}


