﻿$('document').ready(function () {
  
  $('#linkbox ul.category-search li').hover(function () { $(this).css('background-color', '#b3c1ff'); }, function () { $(this).css('background-color', 'transparent'); });


});

function setEnquiryButtons() {
  $('document').ready(function () {
    $('#btnAccount').button().click(function (e) { e.preventDefault(); showForm('#dlgAccountRequest'); }); ;
    $('#btnGeneralEnquiry').button().click(function (e) { e.preventDefault(); showForm('#dlgGeneralEnquiry'); });
  });
};

function showForm(dlgForm) {
  var mask = $('#dlgMask');
  var dialog = $(dlgForm);

  //Get the screen height and width
  var maskHeight = $(document).height();
  var maskWidth = $(window).width();

  //Set height and width to mask to fill up the whole screen
  mask.css({ 'width': maskWidth, 'height': maskHeight });

  //transition effect    
  //mask.fadeIn(500);
  mask.fadeTo("slow", 0.6);

  //Get the window height and width
  var winH = $(window).height();
  var winW = $(window).width();

  //Set the popup window to center
  dialog.css('top', winH / 2 - 515 / 2 + $(window).scrollTop());
  dialog.css('left', winW / 2 - 600 / 2);

  //transition effect
  dialog.fadeIn(500);

  $(document).keyup(function (e) {
    if (e.which == 27) {
      dialog.hide();
      mask.hide();
    }
  });

  //if close button is clicked
  $('.close', dialog).click(function (e) {
    //Cancel the link behavior
    e.preventDefault();
    dialog.hide();
    mask.hide();
  });

  //if mask is clicked
  $(mask).click(function () {
    $(this).hide();
    dialog.hide();
  });

};

function jumpTo(elem) {
  $('html, body').animate({
    scrollTop: $(elem).offset().top
  }, 1000);
}

function loadCarousel() {
  $(document).ready(function () {
    $('#scroll').jCarouselLite({ auto: 1000, speed: 2000, circular: true, visible: 7.6 });
  });
}
