/**
 * @author firstlast
 */

 $(document).ready(function(){
	$('#mailing_list_modal').bind('dialogopen', function(event, ui) {
		NOU.hide_iframe_flash();
	});
	
	$('#mailing_list_modal').bind('dialogclose', function(event, ui) {
		NOU.show_iframe_flash();
	});
		
	$(".mailing_list_modal").live('click', function(e) {
		e.preventDefault();
		$("#mailing_list_modal").dialog({
			bgiframe: true,
			modal: true,
			draggable: false,
			resizable: false,
			height:506,
			width:600
		});
	});
	
	$('.nou_modal_logo').live('click', function(){
		$("#mailing_list_modal").dialog('close');
	});
	
	$('.nou_modal_logo').live('click', function(){
		$("#defn").dialog('close');
	});
	
	$('#defn').bind('dialogopen', function(event, ui) {
		NOU.hide_iframe_flash();
	});
	
	$('#defn').bind('dialogclose', function(event, ui) {
		NOU.show_iframe_flash();
	});
	
	$("#top_bar span").live('click', function(e) {
		e.preventDefault();
		$("#defn").dialog({
			bgiframe: true,
			modal: true,
			draggable: false,
			resizable: false,
			height:506,
			width:600
		});
	});
	
	$('#new_mailing_list').ajaxForm({ 
      dataType: 'json',
	  success: function(data){
	  	if (data.status == 'created'){
			//show thank-you and close modal
		}else{
			alert("There was an error signing up for the mailing list.  Please try again.");
		}
	  }
    });
});