var istouch = modernizr.touch, ismobile = false, w_width = jquery(window).width(), w_height = jquery(window).height(), $mtop = jquery(".mtop"), $mtoph = $mtop.height(); var menu = { trigger: ".menu-handler", init: function () { menu.bind(); }, bind: function () { $(document).on("click", menu.trigger, menu.open); $(document).on("click", ".navmobile dd p a", function (e) { var fkcur = $(this); var fkdd = $(this).parents("p").parents("dd"); if (fkdd.find(".msubnav").size() > 0) { if (fkcur.hasclass("cur")) { fkdd.find(".msubnav").stop(false, false).slideup(); fkcur.removeclass("cur"); } else { jquery(".navmobile dd p a").removeclass("cur"); jquery(".msubnav").stop(false, false).slideup(); fkdd.find(".msubnav").stop(false, false).slidedown(); fkcur.addclass("cur"); e.preventdefault(); } } }); $(document).on("click", "#bg-fukai", menu.open) }, open: function () { if ($("body").is(".open")) { $("body").removeclass("open"); $(".menu-handler").removeclass("active"); $("#bg-fukai").fadeto("fast", 0, function () { $("#bg-fukai").hide(); }); } else { $("#bg-fukai").fadeto("fast", 0.4); $("body").addclass("open"); $(".menu-handler").addclass("active"); } } }; var serachform = { trigger: ".serachbtn", serachbg: ".serachbg", serachclose: ".serachclose", init: function () { serachform.bind(); }, bind: function () { $(document).on("click", serachform.trigger, serachform.open); $(document).on("click", serachform.serachbg, serachform.open); $(document).on("click", serachform.serachclose, serachform.open); }, open: function () { if ($(".searchcon").is(".active")) { $(".searchcon").fadeout(300); $(".searchcon").removeclass("active"); $(".serachbg").fadeout(300); } else { $(".serachbg").fadein(300); $(".searchcon").fadein(300); $(".searchcon").addclass("active"); } } }; var ermform = { trigger: ".ermbtn", ermbg: ".ermbg", ermclose: ".ermclose", init: function () { ermform.bind(); }, bind: function () { $(document).on("click", ermform.trigger, ermform.open); $(document).on("click", ermform.ermbg, ermform.open); $(document).on("click", ermform.ermclose, ermform.open); }, open: function () { if ($(".ermcon").is(".active")) { $(".ermcon").fadeout(300); $(".ermcon").removeclass("active"); $(".ermbg").fadeout(300); } else { $(".ermbg").fadein(300); $(".ermcon").fadein(300); $(".ermcon").addclass("active"); } } }; var _mousemove; var _click; var _mousedown; var _mouseup; if (modernizr.touch) { _mousemove = "touchmove"; _click = "touchend"; _mousedown = "touchstart"; _mouseup = "touchend"; } else { _mousemove = "mousemove"; _click = "click"; _mousedown = "mousedown"; _mouseup = "mouseup"; }; function pagebox() { w_width = jquery(window).width(); w_height = jquery(window).height(); if (w_width <= 1024) { ismobile = true; } else if (w_width > 1024) { ismobile = false; }; $mtoph = $mtop.height(); }; function setimgmax(img, imgw, imgh, tw, th) { var twidth = tw || w_width; var theight = th || w_height; var coe = imgh / imgw; var coe2 = theight / twidth; if (coe < coe2) { var imgwidth = theight / coe; img.css({ height: theight, width: imgwidth, left: -(imgwidth - twidth) / 2, top: 0 }); } else { var imgheight = twidth * coe; img.css({ height: imgheight, width: twidth, left: 0, top: -(imgheight - theight) / 2 }); }; };