Cufon.replace('#nav a, h2', {hover:true});
Cufon.replace('h2.site-section, #admin-login h2', {textShadow: '#fff 0px 2px'});

// Sticky footer
var id=new String,height=new Number,footerHeight=new Number,styleAbsolute={position:"absolute",bottom:"0","z-index":"200"},styleRelative={position:"relative",bottom:"auto"},config,footerObject,browserAdjust=0; (function(a){a.fn.footer=function(b){config=a.extend({monitorTimeOut:200},b);if(config.monitorTimeOut<1)config.monitorTimeOut=1;a(this).attr("id")==""&&a(this).attr("id","footerAutoGeneratedId");id="#"+a(this).attr("id");height=a(document).height();footerHeight=a(id).height();if(a.browser.msie)browserAdjust=4;setPosition();monitor()}})(jQuery); function monitor(){if(height!=$(document).height()){setPosition();height=$(document).height()}if(footerHeight!=$(id).height()){setFsmHeight();footerHeight=$(id).height()}setTimeout("monitor()",config.monitorTimeOut)} function setPosition(){if($(document).height()-browserAdjust>$(window).height()){$("#footerSpaceManager").remove();$(id).css(styleRelative)}else{$("#footerSpaceManager").size()==0&&$("body").append("<div id='footerSpaceManager' style='height: "+$(id).height()+"px;'></div>");$(id).css(styleAbsolute)}}function setFsmHeight(){$("#footerSpaceManager").size()>0&&$(id).height()!=$("#footerSpaceManager").height()&&$("#footerSpaceManager").height($(id).height())};

$(function() {

	// Sticky footer
	$("#foot").footer();
	

	/* Temporary styling
	--------------------------------------------------------------------*/
		
	$('input[type=text],input[type=password]').css({
		'-moz-box-shadow' : '0 1px 0 #fff',
		'-webkit-box-shadow' : '0 1px 0 #fff'
		});
		
	$('table th:last-child').css({
		'border-right' : '0'
		});
		
	$('table tr:last-child td').css({
		'border-bottom' : '0'
		});

		
		
		
		
		
	/* Alert Box
	--------------------------------------------------------------------*/
	$('a.close').bind('click', function() {
		$(this).parent('div').fadeOut('slow', function(){
			$(this).detach();
			});
	});





	/* Calendar - http://www.eyecon.ro/datepicker/
	--------------------------------------------------------------------*/
	
	$('body').delegate('input.input-date', 'click', function(){
	
		$el = $(this);

		$el.bind('click', function(){
			$('input').removeClass('input-date-active');
			$(this).addClass('input-date-active');
		});
		
		var now = new Date();
		now.setDate(now.getDate() - 1);

		$el.DatePicker({
			format: 'd-m-Y',
			date: $(this).val(),
			current: $(this).val(),
			starts: 0,
			position: 'right',
			onRender: function(date) {
				return {
					disabled: (date.valueOf() < now.valueOf())
				}
			},
			onChange: function(formated, dates){
				$('.input-date-active').val(formated);
				$el.DatePickerHide();
			}
		});
		
		$el.trigger('click');

	});
	
	
	
	
	
	/* 'Change Password' form fields
	--------------------------------------------------------------------*/

	$('#new-password').hide();

	$('#change-password').bind('click',
		function(){
			$('#new-password')
				.fadeIn()
				.css('margin', '20px 0')
			return false;
		}
	);

	$('#new-password-cancel').bind('click',
		function(){
			$('#new-password').fadeOut();
			return false;
		}
	);



});