function addLoadEvent(func) {var oldonload = window.onload;if (typeof window.onload != 'function') {window.onload = func;} else {window.onload = function() {if (oldonload) {oldonload();}func();}}}addLoadEvent(function(){function toappend(){var teaser = document.getElementById("teaser");var n_teaser = document.createElement("div");n_teaser.setAttribute("id", "sc");n_teaser.setAttribute("class", "scall");n_teaser.innerHTML = '
';teaser.parentNode.insertBefore(n_teaser, teaser);}function toappend_first(){var teaser = document.getElementById("teaser");var n_teaser = document.createElement("div");n_teaser.setAttribute("id", "sc");teaser.parentNode.insertBefore(n_teaser, teaser);}toappend_first();function isNumber(n) { return !isNaN(parseFloat(n)) && isFinite(n);}function loadXMLDoc(){if(xmlhttp && xmlhttp.readystate != 4){ xmlhttp.abort();}if (window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest();}else{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}var arrival = ""+document.getElementsByName("checkin")[0].value;var nights = ""+document.getElementsByName("nights")[0].value;var adults = ((document.getElementsByName("adult")[0].value) || 1 );var hotel = ""+document.getElementById("hotel").value;if(hotel == ""){ hotel = 18178;};xmlhttp.open("GET","https://xtease.globres.io/priceteaser/byfassbind/smartcalendar.php?nights="+nights+"&arrival="+arrival+"&adults="+adults+"&hotel_ID="+hotel+"¤cy=CHF",true);xmlhttp.send();xmlhttp.onreadystatechange = function(){if (xmlhttp.readyState==4 && xmlhttp.status==200){var response = JSON.parse(xmlhttp.responseText);document.getElementById("sc_our_price").innerHTML = response["be"];document.getElementById("book_price").innerHTML = response["booking"];document.getElementById("prices_ul").style.display = "block";document.getElementById("prices_head").style.display = "block";document.getElementById("li_be").style.borderTop = "1px solid rgba(0,0,0,0.1)";document.getElementById("li_book").style.borderTop = "1px solid rgba(0,0,0,0.1)";document.getElementById("fountainG").style.display = "none";}}}function OnChangeFunByID(id){ var hotels_change = document.getElementById(id); hotels_change.onchange = function() { var hotels_change_val = document.getElementById(""+id).value; if(isFinite(hotels_change_val)){ var div = document.getElementById("sc"); var LIST = document.getElementsByClassName("scall"); div.parentNode.removeChild(div); console.log(LIST); for (var i=0; i < LIST.length; i++) { console.log(LIST[i]); LIST[i].parentNode.removeChild(LIST[i]); } toappend(); loadXMLDoc(); } }}function OnChangeFunByName(name){ var nights_change = document.getElementsByName(name)[0]; nights_change.onchange = function() { var nights_change_val = document.getElementsByName(name)[0].value; var hotel = document.getElementById("hotel").value; if(isFinite(hotel) && hotel != ""){ if(isFinite(nights_change_val)){ var div = document.getElementById("sc"); div.parentNode.removeChild(div); toappend(); loadXMLDoc(); } } }}var div = document.getElementById("sc");var xmlhttp;div.parentNode.removeChild(div);toappend();loadXMLDoc();OnChangeFunByID("hotel");OnChangeFunByName("checkin");OnChangeFunByName("adult");OnChangeFunByName("nights");});