﻿/*
* Page to extend SkyeGroup.aspx Java and jQuery functionality
* Bryan Watt
*/

$(document).ready(function () {
  // Start at 100%
  $("#flashthis").css("opacity", "0.6");

  // Fade to 0.6
  $("#flashthis").animate({ opacity: 1 }, "1000");
    
  // ON MOUSE OVER
  SetMouseOver(img_name_IT, skyeGroupDetails[2]);
  SetMouseOver(img_name_Recruit, skyeRecruitDetails[2]);
  SetMouseOver(img_name_Direct, skyeDirectDetails[2]);
  SetMouseOver(img_name_Training, skyeTrainingDetails[2]);
  SetMouseOver(img_name_Dubai, skyeUAEDetails[2]);

});

function SetMouseOver(imgObject, textMessage) {
  // Set the header setting function
  $(imgObject).hover(
        function () {
          ChangeHeaderText(textMessage)
        }, ResetHeaderLogo);

  // Start with images at 70% opacity
  $(imgObject).css("opacity", 0.7);

  // On mouseover, raise opacity to 100%
  $(imgObject).hover(function () {
    // SET OPACITY TO 100%
    $(this).stop().animate({
      opacity: 1
    }, "slow");

  }, // ON MOUSE OUT
        function () {
          // SET OPACITY BACK TO 50%
          $(this).stop().animate({ opacity: 0.7 }, "slow");
        }
      );
}

function ChangeHeaderText(headerText) {
  // start dim
  $("#flashthis").css("opacity", 0.1);

  // Change the text
  $("#flashthis").find("span").html(headerText);

  // Fade back
  $("#flashthis").animate({ opacity: 1 }, 500);
}

function ResetHeaderLogo() {
  ChangeHeaderText(skyeGroupDetails[2]);
}
