$(document).ready(function() {
  
/* CACHE IMAGES
 var images = [ 'image1.jpg', 'image2.png', 'image3.gif' ];
  jQuery.each(images, function(i) {
    images[i] = new Image();
    images[i].src = this;
  });
*/
  
  
//SLIDE-DOWN-PANEL
  $("#open").click(function(){
    $("div#panel").slideDown("slow");
  });  
  $("#close").click(function(){
    $("div#panel").slideUp("slow");
  });
  $("#toggle a").click(function () {
    $("#toggle a").toggle();
  });
  
  $("#jsddm > li:has(ul)").addClass("hasSubMenu");
  
//SLIDER  
 if (!$('.geoLanding').length){
   $('#slider').codaSlider({
     dynamicTabs: false,
     dynamicArrows: false,
     autoSlide: true
   });
 }
  
//tweet
$("#tweet").tweet({
  username: "JacksonKahlIns",
  avatar_size: 48,
  count: 3,
  intro_text: null,
  outro_text: null,
  join_text:  null,
  loading_text: "Loading tweets..."
});
  
//slideshow
$('#slideshow').cycle({ fx: 'fade', random: 1, pause: 1 });

//tooltip
$(".tooltipnote").hover(function () {
  $(".tooltip").fadeIn('fast');},
    function () {
      $(".tooltip").fadeOut('fast');   
  });
  
//hide #topnav on slidepanel open
$('#toggle a').click(function() {  
  if($("a.close").is(":visible")){
    $("#topnav").hide();
  } else { $("#topnav").show(); }
});

// z-index bug in ie  
var zIndexNumber = 1000;
  $('img').each(function() {
    $(this).css('zIndex', zIndexNumber);
    zIndexNumber += 10;
  });
 
});
