String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, "") }; var VitroLife = {}; VitroLife.Generate = { PDF: function() { var a = $("table.products"); var b = $(a).parent().html(); $.ajax({ type: "POST", url: " /API/Generate.ashx", data: "content=" + b, success: function(a) { alert("Data Saved: " + a) } }) } }; VitroLife.Modal = { init: function(a, b) { this.setBehaviour(a, b) }, addRefNotify: function(a) { $("div.growlUI").find(".ident-update-qty").html(a.qty); $.blockUI({ message: $("div.growlUI"), fadeIn: 700, fadeOut: 700, timeout: 2e3, showOverlay: false, centerY: false, css: { width: "300px", "z-index": "10000000", border: "none", padding: "5px", padding: "30px", backgroundColor: "#0066B3", "-webkit-border-radius": "10px", "-moz-border-radius": "10px", opacity: .8, color: "#fff", position: "absolute"} }) }, setBehaviour: function(a, b) { $(a).click(function() { $(b).show(); $(b).position({ my: "center center", at: "center center", of: $(window), offset: "0 200" }); $(b).dialog; $(b).dialog("open"); return false }) } }; VitroLife.Tabs = { init: function() { this.setBehaviour() }, setBehaviour: function() { $(".tab_content").hide(); $("ul.tabs li:first").addClass("active").show(); $(".tab_content:first").show(); $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); $(this).addClass("active"); $(".tab_content").hide(); var a = $(this).find("a").attr("href"); $(a).fadeIn(); return false }) } }; VitroLife.Menu = { openMenu: false, setBehavior: function() { $("body").click(function(a) { var b = $("header menu"); var c = $(b).find("a.top.active"); if (c != null && VitroLife.Menu.openMenu) { if (!a) { a = window.event } var d = $(a.target); if (d.parents("header menu").length == 0) { $(c).removeClass("active"); $(c).parent().find("div.submenu").hide() } } }); $("header menu li a.top").click(function(a) { var b = $(this).parent().hasClass("home"); if (!b) { VitroLife.Menu.openMenu = true; a.preventDefault(); $(this).parent().parent().find("a.top.active").removeClass("active"); $(this).parent().parent().find("div.submenu").hide(); $(this).addClass("active"); this.subMenu = $(this).parent().find(".submenu"); $(this.subMenu).show(); $(this.subMenu).position({ my: "center top", at: "center center", of: $(this), offset: "0 18" }) } }) }, init: function() { this.setBehavior() } }; VitroLife.getPages = { pageType: "", contentId: "", init: function(a, b, c) { pageType = a; contentId = b; this.setBehavior(c) }, setBehavior: function(a) { $("#navigation ul li a").bind("click", function(b) { var c = ""; if (a == "true") { c = "&date=true" } b.preventDefault(); var d = $(this).attr("rel"); location.hash = d; $(this).addClass("active"); $("#contentPanel").block({ message: '<img src="/Fertility/Images/ajax-loader.gif" />', css: { border: "none", padding: "15px", opacity: 1 }, overlayCSS: { backgroundColor: "#fff", opacity: 1} }); $.ajax({ type: "POST", url: " /Handlers/GetPages.aspx", data: "pageId=" + d + "&pageType=[Corporate]%20Press%20release&lang=" + EPI_CURR_LANG + c, success: function(a) { $("#contentPanel").empty(); $("#contentPanel").html(a); $("#contentPanel").unblock() } }); return false }); if (location.hash != null && location.hash != "") { var b = location.hash.replace("#", ""); $("#navigation ul li a").each(function() { if ($(this).attr("rel") == b) { var a = $(this); window.setTimeout(function() { a.trigger("click") }, 50) } }) } }, fetchPages: function(pageId, type) { $.ajax({ type: "POST", url: "/Handlers/GetPages.aspx", contentType: VitroLife.Common.contentType_json, data: strJsonInData, timeout: VitroLife.Common.ajaxTimeout, success: function(response) { var res = typeof response.d == "string" ? eval(response.d) : response.d; var strHtml = ""; for (var i = 0; i < res.length; i++) { var o = args.res[i]; strHtml += "hej-" } args.objDest.html(strHtml) }, error: function(a, b, c) { } }) } }; VitroLife.eQualheight = { init: function(a) { tallest = 0; a.each(function() { thisHeight = $(this).height(); if (thisHeight > tallest) { tallest = thisHeight } }); a.height(tallest) } }; VitroLife.Common = { apiOrderUrl: "/API/Order.asmx/", apiSearchUrl: "/API/Search.asmx/", apiProductsUrl: "/API/Products.asmx/", apiGenericUrl: "/API/Generic.asmx/", apiNewsletterUrl: "/API/Newsletter.asmx/", ajaxTimeout: 5e4, isInt: function(a) { return !isNaN(a) && parseInt(a) == a }, isPosInt: function(a) { return !isNaN(a) && parseInt(a) == a && parseInt(a) > 0 }, contentType_json: "application/json; charset=utf-8", params: [], getParamValue: function(a) { if (VitroLife.Common.params == null || VitroLife.Common.params.length == 0) { var b, c = /\+/g, d = /([^&;=]+)=?([^&;]*)/g, e = function(a) { return decodeURIComponent(a.replace(c, " ")) }, f = window.location.search.substring(1); while (b = d.exec(f)) { VitroLife.Common.params[e(b[1])] = e(b[2]) } } return VitroLife.Common.params[a] }, initRefreshSession: function() { window.setInterval(function() { var a = "{}"; $.ajax({ type: "POST", url: VitroLife.Common.apiGenericUrl + "RefreshSession", contentType: VitroLife.Common.contentType_json, data: a, timeout: VitroLife.Common.ajaxTimeout, success: function(a) { }, error: function(a, b, c) { } }) }, 15 * 60 * 1e3) }, SendEmail: function() { var a = $("#subscribe-newsletter-input"); var b = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (b.test($(a).val())) { $.ajax({ type: "POST", url: VitroLife.Common.apiNewsletterUrl + "Subscribe", contentType: VitroLife.Common.contentType_json, data: "{'strSubscriberEmail': '" + $(a).val() + "','intSettingsID':'" + EPI_SETTINGS_ID + "'}", timeout: VitroLife.Common.ajaxTimeout, success: function(b) { if (b.d == "True") { $(a).parent().append("<em>Thank you for signing up!</em>"); $(a).remove(); $(".subscription button").remove() } else { alert("An error occured, please try again.") } }, error: function(a, b, c) { } }) } else { $(a).addClass("invalid") } }, hideAllPopups: function() { $(".popup").hide() } }; VitroLife.State = {}; VitroLife.PointOfInterest = { init: function() { $("#pointofinterest").pointsOfInterest() } }; VitroLife.ProductHighlights = { init: function() { this.setBehavior() }, setBehavior: function() { var a = $("#producthighlights"); $(a).find("img").wrap("<span></span>") } }; VitroLife.ProductOrderModule = { init: function() { VitroLife.ProductRefOrder.loadBasket(); VitroLife.ProductRefOrder.reloadOrderQty(); $(".ident-prod-fam-open").bind("click", function() { VitroLife.Common.hideAllPopups(); VitroLife.ProductOrderModule.openFamiliesBox(); return false }); $(".ident-prod-ref-finder-open").bind("click", function() { VitroLife.Common.hideAllPopups(); $("#ProductRefFinderModBox").show(); return false }); $(".ident-prod-ref-removeall").bind("click", function() { VitroLife.ProductRefOrder.remove({ removeall: true, onsuccess: VitroLife.ProductOrderModule.afterAction }); return false }); $("#ProductRefFinderModBox .ident-prod-ref-finder-add").unbind("click").bind("click", function() { function a(a) { VitroLife.ProductOrderModule.afterAction(a) } var b = $(this).parent().children(".ident-prod-ref-finder-value"); var c = b.attr("value").trim(); VitroLife.ProductRefOrder.add({ onsuccess: a, id: -1, qty: 1, ref: c }); return false }); $("#ProductRefFinderModBox .ident-prod-ref-finder-close").unbind("click").bind("click", function() { $(this).parent().hide(); return false }); $(".ident-prod-modbox-close").unbind("click").bind("click", function() { $(this).parent().parent().hide(); return false }); if (VitroLife.State.productIsOrderable == "1") { var a = $(".ident-prod-specprod-open"); a.bind("click", function() { VitroLife.ProductOrderModule.openSpecProductBox(VitroLife.State.productEpiID); return false }); a.show() } }, createBoxNav: function(args) { var strJsonInData = "{'intStartEpiID':'" + args.epiid + "','intEndEpiID':'" + EPI_CURR_PRODUCTS_PAGE_ID + "','intMaxCount':'" + "3" + "','strLanguage':'" + EPI_CURR_LANG + "'}"; $.ajax({ type: "POST", url: VitroLife.Common.apiGenericUrl + "GetBreadcrumbResult", contentType: VitroLife.Common.contentType_json, data: strJsonInData, timeout: VitroLife.Common.ajaxTimeout, success: function(response) { var res = typeof response.d == "string" ? eval(response.d) : response.d; var strHtml = ""; var strProdFamEpiID = ""; var bBackToRoot = false; for (var i = 0; i < res.length; i++) { var o = res[i]; var strClick = ""; if (i == 0) { strClick = 'onclick="VitroLife.ProductOrderModule.openFamiliesBox();return false;"' } else if (i == 1) { if (o.PageTypeName == "[Fertility] Product Family") { strProdFamEpiID = o.PageID; strClick = "onclick=\"VitroLife.ProductOrderModule.openProductsBox('" + strProdFamEpiID + "');return false;\"" } else if (o.PageTypeName == "[Fertility] Product") { bBackToRoot = true } } strHtml += "<a " + strClick + ' title="' + o.PageName + '" href="#">' + o.PageName + "</a>"; if (i + 1 < res.length) { strHtml += " / " } } var objBc = args.objBox.find(".ident-prod-breadcrumbs"); objBc.html(strHtml); objBc.children("a:last").addClass("active"); if (args.onBack) { var objBack = args.objBox.find(".ident-prod-back"); objBack.unbind("click"); objBack.bind("click", { epiid: strProdFamEpiID, backtoroot: bBackToRoot }, args.onBack) } }, error: function(a, b, c) { } }) }, loadBox: function(args) { var strJsonInData = "{'intEpiID':'" + args.epiid + "','strLanguage':'" + EPI_CURR_LANG + "'}"; $.ajax({ type: "POST", url: VitroLife.Common.apiProductsUrl + args.ws, contentType: VitroLife.Common.contentType_json, data: strJsonInData, timeout: VitroLife.Common.ajaxTimeout, success: function(response) { var res = typeof response.d == "string" ? eval(response.d) : response.d; if (args.onsuccess) { args.onsuccess({ objBox: args.objBox, res: res }); return } }, error: function(a, b, c) { } }) }, openFamiliesBox: function() { function a(a) { var b = a.objBox.children(".ident-prod-list"); var c = VitroLife.ProductOrderModule.renderListing(b, a.res); VitroLife.ProductOrderModule.createBoxNav({ epiid: EPI_CURR_PRODUCTS_PAGE_ID, objBox: $("#ProductFamiliesModBox") }); a.objBox.show() } $("#ProductProductsModBox, #ProductSpecProductModBox").hide(); var b = $("#ProductFamiliesModBox"); VitroLife.ProductOrderModule.loadBox({ onsuccess: a, epiid: EPI_CURR_PRODUCTS_PAGE_ID, objBox: b, ws: "GetFamiliesResult", onclick: VitroLife.ProductOrderModule.openProductsBox }) }, openProductsBox: function(a) { function b(b) { function e(a) { VitroLife.ProductOrderModule.openFamiliesBox(); return false } var c = b.objBox.children(".ident-prod-list"); var d = VitroLife.ProductOrderModule.renderListing(c, b.res); VitroLife.ProductOrderModule.createBoxNav({ epiid: a, objBox: $("#ProductProductsModBox"), onBack: e }); b.objBox.show() } $("#ProductFamiliesModBox, #ProductSpecProductModBox").hide(); var c = $("#ProductProductsModBox"); VitroLife.ProductOrderModule.loadBox({ onsuccess: b, epiid: a, objBox: c, ws: "GetProductsResult" }) }, openSpecProductBox: function(a) { function b(b) { function k(a) { if (a.data.backtoroot) { VitroLife.ProductOrderModule.openFamiliesBox() } else { VitroLife.ProductOrderModule.openProductsBox(a.data.epiid) } return false } var c = b.objBox.find(".ident-prod-list"); var d = b.res.length; if (d == 0) { c.html("nothing found") } else { var e = ""; for (var f = 0; f < d; f++) { var g = b.res[f]; e += '<tr><td class="reference"><strong>' + g.Ref + "</strong></td><td><strong>" + g.Title + "</strong><span>" + g.Category + '</span><span class="separator"></span></td><td class="description">' + g.Description + '</td><td class="amount">Amount<br /><input type="text" class="ident-prod-qty" value="1"><input type="hidden" class="ident-prod-id" value="' + g.EpiID + '" /><span>' + g.Size + '</span>  <a class="ident-prod-add button small" href="#"> Add </a></td></tr>' } c.html(e); var h = $("#ProductSpecProductModBox .ident-prod-list .ident-prod-add"); function i(a) { VitroLife.ProductOrderModule.afterAction(a) } function j() { var a = $(this).parent().parent().children(".amount"); var b = a.children(".ident-prod-id").attr("value").trim(); var c = a.children(".ident-prod-qty"); c.attr("value", c.attr("value").trim()); var d = c.attr("value"); if (!VitroLife.Common.isPosInt(d)) { alert("TODO:bad format on number."); return false } VitroLife.ProductRefOrder.add({ id: b, qty: d, onsuccess: i }); return false } h.each(function() { $(this).unbind("click"); $(this).bind("click", j) }) } VitroLife.ProductOrderModule.createBoxNav({ epiid: a, objBox: $("#ProductSpecProductModBox"), onBack: k }); b.objBox.show() } $("#ProductFamiliesModBox, #ProductProductsModBox, #ProductSpecProductModBox").hide(); var c = $("#ProductSpecProductModBox"); VitroLife.ProductOrderModule.loadBox({ onsuccess: b, epiid: a, objBox: c, ws: "GetRefResult" }) }, renderListing: function(a, b) { var c = b.length; if (c == 0) { a.html("nothing found") } else { var d = "<ul>"; for (var e = 0; e < c; e++) { var f = b[e]; d += '<li><a href="' + f.LinkUrl + '">' + f.PageName + '<span style="display:none;" class="ident-prod-pageid">' + f.PageID + '</span><span style="display:none;" class="ident-prod-pagetypename">' + f.PageTypeName + "</span></a></li>" } d += "</ul>"; a.html(d); a.children("ul").children("li").children("a").each(function() { $(this).unbind("click"); $(this).bind("click", function() { var a = $(this).children(".ident-prod-pageid").text(); var b = $(this).children(".ident-prod-pagetypename").text(); if (b == "[Fertility] Product Family") { VitroLife.ProductOrderModule.openProductsBox(a) } else if (b == "[Fertility] Product") { VitroLife.ProductOrderModule.openSpecProductBox(a) } return false }) }) } return true }, afterAction: function(a) { if (a.res.Status.Type == "error") { alert(a.res.Status.Msg) } VitroLife.ProductRefOrder.loadBasket(); VitroLife.ProductRefOrder.reloadOrderQty() }, addCollection: function() { function a(a) { VitroLife.ProductOrderModule.afterAction(a) } var b = $("#ProductSpecProductModBox .ident-prod-list tr .ident-prod-id"); var c = true; var d = []; b.each(function() { var a = $(this).parent(); var b = a.children(".ident-prod-id").attr("value"); var e = a.children(".ident-prod-qty").attr("value").trim(); if (!VitroLife.Common.isInt(e)) { c = false } if (c) { if (VitroLife.Common.isPosInt(e)) { d.push({ id: b, qty: e }) } } }); if (c) { if (d.length > 0) { VitroLife.ProductRefOrder.add({ items: d, onsuccess: a }) } } else { alert(MSG_ERROR_GENERIC) } }, renderBasket: function(a) { function g(a) { VitroLife.ProductOrderModule.afterAction(a) } var b = a.objOrderBasket; var c = ""; var d = a.res.OrderItems; if (d.length == 0) { b.html('<tr><td colspan="4"><strong>You have not added any products.</strong></td></tr>'); return } for (var e = 0; e < d.length; e++) { var f = d[e]; c += '<tr><td class="reference"><strong>' + f.Ref + "</strong></td><td><strong>" + f.Title + "</strong><span>" + f.Category + '</span><span class="separator"></span></td><td class="description">' + f.Description + "</td>" + '<td class="amount ident-prod-orderbasket-line">Amount<br /><input type="text" class="ident-prod-qty" value="' + f.Qty + '"><input type="hidden" class="ident-prod-id" value="' + f.EpiID + '" /><span>' + f.Size + '</span><br /><a class="ident-prod-ref-remove button small" href="#" style="float:right; margin-top: -20px"> x </a><a class="ident-prod-ref-update button small" href="#" style="float:right; margin-top: -20px"> <img src="/Fertility/Images/ui_refresh.png" height="10" width="10" alt="Update" title="Update" /> </a></td></tr>' } b.html(c).children("tr").children(".ident-prod-orderbasket-line").each(function() { var a = $(this).children(".ident-prod-qty"); var b = $(this).children(".ident-prod-id").attr("value").trim(); var c = $(this).children(".ident-prod-ref-update"); c.unbind("click"); c.bind("click", { epiid: b, objQty: a }, function(b) { a.attr("value", a.attr("value").trim()); var c = a.attr("value"); if (!VitroLife.Common.isInt(c) || parseInt(c) < 0) { alert("TODO:bad format on number."); return false } VitroLife.ProductRefOrder.update({ epiid: b.data.epiid, qty: c, onsuccess: g }); return false }); var d = $(this).children(".ident-prod-ref-remove"); d.unbind("click"); d.bind("click", { epiid: b }, function(a) { VitroLife.ProductRefOrder.remove({ epiid: a.data.epiid, onsuccess: g }); return false }) }) } }; VitroLife.ProductRefOrder = { init: function() { }, gotoOrderPage: function() { window.location.href = EPI_CURR_ORDER_URL; return false }, add: function(args) { var strJsonInData, strWSName; var totalQty = 0; if (args.ref) { strWSName = "AddProductByRef"; strJsonInData = "{'intEpiID':'" + EPI_CURR_PRODUCTS_PAGE_ID + "','intQty':'" + args.qty + "','strLanguage':'" + EPI_CURR_LANG + "','strRef':'" + args.ref + "'}"; totalQty = args.qty } else if (args.items) { var strArrayOfProducts = ""; for (var i = 0; i < args.items.length; i++) { strArrayOfProducts += args.items[i].id + ";" + args.items[i].qty + "|"; totalQty += args.items[i].qty } strWSName = "AddProducts"; strJsonInData = "{'strArrayOfProducts':'" + strArrayOfProducts + "','strLanguage':'" + EPI_CURR_LANG + "'}" } else if (args.id) { strWSName = "AddProduct"; strJsonInData = "{'intEpiID':'" + args.id + "','intQty':'" + args.qty + "','strLanguage':'" + EPI_CURR_LANG + "'}"; totalQty = args.qty } else { return } $.ajax({ type: "POST", url: VitroLife.Common.apiOrderUrl + strWSName, contentType: VitroLife.Common.contentType_json, data: strJsonInData, timeout: VitroLife.Common.ajaxTimeout, success: function(response) { var res = typeof response.d == "string" ? eval(response.d) : response.d; if (args.onsuccess) { args.onsuccess({ res: res }); VitroLife.Modal.addRefNotify({ qty: totalQty }) } }, error: function(a, b, c) { } }) }, remove: function(args) { var strJsonInData, strWSName; if (args.removeall) { strWSName = "RemoveAllProducts"; strJsonInData = "{'strLanguage':'" + EPI_CURR_LANG + "'}" } else { strWSName = "RemoveProduct"; strJsonInData = "{'intEpiID':'" + args.epiid + "','strLanguage':'" + EPI_CURR_LANG + "'}" } $.ajax({ type: "POST", url: VitroLife.Common.apiOrderUrl + strWSName, contentType: VitroLife.Common.contentType_json, data: strJsonInData, timeout: VitroLife.Common.ajaxTimeout, success: function(response) { var res = typeof response.d == "string" ? eval(response.d) : response.d; if (args.onsuccess) { args.onsuccess({ res: res }) } }, error: function(a, b, c) { } }) }, update: function(args) { var strJsonInData = "{'intEpiID':'" + args.epiid + "','intQty':'" + args.qty + "','strLanguage':'" + EPI_CURR_LANG + "'}"; $.ajax({ type: "POST", url: VitroLife.Common.apiOrderUrl + "UpdateProductQty", contentType: VitroLife.Common.contentType_json, data: strJsonInData, timeout: VitroLife.Common.ajaxTimeout, success: function(response) { var res = typeof response.d == "string" ? eval(response.d) : response.d; if (args.onsuccess) { args.onsuccess({ res: res }) } }, error: function(a, b, c) { } }) }, reloadOrderQty: function() { var a = "{}"; $.ajax({ type: "POST", url: VitroLife.Common.apiOrderUrl + "GetCurrentOrderQty", contentType: VitroLife.Common.contentType_json, data: a, timeout: VitroLife.Common.ajaxTimeout, success: function(a) { var b = a.d; $(".ident-prod-order-qty").each(function() { $(this).text(b) }) }, error: function(a, b, c) { } }) }, loadBasket: function() { var objOrderBasket = $("#OrderBasket"); if (objOrderBasket.length == 0) { return } var strJsonInData = "{'strLanguage':'" + EPI_CURR_LANG + "','strLanguage':'" + EPI_CURR_LANG + "'}"; $.ajax({ type: "POST", url: VitroLife.Common.apiOrderUrl + "GetCurrentOrderItems", contentType: VitroLife.Common.contentType_json, data: strJsonInData, timeout: VitroLife.Common.ajaxTimeout, success: function(response) { var res = typeof response.d == "string" ? eval(response.d) : response.d; VitroLife.ProductOrderModule.renderBasket({ res: res, objOrderBasket: objOrderBasket }) }, error: function(a, b, c) { alert("error, please reload the page and try again") } }) } }; VitroLife.SearchRel = { searchValue: "", init: function() { this.setBehavior() }, isBusy: false, setBehavior: function() { function c(a) { window.location.href = EPI_CURR_SEARCH_URL + "?SearchCriteria=" + encodeURIComponent(a) + "&sId=" + EPI_CURR_SEARCH_ID } function b(b) { if (a(b)) { VitroLife.SearchRel.execSearch(b) } } function a(a) { return true; if (a != "" && a.length > 2) { return true } alert("You must type in more than 2 letters"); return false } var d = $("#SearchInput"); var e = VitroLife.Common.getParamValue("SearchCriteria"); if (e != null && e != "") { e = e.trim(); d.attr("value", e); b(e) } d.bind("keyup", function(a) { $("form").bind("submit", function(a) { a.preventDefault() }); if (a.keyCode == 13 && !VitroLife.SearchRel.isBusy) { var c = $(this).attr("value").toLowerCase().trim(); b(c) } return false }); $("#searchbutton").bind("click", function(a) { var c = d.attr("value").toLowerCase().trim(); b(c); return false }); $("#toolbox-search").bind("keyup", function(b) { if (b.keyCode == 13) { var d = $(this).attr("value").toLowerCase().trim(); if (a(d)) { c(d) } } return false }); $("#tsearch .tbtnSearch").bind("click", function() { var b = $("#toolbox-search").attr("value").toLowerCase().trim(); if (a(b)) { c(b) } return false }) }, execSearch: function(strSearchCriteria) { var startId = $("#search-options input[type='radio']:checked").val(); var strJsonInData = "{'intEpiID':'" + startId + "','strLanguage':'" + EPI_CURR_LANG + "','strSearchCriteria':'" + strSearchCriteria + "'}"; VitroLife.SearchRel.isBusy = true; $.ajax({ type: "POST", url: VitroLife.Common.apiSearchUrl + "GetSearchResult", contentType: VitroLife.Common.contentType_json, data: strJsonInData, timeout: VitroLife.Common.ajaxTimeout, success: function(response) { var res = typeof response.d == "string" ? eval(response.d) : response.d; VitroLife.SearchRel.renderResult({ res: res, crit: strSearchCriteria }) }, error: function(a, b, c) { VitroLife.SearchRel.isBusy = false; alert("Error/overloaded, please reload the page and try again") } }) }, renderResult: function(a) { var b = $("#search"); var c = a.res; var d = c.length; if (d == 0) { b.html("No results"); $(".prevbutton, .nextbutton").css("display", "none"); $("#search-total").html(""); VitroLife.SearchRel.renderInfo(0, 0, 0) } else { $("#search-total").html('<strong>Your search for "' + a.crit + '" matches ' + d + " posts</strong>"); var e = "<ul>"; for (var f = 0; f < d; f++) { var g = c[f]; e += '<li class="res-item"><a href="' + g.LinkUrl + '">' + g.PageName + '</a><div class="search-breadcrumb grid7">' + g.Breadcrumb + "</div></li>" } e += "</ul>"; b.html(e); var h = 10; var i = $("#search ul li.res-item").raPaging({ rotate: false, pagesize: h, prev: ".prevbutton", next: ".nextbutton", onchange: VitroLife.SearchRel.pagingOnChange }); $(".prevbutton").css("display", "none"); $(".nextbutton").css("display", d <= h ? "none" : "inline-block"); $(".prevbutton, .nextbutton").bind("focus", function() { $(this).trigger("blur") }); VitroLife.SearchRel.renderInfo(1, d <= h ? d : h, i.state.itemcount) } VitroLife.SearchRel.isBusy = false }, pagingOnChange: function(a, b) { a.state.prev.css("display", b.isfirst ? "none" : "inline-block"); a.state.next.css("display", b.islast ? "none" : "inline-block"); VitroLife.SearchRel.renderInfo(b.cfirst + 1, b.clast + 1, a.state.itemcount); return false }, renderInfo: function(a, b, c) { var d = $(".search-nav span"); if (c == 0) { d.parent().hide() } else { d.parent().show(); d.text(a + " - " + b + " / " + c) } } }; VitroLife.Contacts = { init: function() { this.setBehavior() }, setBehavior: function() { function d() { var a = c(); var d = []; var e = $(".ident-contacts-list-group"); e.hide(); var f = b().children(":selected"); var g = ""; if (f.length > 0) { g = f.attr("value") } a.each(function(a) { if ($(this).attr("checked") == "checked") { d[d.length] = $(this).attr("value") } }); e.each(function(a) { function b(a, b) { if (a == null || a == "") { return true } return (new RegExp(a + "(?=;|$)")).test(b) } var c = false; var e = $(this).children(".ident-contacts-list-data-group").attr("value"); for (var f = 0; f < d.length; f++) { if (d[f] == e) { c = true } } if (c) { if (1 == 1) { var h = $(this).children("ul"); h.hide(); var i = 0; h.each(function() { var a = $(this).children("li").children(".ident-contacts-list-data-countries").attr("value"); if (b(g, a)) { i++; $(this).fadeIn(400) } }); c = i > 0 ? true : false } if (c) { $(this).fadeIn(400) } } }) } function c() { return a.children(".groups").children("label.ident-groups-group").children("input") } function b() { return a.children("select") } var a = $(".contacts-filter"); if (a.length > 0) { c().each(function() { $(this).bind("change", function() { d() }) }); b().bind("change", function() { d() }); d(); a.children(".groups").children("label.ident-groups-all").children("input").bind("change", function() { c().attr("checked", $(this).attr("checked") == "checked"); d() }) } }, setIframeInjectContent: function(doc, strSelector, strType) { var objContact = $(doc).contents().find(strSelector); if (objContact.length > 0) { if (objContact.children().length == 0) { var strPreferedContactCollections; switch (strType) { case "TECH_SUPPORT": strPreferedContactCollections = CONTACT_COLL_TECH_SUPPORT; break; case "ORDER_SUPPORT": strPreferedContactCollections = CONTACT_COLL_ORDER_SUPPORT; break } var strJsonInData = "{'strUserPrefCountryCode':'" + USER_PREF_COUNTRY_CODE + "','strPreferedContactCollections':'" + strPreferedContactCollections + "','strLanguage':'" + EPI_CURR_LANG + "'}"; $.ajax({ type: "POST", url: VitroLife.Common.apiGenericUrl + "GetPreferedContact", contentType: VitroLife.Common.contentType_json, data: strJsonInData, timeout: VitroLife.Common.ajaxTimeout, success: function(response) { var res = typeof response.d == "string" ? eval(response.d) : response.d; if (!res) { return } var strHtml = "<p>"; if (res.Email) { strHtml += '<a href="mailto:' + res.Email + '">' + res.Email + "</a><br />" } if (res.Phone) { strHtml += res.Phone } strHtml += "</p>"; objContact.html(strHtml) }, error: function(a, b, c) { } }) } } } }; VitroLife.Events = { init: function() { this.setBehavior() }, setBehavior: function() { function l(d) { function h(a, b, c) { var d = $(".search-nav span"); if (c == 0) { d.parent().hide() } else { d.parent().show(); d.text(a + " - " + b + " / " + c) } } function g(a, b) { a.state.prev.css("display", b.isfirst ? "none" : "inline-block"); a.state.next.css("display", b.islast ? "none" : "inline-block"); p.each(function() { var a = $(this).data("ref"); if ($(this).is(":visible")) { a.fadeIn() } else { a.fadeOut() } }); h(b.cfirst + 1, b.clast + 1, a.state.itemcount); return false } function f(a, b, c) { var d = b.children(".ident-point").attr("value").split(";"); b.children(".col1").children(".no").text(c); var e = parseInt(d[0]) - 16; var f = parseInt(d[1]) - 48; a.append('<a style="left:' + e + "px;top:" + f + 'px;display:none;"><span>' + c + "</span></a>"); var g = a.children("a:last-child"); b.data("ref", g); b.unbind("mouseover").bind("mouseover", { ref: g }, function(a) { a.data.ref.trigger("mouseover"); return false }); b.unbind("mouseout").bind("mouseout", { ref: g }, function(a) { a.data.ref.trigger("mouseout"); return false }); g.bind("mouseover", { ref: b }, function(a) { var b = $(this).parent().children(".infobox"); var c = a.data.ref; b.children(".date").text(c.children(".ident-date").attr("value")); b.children(".title").text(c.children(".title").text()); b.children(".location").text(c.children(".location").text()); var d = $(this).position().left - 58; var e = $(this).position().top - (b.height() + 37); b.css({ left: d + "px", top: e + "px" }); b.show(); return false }); g.bind("mouseout", { ref: b }, function(a) { var b = $(this).parent().children(".infobox"); b.hide(); return false }); var h = b.children("a"); if (h.length > 0) { g.attr("href", h.attr("href")) } else { g.bind("click", function() { return false }) } } var j = $.datepicker.parseDate(b, d.from); var k = $.datepicker.parseDate(b, d.to); var l = c.children(".map"); e.hide(); e.removeClass("ident-vis"); l.children("a").remove(); var m = 0; e.each(function() { var a = $(this).children("input.ident-date").attr("value"); var b = i(j, k, a); if (b) { m++; f(l, $(this), m) } if (b) { $(this).addClass("ident-vis"); $(this).show() } }); var n = 10; var o = a.children().children(".search-nav"); var p = a.children().children(".events-list").children("li.ident-vis"); var q = p; var r = p.raPaging({ rotate: false, pagesize: n, prev: ".prevbutton", next: ".nextbutton", onchange: g }); $(".prevbutton").css("display", "none"); $(".nextbutton").css("display", r.state.itemcount <= n ? "none" : "inline-block"); h(1, r.state.itemcount < n ? r.state.itemcount : n, r.state.itemcount); p.each(function() { if ($(this).is(":visible")) { var a = $(this).data("ref"); a.show() } }) } function k(a, b) { var c = new RegExp("\\d\\d\\d\\d-\\d\\d-\\d\\d"); return c.test(a) && c.test(b) } function j(a, c) { var d = $.datepicker.parseDate(b, a); var e = $.datepicker.parseDate(b, c); var f = e - d } function i(a, c, d) { var e = typeof a == "string" ? $.datepicker.parseDate(b, a) : a; var f = typeof c == "string" ? $.datepicker.parseDate(b, c) : c; var g = typeof d == "string" ? $.datepicker.parseDate(b, d) : d; var h = e - g <= 0; var i = f - g >= 0; return h && i } function h(b, c) { var e, g; d.each(function() { if (f($(this))) { e = $(this).children("input") } else { g = $(this).children("input") } }); if (b) { e.attr("value", c) } else { g.attr("value", c) } var h = e.attr("value"); var i = g.attr("value"); a.children().children(".events-list-info").text(h + " - " + i); if (k(h, i)) { l({ from: h, to: i }) } } function g(a, c) { var d = $.datepicker.parseDate(b, a); var e = $(this).parent(); var g = f(e); $(this).datepicker().hide(); h(g, a) } function f(a) { return a.hasClass("ident-filter-from") } var a = $(".events-overview"); if (a.length == 0) { return } var b = "yy-mm-dd"; $.datepicker.setDefaults({ dateFormat: b }); var c = a.children(".events-map-area"); var d = c.children(".filters").children(".filter"); var e = a.children().children(".events-list").children("li"); e.each(function() { var a = $(this).children("a"); if (a.length > 0) { $(this).bind("click", { url: a.attr("href") }, function(a) { window.location.href = a.data.url; return false }) } else { $(this).css("cursor", "default") } }); d.each(function() { var a = f($(this)); var c = $(this).children(".datepicker").datepicker({ onSelect: g, defaultDate: a ? -7 : 7 }); c.hide(); h(a, $.datepicker.formatDate(b, c.datepicker("getDate"))); $(this).children("a").bind("click", function() { $(this).parent().children(".datepicker").datepicker().show(); return false }) }) } }; (function(a) { a.fn.clearDefault = function() { return this.each(function() { var b = a(this).val(); a(this).focus(function() { if (a(this).val() == b) a(this).val("") }); a(this).blur(function() { if (a(this).val() == "") a(this).val(b) }) }) } })(jQuery); $(document).ready(function() { VitroLife.PointOfInterest.init(); VitroLife.ProductHighlights.init(); VitroLife.ProductRefOrder.init(); VitroLife.ProductOrderModule.init(); VitroLife.SearchRel.init(); VitroLife.Menu.init(); VitroLife.Tabs.init(); VitroLife.Events.init(); $("#toolbox-search").clearDefault(); $("#subscribe-newsletter-input").clearDefault(); VitroLife.Common.initRefreshSession(); VitroLife.Contacts.init(); $(".subscription button").click(function() { VitroLife.Common.SendEmail() }) })
