/** * Xajax wrapper for all Ajax calls, so you don't have to register PHP-Ajax Functions * * @author Jorrit & Ralf * @param string module * @param string functionName * @param array argumentsArray; Array with argument for the module's function */ function ytw_call(module, functionName, argumentsArray) { var newArgumentsArray = new Array(1); newArgumentsArray[0] = module; if (argumentsArray) { newArgumentsArray = newArgumentsArray.concat(argumentsArray); } return xajax.call(functionName, newArgumentsArray); } xajax.realCall = xajax.call; xajax.realProcessResponse = xajax.processResponse; var ajaxFunction; xajax.call = function(sFunction, aArgs, sRequestType) { switch(sFunction){ case 'update_search_results': ajaxFunction= sFunction; showSearchLoader(); break; case 'update_calc_table': ajaxFunction= sFunction; if (aArgs[3]) { if ($('checkLoader')) $('checkLoader').style.display = 'block'; } else { if ($('priceLoader')) $('priceLoader').style.display = 'block'; } if ($('calcForm')) $('calcForm').style.display = 'none'; break; case 'update_price_info': ajaxFunction= sFunction; // TODO: don't use html here // .. if ($('priceTableContainer')) $('priceTableContainer').innerHTML = 'loading.. data & prijzen worden geladen...'; break; } return this.realCall(sFunction, aArgs, sRequestType); } xajax.processResponse = function(xml) { switch(ajaxFunction){ case 'update_search_results': hideSearchLoader(); ajaxFunction = ''; break; case 'update_calc_table': if ($('priceLoader')) $('priceLoader').style.display = 'none'; if ($('checkLoader')) $('checkLoader').style.display = 'none'; if ($('calcForm')) $('calcForm').style.display = 'block'; break; case 'load_bookframe': // document.body.scrollTop = 0; scrollTo(0, 0); break; } return this.realProcessResponse(xml); } xajax.loadingFunction = function() { if (xajax.$('loadingDiv')) { xajax.$('loadingDiv').style.display='block'; } } xajax.doneLoadingFunction = function() { if (xajax.$('loadingDiv')) { xajax.$('loadingDiv').style.display = 'none'; } } function submitForm() { xajax_processForm(xajax.getFormValues("theForm", true)); } function showLoader() { if (xajax.$('spinner')) { xajax.$('spinner').style.display = 'inline'; } } function hideLoader() { if (xajax.$('spinner')) { xajax.$('spinner').style.display = 'none'; } } function showSearchLoader() { if ($('loader_text')) { $('loader_text').style.display = 'block'; } } function hideSearchLoader() { if ($('loader_text')) { $('loader_text').style.display = 'none'; } } function showSubmit() { if (xajax.$('submitButton')) { xajax.$('submitButton').disabled=false; xajax.$('submitButton').value="Submit"; } } function hideSubmit() { if (document.getElementById('submitButton')) { xajax.$('submitButton').disabled=true; xajax.$('submitButton').value="Please wait..."; } } function confirmDelete(object, link) { var confirmation; confirmation = confirm("Are you sure you want to delete this record?"); if (confirmation) return location.href = link; else return false; } var counter = 0; function addOption(selectId, txt, val) { if (typeof(val) == 'object') { if (val.displayName) { // do not add options with no result if (val.resultCount == 0) return; if(selectId != "NightCount") txt = val.displayName+' ('+val.resultCount+')'; else if(selectId == "NightCount") { dagen = "nacht"; if(val.displayName != "1") dagen = dagen + "en"; txt = val.displayName+' '+dagen+' ('+val.resultCount+')'; } val = val.displayName; } } var objOption = new Option(txt, val); $(selectId).options.add(objOption); $(selectId).disabled = false; } function removeOptions(selectId) { if ($(selectId)) $(selectId).options.length = 0; addOption(selectId, '', 'empty'); $(selectId).disabled = true; } function selOption(selectId, val) { var element = $(selectId); if ( element == null ){ return; } // value is a criterium item object if(typeof(val) == 'object') { selSearchOption(element, val); return; } if ( element.options ) { for(var i=0; i