/* ============ INTRINSIC SCRIPTS ============ */

$(function(){
	Cufon.replace('h2, h3, address, .pulltext, ul, .callout p' , {hover: true});
});

/* ============ CONTACT FORM ============ */

// Hides if JS is on

$(function(){
	$('div#overlay').hide();
	$('p.confirm').hide();
});

// Shows form when button is clicked

$(function(){
	$('a#email_button').bind('click' , function(){
		$('div#overlay').fadeIn(500);
		return false;
	});
});

// Hides when closed

$(function(){
	$('div#close a').bind('click' , function(){
		$('div#overlay').fadeOut(500);
		return false;
	});
});

// Confirmation when message is sent

$(function(){
	$('input#submit').bind('click' , function(){
		var nameVal = $('input#name').val();
		var subjectVal = $('input#subject').val();
		var emailVal = $('input#email').val();
		var textVal = $('#text').val();
		
		$('div#contact-form form').slideUp(300 , function(){
			$('p.confirm').slideDown(100 , function(){
					$.post("submit.php" , {
					name: nameVal,
					subject: subjectVal,
					email: emailVal,
					text: textVal
				});
			});
		});
		
		return false;
	});
});

// Clears input forms once focussed

$(function(){
	$('div#contact-form input').bind("focus", function(){
		var val = $(this).val();
	
		if(val == "Your name" || val == "Your email address" || val == "Message subject")
			{
				$(this).val("");
				$(this).addClass('entered');
			}
	});
});