jQuery.noConflict();
     
     // Put all your code in your document ready area
     jQuery(document).ready(function($){
    	 var coupon = $("div.simple-overlay").overlay({api: true, closeOnClick:false, onLoad:showEscape(), close: "#closeBTN"}); 
    	 var couponContent = $("#couponContent").html();
    	 $("#couponContent").text("");
//alert(couponContent);
    	// $('.error').hide();
		  $('input.text-input').css({backgroundColor:"#FFFFFF"});
		  $('input.text-input').focus(function(){
		    $(this).css({backgroundColor:"#FFDDAA"});
		  });
		  $('input.text-input').blur(function(){
		    $(this).css({backgroundColor:"#FFFFFF"});
		  });

		  $(".button").click(function() {
				// validate and process form
				// first hide any error messages
		    $('.error').hide();
				
			  var name = $("input#name").val();
				if (name == "") {
		      $("label#name_error").show();
		      $("input#name").focus();
		      return false;
		    }
				var email = $("input#email").val();
				
				var re = new RegExp(/^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$/);

				if (email == "") {
		      $("label#email_error").show();
		      $("input#email").focus();
		      return false;
		      }
		 if(!email.match(re)){
			    	  
			    	  $("label#email_error").html("Please enter valid email").show();
				      $("input#email").focus();
				      return false;
				}
		    
			
				
			var str = $("form").serialize();
			//$("#data").text(str);
			$("#formAction").html('<iframe src="http://www.frppromotions.com/eonscripts/email.php?'+str+'" border="0" width="0" height="0"></iframe>');  
			$('#contact_form').html("<div id='message'></div>");
	        $('#message').html("<h2>Thanks!</h2>")
	        .append("<p>We will be in touch soon. In just a moment, you will see your coupon codes...</p>")
	        .hide().fadeIn(1500, function() {
	        //  $('#message').append("<img id='checkmark' src='images/check.png' />");
	        	
	        	$("#couponContent").html(couponContent);
	        	coupon.load();
	        });
			      
			
			      return false;
		  });
		  
		  function showEscape(){
			  $("#boxMessage").html("<h3>Press your ESCAPE key to return to the site</h3>");
		  };
       // Do jQuery stuff using $
      // $("div#adBanner").hide();
//    	 $(function() {
//    		 
//    			
//
//    				//var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone;
//    				//alert (dataString);return false;
//    				
//	

//    				
//    				
//    			
//    		    	
	
//    		    	
//
//    		    return false;
//    			});
//    		});
    		
    	 var triggers = $("button.modalInput").overlay({ 
    		 
    		    // some expose tweaks suitable for modal dialogs 
    		    expose: { 
    		        color: '#333', 
    		        loadSpeed: 200, 
    		        opacity: 0.9
    		        
    		    }, 
    		 
    		    closeOnClick: false 
    		});
    	 var buttons = $("#yesno button").click(function(e) { 
    	     
    		    // get user input 
    		    var yes = buttons.index(this) === 0; 
    		 
    		    // do something with the answer 
    		    triggers.eq(0).html("You clicked " + (yes ? "yes" : "no")); 
    		});
    	 
    	 $("#prompt form").submit(function(e) { 
    		 
    		    // close the overlay 
    		    triggers.eq(1).overlay().close(); 
    		 
    		    // get user input 
    		    var input = $("input", this).val(); 
    		 
    		    // do something with the answer 
    		    triggers.eq(1).html(input); 
    		 
    		    // do not submit the form 
    		    return e.preventDefault(); 
    		});
    	
     });
