wp/wp-content/themes/themeforest-2964855-scrn-responsive-single-page-portfolio/SCRN/js/contact-form.js
changeset 0 d970ebf37754
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wp/wp-content/themes/themeforest-2964855-scrn-responsive-single-page-portfolio/SCRN/js/contact-form.js	Wed Nov 06 03:21:17 2013 +0000
@@ -0,0 +1,49 @@
+jQuery(document).ready(function() {
+	
+	//if submit button is clicked
+	jQuery('.contact-form #submit').click(function () {		
+		
+		//Get the data from all the fields
+		var name = jQuery('input[name=name]');
+		var email = jQuery('input[name=email]');
+		var website = jQuery('input[name=website]');
+		var comment = jQuery('textarea[name=comment]');
+
+		//Simple validation to make sure user entered something
+		//If error found, add hightlight class to the text field
+		if (name.val()=='') {
+			name.addClass('hightlight');
+			return false;
+		} else name.removeClass('hightlight');
+		
+		if (email.val()=='') {
+			email.addClass('hightlight');
+			return false;
+		} else email.removeClass('hightlight');
+		
+		if (comment.val()=='') {
+			comment.addClass('hightlight');
+			return false;
+		} else comment.removeClass('hightlight');
+		
+		//disabled all the text fields
+		jQuery('.text').attr('disabled','true');
+		
+		//show the loading sign
+		jQuery('.loading').show();
+
+		jQuery.post("../wp-content/themes/SCRN/index.php", { name : name.val(), email : email.val(), comment : comment.val(), submit : "yes" }, function() {
+						
+			jQuery('.form').fadeOut('slow');					
+
+			jQuery('.done').fadeIn('slow');
+
+			jQuery('.contact-form form').fadeOut('slow');
+
+		});
+					
+		return false;
+						
+		//cancel the submit button default behaviours
+	});	
+});