// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
$(document).ready(function(){
  
  $('a[rel*=facybox]').facybox()
  
	$(function() {
		$('ul.image-gallery li a').lightBox();
		$('.news_articles ul.images li a').lightBox();
	});
	
	

  $('a').each(function(){
    if ($(this).attr('href').substr(0,7) == 'http://')
    {
      $(this).addClass('new-window');
    }
  });
  

  $('a.new-window').click(function(){
    window.open(this.href);
    return false;
  });

  




})

$(document).bind('parchment.opened', function() {
  
  $("#pages ul").sortable({
    cursor : 'move',
    scroll : true,
    update : function () {
      $.post( '/pages/pagesort', '_method=put&'+$(this).sortable('serialize'))
    }
  });
  
})