// JavaScript Document
  $(document).ready(function(){
$("#main").prepend('<div id="contactFormContainer"><div id="contactForm"><fieldset><form id="formvalidation" action="/system/plugins/contact/mailer.php" method="post"><label for="Name">Name *</label><input id="Name" type="text" name="name" title="Your Name Required" class="required" /><p></p><label for="Email">Email address *</label><input id="Email" type="text" name="email" title="Your Email Required"  class="email required" /><p> </p><label for="Message">Your message *</label><textarea id="Message" name="message" rows="3" cols="20" title="Message Required"  class="required" ></textarea><p> </p><input id="sendMail" type="submit" name="submit" value="Send Message"  /></form><p id="messageSent"><!-- --></p></fieldset></div><div id="contactLink"></div></div>');

									   
		$("#formvalidation").validate({
 errorPlacement: function(error, element) {
     error.appendTo(element.next("p") );
   },

   submitHandler: function(form) {
   	$(form).ajaxSubmit({						
					target: 		'#messageSent',
				//	beforeSubmit: 	showPreloader,
				
					success: 		closeForm
		
			});
   }
});
									   

                $("#contactLink").click(function(){
                    if ($("#contactForm").is(":hidden")){
                        $("#contactForm").slideDown("slow");
                    }
                    else{
                        $("#contactForm").slideUp("slow");
                    }
                });
                
     
		 }); 
		  function closeForm(){
                $("#messageSent").show("slow");
                setTimeout('$("#messageSent").hide();$("#contactForm").slideUp("slow")', 2000);
           }
