
var firstTime = 0;
var holdMinutes = 0;
// This is called every 5 seconds to check to see if we need to upload anything new

function pingServer(){


// checking if we need to initially do any drawing


if(holdMinutes != getCurrentMinutes()){
	removeAllTags();
	holdMinutes = getCurrentMinutes();
}

//alert("Pinging Server"); 

requestTags("test");
}

function resetTags(){

tagIdCount = 0;    //reset tagCount
removeAllTags();   //clear all the tags from the screen
myTags.length = 0; //clear myTags array


	for(var i = 0; i < mySeconds.length ; i ++){
		createTagFromServer(myText[i], mySeconds[i], myMinutes[i], myHours[i]);
	}

}

/* Tags y coordinates have to be positioned based on the minutes & hours they reside on 

      tagTopIncrement - how much to push down for each minute
      tagTopStartingPoint - starting point of first tag
*/


function positionTags(){

	var totalMinutes = parseInt(getCurrentHours() * 60) + parseInt(getCurrentMinutes());

	for(var i = 1; i <= tagIdCount; i++){
		myTags[i].y = ((totalMinutes - myTags[i].minutes) * (tagTopIncrement+50)) + tagTopStartingPoint + "px";
					//tagTopStartingPoint + (tagTopIncrement * row_minutes) + "px";
	
	}

}

function initialize(){

	if(firstTime == 0){
		//alert("first time");
	   var minutes = getCurrentMinutes();
	   var hours   = getCurrentHours();

	   //store total minutes into minutes
	   minutes = minutes + hours * 60;
	   
	   //alert("Number of times to call startScroll(): " + minutes);
	  for(var i = 0; i < minutes; i++){
	//   startScroll(i);
		pushDownTagsDos();
	   }
	   firstTime = 1 ;
	}
}
