function setYes(a){ tmpCheckbox = document.getElementById(a); tmpCheckbox.value = "1" } function setNo(a){ tmpCheckbox = document.getElementById(a); tmpCheckbox.value = "0" } function changebutton(obj, cmd){ obj.className = cmd; } var smooth_timer; v=25; function smoothScrollLogin(){ if (document.getElementById('loginbox').style.display != 'block'){ document.getElementById('loginbox').style.display = 'block'; setInterval("smoothScrollLogin();", 100); } else { v = v/1.1; scrollBy(0,v); if(v>1){ setInterval("smoothScrollLogin();", 10); } } } function changebuttondiv(name){ var button_up = document.getElementById(name + '_up'); var button_down = document.getElementById(name + '_down'); var info = document.getElementById(name); if (info.style.display == 'none'){ info.style.display = 'block'; button_up.style.display = 'block'; button_down.style.display = 'none'; } else { info.style.display = 'none'; button_up.style.display = 'none'; button_down.style.display = 'block'; } } function rowOver(i, nColor) { if (!nColor) nColor = "#ECECD9"; var nameObj = (document.getElementById) ? document.getElementById('name' + i) : eval("document.all['name" + i + "']"); if (nameObj != null) nameObj.style.background=nColor; } function rowOut(i, nColor) { var trObj = (document.getElementById) ? document.getElementById('ihtr' + i) : eval("document.all['ihtr" + i + "']"); var nameObj = (document.getElementById) ? document.getElementById('name' + i) : eval("document.all['name" + i + "']"); if (trObj == null || trObj.style.display=="none") nameObj.style.background=nColor; } function smoothHeight(id, curH, targetH, stepH, mode) { diff = targetH - curH; if (diff != 0) { newH = (diff > 0) ? curH + stepH : curH - stepH; ((document.getElementById) ? document.getElementById(id) : eval("document.all['" + id + "']")).style.height = newH + "px"; if (smooth_timer) window.clearTimeout(smooth_timer); smooth_timer = window.setTimeout( "smoothHeight('" + id + "'," + newH + "," + targetH + "," + stepH + ",'" + mode + "')", 20 ); } else if (mode != "o") ((document.getElementById) ? document.getElementById(mode) : eval("document.all['" + mode + "']")).style.display="none"; } function servOC(i, href, nColor) { var trObj = (document.getElementById) ? document.getElementById('ihtr' + i) : eval("document.all['ihtr" + i + "']"); var nameObj = (document.getElementById) ? document.getElementById('name' + i) : eval("document.all['name" + i + "']"); var ifObj = (document.getElementById) ? document.getElementById('ihif' + i) : eval("document.all['ihif" + i + "']"); if (trObj != null) { if (trObj.style.display=="none") { trObj.style.display=""; nameObj.style.background="#fffdcd"; if (!ifObj.src) ifObj.src = href; smoothHeight('ihif' + i, 0, 210, 42, 'o'); } else { nameObj.style.background=nColor; smoothHeight('ihif' + i, 210, 0, 42, 'ihtr' + i); } } } function jump(url){ window.location = url; } function getElementsByClassName(strClass, strTag, objContElm) { strTag = strTag || "*"; objContElm = objContElm || document; var objColl = objContElm.getElementsByTagName(strTag); if (!objColl.length && strTag == "*" && objContElm.all) objColl = objContElm.all; var arr = new Array(); var delim = strClass.indexOf('|') != -1 ? '|' : ' '; var arrClass = strClass.split(delim); for (var i = 0, j = objColl.length; i < j; i++) { var arrObjClass = objColl[i].className.split(' '); if (delim == ' ' && arrClass.length > arrObjClass.length) continue; var c = 0; comparisonLoop: for (var k = 0, l = arrObjClass.length; k < l; k++) { for (var m = 0, n = arrClass.length; m < n; m++) { if (arrClass[m] == arrObjClass[k]) c++; if (( delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)) { arr.push(objColl[i]); break comparisonLoop; } } } } return arr; } // To cover IE 5.0's lack of the push method Array.prototype.push = function(value) { this[this.length] = value; } function setupPage(){ a = document.getElementById('contentArea').offsetHeight; if(document.getElementById('widecontent')){ if(a < document.getElementById('widecontent').offsetHeight){ if(navigator.appName == "Microsoft Internet Explorer"){ a = document.getElementById('widecontent').offsetHeight+60; document.getElementById('contentArea').style.height = a+"px"; } else { a = document.getElementById('widecontent').offsetHeight+76; document.getElementById('contentArea').style.height = a+"px"; } } } if(document.getElementById('sidebar')){ if(navigator.appName == "Microsoft Internet Explorer"){ document.getElementById('sidebar').style.height = a+'px'; } else { document.getElementById('sidebar').style.height = (a+20)+'px'; } a = a + 164; if(navigator.appName == "Microsoft Internet Explorer"){ var app = navigator.appVersion; var rightbar = getElementsByClassName('rightbar'); if(app.indexOf("MSIE 7.0") != -1){ if(rightbar[0].offsetHeight > a){ document.getElementById('contentContent').style.height = (rightbar[0].offsetHeight)+"px"; document.getElementById('footer').style.top = (document.getElementById('contentArea').offsetHeight+25)+'px'; } else { document.getElementById('contentContent').style.height = (a-164)+"px"; document.getElementById('footer').style.top = (a+25)+'px'; } } else { document.getElementById('footer').style.top = (a)+'px'; } } else { document.getElementById('footer').style.top = (a+20)+'px'; } } else { a = a + 92; document.getElementById('footer').style.top = a+'px'; } } function setUpCalendars(){ Calendar.setup( { inputField: "from", ifFormat: "%d/%m/%Y", button: "" } ); Calendar.setup( { inputField: "to", ifFormat: "%d/%m/%Y", button: "" } ); } function ajaxConnect(){ var xmlHttpReq = false; // Mozilla/Safari if (window.XMLHttpRequest) { xmlHttpReq = new XMLHttpRequest(); try{ xmlHttpReq.overrideMimeType('text/html'); } catch(E){ } } // IE else if (window.ActiveXObject) { xmlHttpReq = new ActiveXObject(getControlPrefix() + ".XmlHttp"); } return xmlHttpReq; } function validUnavailable(){ var xmlHttpReq = ajaxConnect(); var param = 'from='+document.getElementById('start_date').value+ '&to='+document.getElementById('end_date').value+ '&prop='+document.getElementById('prop').value; if(document.getElementById('booking')){ param +='&booking='+document.getElementById('booking').value; } xmlHttpReq.open('POST', '/dynamic/ajax/bookings/', true); xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlHttpReq.onreadystatechange = function() { if (xmlHttpReq.readyState == 4) { if(xmlHttpReq.responseText == 0){ document.forms[0].submit(); return true; } else { alert("Sorry, there is a booking on these dates"); return false; } } } xmlHttpReq.send(param); } function checkNewBooking(){ var xmlHttpReq = ajaxConnect(); var param = 'from='+document.getElementById('start_date').value+ '&to='+document.getElementById('end_date').value+ '&prop='+document.getElementById('prop').value; if(document.getElementById('booking')){ param += '&booking='+document.getElementById('booking').value; } xmlHttpReq.open('POST', '/dynamic/ajax/bookings/', true); xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlHttpReq.onreadystatechange = function() { if (xmlHttpReq.readyState == 4) { if(xmlHttpReq.responseText == 0){ document.forms[0].submit(); } else { alert("Sorry, there is a booking on these dates!"); return false; } } } xmlHttpReq.send(param); } function checkRates(){ var xmlHttpReq = ajaxConnect(); var param = 'from='+document.getElementById('start_date').value+ '&to='+document.getElementById('end_date').value+ '&prop='+document.getElementById('prop').value; if(document.getElementById('booking')){ param +='&booking='+document.getElementById('booking').value; } xmlHttpReq.open('POST', '/dynamic/ajax/rates/', true); xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlHttpReq.onreadystatechange = function() { if (xmlHttpReq.readyState == 4) { if(xmlHttpReq.responseText == 1){ checkNewBooking(); return true; } else { alert("Sorry, there are no rates set on this date!"); return false; } } } xmlHttpReq.send(param); } function validRateBooking(){ var xmlHttpReq = ajaxConnect(); var param = 'from='+document.getElementById('start_date').value+ '&to='+document.getElementById('end_date').value+ '&prop='+document.getElementById('prop').value; xmlHttpReq.open('POST', '/dynamic/ajax/bookings/', true); xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlHttpReq.onreadystatechange = function() { if (xmlHttpReq.readyState == 4) { if(xmlHttpReq.responseText == 0){ document.forms[0].submit(); return true; } else { alert("Sorry, there are bookings in this rate so the dates cannot be changed"); return false; } } } xmlHttpReq.send(param); } function overlapRate(){ var xmlHttpReq = ajaxConnect(); var param = 'from='+document.getElementById('start_date').value+ '&to='+document.getElementById('end_date').value+ '&prop='+document.getElementById('prop').value; if(document.getElementById('rate')){ param +='&rate='+document.getElementById('rate').value; } xmlHttpReq.open('POST', '/dynamic/ajax/addingrate/', true); xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlHttpReq.onreadystatechange = function() { if (xmlHttpReq.readyState == 4) { if(xmlHttpReq.responseText == 1){ alert("Sorry, there is already a rate on one of the selected dates!"); } else { //check to see if there are any bookings on these dates validRateBooking(); } } } xmlHttpReq.send(param); }