jQuery(document).ready(function () { fsj_init_elements(); jQuery('#fsj_modal_container').appendTo(document.body); // fix hide event in bootstrap when mootools is loaded if (typeof (MooTools) != "undefined") { (function ($) { $$('[data-toggle=collapse]').each(function (e) { if ($$(e.get('data-target')).length > 0) { $$(e.get('data-target'))[0].hide = null; } }); })(MooTools); } }); function fsj_init_elements() { jQuery('.fsj_vertcenter').each(function () { var elem_height = jQuery(this).outerHeight(true); var parent_height = jQuery(this).parent().height(); var offset = parseInt((parent_height - elem_height) / 2); jQuery(this).css('top', offset + 'px'); }); jQuery('.fsj_show_modal').click(function (ev) { ev.preventDefault(); var url = jQuery(this).attr('href'); var width = jQuery(this).attr('data_modal_width'); if (typeof (width) != "number") width = 0; if (width < 1) width = 560; if (jQuery(window).width() < 766) { width = jQuery(window).width(); } var offset = parseInt(width / 2); jQuery('#fsj_modal').unbind('hidden'); jQuery('#fsj_modal').html(jQuery('#fsj_modal_base').html()); jQuery('#fsj_modal').css('width', width + 'px'); jQuery('#fsj_modal').css('margin-left', '-' + offset + 'px'); jQuery('#fsj_modal').modal("show"); jQuery('#fsj_modal').load(url); }); jQuery('.fsj_show_modal_window').click(function (ev) { ev.preventDefault(); var url = jQuery(this).attr('href'); var width = jQuery(this).attr('data_window_width'); var height = jQuery(this).attr('data_window_height'); if (typeof(width) == "undefined") width = 560; if (typeof(height) == "undefined") height = 480; if (typeof (width) == "string" && width.indexOf('%') > 0) { width = width.replace("%", ""); width = parseInt(width / 100 * jQuery(window).width()); } if (typeof (height) == "string" && height.indexOf('%') > 0) { height = height.replace("%", ""); height = parseInt(height / 100 * jQuery(window).height()); } window.open(url, "_newwindow", "toolbar=no,width=" + width.toString() + ",height=" + height.toString() + ",status=no"); }); jQuery('.fsj_show_modal_iframe').click(function (ev) { ev.preventDefault(); var url = jQuery(this).attr('href'); var width = jQuery(this).attr('data_modal_width'); if (typeof(width) == "undefined") width = 560; if (typeof(width) == "string" && width.indexOf('%') > 0) { width = width.replace("%", ""); width = parseInt(width / 100 * jQuery(window).width()); } if (width > parseInt(jQuery(window).width() * 0.95)) width = parseInt(jQuery(window).width() * 0.95); var offset = parseInt(width / 2); var onclose = jQuery(this).attr('data_modal_close'); jQuery('#fsj_modal').unbind("hidden"); if (onclose) { jQuery('#fsj_modal').on('hidden', function () { eval(onclose); }); } jQuery('#fsj_modal').addClass('iframe'); jQuery('#fsj_modal').html("