var $ = jQuery.noConflict(); var rootel = 'wheelsform'; var jqfrm = "\u003ciframe width=\"100%\" id=\"wheelscars\" src=\"https://costa-web.wheelsys.io/$wsid$reservations/?lang=fr\" frameborder=\"0\" scrollong=\"no\" allowtransparency=\"true\" onload=\"resizeIframe(this)\"\u003e\u003c/iframe\u003e"; var url1 = "https://costa-web.wheelsys.io/public/css/wheels.css"; var ifrurl = "https://costa-web.wheelsys.io/"; var ifr = ifrurl.split("/"); ifrurl = ifr[0] + "//" + ifr[2]; var oper = 'step2' window.addEventListener("message", receiveMessage, false); function WsParam(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } function receiveMessage(event) { if (event.origin !== ifrurl) { // alert(event.origin); return; } targurl = event.data; if (!isNaN(parseFloat(targurl)) && isFinite(targurl)) { //alert(targurl); var h = parseFloat(targurl); var doTop = true; if (h < 0) { doTop = false; h = 0-h; } $("#wheelscars").parent().height(h); $("#wheelscars").height(h); if (doTop) { var y = 0; y = $("#wheelscars").parent().offset().top; window.scrollTo(0, y); } return; } targurl = targurl.replace("$wsid$", WsParam("WSID")); window.location.href = targurl; } function resizeIframe(obj) { //obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px'; } $(document).ready(function() { if (document.createStyleSheet) { document.createStyleSheet(url1); } else { jQuery('').appendTo('head'); } //CALL CREATION SCRIPT jqfrm = jqfrm.replace('$abcd$', encodeURIComponent(window.location.href)).replace("$wsid$", "(S(" + WsParam("WSID") + "))/"); $("#" + rootel).html(jqfrm); $("#" + rootel).css("position", "relative"); $("#" + rootel).css("z-index", "100"); $("#" + rootel).css("background-color", "transparent"); if (oper == "step2") { if (window.outerWidth < 768) { //$("#" + rootel).css("padding-bottom", "90%"); $("#" + rootel).css("min-height", "550px"); } else if (window.outerWidth >= 768 && window.outerWidth <= 991) { $("#" + rootel).css("min-height", "550px"); } else if (window.outerWidth > 992) { $("#" + rootel).css("min-height", "250px"); } } else { if (window.outerWidth > 992) { $("#" + rootel).css("height", "250px"); } else { if (window.outerWidth >= 768 && window.outerWidth <= 992) { $("#" + rootel).css("height", "550px"); } } $("#" + rootel).css("overflow-y", "visible"); } });