(function($) {
  $(document).ready(function() {
    
    // Login form colorbox
    $(".login-link").colorbox({width:"30%", inline:true, href:"#login-box"});
    
    // Lightbox for product screenshots
    $("a[rel='screenshot']").colorbox();
   
    // Add feature slider functionality to homepage
//    if ($("#page-assetid-31141").length) {
//      $("#slider").easySlider({
//        numeric: true
//      });
//      if ($("#controls li").length <= 1){
//        $("#controls").hide();
//     }
//   }
    // Enable superfish for the top navigation
    $("#nav-first>ul").superfish({
      autoArrows:    false,
      animation:   {height:'show'}
    });

    // Hide "back to top" link on homepage
//    $("#page-assetid-31141 #back-to-top").hide();

//    $("#login-box").dialog(
//      autoOpen: false,
//      height: 205,
//      width: 270,
//      modal: true
//    );

    if($("#nav-first .login-link").length)
    {
      openLoginBoxIfAttemptFailed();
    }

//    $("#login a").click(function() {
//        $("#login-box").dialog("open");
//       return false;
//    });

  })


})(jQuery); //end (function($)


// Open login box if attempt failed
function openLoginBoxIfAttemptFailed() {
  var test = $("#login-box #sq-message").text();
  if (test!=0)
  {
        $("#nav-first .login-link").click();
  }
}


