/*
+------------------------------------------------------------------------------------------+
COMPANY: Raven Developers 2008
+------------------------------------------------------------------------------------------+
FILE INFO: Menu system Java Script
+------------------------------------------------------------------------------------------+
WEBSITE: http://www.ravendevelopers.com
+------------------------------------------------------------------------------------------+
Portions created by Anirudh K. Mahant are Copyright of Raven Developers (C) 2008.
+------------------------------------------------------------------------------------------+
COPYRIGHT NOTICE:
The contents of this file are protected and copyrighted and are subject to
the original developer(s) of this file;Unauthorised use of this file is strictly prohibited.	
+------------------------------------------------------------------------------------------+
$(document).ready(function(){
  
  // Highlight the whole menu row when hovered on the main topic
  $(".site-menu a.highlighted").hover(
    function () {
      // Finds each parent anchor element and applies the hover style to them
      $(this).parent().parent().find("a").each(function(i) {
        $(this).addClass("highlighted");
      });
    },
    function () {
      // Removes each parent anchor elements hover style
      $(this).parent().parent().find("a").each(function(i) {
        $(this).removeClass("highlighted");
      });
      // Restore the original highlighed style on the title menu
      $(this).addClass("highlighted");
    }
  );
  
  //On hover menu parent display the menu items
  $("td.menuparent").hover(
    function () {
      $(this).find("ul").addClass("site-menu-hover");
      // Adjust the width of child menu items upon hover cause we dont know when the user changes his
      // monitor resolution, so to make it look consistent even after resolution change apply a fresh width
      // everytime the link is hovered upon
      $("td.menuparent ul li a").width($(this).innerWidth()-35);
    },
    function () {
      $(this).find("ul").removeClass("site-menu-hover");
    }
  );
  // This would add an extra class to display the parent menu item in persistent
  // drop down style instead of removing the style when hovering out of it.
  $("td.menuparent ul").hover(
    function () {
      $(this).prev("ul.site-menu-hover td.menuparent a").addClass("jq-hover");
    },
    function () {
      $(this).prev("ul.site-menu-hover td.menuparent a").removeClass("jq-hover");
    }
  );
});
*/

// Fixes some hover issues on menuparent class and takes care of displaying the overall menusystem :)
$(document).ready(function(){
  
  // Highlight the whole menu row when hovered on the main topic
  $(".site-menu td.highlighted a").hover(
    function () {
      // Finds each parent anchor element and applies the hover style to them
      $(this).parent().parent().find("a").each(function(i) {
        $(this).addClass("highlighted");
      });
    },
    function () {
      // Removes each parent anchor elements hover style
      $(this).parent().parent().find("a").each(function(i) {
        $(this).removeClass("highlighted");
      });
      // Restore the original highlighed style on the title menu
      $(this).addClass("highlighted");
    }
  );
  
  //On hover menu parent display the menu items
  $("td.menuparent").hover(
    function () {
      $(this).find("ul").addClass("site-menu-hover");
      // Adjust the width of child menu items upon hover cause we dont know when the user changes his
      // monitor resolution, so to make it look consistent even after resolution change apply a fresh width
      // everytime the link is hovered upon.
      //Fixes IE on hover problems
	  if ($.browser.msie){$(this).children("a").addClass("jq-hover");};
	  $("td.menuparent ul li a").width($(this).innerWidth()-37);
    },
    function () {
      $(this).find("ul").removeClass("site-menu-hover");
	  if ($.browser.msie){$(this).children("a").removeClass("jq-hover");};
    }
  );
  // This would add an extra class to display the parent menu item in persistent
  // drop down style instead of removing the style when hovering out of it.
  $("td.menuparent ul").hover(
    function () {
      $(this).prev("ul.site-menu-hover td.menuparent a").addClass("jq-hover");
    },
    function () {
      $(this).prev("ul.site-menu-hover td.menuparent a").removeClass("jq-hover");
    }
  );
});
