$(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 = "MESSAGE";
    }
  }); 



 $("#myl").click(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 == 'EMAIL ADDRESS') {		
          alert("Please enter your email address");
		  $("input#email").val('EMAIL ADDRESS') ;
          return false;
      }
	  
var company = $("input#company").val();
var telephone = $("input#telephone").val();
var message= $("textarea#message").val();




  var dataString = 'name='+ name + '&email=' + email + '&company=' + company + '&telephone=' + telephone + '&message=' + message;
  //alert (dataString);return false;
  $.ajax({
    type: "POST",
    url: "/wp-content/themes/SpinConcepts/ajax/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;

 });
 

});