$(document).ready(function(){
	$('#fader').innerfade({
		speed: 1500,
		timeout: 8000,
		type: 'sequence',
		containerheight: '220px',
		containerwidth: '257px'
	});

	//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';
	});
	
	//NAVBAR STUFF
	var jj = 0;
	var padL = 0;
	var padR = 0;
	var pad = 0;
	$('#navbar a').each(function(){
		jj += parseFloat($(this).width());
		padL += parseFloat($(this).css('padding-left'));
		padR += parseFloat($(this).css('padding-right'));
		pad = parseFloat($(this).css('padding-right'));
	});
	
	jj = jj+padL+padR;
	
	
	var total = $('#navbar').width();
	var leftover = total - jj;
	var half = leftover/2;
	var final = (Math.floor(half));
	if(final > 22){
		final = 22;
	}
	var pp = final+pad;
	
	$('#navbar a:first').css({'padding-left' : pp+'px', '-moz-border-radius-topleft' : '12px', '-webkit-border-top-left-radius' : '12px', '-moz-border-radius-bottomleft' : '12px', '-webkit-border-bottom-left-radius' : '12px'});
	$('#navbar a:last').css({'padding-right' : pp+'px', '-moz-border-radius-topright' : '12px', '-webkit-border-top-right-radius' : '12px', '-moz-border-radius-bottomright' : '12px', '-webkit-border-bottom-right-radius' : '12px'});
	
	//COLORBOX
	$("a[rel='example1']").colorbox();

	
	//BUTTONS
	$('.button').click(function(){
		window.location = $(this).attr('rel');
	});
	$('.button').hover(function(){
		$(this).children().css('color', '#ffffff');
	},function(){
		$(this).children().css('color', '#fff79f');		
	});
});
