/** * The file contains only ajax funtions * generic to the entire site **/ /** * Return * HtmlObject **/ function $$ (element) { return document.getElementById (element) } /** * void userRegister * call ajax script to save user * and send confirm email @ Parameters HtmlFormObject obj **/ function userRegister (obj) { //get form vars $.post ( "/ajax/ajax_user_register.php", { action: obj.action.value , email_address_confirm: obj.email_address_confirm.value, email_address: obj.email_address.value }, function (data) { document.getElementById (obj.response.value ).style.display = "block"; document.getElementById (obj.response.value ).innerHTML= data; } ); return false; } function forgotMyPassword (form) { var obj = document.getElementById (form); //get form vars $.post ( "/ajax/ajax_user_forgoten_password.php", { //action: obj.action.value, email_address: obj.user_name.value }, function (data) { document.getElementById (obj.response.value ).style.display = "block"; document.getElementById (obj.response.value ).innerHTML= data; } ); return false; } function addToList (listType, id, num, divId, onlyUpdateTotals) { var responseNecessary = "yes"; if (onlyUpdateTotals == "yes") { num = 0; var totalText = (listType == "enquiryList") ? $("#enquiry_total") : $("#wish_total"); } if (num) { var informText = (listType == "enquiryList") ? $("#"+num+"_enquire_text") : $("#"+num+"_wish_text"); var totalText = (listType == "enquiryList") ? $("#enquiry_total") : $("#wish_total"); } else if (num=="" && divId !="") { var informText = $("#"+divId); var totalText = (listType == "enquiryList") ? $("#enquiry_total") : $("#wish_total"); } else { responseNecessary = "no"; } //this ajax call adds the object to the cookie, it will also get if the item is already added, this is done in the script $.post ( BASE+"/ajax/ajax_populate_lists.php", {list_type: ""+listType, item_id: ""+id}, function (data) { eval("var response = " + data); if (responseNecessary == "yes" || onlyUpdateTotals == "yes") { if (responseNecessary == "yes" && onlyUpdateTotals != "yes") { //this the object to the cookie and informs the user that the item is added informText.html(response["alert_text"]); } //this updates the toal amount of items in the header (response["total"] != "void") ? totalText.html("("+response["total"]+")") : ""; if (listType == "enquiryList") { //this refreshes the enquiry list $("#enquiry_box_container").html(response["html"]); //this updates the total amount of items in the enquiry list (response["total"] != "void") ? $("#enquiry_list_total").html("("+response["total"]+")") : ""; } } else { return; } } ); } function addToListAndGoToEnquiry (listType, id, form) { $.post ( BASE+"/ajax/ajax_populate_lists.php", {list_type: ""+listType, item_id: ""+id}, function (data) { eval("var response = " + data); //document.forms[form].submit(); $("#"+form).submit(); } ); } function removeFromList (deleteAmount, listType, id, listPage) { var delAmnt = (deleteAmount == "all") ? "all" : "one"; var id = (id == "") ? 0 : id; //this determines whether the enquiry list or enquirybox needs to be refreshed var listDiv = (listPage == "enquiry") ? $("#enquiry_list_container") : $("#enquiry_box_container"); //var informText = (listType == "enquiryList") ? $("#enquire_text") : $("#wish_text"); var totalText = (listType == "enquiryList") ? $("#enquiry_total") : $("#wish_total"); //this ajax call adds the object to the cookie, it will also get if the item is already added, this is done in the script $.post ( BASE+"/ajax/ajax_remove_lists.php", {amount: ""+delAmnt, list_type: ""+listType, item_id:id, fromPage: ""+listPage}, function (data) { eval("var response = " + data); //this updates the toal amount of items in the header totalText.html("("+response["total"]+")"); if (listType == "enquiryList") { //this refreshes the enquiry list listDiv.html(response["html"]); //this updates the total amount of items in the enquiry list $("#enquiry_list_total").html("("+response["total"]+")"); //if (listPage == "enquiry") { //check if we are on the enquire now page //if ($("#enquiry_box_1_"+id)) { $("#enquiry_box_1_"+id).hide(); $("#enquiry_box_2_"+id).hide(); //} //} } } ); } function reloadEnquiryCategory (category, totalForThisCategory) { $.post ( //calculate the path for the new enquiry form content "forms/" + category + "-enquiry.php", {}, function (data) { //ajax in content to this div.. $("#ajaxedContent").html(data); JQueryTheDates(totalForThisCategory); //remove the active class from the current category.. $("#"+currEnquiryCategory).removeClass("active"); //remove the active class from the current category in the enquiryList.. $("#list_"+currEnquiryCategory).removeClass("active"); //add the onclick ajax call for the currnent(now previous) category.. $("#"+currEnquiryCategory+ " a").attr("href","javascript:reloadEnquiryCategory('"+currEnquiryCategory+"', "+categoryTotals[currEnquiryCategory]+");"); if (category == "detailsForm") { //set the new category, to the details form currEnquiryCategory = "Details Form"; //redo and set all te new jquery stuff since the the content has been loaded in again redoAllJQueryStuff("noDropDowns"); //Change the 'proced' buttons document.getElementById("proceedTop").style.display="none"; document.getElementById("proceedTop2").style.display="block"; document.getElementById("proceedBottom").style.display="none"; document.getElementById("proceedBottom2").style.display="block"; } else { //save the new current category currEnquiryCategory = category; //add active class to the new category $("#"+currEnquiryCategory).addClass("active"); //add active class to the new category in the enquiryList.. $("#list_"+currEnquiryCategory).addClass("active"); //remove the onclick ajax call for the new active category.. $("#"+currEnquiryCategory+ " a").attr("href","javascript:void(0);"); //redo and set all te new jquery stuff since the the content has been loaded in again redoAllJQueryStuff("noDropDowns"); //Change the 'proced' buttons onclicks document.getElementById("proceedTop").style.display="block"; document.getElementById("proceedTop2").style.display="none"; document.getElementById("proceedBottom").style.display="block"; document.getElementById("proceedBottom2").style.display="none"; } } ); } function ajaxInNextEnquiryCategory () { //flag is used to flag whether we have found the current category in the categories forloop. var flag = false; //flag is used to flag that the new category to be ajaxed in has been found and the forloop should do nothing var flag2 = true; nextTypeToAjaxIn = false; //loop threw the categories.. for (index in categoryTypes) { //check if a category has been found or not.. if (flag) { var amountForThisType = categoryTotals[categoryTypes[index]]; if (amountForThisType > 0 && flag2) { //save the next category in a variable.. var nextTypeToAjaxIn = categoryTypes[index]; flag2 = false; } } //set the flag is used to flag whether we have found the current category in the categories forloop.. (categoryTypes[index] == currEnquiryCategory) ? flag=true : ""; } //if we've found another category.. if (nextTypeToAjaxIn) { saveAllEnquiries(); $.post ( "forms/" + nextTypeToAjaxIn + "-enquiry.php", {}, function (data) { //ajax in content to this div.. $("#ajaxedContent").html(data); //remove the active class from the current category.. $("#"+currEnquiryCategory).removeClass("active"); //remove the active class from the current category in the enquiryList.. $("#list_"+currEnquiryCategory).removeClass("active"); //add the onclick ajax call for the currnent(now previous) category.. $("#"+currEnquiryCategory+ " a").attr("href","javascript:reloadEnquiryCategory('"+currEnquiryCategory+"', "+categoryTotals[currEnquiryCategory]+");"); //save the new current category currEnquiryCategory = nextTypeToAjaxIn; //add active class to the new category $("#"+currEnquiryCategory).addClass("active"); //add active class to the new category in the enquiryList.. $("#list_"+currEnquiryCategory).addClass("active"); //remove the onclick ajax call for the new active category.. $("#"+currEnquiryCategory+ " a").attr("href","javascript:void(0);"); //redo and set all te new jquery stuff since the the content has been loaded in again redoAllJQueryStuff("noDropDowns"); document.getElementById("proceedTop").style.display="block"; document.getElementById("proceedTop2").style.display="none"; document.getElementById("proceedBottom").style.display="block"; document.getElementById("proceedBottom2").style.display="none"; } ); } else { saveAllEnquiries(); $.post ( "forms/detailsForm-enquiry.php", {}, function (data) { //ajax in content to this div.. $("#ajaxedContent").html(data); //remove the active class from the current category.. $("#"+currEnquiryCategory).removeClass("active"); //remove the active class from the current category in the enquiryList.. $("#list_"+currEnquiryCategory).removeClass("active"); //add the onclick ajax call for the currnent(now previous) category.. $("#"+currEnquiryCategory+ " a").attr("href","javascript:reloadEnquiryCategory('"+currEnquiryCategory+"', "+categoryTotals[currEnquiryCategory]+");"); //set the new category, to the details form currEnquiryCategory = "Details Form"; //redo and set all te new jquery stuff since the the content has been loaded in again redoAllJQueryStuff("noDropDowns"); //Change the 'proced' buttons document.getElementById("proceedTop").style.display="none"; document.getElementById("proceedTop2").style.display="block"; document.getElementById("proceedBottom").style.display="none"; document.getElementById("proceedBottom2").style.display="block"; } ); } } function saveAllEnquiries () { var cntr = 0; var openEnquiry = $('#form_number_'+cntr).get(0); while (openEnquiry) { saveThisEnquiry (cntr); cntr++; var openEnquiry = $('#form_number_'+cntr).get(0); } } function redoAllJQueryStuff (flag) { initLogo(); initHover() initMenuSite(); if (flag!="noDropDowns") { initSelect(); } initTabs(); initDestList(); initCalendar(); initFootPopups(); initIDontKnowMyDates(); initSelectChild(); initOpenClose(); initAnotherRoom(); initQuestionBox(); initCarVariants(); initAdditionalTabs(); checkChildAgeDropDowns(); makeAllCalenders(); } function JQueryTheDates (total) { var num = 0; for (num=0; num,\'#?\\|¬`\/\[\]]/ if( rExp.test(str) ) isOK = "false"; if( str.indexOf('.') == -1 || str.indexOf('@') == -1 ) isOK = "false"; if( str.slice(str.lastIndexOf('.')+1,str.length).length < 2 ) isOK = "false"; if( str.slice(0,str.indexOf('@')).length < 1 ) isOK = "false"; if( str.slice(str.indexOf('@')+1,str.lastIndexOf('.')).length < 1 ) isOK = "false"; return isOK; } function openEnquiryDivAgain (form) { $(form).find('div.thumbnail').slideDown('fast'); $(form).find('div.room').slideDown('fast'); $(form).find('div.car-options').show(); $(form).find('div.message').slideUp('fast'); $(form).find('a.click').css('background-position','100% -22px'); $(form).find('div.check ul.radios-inline').show(); $(form).find('div.check a.get-a-quote').hide(); $(form).find('div.respons a.click').text('Save & Minimize'); } function saveThisEnquiry (formNum) { //sets the current category type var currType = ClassCategoryTypes[currEnquiryCategory]; //sets the parent div of the form to a variable that allows us to reference that specific form's elements var form = "#form_number_"+formNum; var name = $(form).find('div.title h3').html(); //set all the other variables to be posted through.. var supplier = $(form).find('#supplier_id').val(); if (SHOW_INCOMPLETE_SECTIONS_AFTER_LAUNCH == "no") { var listID = $(form).find('#listID').val(); } else { var listID = $(form).find('#listID').val(); } var question = $(form).find('#question').val(); var isLimo = "no"; //check whether category is car rental if (currEnquiryCategory != "car-rental") { var dateFrom = $(form).find('div.room input.form-text').val(); var dateTo = $(form).find('div.room input.form-text2').val(); //This logic calculates the enquiry type.. if ($(form+" input.dont_know")[0].checked) { var enquiryType = enquiryTypeArray["general"]; //if it is a general enquiry, then the dates are not needed dateFrom = ""; dateTo = ""; } else { if ($(form+" input:radio[id=r21]")[0].checked) { var enquiryType = enquiryTypeArray["priceAndAvailibity"]; } else if ($(form+" input:radio[id=r22]")[0].checked) { var enquiryType = enquiryTypeArray["provisional"]; } else { alert("Please add check in and check out date, and specify whether you confirmin price & availibilty or making a Proviional Booking. Or alternatively make sure that the `I don't know my dates` option is selected!"); setTimeout("openEnquiryDivAgain('"+form+"')", 1000); return; } } //Get rooms criteria var roomString = getRooms(form, listID, currEnquiryCategory); } else { var dateFrom = ""; var dateTo = ""; if ($(form+" input:radio[id=r21]")[0].checked) { var enquiryType = enquiryTypeArray["priceAndAvailibity"]; } else if ($(form+" input:radio[id=r22]")[0].checked) { var enquiryType = enquiryTypeArray["provisional"]; } else { alert("Please add check in and check out date, and specify whether you confirmin price & availibilty or making a Proviional Booking. Or alternatively make sure that the `I don't know my dates` option is selected!"); setTimeout("openEnquiryDivAgain('"+form+"')", 1000); return; } if ($(form).find('#car_rental_type').val() == "limo") { var isLimo = "yes"; } var roomString = getCarRentalCriteria(form); } var valuesString = (currType) ? "category="+currType : ""; valuesString += (isLimo) ? "&isLimo="+isLimo : ""; valuesString += (name) ? "&name="+name : ""; valuesString += (enquiryType) ? "&enquiry_type="+enquiryType : ""; valuesString += (supplier) ? "&supplier_id="+supplier : ""; valuesString += (listID) ? "&enquiry_list_id="+listID : ""; valuesString += (question) ? "¬es="+question : ""; valuesString += (dateFrom) ? "&date_from="+dateFrom : ""; valuesString += (dateTo) ? "&date_to="+dateTo : ""; valuesString += (roomString) ? roomString : ""; $.ajax ( { type: "POST", url: "forms/save-enquiry.php", data: valuesString, success: function (data) { eval ("data = " + data); if (data) { for (s=0; s,\'#?\\|¬`\/\[\]]/ if( rExp.test(str) ) isOK = false; if( str.indexOf('.') == -1 || str.indexOf('@') == -1 ) isOK = false; if( str.slice(str.lastIndexOf('.')+1,str.length).length < 2 ) isOK = false; if( str.slice(0,str.indexOf('@')).length < 1 ) isOK = false; if( str.slice(str.indexOf('@')+1,str.lastIndexOf('.')).length < 1 ) isOK = false; if (!isOK) { document.getElementById ("validation_response" ).innerHTML = "The email address you have entered does not contain valid characters!"; document.getElementById ("validation_response" ).style.display = "block"; obj.email.setAttribute("style", "background:yellow;"); flag4="false"; } else { document.getElementById ("validation_response" ).style.display = "none"; obj.email.setAttribute("style", ""); flag4="true"; if (obj.email.value != obj.repeatEmail.value) { document.getElementById ("validation_response" ).innerHTML = "Please make sure you have entered the same email!"; document.getElementById ("validation_response" ).style.display = "block"; obj.repeatEmail.setAttribute("style", "background:yellow;"); var flag5 = "false"; } else { document.getElementById ("validation_response" ).innerHTML = "Please complete all the fields before clicking submit!"; document.getElementById ("validation_response" ).style.display = "none"; obj.repeatEmail.setAttribute("style", ""); flag5 = "true"; } } if (obj.name.value =="") { obj.name.setAttribute("style", "background:yellow;"); var flag1 = "false"; } else { obj.name.setAttribute("style", ""); flag1 = "true"; } if (obj.email.value == "") { obj.email.setAttribute("style", "background:yellow;"); var flag3 = "false"; } else { obj.email.setAttribute("style", ""); flag3 = "true"; } if (obj.repeatEmail.value == "") { obj.repeatEmail.setAttribute("style", "background:yellow;"); var flag3 = "false"; } else { obj.repeatEmail.setAttribute("style", ""); flag3 = "true"; } if (obj.number.value =="") { obj.number.setAttribute("style", "background:yellow;"); var flag2 = "false"; } else { obj.number.setAttribute("style", ""); flag2 = "true"; } if (flag1=="false" || flag2=="false" || flag3 =="false") { document.getElementById ("validation_response" ).innerHTML = "Please complete all the fields before clicking submit!"; document.getElementById ("validation_response" ).style.display = "block"; } else { document.getElementById ("validation_response" ).style.display = "none"; } if (flag4 == "false") { document.getElementById ("validation_response" ).innerHTML = "The email address you have entered does not contain valid characters!"; document.getElementById ("validation_response" ).style.display = "block"; } else if (flag5 == "false") { document.getElementById ("validation_response" ).innerHTML = "Please make sure you have entered the same email!"; document.getElementById ("validation_response" ).style.display = "block"; } if (flag1 == "false" || flag2 == "false" || flag3 == "false") { document.getElementById ("validation_response" ).innerHTML = "Please complete all the fields before clicking submit!"; document.getElementById ("validation_response" ).style.display = "block"; } var newsletterOption = (obj.newsletter.checked) ? "yes" : "no"; $.ajax ( { type: "POST", url: BASE + "/forms/captcha/captcha.php", data: "txtCaptcha="+encodeURIComponent(obj.txtCaptcha.value), success: function (data) { if (data == "successful") { if (flag1 == "true" && flag2 == "true" && flag3 == "true" && flag4 == "true" && flag5 == "true") { document.getElementById ("validation_response" ).style.display = "none"; $.ajax ( { type: "POST", url: "forms/general-enquiry.php", data: "fromName="+obj.name.value+"&userEmail="+obj.email.value+"&message="+obj.comments.value+"&toEmail="+obj.supEmail.value+"&custNumber="+obj.number.value+"&subj="+formType+"&about="+aboutUs+"&newsletter="+newsletterOption, success: function (data) { eval ("data = " + data); if (data == "Mail was not sent") { document.getElementById ("confirmation_response" ).style.display = "block"; $("#confirmation_response" ).html(obj.error.value); } else { document.getElementById ("confirmation_response" ).style.display = "none"; document.forms[form].submit(); } } } ); } } else if (data == "failed") { document.getElementById ("validation_response" ).innerHTML = "The security code you have entered has is incorrect."; document.getElementById ("validation_response" ).style.display = "block"; } } } ); } function changeHomepageType (obj, hidden, multipleTypes) { var enableAlerts = "no"; // This is to set off all the alerts, helps with debugging this function. set to "yes if you wana debug" var hiddenBox = $("#"+hidden); var newValue = $(obj).val(); var oldValue = hiddenBox.val(); var OldTypes = oldValue.split(","); (enableAlerts=="yes") ? alert("old value-:" + oldValue) : ""; if (multipleTypes != "yes") { (enableAlerts=="yes") ? alert("not multiple types") : ""; $("#"+hidden).val(newValue); } else { (enableAlerts=="yes") ? alert("multiple types") : ""; if (obj.checked) { (enableAlerts=="yes") ? alert("checked") : ""; var isNotYetInSearchBox = "true"; for ( var i in OldTypes ) { if (OldTypes[i] == newValue) { (enableAlerts=="yes") ? alert(OldTypes[i] + "already in list") : ""; isNotYetInSearchBox = "false"; } } if (isNotYetInSearchBox=="true") { (enableAlerts=="yes") ? alert("adding "+newValue) : ""; var valueToAdd = (oldValue=="" || oldValue=="All") ? newValue : newValue+","+oldValue; hiddenBox.val(valueToAdd); } } else { (enableAlerts=="yes") ? alert("not checked") : ""; hiddenBox.val(""); for ( var i in OldTypes ) { (enableAlerts=="yes") ? alert("remove: " + newValue + " from " + OldTypes[i] + " gives us: " + (OldTypes[i] == newValue)) : ""; if (OldTypes[i] != newValue) { (enableAlerts=="yes") ? alert("adding: " + OldTypes[i]) : ""; var valueToAdd = (oldValue=="" || oldValue=="All") ? OldTypes[i] : OldTypes[i]+","+hiddenBox.val(); hiddenBox.val(valueToAdd); } } } } (enableAlerts=="yes") ? alert("NEW VALUE IS: " + hiddenBox.val()) : ""; } var HOMEPAGE_AJAX_SEARCH_TIMMER; var HOMEPAGE_AJAX_SEARCH_TIMEOUT = 3000; function doAjaxHomepageSearch (form) { var form_object = document.getElementById (form); if ( (form == "adv_search_form") || ( (form_object.category.value == "Accommodation" || form_object.category.value == "Safari") && (form_object.your_destination.value.length > 2 && (form_object.your_destination.value != SEARCH_TERM_DEFAULT) ) ) ) { if (form_object.your_destination) { if (form_object.your_destination.value == SEARCH_TERM_DEFAULT) { form_object.your_destination.value = ""; } } document.getElementById(form_object.finish_field.value+"_spinner").style.display = "block"; // If values aren't specified for the following, remove the values so nohing gets posted through if ($("#min-price").val() == "Rand") { $("#min-price").val(""); } if ($("#max-price").val() == "Rand") { $("#max-price").val(""); } //var categoryToSearchBy = $("#"+form+" #category_div .jquery-selectbox-currentItem").html(); var categoryToSearchBy = $("#hiddenCategory").val(); form_object.category.value = categoryToSearchBy; //$("#"+form+" #hiddenCategory").val(categoryToSearchBy); //var theSelectedValue = $("#rating .jquery-selectbox-currentItem").html(); var theSelectedValue = $("#hiddenRating").val(); //var theHiddenInput = $("#hiddenRating"); //if (theSelectedValue) { // theHiddenInput.val(theSelectedValue); //} var serial_data = $("#" + form).serialize (); if (HOMEPAGE_AJAX_SEARCH_TIMMER) window.clearTimeout (HOMEPAGE_AJAX_SEARCH_TIMMER); HOMEPAGE_AJAX_SEARCH_TIMMER = window.setTimeout (function () { $.post ( BASE + "/ajax/ajax_units_search.php", serial_data, function (data) { document.getElementById(form_object.finish_field.value).innerHTML = data; document.getElementById(form_object.finish_field.value).style.display = "block"; document.getElementById(form_object.finish_field.value+"_spinner").style.display = "none"; //$('#btn-dest-list').toggleClass('btn-dest-active'); //$('#popup-destination-list2').toggleClass('destination-list-hide'); redoJQueryCallsForAjaxedHomepageSearchResultsContent(); } ); }, HOMEPAGE_AJAX_SEARCH_TIMEOUT); } else { window.clearTimeout (HOMEPAGE_AJAX_SEARCH_TIMEOUT); $$(form_object.finish_field.value).style.display = "none"; $$(form_object.finish_field.value+"_spinner").style.display = "none"; } } function redoJQueryCallsForAjaxedHomepageSearchResultsContent () { $('#popup-destination-list2 a.close').click(function(){ //$('#btn-dest-list').removeClass('btn-dest-active'); $('#popup-destination-list2').addClass('destination-list-hide'); return false; }); } function sendHomepageSearch(form, searchType) { var form_object = document.getElementById (form); // If values aren't specified for the following, remove the values so nohing gets posted through if (form_object.your_destination) { if (form_object.your_destination.value == SEARCH_TERM_DEFAULT) { form_object.your_destination.value = ""; } } if ($("#min-price").val()=="Rand") { $("#min-price").val(""); } if ($("#max-price").val() == "Rand") { $("#max-price").val(""); } //if ($("#"+form+" #category_div .jquery-selectbox-currentItem").html()) { //var categoryToSearchBy = $("#"+form+" #category_div .jquery-selectbox-currentItem").html(); if (searchType == "norm" || searchType == "") { var categoryToSearchBy = $("#hiddenCategory").val(); } else { var categoryToSearchBy = form_object.category.value; } // Line below is redundant surely ??? form_object.category.value = categoryToSearchBy; //var theSelectedValue = $("#rating .jquery-selectbox-currentItem").html(); var theSelectedValue = $("#hiddenRating").val(); //var theHiddenInput = $("#hiddenRating"); //if (theSelectedValue) { // theHiddenInput.val(theSelectedValue); //} var typeValue = $("#type .jquery-selectbox-currentItem").html(); if (typeValue == "Testimonials" || typeValue == "Latest Reviews" || typeValue == "Cape Town Map" || typeValue == "Latest News" || typeValue == "Customised Booking" || typeValue == "Corporate Travel" || typeValue == "Conferences") { var subTypeSpecial = "yes"; } else { var subTypeSpecial = "no"; } if (typeValue) { form_object.type.value = (typeValue == "All") ? "" : typeValue; } if (subTypeSpecial == "yes") { var urlToPostTo = BASE+"/"+categoryToSearchBy.replace(" ", "-").replace(" ", "-").toLowerCase()+"/"+typeValue.replace(" ", "-").replace(" ", "-").toLowerCase(); } else { var urlToPostTo = BASE+"/"+categoryToSearchBy.replace(" ", "-").replace(" ", "-").toLowerCase()+"/search-results"; } urlToPostTo = urlToPostTo + "#search_top"; $("#"+form).attr("action", urlToPostTo); //alert("Category:- " + categoryToSearchBy + " formAction:- " + urlToPostTo + " type:- " + form_object.type.value); return true; } function changeHomepageSearch (div, form) { var form_object = document.getElementById (form); //var categoryToSearchBy = $("#"+form+" #category_div .jquery-selectbox-currentItem").html(); var categoryToSearchBy = $("#hiddenCategory").val(); $.post ( BASE + "/ajax/get_homepage_adv_search.php?category="+categoryToSearchBy, "", function (data) { document.getElementById(div).style.display = "block"; document.getElementById(div).innerHTML = data; redoAllJQueryStuff(); } ); } function ajaxInDetailedMap (pageID, pageCategory, mapID, theBack, finishDiv, mapType, safariID) { $.post ( BASE+"/ajax/ajax_fetch_map_search.php", {pageid: ""+pageID, category: ""+pageCategory, mapid: ""+mapID, back: ""+theBack, map_type: ""+mapType, finish: ""+finishDiv, safari: ""+safariID}, function (data) { $("#"+finishDiv).html(data); $("#"+finishDiv).css({display:"block"}); } ); } function changeHomepageCategory (dropdown, formId) { var value = dropdown.value; cats_Array = new Array ("Accommodation", "Safari", "Corporate", "Info", "Car_Rental", "Tours", "Things_To_Do"); for (i=0; i 2 && form_object.search_string.value != "Keyword Search") { var serial_data = $("#" + form).serialize (); if (SEARCH_TIMMER) window.clearTimeout (SEARCH_TIMMER); SEARCH_TIMMER = window.setTimeout (function () { $.post ( BASE + "/ajax/ajax_keyword_search.php", serial_data, function (data) { document.getElementById(form_object.finish_field.value).innerHTML = data; document.getElementById(form_object.finish_field.value).style.display = "block"; //$('#btn-dest-list').toggleClass('btn-dest-active'); //$('#popup-destination-list2').toggleClass('destination-list-hide'); redoJQueryCallsForAjaxedHomepageSearchResultsContent(); } ); }, SEARCH_TIMEOUT); } else { window.clearTimeout (SEARCH_TIMEOUT); $$(form_object.finish_field.value).style.display = "none"; } } function addDestination (form, val) { document.getElementById(form).your_destination.value=val; doAjaxHomepageSearch(form); } function is_int(input){ return typeof(input)=='number'&&parseInt(input)==input; } function ajaxInNonCachedValues (finishDiv, script) { $.post ( BASE + "/ajax/"+script, "", function (data) { document.getElementById(finishDiv).innerHTML = data; } ); } function showHideMappingSpinner (action) { if ($("#loadingDiv")) { if (action=="show") { $("#loadingDiv").show(); } else { $("#loadingDiv").hide(); } } }