// Show/Hide the pulldown when rolling over the menu on the Category and Search pages
/*
function hideList()
{
  var divId = document.getElementById('sortForm')
  if(!divId) return;

  divId.style.display=(divId.style.display=="inline"?"none":"inline");
}

function showList()
{
  var divId = document.getElementById('sortForm')
  if(!divId) return;

  divId.style.display=(divId.style.display=="none"?"inline":"inline");
}
*/

// Script from http://webexpose.org/2006/12/28/jquery-pop-up-menu-tutorial/
var obj = null;

function checkHover()
{
  if (obj)
  {
    obj.find("ul").hide(70);
    obj.find(".mainTitle").css({ background:"#000", color:"#fff" });

    // Check for IE6 and show the select box
    if(typeof document.body.style.maxHeight === "undefined")
    {
      if(document.getElementById('sortForm'))
      {
        document.getElementById('sortForm').style.display="inline";
      }
    } 
  } // Wait before fading out drop menu
}


$(document).ready(function(){

  $("#navBar > li").hover(function()
  {
    if (obj)
    {
      // if current UL already visibile, hide it
      obj.find("ul").hide(70);
      obj.find(".mainTitle").css({ background:"#000", color:"#fff" });
      obj = null;
    }

    $(this).find("ul").show();
    $(this).find(".mainTitle").css({ background:"#fff", color:"#000" });

    // Check for IE6 and hide the select box
    if(typeof document.body.style.maxHeight === "undefined")
    {
      var index = $(this).prevAll().size();

      if(document.getElementById('sortForm'))
      {
        if (index == 1 || index == 3 || index == 4)
        { 
          document.getElementById('sortForm').style.display="none";
        }
        else
        {
          document.getElementById('sortForm').style.display="inline";
        }
      }
    }

   }, function() {
      obj = $(this);
      setTimeout("checkHover()",200);
  });


  $(".seeMore").click(function(){
    if ($("#addImprint").is(":hidden"))
    {
      $("#addImprint").slideDown("500");
    }
    else
    {
      $("#addImprint").fadeOut("slow");
    }

    changeTxt(this,'View Less');
  });


  // Customer Service rollover
  $(".csList > ul").hover(function()
  {
    $(this).css({ background:"#0099ff" });
    $(this).find("li").css({ color:"#fff" });
    $(this).find("li a").css({ color:"#fff" }) },

    function() {
      $(this).css({ background:"#fff" });
      $(this).find("li").css({ color:"#333"});
      $(this).find("li a").css({ color:"#333"})
  });

});
