$(document).ready(function() {
						   
$("#nav-menu li").prepend("<span></span>"); //Throws an empty span tag right before the a tag

	$("#nav-menu li").each(function() { //For each list item...
		var linkText = $(this).find("a").html(); //Find the text inside of the <a> tag
		$(this).find("span").show().html(linkText); //Add the text in the <span> tag
	}); 

	$("#nav-menu li").hover(function() {	//On hover...
		$(this).find("span").stop().animate({
			marginTop: "-40" //Find the <span> tag and move it up 40 pixels
		}, 250);
	} , function() { //On hover out...
		$(this).find("span").stop().animate({
			marginTop: "0"  //Move the <span> back to its original state (0px)
		}, 250);
	});

  // Check for hash value in URL
    var hash = window.location.hash.substr(1);
    var href = $('#topnav li a').each(function(){
        var href = $(this).attr('href');
        if(hash==href.substr(0,href.length-5)){
            var toLoad = hash+'.html #content';
            $('#content').load(toLoad)
        }
    });


$("#sendMail").click(function(){

	var flag = false;
	var eMsg = '';
	
	if ($("#fullName").val() == '')
	{
		flag = true;
		eMsg = eMsg + 'Please enter your Full Name\n';
		
		
	}
	
	if ($("#emailAddress").val() == '')
	{
		flag = true;
		eMsg = eMsg + 'Please enter a valid e-mail address\n';
		
			
	}
	
	
	if ($("#sumCheck").val() != '10')
	{
		flag = true;
		eMsg = eMsg + 'The value you entered in the spam chack field is incorrect\n';
		
	}
	
	if (flag == false)
	{
		document.contact_form.action = 'contact-submit.php';
		document.contact_form.submit(); 	

	}
	else
	{
		alert(eMsg);
	}
});



});

