$(document).ready(function(){
	//INPUT ELEMENTS	
		var st = '#4c4c4c';
		var en = '#9a9a9a';
		
		$('input[type=hidden]').each(function(){
			$(this).css('display', 'none');
		});
			
		$(':input').focus(function(){
			if($(this).val() == $(this).attr('rel')){
				$(this).css('color', en);
				$(this).keydown(function(){
					if($(this).val() == $(this).attr('rel')){					
						$(this).val('');
						$(this).css('color', st);
					}
				});
			}
		}).blur(function(){
			if($(this).val() == '' || $(this).val() == $(this).attr('rel')){
				var atty = $(this).attr('rel');
				$(this).val(atty).css('color', st);
			}
		});
		
		//CHECKBOX
		$('input[type=checkbox]').each(function(){
			$(this).css({'display' : 'inline', 'width' : 'auto', 'padding' : '0px', 'margin-right' : '5px'});
		});
	//INPUT ELEMENTS
		
	//FIND LOGO
	$('#logo').css('cursor', 'pointer').bind({
		click: function(){
			window.location = './?page=home';	
		},
		mouseenter: function(){
			$(this).fadeTo(500, 0.5);
		},
		mouseleave: function(){
			$(this).fadeTo(500, 1.0);
		}
	});
	
	//BUTTONS RIGHT
	$('.button').css('cursor', 'pointer').bind({
		click: function(){
			if($(this).attr('rel') == undefined){
				window.location = './?page=home';	
			}else{
				window.location = $(this).attr('rel');	
			}			
		},
		mouseenter: function(){
			$(this).fadeTo(500, 0.5);
		},
		mouseleave: function(){
			$(this).fadeTo(500, 1.0);
		}
	});
	
	//CLEANING UP MARGINS AND JUNK
	$('#right a:last').css({'border-bottom' : 'none', 'padding-bottom' : '0px', 'margin-bottom' : '0px'});
	$('#right a:first').css({'padding-top' : '0px', 'margin-top' : '0px'});
	
	//CALENDAR SHOW
	$('.showDescription').toggle(function(){
		$(this).next().show(1000);
		$(this).css('font-weight', 'bold');
	},function(){
		$(this).next().hide('slow');
		$(this).css('font-weight', 'normal');
	});
	
	//CENTER NAV
	big = 0;
	$('#navbar a').each(function(){
		var num = $(this).width();
		var margL = parseFloat($(this).css('margin-left'));
		var margR = parseFloat($(this).css('margin-right'));
		var padL = parseFloat($(this).css('padding-left'));
		var padR = parseFloat($(this).css('padding-right'));
		var border = parseFloat($(this).css('border-width'));
		if(isNaN(border))var border = 0;
		final = num+margL+margR+padL+padR+border;
		big = final+big;
	});

	var final = Math.floor(($('#body').width() - big) / 2);
	$('#navbar a:first').before('<a style="width: '+final+'px; padding-right: 0px; padding-left: 0px"></a>');
});
