
$(function() {
	
   
   
});

function addImagesToCycle(element, image_array) {
	if (element.length == 0 || image_array.length == 0) {
      return false;
   }
   
   for (var i in image_array) {
      var img = $("<img />");
      img.attr("alt", "");
      img.attr("height", element.height());
      img.attr("src", image_array[i]);
      img.attr("width", element.width());
      element.append(img);
   }
   
   // element.contextMenu(null, new Array());
   
}

function restartCycle() {
   
   var s = 6;
   
   $("div#Cycle div.left").cycle({
      fx: "fade",
      next: "#cycle1",
      timeout: 3 * s * 1000,
      delay: -2 * s * 1000
   });
   $("div#Cycle div.center").cycle({
      fx: "fade",
      next: "#cycle2",
      timeout: 3 * s * 1000,
      delay: -1 * s * 1000
   });
   $("div#Cycle div.right").cycle({
      fx: "fade",
      next: "#cycle3",
      timeout: 3 * s * 1000,
      delay: 0 * s * 1000
   });
   
}

function startCycle() {
   
   restartCycle();
   
   // Restart every 5 minutes (which will hopefully clear any 'built up' timing issues)
   var restartInterval = window.setInterval(function() {
      stopCycle();
      restartCycle();
   }, 1 * 60 * 60 * 1000);
   
   $("div#Header div#Cycle img").contextMenu(null, new Array());
   
}

function stopCycle() {
   
   $("div#Cycle div.left").cycle("stop");
   $("div#Cycle div.center").cycle("stop");
   $("div#Cycle div.right").cycle("stop");
   
}
