jQuery.preloadImages = function() {
  for (var i = 0; i < arguments.length; i++) {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

$.preloadImages("/Includes/Images/smallbusiness-banner.jpg'", 
                "/Includes/Images/enterprise-banner.jpg",
                "/Includes/Images/schools-banner.jpg",
                "/Includes/Images/healthcare-banner.jpg");

$("#infodiv").css({opacity: ".7"});
$(document).ready(function() {
  $("#bannerfade").fadeIn("slow", function() {
    $("#bannerfade").fadeTo("slow", 0.7, function() {
      $("#dock").fadeIn("slow");
    });
  });
  $('#dock').Fisheye({
    maxWidth: 30,
    items: 'a',
    itemsText: 'span',
    container: '.dock-container',
    itemWidth: 50,
    proximity: 50,
    halign : 'center'
  });
  $("#smallbusiness, #enterprise, #schools, #healthcare").fadeTo("fast", 0.5);
});

$("#div_soho, #div_enterprise").live('mouseover', function () {
  $(this).find('p').css({ color : '#0088CC' });
});

$("#div_soho, #div_enterprise").live('mouseout', function () {
  $(this).find('p').css({ color : '#777777' });
});

$("#div_buildityourself").click(function() {
  window.location = '/Download';
});
$("#div_soho").click(function() {
  window.location = '/Appliances/Small_And_Medium_Businesses';
});
$("#div_enterprise").click(function() {
  window.location = '/Appliances/Large_Enterprises';
});
$(".div_ubuntu").click(function() {
  window.location = '/Resources/Ubuntu_Linux/';
});
$("#malware").click(function() {
  $("#bannerimage").stopTime('controlled');
  Malware();
});
$("#smallbusiness").click(function() {
  $("#bannerimage").stopTime('controlled');
  SmallBusiness();
});
$("#enterprise").click(function() {
  $("#bannerimage").stopTime('controlled');
  Enterprise();
});
$("#schools").click(function() {
  $("#bannerimage").stopTime('controlled');
  Schools();
});
$("#healthcare").click(function() {
  $("#bannerimage").stopTime('controlled');
  Healthcare();
});

var current = 'Malware';
$("#bannerimage").everyTime(8000, 'controlled', function() {
  switch (current) {
    case 'Malware':
      current = 'SmallBusiness';
      Malware();
      break;
    case 'SmallBusiness':
      current = 'Enterprise';
      SmallBusiness();
      break;
    case 'Enterprise':
      current = 'Schools';
      Enterprise();
      break;
    case 'Schools':
      current = 'Healthcare';
      Schools();
      break;
    case 'Healthcare':
      current = 'Malware';
      Healthcare();
      break;
  }
});

function Malware () {
  $("#smallbusiness, #enterprise, #schools, #healthcare").fadeTo("fast", 0.5);
  $("#malware").fadeTo("fast", 1.0);
  $("#bannerimage").attr({ src: '/Includes/Images/malware-banner.jpg'});
  $("#infodiv_text").text("Protect Your Network From Malicious Software");
  $("#infodiv_p").text("Protecting your network from viruses, spyware, adware, trojans, worms, and even identity theft, with no end user software.");
}

function Enterprise () {
  $("#smallbusiness, #malware, #schools, #healthcare").fadeTo("fast", 0.5);
  $("#enterprise").fadeTo("fast", 1.0);
  $("#bannerimage").attr({ src: '/Includes/Images/enterprise-banner.jpg'});
  $("#infodiv_text").text("Large Enterprises");
  $("#infodiv_p").text("The Malware Prevention System was designed for performance. Even if your enterprise has 20,000 end-users, you may need only one appliance.");
}

function SmallBusiness () {
  $("#smallbusiness").fadeTo("fast", 1.0);
  $("#malware, #enterprise, #schools, #healthcare").fadeTo("fast", 0.5);
  $("#bannerimage").attr({ src: '/Includes/Images/smallbusiness-banner.jpg'});
  $("#infodiv_text").text("Small Businesses");
  $("#infodiv_p").text("Our MPSAPPSMB appliance is specifically designed for smaller businesses to be completely self maintained without the need of any administration.");
}

function Schools () {
  $("#smallbusiness, #malware, #enterprise, #healthcare").fadeTo("fast", 0.5);
  $("#schools").fadeTo("fast", 1.0);
  $("#bannerimage").attr({ src: '/Includes/Images/schools-banner.jpg'});
  $("#infodiv_text").text("Protecting Schools");
  $("#infodiv_p").text("Protect every student on your entire wired and wireless campus with a single appliance.");
}

function Healthcare () {
  $("#smallbusiness, #malware, #enterprise, #schools").fadeTo("fast", 0.5);
  $("#healthcare").fadeTo("fast", 1.0);
  $("#bannerimage").attr({ src: '/Includes/Images/healthcare-banner.jpg'});
  $("#infodiv_text").text("We Know Healthcare");
  $("#infodiv_p").text("We don't filter Internet traffic based on keywords or website categorization. We simply filter the malicous software, not the content.");
}