if(typeof mySnipApps == "undefined") { (function() { var urlPrefix = document.location.protocol.replace(":",""); var csrc = "//openhotel.com/templates/snipapps/reset.css"; var stytag = document.createElement("link"); var allsty = document.getElementsByTagName("link"); for(var c = 0; c < allsty.length; c++) { if(allsty[c].rel == "stylesheet" && allsty[c].href && allsty[c].href == csrc) return true; } stytag.setAttribute("rel","stylesheet"); stytag.setAttribute("type","text/css"); stytag.setAttribute("media","screen"); stytag.setAttribute("href",csrc); if(typeof stytag != "undefined") document.getElementsByTagName("head")[0].appendChild(stytag); })(); //////////DEPRECIATED function loadCSSFile(thisCSS){jQuery("head").append(jQuery("").attr("href",thisCSS));} function loadJSFile(jsrc){var allscr=document.getElementsByTagName("script");var cbtest=arguments.length>1?arguments[1]:"";var cbfunc=arguments.length>2&&typeof arguments[2]=="function"?arguments[2]:"";var cbeval="";var isdupe=0;var isload=0;for(var s=0;s 0 && typeof arguments[0] == "function") callback = arguments[0]; if(self.loading == -1 && self.inited == false) { self.loading = 0; // For Definition Windows document.write(""); self.loadScripts(); } self.checkInited(0,callback); }; this.loadScripts = function() { if(self.loading > -1 && self.loading < self.scripts.length) { if(eval(self.scripts[self.loading].test) == true) { self.loading += 1; } else { if(self.scripts[self.loading].loading == 0) { self.scripts[self.loading].loading = 1; var scriptTag = document.createElement('script'); scriptTag.setAttribute("type","text/javascript"); scriptTag.setAttribute("src", self.scripts[self.loading].src); if(typeof scriptTag != "undefined") { document.getElementsByTagName("head")[0].appendChild(scriptTag); } else { // It didn't load. self.loading += 1; } } } // if(console) console.log(self.scripts[self.loading]); if(self.loading >= self.scripts.length) { self.inited = true; //Bowser !function(e,t){typeof module!="undefined"&&module.exports?module.exports.browser=t():typeof define=="function"?define(t):this[e]=t()}("bowser",function(){function t(t){function n(e){var n=t.match(e);return n&&n.length>1&&n[1]||""}var r=n(/(ipod|iphone|ipad)/i).toLowerCase(),i=/like android/i.test(t),s=!i&&/android/i.test(t),o=n(/version\/(\d+(\.\d+)?)/i),u=/tablet/i.test(t),a=!u&&/[^-]mobi/i.test(t),f;/opera|opr/i.test(t)?f={name:"Opera",opera:e,version:o||n(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)}:/windows phone/i.test(t)?f={name:"Windows Phone",windowsphone:e,msie:e,version:n(/iemobile\/(\d+(\.\d+)?)/i)}:/msie|trident/i.test(t)?f={name:"Internet Explorer",msie:e,version:n(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:/chrome|crios|crmo/i.test(t)?f={name:"Chrome",chrome:e,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:r?(f={name:r=="iphone"?"iPhone":r=="ipad"?"iPad":"iPod"},o&&(f.version=o)):/sailfish/i.test(t)?f={name:"Sailfish",sailfish:e,version:n(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(t)?f={name:"SeaMonkey",seamonkey:e,version:n(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel/i.test(t)?(f={name:"Firefox",firefox:e,version:n(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(t)&&(f.firefoxos=e)):/silk/i.test(t)?f={name:"Amazon Silk",silk:e,version:n(/silk\/(\d+(\.\d+)?)/i)}:s?f={name:"Android",version:o}:/phantom/i.test(t)?f={name:"PhantomJS",phantom:e,version:n(/phantomjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(t)||/rim\stablet/i.test(t)?f={name:"BlackBerry",blackberry:e,version:o||n(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:/(web|hpw)os/i.test(t)?(f={name:"WebOS",webos:e,version:o||n(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(t)&&(f.touchpad=e)):/bada/i.test(t)?f={name:"Bada",bada:e,version:n(/dolfin\/(\d+(\.\d+)?)/i)}:/tizen/i.test(t)?f={name:"Tizen",tizen:e,version:n(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||o}:/safari/i.test(t)?f={name:"Safari",safari:e,version:o}:f={},/(apple)?webkit/i.test(t)?(f.name=f.name||"Webkit",f.webkit=e,!f.version&&o&&(f.version=o)):!f.opera&&/gecko\//i.test(t)&&(f.name=f.name||"Gecko",f.gecko=e,f.version=f.version||n(/gecko\/(\d+(\.\d+)?)/i)),s||f.silk?f.android=e:r&&(f[r]=e,f.ios=e);var l="";r?(l=n(/os (\d+([_\s]\d+)*) like mac os x/i),l=l.replace(/[_\s]/g,".")):s?l=n(/android[ \/-](\d+(\.\d+)*)/i):f.windowsphone?l=n(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):f.webos?l=n(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):f.blackberry?l=n(/rim\stablet\sos\s(\d+(\.\d+)*)/i):f.bada?l=n(/bada\/(\d+(\.\d+)*)/i):f.tizen&&(l=n(/tizen[\/\s](\d+(\.\d+)*)/i)),l&&(f.osversion=l);var c=l.split(".")[0];if(u||r=="ipad"||s&&(c==3||c==4&&!a)||f.silk)f.tablet=e;else if(a||r=="iphone"||r=="ipod"||s||f.blackberry||f.webos||f.bada)f.mobile=e;return f.msie&&f.version>=10||f.chrome&&f.version>=20||f.firefox&&f.version>=20||f.safari&&f.version>=6||f.opera&&f.version>=10||f.ios&&f.osversion&&f.osversion.split(".")[0]>=6?f.a=e:f.msie&&f.version<10||f.chrome&&f.version<20||f.firefox&&f.version<20||f.safari&&f.version<6||f.opera&&f.version<10||f.ios&&f.osversion&&f.osversion.split(".")[0]<6?f.c=e:f.x=e,f}var e=!0,n=t(typeof navigator!="undefined"?navigator.userAgent:"");return n._detect=t,n}) jQuery.browser=bowser; //this is a patch for prop. It doesn't work correctly in chrome for some reason. remove and check when we next upgrade jQuery if(jQuery.browser.chrome){(function(e){e.oldProp=e.fn.prop;e.oldRemoveProp=e.fn.removeProp;e.fn.prop=function(t){if(t=="checked"||t=="disabled"||t=="readonly"){return e.fn.attr.apply(this,arguments)}else{return e.oldProp.apply(this,arguments)}};e.fn.removeProp=function(t){if(t=="checked"||t=="disabled"||t=="readonly"){return e.fn.removeAttr.apply(this,arguments)}else{return e.oldRemoveProp.apply(this,arguments)}}})(jQuery)} self.browser = self.getDom(); // jQuery.noConflict(); // All WebKit Browsers are Safari to jQuery. Just in case, though, there is a hook. if(self.browser == "safari" || self.browser == "chrome") jQuery.isReady = true; } else { setTimeout(mySnipApps.loadScripts, 300); } } }; this.checkInited = function(elapsed) { var callback = (arguments.length > 1 && typeof arguments[1] == "function") ? arguments[1] : ""; if(!self.inited) { if(elapsed <= 25000) { var invokestring = "mySnipApps.checkInited(" + (elapsed + 200); if(typeof callback == "function") { invokestring = invokestring + "," + callback + ")"; } else { invokestring = invokestring + ")"; } setTimeout(invokestring, 200); } else { // timed out } } else { // Now that we're inited, run callback. if(typeof callback == "function") callback(); } }; /* ---------------------- */ /* Standard Functions */ /* ---------------------- */ this.create = function(sid,app,key) { var link = "//"+self.snipapps_domain+"/templates/snipapps/_remote/snippet.cfm"; var params = "mode=load&json=1"; // var trimquery = self.path_info; var scon = jQuery("#" + sid); var sload = jQuery("#" + sid + "_loading"); // Strip ? from URL query. // if(trimquery != "") { // trimquery = trimquery.split("?"); // trimquery = trimquery[1]; // } //params = params + "&urlvars=" + escape(trimquery) + "&app=" + app + "&key=" + key + "&domain=" + self.caller_domain + "&scriptid=" + sid + "&" + self.session_key + "&format=json&jsoncallback=?"; params = params + "&app=" + app + "&key=" + key + "&domain=" + self.caller_domain + "&scriptid=" + sid + "&" + self.session_key + "&format=json&jsoncallback=?"; jQuery.getJSON(link, params, function(json) { if(json.recordcount > 0) { var DoCommit = json.data.docommit[0]; var content = jQuery.trim(json.data.content[0]); var snippetType = json.data.type[0]; if(DoCommit == 1) { jQuery(sload).hide(); jQuery(scon).empty().html(content).show(); // Add to Snippet List var snipindex = self.snippets.length; self.snippets[snipindex] = new Object(); self.snippets[snipindex].type = snippetType; self.snippets[snipindex].app = app; self.snippets[snipindex].key = key; self.snippets[snipindex].script_id = sid; // States self.snippets[snipindex].states = new Object(); // Base State self.snippets[snipindex].states.base = new Object(); self.snippets[snipindex].states.base.key = key; self.snippets[snipindex].states.base.urlvars = new Object(); self.snippets[snipindex].states.base.formvars = new Object(); } else { return false; } } }); }; // A call by a snippet to navigate to another page with specified url variables. this.navigate = function(sid,data,urlvars) { var link = ""; var params = "json=1"; var scon = jQuery("#" + sid); var sload = jQuery("#" + sid + "_loading"); var snip = ""; // This only works if the scriptid is unique. Which it should be. if(jQuery(scon).length == 1) { jQuery(scon).hide(); jQuery(sload).show(); snip = self.getSnippet(sid); link = "//"+self.snipapps_domain+"/apps/" + snip.app + ".cfm/mode/load"; params = "json=1&app=" + snip.app + "&key=" + snip.key + "&scriptid=" + snip.script_id + "&data=" + data + "&urlvars=" + escape(urlvars) + "&domain=" + self.caller_domain + "&child=1&" + self.session_key + "&format=json&jsoncallback=?"; jQuery.getJSON(link, params, function(json) { if(json.recordcount > 0) { var DoCommit = json.data.docommit[0]; var content = jQuery.trim(json.data.content[0]); if(DoCommit == 1) { jQuery(sload).hide(); jQuery(scon).empty().html(content).show(); } else { return false; } } }); } }; // A call by a snippet to reload base. Does not modify URL string. this.restore = function(sid) { var link = ""; var params = "json=1"; var scon = jQuery("#" + sid); var sload = jQuery("#" + sid + "_loading"); var snip = ""; var urlvars = ""; var formvars = ""; var u = 0; var f = 0; if(jQuery(scon).length == 1) { jQuery(scon).hide(); jQuery(sload).show(); jQuery(sload).css("display","table-cell"); snip = self.getSnippet(sid); urlvars = ""; for(u in snip.states.base.urlvars) urlvars = self.paramAppend(urlvars,u,snip.states.base.urlvars[u]); // Strip ? from URL query. if(urlvars != "") { urlvars = urlvars.split("?"); urlvars = urlvars[1]; } for(f in snip.states.base.formvars) formvars = self.paramAppend(formvars,f,snip.states.base.formvars[u]); // Strip ? from FORM query. if(formvars != "") { formvars = formvars.split("?"); formvars = formvars[1]; } link = "//"+self.snipapps_domain+"/apps/" + snip.app + ".cfm/mode/load"; params = params + "&urlvars=" + escape(urlvars) + "&formvars" + escape(formvars) + "&app=" + snip.app + "&key=" + snip.key + "&domain=" + self.caller_domain + "&scriptid=" + snip.script_id + "&" + self.session_key + "&format=json&jsoncallback=?"; jQuery.getJSON(link, params, function(json) { if(json.recordcount > 0) { var DoCommit = json.data.docommit[0]; var content = jQuery.trim(json.data.content[0]); if(DoCommit == 1) { jQuery(sload).hide(); jQuery(scon).empty().html(content).show(); } else { return false; } } }); } }; // A call by a snippet to refresh this script's base page with this url string. this.refreshbase = function(sid,urlstring) { var uarray = urlstring.split("&"); var farray = ""; var clear = (arguments.length > 3 && arguments[3] == false) ? false : true; var parray = ""; var pname = ""; var pval = ""; if(arguments.length > 2 && arguments[2] != "") { farray = arguments[2]; farray = farray.split("&"); } if(clear) { self.clearBaseUrlVars(sid); self.clearBaseFormVars(sid); } for(var u = 0; u < uarray.length; u++) { parray = uarray[u].split("="); pname = parray[0]; pval = parray[1]; self.setBaseUrlVar(sid,pname,pval); } if(typeof farray == "object" && typeof farray.length != "undefined") { for(var f = 0; f < farray.length; f++) { parray = farray[r].split("="); pname = parray[0]; pval = parray[1]; self.setBaseFormVar(sid,pname,pval); } } self.restore(sid); }; // Restore a specific sort of snippet on the same page without modifying form/url variables. this.restoreTo = function(sapp,stype) { var snips = self.findSnippets(sapp,stype); // If no snippets found, no point in wasting time. if(typeof snips != "object" || typeof snips.length == "undefined" || snips.length == 0) return false; for(var s = 0; s < snips.length; s++) self.restore(snips[s].script_id); }; // Post form or url to a specific sort of snippet on the same page. this.postTo = function(sapp,stype,postdata) { var snips = self.findSnippets(sapp,stype); var formdata = { method: "get", datakey: "" }; // If no snippets found, no point in wasting time. if(typeof snips != "object" || typeof snips.length == "undefined" || snips.length == 0) return false; jQuery.extend(formdata,postdata); formdata.method = formdata.method.toLowerCase(); for(var s = 0; s < snips.length; s++) { self.clearBaseUrlVars(snips[s].script_id); self.clearBaseFormVars(snips[s].script_id); for(var f in formdata) { if(f != "method") { if(formdata.method == "post") { self.setBaseFormVar(snips[s].script_id,f,formdata[f]); } else { self.setBaseUrlVar(snips[s].script_id,f,formdata[f]); } } } self.restore(snips[s].script_id); } }; /* ------------------- */ /* Modal Functions */ /* ------------------- */ // Create and post to modal window this.openModal = function(sid,postdata) { // initlaize variables var link = ""; var params = ""; var fswidth = jQuery(document).width(); var fsheight = jQuery(document).height(); var snip = self.getSnippet(sid); var urlvars = ""; var formvars = ""; var formdata = { method: "get", datakey: "" }; // modal elements. var modalwin = ""; var modalmask = ""; var modalload = ""; var modalcontent = ""; var modalclose = ""; jQuery.extend(formdata,postdata); formdata.method = formdata.method.toLowerCase(); // we require a data key to proceed if(formdata.datakey == "") return false; // serialize formdata and setup link/params for(var f in formdata) { if(f != "method" && f != "datakey") { if(formdata.method == "post") { formvars = self.paramAppend(formvars,f,formdata[f]); } else { urlvars = self.paramAppend(urlvars,f,formdata[f]); } } } // Strip ? from URL query. if(urlvars != "") { urlvars = urlvars.split("?"); urlvars = urlvars[1]; } // Strip ? from FORM query. if(formvars != "") { formvars = formvars.split("?"); formvars = formvars[1]; } link = "//"+self.snipapps_domain+"/apps/"+snip.app+".cfm/mode/load"; params = "json=1&modal=1&app="+snip.app+"&key="+snip.key+"&scriptid="+snip.script_id+"&data="+formdata.datakey+"&urlvars="+escape(urlvars)+"&formvars="+escape(formvars)+"&domain="+self.caller_domain+"&child=1&"+self.session_key+"&format=json&jsoncallback=?"; // create modal window // max z-index is 2147483647, but we need it to work with prettyPhoto, so it has to be less than 9000. modalwin = jQuery('
').prependTo("body"); modalmask = jQuery('
 
').prependTo("body"); // show modal window and load content jQuery(modalmask) .click(function() { mySnipApps.closeModal(); }) .animate({ width: fswidth, height: fsheight }, 300, "linear", function() { jQuery(window).scrollTop(0); modalclose = jQuery('
Close Window
').prependTo(modalwin); modalload = jQuery('
').appendTo(modalwin); jQuery(modalwin) .css("width",fswidth) .css("height",fsheight) .show(); jQuery.getJSON(link,params,function(json) { if(json.recordcount > 0) { var DoCommit = json.data.docommit[0]; var content = jQuery.trim(json.data.content[0]); jQuery(modalload).hide(); if(DoCommit == 1) { modalcontent = jQuery('
'+content+'
').appendTo(modalwin); } else { return false; } } }); }); }; // Hide and destroy modal window this.closeModal = function() { jQuery("div[name='modal'][data-snipapps='modal']") .hide() .remove(); jQuery("div[name='mask'][data-snipapps='modal']") .animate({ width: 1, height: 1, opacity: 0 }, 300, "linear", function() { jQuery(this).hide().remove(); }); }; /* --------------------- */ /* Session Functions */ /* --------------------- */ this.persistSession = function() { self.setCookie("ai-snipapps-domain",mySnipApps.snipapps_domain); self.setCookie("ai-snipapps-session_key",mySnipApps.session_key); }; this.getPersistedSession = function() { var snipdomain = self.readCookie("ai-snipapps-domain"); var snipsession = self.readCookie("ai-snipapps-session_key"); if(snipdomain != null && snipsession != null && snipdomain == mySnipApps.snipapps_domain && snipsession != "") { mySnipApps.session_key = snipsession; } }; this.clearSession = function() { self.setCookie("ai-snipapps-domain",""); self.setCookie("ai-snipapps-session_key",""); }; this.setCookie = function(name,value) { var days = (arguments.length > 2) ? arguments[2] : 1; var date = new Date(); var expires = ""; var path = "path=/" // Set to expire tomorrow. Will be deleted on reload anyway. date.setTime(date.getTime()+(days*24*60*60*1000)); expires = "expires=" + date.toGMTString(); document.cookie = name + "=" + escape(value) + "; " + expires + "; " + path; }; this.readCookie = function(name) { var nameEQ = name.toLowerCase() + "="; var ca = document.cookie.split(";"); for(var i = 0; i < ca.length; i++) { var c = ca[i]; while(c.charAt(0)==" ") c = c.substring(1,c.length); if(c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length,c.length)); } return null; }; /* -------------------- */ /* Helper Functions */ /* -------------------- */ // Retrieves the Snippet with that Script ID. this.getSnippet = function(sid) { for(var s = 0; s < self.snippets.length; s++) { if(self.snippets[s].script_id == sid) { return self.snippets[s]; break; } } }; // Retrieves an array of snippets that matches app and type. this.findSnippets = function(sapp,stype) { var result = new Array(); for(var s = 0; s < self.snippets.length; s++) { if(self.snippets[s].app == sapp && self.snippets[s].type == stype) result[result.length] = self.snippets[s]; } return result; }; // Changes a variable in the base URL this.setBaseUrlVar = function(sid,vname,vval) { for(var s = 0; s < self.snippets.length; s++) { if(self.snippets[s].script_id == sid) { if(vval == "") { self.snippets[s].states.base.urlvars[vname] = null; } else { self.snippets[s].states.base.urlvars[vname] = vval; } break; } } }; // Clears the base URL of all its variables. this.clearBaseUrlVars = function(sid) { for(var s = 0; s < self.snippets.length; s++) { if(self.snippets[s].script_id == sid) { self.snippets[s].states.base.urlvars = new Object(); break; } } }; // Changes a variable in the base FORM this.setBaseFormVar = function(sid,vname,vval) { for(var s = 0; s < self.snippets.length; s++) { if(self.snippets[s].script_id == sid) { if(vval == "") { self.snippets[s].states.base.formvars[vname] = null; } else { self.snippets[s].states.base.formvars[vname] = vval; } break; } } }; // Clears the base FORM of all its variables. this.clearBaseFormVars = function(sid) { for(var s = 0; s < self.snippets.length; s++) { if(self.snippets[s].script_id == sid) { self.snippets[s].states.base.formvars = new Object(); break; } } }; // Navigation Function For Page Numbers this.navPageNumber = function(target,sid) { self.setBaseUrlVar(sid,"page",target); self.restore(sid); return true; }; // Append to a URL param string. this.paramAppend = function(str,pname,pval) { str = jQuery.trim(str); pname = jQuery.trim(pname); if(typeof pval == "string") pval = jQuery.trim(pval); if(str == "") { str = "?" + pname + "=" + pval; } else { str += "&" + pname + "=" + pval; } return str; }; // Checks to see if a condition is true over time. If true, runs callback. this.checkConditionOverTime = function(evalstring,time,callback) { // Forget it if(typeof callback != "function") return false; var checkfunction = function() { if(eval(evalstring) == true) { callback(); } else { self.checkConditionOverTime(evalstring,time,callback); } }; setTimeout(checkfunction,time); }; // this function is used to determine if scripts.js.cfm has been loaded. Please don't remove it. this.getDom = function() { var thisdom = 'ie'; if(document.getBoxObjectFor) { thisdom = 'ff'; } else if(jQuery.browser.mozilla == true) { thisdom = 'ff'; } else if(jQuery.browser.webkit == true) { thisdom = 'webkit'; } else if(jQuery.browser.safari == true) { thisdom = 'safari'; } else if(jQuery.browser.opera == true) { thisdom = 'opera'; } return thisdom; } } var mySnipApps = new snipApps(); mySnipApps.session_key = "CFID=1336656&CFTOKEN=81e9064cff434767-0589D567-D809-B3FB-A7913C0902D98CAD&jsessionid=9430d47420374158121f"; mySnipApps.snipapps_domain = "openhotel.com"; mySnipApps.getPersistedSession(); } document.write(''); document.write('
'); mySnipApps.init(function() { mySnipApps.create("openhotel-snippet-hotel-0589D592-B980-9E8D-14B90FD8D1A904EA","hotel","TTlbIjo2ODo7JDoqOiBMKCJXOFciQUsmOUhGKTJbOi4lTVlZLyVfUUdMP1ooXF0qSls9I0hDPT4iQFtYOAozRkVJSyA4JClVTSsvIiwrKTNVLUhRX0Q7UFAgIAo_EQUAL_"); });