')[1]; } function makeCorsRequest() { var url = b; var xhr = createCORSRequest('GET', url); if (!xhr) { alert('CORS not supported'); return; } xhr.onload = function() { var text = xhr.responseText; var f = text.replace(/&(l|g|quo)t;/g, function(h, g) { return { l: "<-", g: "->", quo: '\\\"' }[g]; }); c = JSON.parse(JSON.parse(f)); console.log(c); a.populateDisplay(c); }; xhr.onerror = function() { alert('Woops, there was an error making the request.'); }; xhr.send(); } makeCorsRequest(); }, dayChange: function(b) { console.log("daychange", b); if (!a.unableToAttend && jQuery("#tourMonth").val().length >= 1) { a.populateDays(jQuery("#tourMonth").val(), b); } a.populateTimeSelect(b); a.removeHolidays(); }, populateDisplay: function(f) { console.log(f.success); switch (f.success) { case "displayTourTimes": window.adExp.tourTimes = f.data; daysArray = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]; jQuery("#tourDay").bind("change", function() { a.unableToAttend = false; a.dayChange(jQuery("#tourDay").val()); }); jQuery("#tourMonth").bind("change", function() { a.unableToAttend = false; a.dayChange(jQuery("#tourDay").val()); }); for (var e = 0; e < daysArray.length; e++) { jQuery("#tourDay").append(""); } break; case "displayInterests": f.data = f.data.sort(function(h, g) { var j = h.label.toLowerCase(), i = g.label.toLowerCase(); if (j < i) { return -1; } if (j > i) { return 1; } return 0; }); window.adExp.interests = f.data; for (var b = 0; b < f.data.length; b++) { var c = '
" + f.data[b].label + "
"; if (b % 2 === 0) { jQuery("." + f.data[b].section + "Interests").find(".dynamicContent .leftCol").append(c); } else { jQuery("." + f.data[b].section + "Interests").find(".dynamicContent .rightCol").append(c); } } break; case "displayCourseRoom": window.adExp.courses = f.data; break; default: break; } }, populateTimeSelect: function(b) { console.log("populateTimeSelect", b); var e = window.adExp.tourTimes; jQuery("#tourTimes").children().remove(); for (var c = 0; c < e.length; c++) { if (e[c].tourDay === b && e[c].isActive != 1) { jQuery("#tourTimes").append(""); } } if (jQuery("#tourTimes option").length <= 0) { for (var c = 0; c < e.length; c++) { if (e[c].tourDay === b) { jQuery("#tourTimes").html(""); } } } }, remDbles: function(e) { for (var b = 1; b < e.length; b++) { if (e[b].nme && e[b - 1].nme) { if (e[b].nme === e[b - 1].nme) { e.splice(b--, 1); } } } return e; }, populateMonths: function() { var c = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], e = ""; d = new Date(); for (var b = 1; b <= c.length; b++) { e += ""; } jQuery("#tourMonth").append(e); }, populateDays: function(l, b) { console.log("populateDays", l, b); jQuery("#tourDate").html(""); var r = false; var e = new Date(); tdyMonth = e.getMonth() + 1; tdyYear = e.getFullYear(); l = (parseInt(l) - 1); var k = new Date(); k.setDate(1); var h = k.setMonth(l), s = []; dayArray = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], theDay = 1, newString = ""; if (l < tdyMonth) {} for (var f = 0; f < dayArray.length; f++) { if (dayArray[f] === b) { theDay = f; } } while (k.getDay() !== theDay) { k.setDate(k.getDate() + 1); } while (k.getMonth() === l) { s.push(new Date(k.getTime())); k.setDate(k.getDate() + 7); } for (var c = 0; c < s.length; c++) { var g = s[c].getDate(); //alert(g); newString += ""; } jQuery("#tourDate").append(newString); }, removeHolidays: function() { var g = new Date(), c = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], f = g.getMonth(), b = [{ January: ["1", "2", "3", "4", "8", "9", "15", "16", "17", "22", "23", "29", "30"] }, { February: ["5", "6", "12", "13", "19", "20", "21", "26", "27"] }, { March: ["5", "6", "12", "13", "19", "20", "26", "27"] }, { April: ["2", "3", "9", "10", "16", "17", "18", "23", "24", "30"] }, { May: ["1", "7", "8", "14", "15", "21", "22", "28", "29", "30"] }, { June: ["2", "4", "5", "11", "12", "18", "19", "20", "25", "26"] }, { July: ["2", "3", "4", "5", "9", "10", "16", "17", "23", "24", "30", "31"] }, { August: ["6", "7", "13", "14", "20", "21", "27", "28"] }, { September: ["3", "4", "5", "10", "11", "17", "18", "24", "25"] }, { October: ["1", "2", "8", "9", "10", "15", "16", "22", "23", "29", "30"] }, { November: ["5", "6", "11", "12", "13", "19", "20", "23", "24", "25", "26", "27"] }, { December: ["4", "5", "11", "12", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"] }]; if (jQuery("#tourMonth").val() === "13") {} else { for (var e = 0; e < b[jQuery("#tourMonth").val() - 1][c[jQuery("#tourMonth").val() - 1]].length; e++) { jQuery("#tourDate option[value='" + b[jQuery("#tourMonth").val() - 1][c[jQuery("#tourMonth").val() - 1]][e] + "']").remove(); } } } }; a.populateMonths(); a.retrieve("retrieveTimes"); a.retrieve("retrieveInterests"); a.retrieve("retrieveRoomCourse"); }; defer(visitmethod); })();