// Ajax Hotel Configurator var Cookie = { set: function(name, value, daysToExpire) { var expire = ''; if (daysToExpire != undefined) { var d = new Date(); d.setTime(d.getTime() + (86400000 * parseFloat(daysToExpire))); expire = '; expires=' + d.toGMTString(); } return (document.cookie = escape(name) + '=' + escape(value || '') + expire); }, get: function(name) { var cookie = document.cookie.match(new RegExp('(^|;)\\s*' + escape(name) + '=([^;\\s]*)')); return (cookie ? unescape(cookie[2]) : null); }, erase: function(name) { var cookie = Cookie.get(name) || true; Cookie.set(name, '', -1); return cookie; }, accept: function() { if (typeof navigator.cookieEnabled == 'boolean') { return navigator.cookieEnabled; } Cookie.set('_test', '1'); return (Cookie.erase('_test') === '1'); } }; Array.prototype.inArray = function (value) { for (var i=0; i < this.length; i++) { if (this[i] === value) { return true; } } return false; }; success = function() { //$('action').innerHTML = "Yeah."; } complete = function ( originalRequest ) { $('output').innerHTML = originalRequest.responseText; $('action').removeClassName("show"); } failure = function() { $('action').innerHTML = "failure"; } loading = function() { $('action').addClassName("show"); } var clicked = new Array(); get = function(evt) { var child = Event.element(evt); if(child){ name = child.name; $('selection').innerHTML = ""; if(child.checked == true && name.search(/leistung.+/) != -1){ $('lastn').value = child.id; $('lastv').value = child.value; clicked.unshift(child); for (var i=0; i 0){ for (var i=0; i 0){ $('lastn').value = clicked[0].id; $('lastv').value = clicked[0].value; $(clicked[0].parentNode).addClassName("fettrot"); $('selection').innerHTML = clicked[0].parentNode.innerHTML; } } } } new Ajax.Updater('output', 'ajax/configurator.xml', { method: 'get', onSuccess: success, onLoading: loading, onComplete: complete, parameters: $('confic').serialize(true)}); var checkboxes = Form.getInputs('confic', 'checkbox'); var cookieString = new String(); for (var i=0; i