$(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

	//mp3s
    $(document).ready(function() {
        $(".playlist").playlist(
            {
                playerurl: "js/drplayer.swf"
            }
        );
    });	
	//mp3s
	
	//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.5);
		},
		mouseleave: function(){
			$(this).fadeTo(500, 1.0);
		}
	});
	
	//SLIDER
	$(document).ready(function(){	
		$("#slider").easySlider({
			auto: true, 
			continuous: true
		});
	});
	
	//COLORBOX
	$("a[rel='example1']").colorbox();
	$("a[rel='example2']").colorbox();
	$("a[rel='example3']").colorbox();
	$("a[rel='example4']").colorbox();
	$("a[rel='example5']").colorbox();
	$("a[rel='example6']").colorbox();
	$("a[rel='example7']").colorbox();
	
	$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});	
	
	//red line height
	cH = $('#container').height();
	fH = cH - $('#footer').height();
	bH = cH - 280;
	$('#redLine').css('height', fH+'px');
	$('#boxes').css('height', bH+'px');
	
	//email us
	$('.emailSubmit').click(function(){
		email = $('input[name=emailGive]').val();
		if(email != 'EMAIL ADDRESS'){
			$.ajax({
				type: 'POST',
				url: 'php/ajax/email.php',
				data: 'email='+email,
				success: function(msg){
					if(msg == 'good'){
						$('#emailHolder').slideUp('fast', function(){
							$('#emailError').html('Thanks, we will be in touch with you shortly').slideDown('slow');
						});
					}else{
						$('#emailHolder').slideUp('fast', function(){
							$('#emailError').html(msg).slideDown('slow');
						});
					}
				},
				dataType: 'html'
			});
		}
	});
	
	//carousel
	$('#mycarousel').jcarousel();
	$('#mycarousel2').jcarousel();
	$('#mycarousel3').jcarousel();
	$('#mycarousel4').jcarousel();
	$('#mycarousel5').jcarousel();
	$('#mycarousel6').jcarousel();
	$('#mycarousel7').jcarousel();
	$('#mycarousel8').jcarousel();
	
	//margins
	$('#navbar a').last().css('padding-right', '0px');
	$('#inner a').last().css({'margin-bottom' : '0px', 'padding-bottom' : '0px', 'border-bottom' : 'none'});
	
	//SHOW HIDDEN
	$('.show_hidden').toggle(function(){
		$(this).next().slideDown('slow');
	},function(){
		$(this).next().slideUp('fast');	
	});
});
