/*  jquery routines to animate title fade-in
    and activate menu stars  */


jQuery(document).ready(function($){
  SetRoundedCorners($);  // for IE
  TitleShadeAnim($);  
  InitialiseFoxInStone($);
  InitialiseMenuStars($); 
  InitialiseReveal($);
  
});

function PxToInt(DimensionStrPx){
  var len = DimensionStrPx.length;
  var s = DimensionStrPx.substring(0,len-2);
  return parseInt(s);
}  

  

function TitleShadeAnim($){
  $(".hex_title_shade").fadeIn(5000);
  $(".hex_menubg_shade").fadeIn(5000);
}

  
function SetRoundedCorners($){
	if (! $.browser.msie) return false;
  $("div.bb").corner("8px");
  $("div.obj_bg").corner("14px");
  $("div.obj_bg2").corner("14px");
  $(".grande2 h2").corner("14px");
  $("#sidebar h2").corner("14px");
  $(".wp-caption").corner("4px");

}  
  
  
//--------------------------------------  
function InitialiseMenuStars($){
// Set up the menu stars to popup what they do
//--------------------------------------  
  var menuStars = $(".hex_menuStar");
  menuStars.hover(
    function() {                              // --- start hover ---
      // get the objects to work with
      var starA = $(this);
      //var menuDiv = starA.parent(); 
      var ml = $('#ml');
      // get the position of the star and offset the label accordingly
      var left = PxToInt(starA.css('left'));
      var top = PxToInt(starA.css('top'));
      //if(left<30){left = left - 66}else{left=left+33}
      left = left + 33;  // always on right 'cos might be interfered with by title shade regardless of layering
      top = top + 6;
      // organise the label and show it
      ml.css('left',left);
      ml.css('top',top);
      ml.html(starA.attr('alt'));
      ml.css('visibility','visible');
      
    }, 
    function () {        // --- end hover ---
      $('#ml').css('visibility','hidden');     // hide the label
    }
  );
}
  
//--------------------------------------  
function InitialiseFoxInStone($){
// Set up home page pop-up
//--------------------------------------  
  $(".hex_foxinstonea").hover(
    function() {                              // --- start hover ---
      $('.hex_aboutHome').css('visibility','visible');
    }, 
    function () {        // --- end hover ---
      $('.hex_aboutHome').css('visibility','hidden'); 
    }
  );
};


