// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults


function showProgress()
{
	jQuery("body").append("<div id='TB_load'><img src='" + "/images/loadingAnimation.gif" + "' /></div>");//add loader to the page
	jQuery('#TB_load').show();
}

function hideProgress()
{
	jQuery("#TB_load").remove();
}

// full sizin it

jQuery(window).resize( function() {
	jQuery('.full_size').each(function() {
		var window_height = jQuery(window).height();
		var offset_top = jQuery(this).offset().top;
		var padding = jQuery(this).outerHeight() + jQuery(this).height();
    var parent_padding = (jQuery(this).parent().outerHeight() - jQuery(this).parent().height()) / 2;
		var children_height = 0;
		for (x in jQuery(this).find("~ div")) {children_height += x;}
		
    jQuery(this).height(window_height - offset_top - parent_padding - children_height - padding);
	});
});

jQuery('.full_size').each(function() {
	var window_height = jQuery(window).height();
	var offset_top = jQuery(this).offset().top;
	var padding = jQuery(this).outerHeight() + jQuery(this).height();
  var parent_padding = (jQuery(this).parent().outerHeight() - jQuery(this).parent().height()) / 2;
	var children_height = 0;
	for (x in jQuery(this).find("~ div")) {children_height += x;}

  jQuery(this).height(window_height - offset_top - parent_padding - children_height - padding);
});

/*
* immediateSiblings 1.0.0 (2008-07-14)
*
* Copyright (c) 2006,2007 Jonathan Sharp (http://jdsharp.us)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://jdsharp.us/
*
* Built upon jQuery 1.2.6 (http://jquery.com)
*/
$.fn.immediateSiblings = function(selector) {
var siblings = [];
if ( this.length > 0 ) {
this.each(function() {
var elm = $(this);
while ( elm.prev().is( selector ) ) {
elm = elm.prev();
siblings.unshift( elm[0] );
}
siblings.push( this );
var elm = $(this);
while ( elm.next().is( selector ) ) {
elm = elm.next();
siblings.push( elm[0] );
}
});
}
return this.pushStack( $.unique( siblings ) );
};