$(document).ready(function(){ //email opt-in in footer
  $("#opt_in_email,#opt_in_email_modal,#opt_in_email_blog").labelify();
  $(".signup_button").click(function(){
	 var email = $("input#opt_in_email").val(); 
	 if (email == "enter email address") {  
	   alert("Please enter an email address to add to our newsletter list."); 
	   $("input#opt_in_email").focus();  
	   return false;  
	 }
	 var dataString = 'email=' + email;  
	 //alert (dataString);return false;  
	 $.ajax({  
		type: "POST",  
		url: "/wp-content/themes/usdp/includes/process/ajax.php?type=email_opt_in",  
		data: dataString,  
		success: function() {  
			$('#email_opt_in_div').html("<div id='message'></div>");  
			$('#message').html("<h2>Thank you!</h2>")  
		   .append("<p>We will be in touch soon.</p>")  
		   .hide()  
		   .fadeIn(1500, function() {  
			 //$('#message').append("<img id='checkmark' src='images/check.png' />");  
		   });  
		}  
	 });  
	 return false;  
  });
  
  
}); // end email opt-in in footer



$().ready(function() { //email opt-in modal in social links
	
	var t = $('#opt_in_modal div.jqmdMSG');
	
	$('#opt_in_modal').jqm({
		trigger: 'a.opt_in_modal_trigger',
		//target: t,
		onShow: function(h) { 
			h.w.fadeIn(400); // show window
		},
		onHide: function(h) { 
			t.html('Please Wait...');  // Clear Content HTML on Hide.
			h.o.remove(); // remove overlay
			h.w.fadeOut(400); // hide window
			
		},
		overlay: 55});
	
	// Work around for IE's lack of :focus CSS selector
	if($.browser.msie)
		$('input')
			.focus(function(){$(this).addClass('iefocus');})
			.blur(function(){$(this).removeClass('iefocus');});
			
	  $(".signup_modal").click(function(){
		 var email = $("input#opt_in_email_modal").val(); 
		 if (email == "enter email address") {  
		   alert("Please enter an email address to add to our newsletter list."); 
		   $("input#opt_in_email_modal").focus();  
		   return false;  
		 }
		 var dataString = 'email=' + email;  
		 $.ajax({  
			type: "POST",  
			url: "/wp-content/themes/usdp/includes/process/ajax.php?type=email_opt_in",  
			data: dataString,  
			success: function() {  
				$('#email_opt_in_div_modal').html("<div id='message'></div>");  
				$('#message').html("<h2>Thank you!</h2>")  
			   .append("<p>We will be in touch soon.</p>")  
			   .hide()  
			   .fadeIn(1100);  
			}  
		 });  
		 return false;  
		  });
	
	
});


$(document).ready(function(){ //email opt-in in right column on blog
  $(".signup_button_blog").click(function(){
	 var email = $("input#opt_in_email_blog").val(); 
	 if (email == "enter email address") {  
	   alert("Please enter an email address to add to our newsletter list."); 
	   $("input#opt_in_email_blog").focus();  
	   return false;  
	 }
	 var dataString = 'email=' + email;  
	 //alert (dataString);return false;  
	 $.ajax({  
		type: "POST",  
		url: "/wp-content/themes/usdp/includes/process/ajax.php?type=email_opt_in",  
		data: dataString,  
		success: function() {  
			$('#email_opt_in_blog_div').html("<div id='message'></div>");  
			$('#message').html("<h2>Thank you!</h2>")  
		   .append("<p>We will be in touch soon.</p>")  
		   .hide()  
		   .fadeIn(1500, function() {  
			 //$('#message').append("<img id='checkmark' src='images/check.png' />");  
		   });  
		}  
	 });  
	 return false;  
  });
  
  
}); // end email opt-in right column on blog

$().ready(function() { //vimeo modal popup on design+tech page
	
	var t = $('#vimeo_modal div.jqmdMSG');
	
	$('#vimeo_modal').jqm({
		trigger: 'a.vimeo_modal_trigger',
		//target: t,
		onShow: function(h) { 
			h.w.fadeIn(400); // show window
		},
		onHide: function(h) { 
			t.html('Please Wait...');  // Clear Content HTML on Hide.
			h.o.remove(); // remove overlay
			h.w.fadeOut(400); // hide window
			
		},
		overlay: 85});
	
	// Work around for IE's lack of :focus CSS selector
	if($.browser.msie)
		$('input')
			.focus(function(){$(this).addClass('iefocus');})
			.blur(function(){$(this).removeClass('iefocus');});	
});

