$(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);
		}
	});
	
	$('#foot_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);
		}
	});
	
	//CLEANING UP MARGINS AND JUNK
	$('#navbar a:last').css('padding-right', '0px');
	$('#navbar a:first').css('padding-left', '0px');
	$('#right a:last').next().css('display', 'none');
	
	//CALENDAR SHOW
	$('.showDescription').toggle(function(){
		$(this).next().show(1000);
		$(this).css('font-weight', 'bold');
	},function(){
		$(this).next().hide('slow');
		$(this).css('font-weight', 'normal');
	});

	//SPEAKING ENGAGEMENT
	
	$('#speaking').css('cursor', 'pointer').bind({
		click: function(){
			window.location = './?page=speaking';
		},
		mouseenter: function(){
			$(this).fadeTo(500, 0.5);
		},
		mouseleave: function(){
			$(this).fadeTo(500, 1.0);
		}
	});
	
	//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');
			}
		}
	});
	
	//GET LINE HEIGHT
	var h1 = $('#left').height();
	var h2 = $('#right').height();
	if(h1 > h2){
		$('#line').css('height', h1+'px');
	}else{
		$('#line').css('height', h2+'px');	
	}
});
