 <% if bulletin -%>

<div class="modal hide fade in banner-preview" id="bulletin-<%=bulletin.id%>">
  <div class="modal-header">
    <a class="close" data-dismiss="modal">×</a>
    <h3><%= t(:preview) %></h3>
  </div>
  <div class="modal-body">
		<iframe src=<%= panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.category.id ,:preview=>true) %>></iframe>
  </div>
  <div class="modal-footer">

		<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_approve_path(bulletin),:method => :post, :html => {:class => 'form-horizontal'} do |f| %>

      <%= content_tag :div,:class => "control-group pull-left" do -%>
				<%= f.label :approval_stat, t('approval.stat'), :class=>"control-label" %>

				<%= content_tag :div,:class => "controls" do -%>

					<%= content_tag :label,:class => "radio inline" do -%>
						<%= f.radio_button :is_checked, true , {:class => 'privacy'} %> 
						<%= t('approval.pass') %>
					<% end -%>

					<%= content_tag :label,:class => "radio inline" do -%>
						<%= f.radio_button :is_checked, false, (!@bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%> 
						<%= t('approval.not_pass') %>
					<% end -%>

				<% end -%>

			<% end -%>

      <%= content_tag :div,:class => "control-group pull-left reject" do -%>
				<%= label :is_checked_false, t('approval.not_pass_reason'), :class=>"control-label" %>
			  <%= content_tag :div,:class => "controls" do -%>
			    <%= f.text_field :not_checked_reason, :class=>"input-xlarge" %>
				<% end %>
			<% end %>
			

			<%= content_tag :div,:class => "control-group pull-right" do -%>
				<%= f.submit t(:submit_approval),:class=>"btn"%>
				<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
			<% end %>
					
		<% end %>

  </div>
  <div>
  	<script type="text/javascript" src="/assets/kernel.js"></script>
		<script type="text/javascript">
			$(function() {
	      $("iframe").load(function() {
	        // Get the body element
	        var frameBody = $("iframe").contents().find('body');
	        // Get all links inside the BODY tag
	        $("iframe").contents().find('#orbit-bar').hide();
	        
	        frameBody.find('a').click(function(e){
	          //Disable all default actions
	          e.preventDefault();
	        });
	        $('input', frameBody).attr("disabled", true);
	      });
	      $(".modal").on("hidden", function () {
	        $("#show_preview").remove();
	      });
	    });
		</script>
		<script>
      $('#show_preview').on(clickEvent, 'input[type="radio"]', function(event) {
        if($(this).val() == "true") {
          $('.reject').addClass('hide');
        } else {
          $('.reject').removeClass('hide');
        }
      });
    </script>
	</div>
</div>

<% end -%>
