(function($)
{
  
  $('div.picture_show a').colorbox({rel: 'group',height: '600px'});  
  $('div.blog_pictures a').colorbox({rel: 'group',height: '600px'});  
  $('div.media a').colorbox({rel: 'group',height: '600px'});  

  
    $('.submit,.button,.dm_page_content .navigation_menu li a').fadeTo(1,0.74).hover(function(){
      $(this).fadeTo(150,0.99);
    },function(){
      $(this).fadeTo(150,0.54);
    });  


    $('.media').cycle({
      fx:     'fade',
      prev:   '#prev',
      next:   '#next',
      pause:  '#pause',
      resume: '#resume'
    });

  // Here is the entry point for your front javascript
  
  function loadCkEditors() {
    $('textarea.dm_ckeditor').each(function(){
      var form = $(this).parent().parent().parent(), $textarea = $(this);
      var label = $textarea.prev('label').hide();
      //Kill all existing instances before loading
      //ckeditor again or it will not work with ajax request
      if ( $textarea.attr('id') in CKEDITOR.instances ) {
        CKEDITOR.remove(CKEDITOR.instances[$textarea.attr('id')]);
      }
      $textarea.ckeditor(function(){}, $textarea.metadata());
      form.find('input.submit').click(function() {
        $textarea.text($textarea.val());
      });

    });
  }


  if ($('textarea.dm_ckeditor').length) {
    loadCkEditors()
  }
  
  $('.file_add a').click(function(){
      if ($(this).attr('rel')) {
        $('#'+$(this).attr('rel')).toggle();
        return false;
      }
    });  

  
})(jQuery);



jQuery(function($){
    $.supersized({
          //Size & Position
          vertical_center         :   1,    //Vertically center background
          horizontal_center       :   0,    //Horizontally center background
          slide_interval          :   15000,
          fit_portrait           :   1,    //Portrait images will not exceed browser height
          fit_landscape      :   0,    //Landscape images will not exceed browser width
          //Background image
          slides  :  [ 
            { image : '/theme/images/003.jpg' }
           //, { image : '/theme/images/004.jpg' }
          
        ]          
        });  
});    
    


$(window).bind("load", function() {
       //setup the height and position for your sticky footer
       var footerHeight = 0,
           footerTop = 0,
           $footer = $(".dm_layout_bottom");
       positionFooter();
       function positionFooter() {
                footerHeight = $footer.height();
                footerTop = ($(window).scrollTop()+$(window).height()-footerHeight)+"px";
               if ( ($(document.body).height()+footerHeight) < $(window).height()) {
                   $footer.css({
                        position: "absolute"
                   }).animate({
                        top: footerTop
                   })
               } else {
                   $footer.css({
                        position: "static"
                   })
               }
 
       }
 
       $(window)
               .scroll(positionFooter)
               .resize(positionFooter)
})


