$(document).ready(function() {
	$("div.clearfix").append("<div style='clear:both;background-color:transparent;height:0;border:0;padding:0;'></div>");
	$("form#contact-form").submit(function(e){
		var data='task=submit_contact_form';
		if ($("form#contact-form input.required").val() == '') {
				alert("Please fill all the require fields.");
		} else {
		$(this).find("input,textarea").each(function(){
			data = data+'&'+$(this).attr("name")+'='+$(this).val();
		});
		}
		e.preventDefault();														
	});

	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	$("ul.topnav li a").click(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).parent().find("span").addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).parent().find("span").removeClass("subhover"); //On hover out, remove class "subhover"
	});
});
