<%= render :partial => "sector_form" %>
<%= javascript_tag do %>
$("#center_body").css("width","782px");
$("#center_body").css("max-width","782px");
$("#content").css("width","782px");
$("#contacts_filter_input").Watermark("<%= escape_javascript(I18n.t('search.name')) %>");
$("#contacts_grid_extra").click(function(){
$("#contacts_grid").css("overflow-y","scroll");
$("#contacts_grid").scrollTo("+=308px", 800, {axis:'y'});
$("#contacts_grid_extra").css("opacity",0);
});
var unselected_actor_click = function(){
var clone = $(this).clone();
clone.attr("id",$(this).attr("id") + "_selected");
$(this).fadeOut("fast",function(){
clone.hide();
$(this).before(clone);
$("#contacts_grid_selected_hint").before($(this));
$(this).off("click.unselected_actor");
$(this).on("click.selected_actor", selected_actor_click);
if($("#contacts_grid_selected_hint").css("display")!="none"){
$("#contacts_selector_modifiers").css("opacity",1);
$("#contacts_grid_selected_hint").hide();
}
var height = 336 - Math.ceil(($("#contacts_grid_selected").children().length - 1) / 10) * 28;
if(height != $("#contacts_grid_available").height())
$("#contacts_grid_available").animate({height: height});
$(this).fadeIn("fast");
});
};
var selected_actor_click = function(){
var clone = $("#" + $(this).attr("id") + "_selected");
$(this).fadeOut("fast",function(){
clone.before($(this));
$(this).off("click.selected_actor");
$(this).on("click.unselected_actor", unselected_actor_click);
if($("#contacts_grid_selected").children().length <= 2){
$("#contacts_selector_modifiers").css("opacity",0);
$("#contacts_grid_selected_hint").fadeIn("fast");
}
var height = 336 - Math.ceil(($("#contacts_grid_selected").children().length - 1) / 10) * 28;
if(height != $("#contacts_grid_available").height())
$("#contacts_grid_available").animate({height: height});
$(this).fadeIn("fast");
clone.remove();
});
};
$("#contacts_selector_clear").on("click",function(){
$("#contacts_grid_selected .actor").each(function(){
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
var cb = $(this)[0];
!cb.dispatchEvent(evt);
});
});
$(".actor").on("click.unselected_actor",unselected_actor_click);
$("#contacts_changes_button").click(function(){
if($(".contacts_changes_tipsy_menu").length != 0){
$("#contacts_changes_button").tipsy("hide");
}else{
$("#contacts_changes_button").tipsy("show");
$("#contacts_changes_title").click(function(){
$("#contacts_changes_button").tipsy("hide");
});
}
});
<%= render :partial => 'cheesecake' %>
<% end %>