@init_interface = ->
$("body#dialog_container.dialog").addClass "iframed" if parent and parent.document.location.href != document.location.href
$("input:submit:not(.button)").addClass "button"
unless $.browser.msie
$("#page_container, .wym_box").corner "5px bottom"
$(".wym_box").corner "5px tr"
$(".field > .wym_box").corner "5px tl"
$(".wym_iframe iframe").corner "2px"
$(".form-actions:not(\".form-actions-dialog\")").corner "5px"
$("#recent_activity li a, #recent_inquiries li a").each (i, a) ->
$(this).textTruncate
width: $(this).width()
tooltip: false
$("textarea.wymeditor").each ->
textarea = $(this)
if (instance = WYMeditor.INSTANCES[$((textarea.next(".wym_box").find("iframe").attr("id") or "").split("_")).last().get(0)])?
if (next = textarea.parent().next())? and next.length > 0
next.find("input, textarea").keydown($.proxy((e) ->
shiftHeld = e.shiftKey
if shiftHeld and e.keyCode == $.ui.keyCode.TAB
@_iframe.contentWindow.focus()
e.preventDefault()
, instance)).keyup (e) ->
shiftHeld = false
if (prev = textarea.parent().prev())? and prev.length > 0
prev.find("input, textarea").keydown $.proxy((e) ->
if e.keyCode == $.ui.keyCode.TAB
@_iframe.contentWindow.focus()
e.preventDefault()
, instance)
if ($menu = $("#menu")).length > 0
$menu.jcarousel
vertical: false
scroll: 1
buttonNextHTML: "' alt='down' height='15' width='10' />"
buttonPrevHTML: "' alt='up' height='15' width='10' />"
listTag: $menu.get(0).tagName.toLowerCase()
itemTag: $menu.children(":first").get(0).tagName.toLowerCase()
if $menu.outerWidth() < $("#page_container").outerWidth()
$("#page_container:not('.login #page_container')").corner "5px tr"
else
$("#page_container:not('.login #page_container')").uncorner()
$("#current_locale li a").click (e) ->
$("#current_locale li a span").each (span) ->
$(this).css "display", (if $(this).css("display") == "none" then "" else "none")
$("#other_locales").animate
opacity: "toggle"
height: "toggle"
, 250
$("html,body").animate scrollTop: $("#other_locales").parent().offset().top, 250
e.preventDefault()
$("#existing_image img").load ->
$("form.edit_image .form-actions").css "margin-top": ($("#existing_image").height() - $("form.edit_image").height() + 8)
$(".form-actions .form-actions-left input:submit#submit_button").click (e) ->
$("' width='16' height='16' class='save-loader' />").appendTo $(this).parent()
$(".form-actions.form-actions-dialog .form-actions-left a.close_dialog").click (e) ->
titlebar_close_button = $('.ui-dialog-titlebar-close')
titlebar_close_button = parent.$('.ui-dialog-titlebar-close') if parent
titlebar_close_button.trigger('click')
e.preventDefault()
$("a.suppress").live "click", (e) ->
e.preventDefault()