$(document).ready(function(){

	$('input[type="text"]').focus(function() {
		
        if (this.value == this.defaultValue){
        	this.value = '';
    	}
        if(this.value != this.defaultValue){
	    	this.select();
        }
    });
	
	
	$('input[type="text"]').blur(function() {
    if(this.value == '') {
      this.value = this.defaultValue;
    }
  }); 
  
	
	$("textarea#message").focus(function() {
		
        if (this.value == this.defaultValue){
        	this.value = '';
    	}
        if(this.value != this.defaultValue){
	    	this.select();
        }
    });
	
		$("textarea#message").blur(function() {
    if(this.value == '') {
      this.value = "Type your message";
    }
  }); 


	
	$("textarea#message-side").focus(function() {
		
        if (this.value == this.defaultValue){
        	this.value = '';
    	}
        if(this.value != this.defaultValue){
	    	this.select();
        }
    });
	
		$("textarea#message-side").blur(function() {
    if(this.value == '') {
      this.value = "Type your message";
    }
  }); 


  $("form#form2").submit(function() {



var name = $("input#name").val();
  		if (name == "" || name == 'Your Name' ) {		
          alert("Please enter your name");
		  $("input#name").val("Your Name");
		  
          return false;
      }
	  
var email = $("input#email").val();
  		if (email== "" || email == 'E-mail ID') {		
          alert("Please enter your email address");
		  $("input#email").val('E-mail ID') ;
          return false;
      }
	  

var telephone = $("input#telephone").val();
var message= $("textarea#message").val();




  var dataString = 'name='+ name + '&email=' + email  + '&telephone=' + telephone + '&message=' + message;
  //alert (dataString);return false;
  $.ajax({
    type: "POST",
    url: "submitform.php",
    data: dataString,
    success: function() {
      $('#form2').html("<div id='message' align='center'></div>");
      $('#message').html("<p align='center' ><h2>THANK YOU for contacting us!</h2></p>")
      .append("<p align='center'>We will get back to you soon.</p>")
      
      
    }
  });
  return false;

 });
 
 
  $("form#form3").submit(function() {

      $('#err-text').html("");

var name = $("input#name-side").val();
  		if (name == "" || name == 'Your Name' ) {		
         
      $('#err-text').html("Please enter your name");
		  $("input#name-side").val("Your Name");
		  
          return false;
      }
	  
var email = $("input#email-side").val();
  		if (email== "" || email == 'E-mail ID') {		
         $('#err-text').html("Please enter your email address");
		  $("input#email-side").val('E-mail ID') ;
          return false;
      }
	  

var telephone = $("input#telephone-side").val();
var message= $("textarea#message-side").val();




  var dataString = 'name='+ name + '&email=' + email  + '&telephone=' + telephone + '&message=' + message;
  //alert (dataString);return false;
  $.ajax({
    type: "POST",
    url: "submitform.php",
    data: dataString,
    success: function() {
      $('#form3').html("<div id='message' align='center'><p align='center' ><h2>THANK YOU for contacting us!</h2></p><p align='center'>We will get back to you soon.</p></div>");

      
      
    }
  });
  return false;

 });
 
 
 
 
});
