$(document).ready(function() {
  // Options for SuperBGImage
  $.fn.superbgimage.options = {
    //id: 'background', // id for the containter
    //z_index: -1,
    transition : 1, // 0-none, 1-fade, 2-slide down, 3-slide left, 4-slide top, 5-slide right, 6-blind horizontal, 7-blind vertical, 90-slide right/left, 91-slide top/down
    //randomtransition: 1, // 0-none, 1-use random transition (0-7)
    slideshow : 1, // 0-none, 1-autostart slideshow
    slide_interval : 10000, // interval for the slideshow
    randomimage : 0, // 0-none, 1-random image
    speed : 'slow' // animation speed
  };

  // initialize SuperBGImage
  $('#superbgimage').superbgimage().hide();

  $('#superbgimage').height($('#wrap').height());

  $('.scroll-pane').jScrollPane({
    showArrows : true
  });

  $('.inside-scroll-pane').jScrollPane();

  //$('body').supersleight();
  
  //$('body').supersleight({shim: '/static_files/images/trans.gif'});

  $('#trigger').addClass("nonSelected");

  $('#trigger').click(function() {

    if($(this).hasClass('nonSelected')) {
      $('#panel').slideToggle('slow');
      //$("#trigger").removeClass("close");
      $('#trigger').removeClass("nonSelected");
      $("#trigger img").attr("src", "/static_files/images/tab.png");
      Cufon.refresh();
      $('.featureoffer').fadeOut();

    } else {
      $('#panel').slideToggle('slow');
      $('#trigger').addClass("nonSelected");
      $('.featureoffer').fadeIn(2000);
      $("#trigger img").attr("src", "/static_files/images/tab-on.png");
    }

    return false;
  });

  $(".lowernav a[rel^='prettyPhoto']").prettyPhoto({
    animationSpeed : 'fast',
    theme : 'dark_rounded',
    slideshow : 10000
  });

  var promotions_qty = $('.featureoffer ul li').size();
  var next_promotion = 0;
  var rotate_promotions = function() {
    if(next_promotion == promotions_qty) {
      next_promotion = 0
    }
    $('.featureoffer ul li').hide();
    $('.featureoffer ul li').eq(next_promotion).fadeIn(500);
    next_promotion++;
  };
  //rotate_promotions();
  $('.featureoffer ul li').hide();
  setInterval(rotate_promotions, 6000);

  $('a[href$="pdf"]').attr('target', '_blank');
  
  
   if($.browser.msie && $.browser.version=="6.0") {
  
  //alert("Im the annoying IE6");

	Cufon.replace('.featureoffer h2, .featureoffer h3, h1, h1.inside', {
  fontFamily : 'Trajan Pro'
});

	} else {
	
	Cufon.replace('.featureoffer h2, .featureoffer h3, h1, h1.inside, .footer .lowernav li a, .subnav li a', {
  fontFamily : 'Trajan Pro'
});
	
	}
  
  
});

$(window).resize(function() {
  $('#superbgimage').height($('#wrap').height());
});

