$(document).ready(function(){
	//INPUT ELEMENTS	
		//remove styles from hidden inputs
		$('input[type=hidden]').each(function(){$(this).css('display', 'none');});
		
		//change color unless typed in	
		$(':input').focus(function(){
			if($(this).val() == $(this).attr('rel')){
				$(this).fadeTo(500, 0.5);
				$(this).keydown(function(){
					if($(this).val() == $(this).attr('rel')){					
						$(this).val('');
						$(this).fadeTo(500, 1.0);
					}
				});
			}
		}).blur(function(){
			if($(this).val() == '' || $(this).val() == $(this).attr('rel')){
				var atty = $(this).attr('rel');
				$(this).val(atty).fadeTo(500, 1.0);
			}
		});
		
		//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';	
		}
	});
	
	$('#footLogo').css('cursor', 'pointer').bind({
		click: function(){
			window.location = './?page=home';	
		},
		mouseenter: function(){
			$(this).fadeTo(500, 0.3);
		},
		mouseleave: function(){
			$(this).fadeTo(500, 1.0);
		}
	});
	
	//twitter
	$("#twitter").getTwitter({
		userName: "Guido_Montesano",
		numTweets: 4,
		loaderText: "Loading tweets...",
		slideIn: true,
		showHeading: true,
		headingText: "Latest Tweets",
		showProfileLink: true
	});

	//margins
		$('#navbar a').last().css('padding-right', '0px');
		$('#inner a').last().css({'padding-bottom':'0px', 'margin-bottom':'0px', 'border-bottom':'none'});
	//margins
	
	//social
		$('#social a').hover(function(){
			$(this).fadeTo(750, 0.5);
		},function(){
			$(this).fadeTo(750, 1.0);		
		});
	//social
	
	//buttons
		$('#buttons a').hover(function(){
			$(this).fadeTo(750, 1.0);
		},function(){
			$(this).fadeTo(750, 0.5);		
		});
	//buttons
		
	//CALENDAR SHOW
	$('.showDescription').toggle(function(){
		$(this).next().show(1000);
		$(this).css('font-weight', 'bold');
	},function(){
		$(this).next().hide('slow');
		$(this).css('font-weight', 'normal');
	});			

	//PLAYLIST
	$('.playlist li a').click(function(){
		var inner = $(this).html();
		
		if(inner == 'play'){
			$(this).html('playing');
		}else{
			if(inner == 'playing'){
				$(this).html('paused (click to play)');
			}else{
				$(this).html('playing');
			}
		}
	});
		
	//SHOW HIDDEN
	$('.show_hidden').toggle(function(){
		$(this).next().slideDown('slow');
	},function(){
		$(this).next().slideUp('fast');	
	});
});
