$(document).ready(function(){ $("img").unveil(); window.addEventListener("resize", function () { adjust_card_height (); }); $('a[href^="#"]').on('click',function (e) { e.preventDefault(); var target = this.hash, $target = $(target); if ($target.offset()) var scrollpositiontop = $target.offset().top; else var scrollpositiontop = "0.000001"; $('html, body').stop().animate({ 'scrollTop': scrollpositiontop }, 900, 'swing', function () { window.location.hash = target; }); }); adjust_card_height (); $(window).scroll(function(){ if ($(this).scrollTop() > 250) { $('#backtotop').fadeIn(300); } else { $('#backtotop').fadeOut(300); } }); $(window).scroll(function(){ if ($(this).scrollTop() > 215) { $('#menu_hor').addClass("fixed"); $('#menu_hor_banner').addClass("fixed"); } else { $('#menu_hor').removeClass("fixed"); $('#menu_hor_banner').removeClass("fixed"); } }); }); function adjust_card_height () { $("div#box_spc").each( function() { var height_div_here = 0; var height_h3_here = 0; $(this).find("div#box_card h3").each( function() { $(this).height("auto"); var height_h3 = $(this).height(); if (height_h3 > height_h3_here) height_h3_here = height_h3; }); if ($("body").width() > 980) $(this).find("div#box_card h3").height(height_h3_here); $(this).find("div#box_card").each( function() { $(this).height("auto"); var height_box = $(this).height(); if (height_box > height_div_here) height_div_here = height_box; }); if ($("body").width() > 980) $(this).find("div#box_card").height(height_div_here); }); } function tmpcontainer_reset () { $("#tmpcontainer").removeClass(); $("#tmpcontainer").attr("style",""); } function popup_open (type, parameter, callback, ajax) { $("#popup_outer").removeClass("hidden"); //$("#popup_inner").css("width", "380px"); //$("#popup_inner").css("margin-left", "-190px"); //$("#popup_inner").css("height", "auto"); //$("#popup_inner").css("min-height", "100px"); //$("#popup_inner").css("margin-top", "-144px"); $("#popup_inner").addClass(type); if (type == "wait") { if (!parameter) $("#popup_inner").html("

"); else $("#popup_inner").html("

" + parameter + "

"); } else { $("#popup_inner").html("

"); var popup_code = $.post("/ajax/popup/open_popup.inc.php", { type: type, parameter: parameter }, function(data) { if (data) { var obj = JSON.parse(data); if (!obj.Success) { $("#popup_inner").removeClass(); popup_close(); alert(obj.ErrorMessage); } else { var popup_output = ""; $("#popup_inner").html(popup_output); if ($("textarea.copy")) $("textarea.copy").select(); else alert('!'); $(".popup_switch").live("click",function () { if (!$(this).hasClass("deactivated")) { if ($(this).hasClass("popup_close")) popup_close(); if (typeof(callback) == 'function') callback($(this).attr("name"), obj.MoreData); } }); if ($("#popup_autoclose").val()) { var delaytime = $("#popup_autoclose").val(); if (delaytime) timeoutID = window.setTimeout(popup_close, delaytime); } if (type == "ajax") { if (typeof(ajax) != 'function') { alert('No valid ajax function.'); } else { ajax($(this).attr("name")); } } } } else alert('No connection'); }); } } function popup_close() { $(".popup_switch").die(); $("#popup_outer").addClass("hidden"); $("#popup_inner").removeClass(); $("#popup_inner").html(""); $("div#popup_inner").css("height","auto"); $("div#popup_inner").css("margin-top", "-144px"); $("div#popup_inner div.popuptable").css("height", "auto"); }