var pgInit = {}; pgInit.vars = { promotions: '[{"id":"52","title":"Base Plan","description":"","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/roomsfortourists.guestcentric.org\/?gc=51ffc67c2b867baef0255a514873d3a0&l=pt&nrNights=2&preselect=promo67&startDay=","image":""},{"id":"12","title":"Custom 29 sep","description":"Custom 29 sep TEASER","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/roomsfortourists.guestcentric.org\/?gc=51ffc67c2b867baef0255a514873d3a0&l=pt&nrNights=2&preselect=promo16&startDay=","image":""},{"id":"16","title":"custom free","description":"ghjk","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/roomsfortourists.guestcentric.org\/?gc=51ffc67c2b867baef0255a514873d3a0&l=pt&nrNights=8&preselect=promo20&startDay=","image":""},{"id":"18","title":"custom free","description":"ghjk","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/roomsfortourists.guestcentric.org\/?gc=51ffc67c2b867baef0255a514873d3a0&l=pt&nrNights=8&preselect=promo22&startDay=","image":""},{"id":"20","title":"custom free","description":"ghjk","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/roomsfortourists.guestcentric.org\/?gc=51ffc67c2b867baef0255a514873d3a0&l=pt&nrNights=8&preselect=promo24&startDay=","image":""},{"id":"22","title":"free","description":"kjhlkjk","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/roomsfortourists.guestcentric.org\/?gc=51ffc67c2b867baef0255a514873d3a0&l=pt&nrNights=5&preselect=promo26&startDay=","image":""},{"id":"23","title":"free","description":"kjhlkjk","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/roomsfortourists.guestcentric.org\/?gc=51ffc67c2b867baef0255a514873d3a0&l=pt&nrNights=5&preselect=promo27&startDay=","image":""},{"id":"4","title":"No promo code","description":"hjkl","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/roomsfortourists.guestcentric.org\/?gc=51ffc67c2b867baef0255a514873d3a0&l=pt&nrNights=2&preselect=promo7&startDay=","image":"https:\/\/secure.guestcentric.org\/bin\/b39908b5a4c7a4fe\/thumb-_08a7957_vida_das_girafas_filipe_ferreira_188720419058483502a03065.jpg"},{"id":"24","title":"Promo\u00e7\u00e3o - GUEST-8754","description":"Teaser GUEST-8754","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/roomsfortourists.guestcentric.org\/?gc=51ffc67c2b867baef0255a514873d3a0&l=pt&nrNights=2&preselect=promo28&startDay=","image":"https:\/\/secure.guestcentric.org\/bin\/b39908b5a4c7a4fe\/thumb-screen-shot-2019-06-25-at-10.39.026.png"}]', displayTime: 10, transitionTime: 1.5, frameworkPath: 'https://secure.guestcentric.org/js/yui/build/' }; /** * promotions gadget javascript file * @fileOverview * @author marco.lopes * @version 1.0 * @since 2008-10-28 */ (function() { if(!pgInit.vars.frameworkPath) { alert("framework path for the weather gadget not found!"); return; } //creating gadget info var gadget = {gadget: "promotionGadget", status: "waiting", start: init}; //check for Guestcentric Gadgets Stack if(!window.gcGadgetStack) { //registering gcGadgetStack gadget.status = "loading"; window.gcGadgetStack = [gadget]; gadget.start(); } else if(gcGadgetStack[gcGadgetStack.length-1].status === "loaded") { //registering gcGadgetStack gadget.status = "loading"; gcGadgetStack.push(gadget); gadget.start(); } else { //adding gadget to Guestcentric Gadgets Stack gcGadgetStack.push(gadget); } var G; //framework object /** * load necessary YUI modules * @param {Function} callback function to execute after loading the modules */ function loadYUIModules(callback) { //loading necessary files new YAHOO.util.YUILoader( { require: ["dom", "animation", "event", "json"], loadOptional: true, base: pgInit.vars.frameworkPath, onSuccess: function() { callback(); }, onFailure: function() { changeGadgetStatus(); } }).insert(); } //END OF loadYUIModules /** * changes the gadget status */ function changeGadgetStatus() { //changing the gadget status for(var i=0, li=gcGadgetStack.length; i 1) { randIndex = parseInt(Math.random() * promotions.length, 10); while(randIndex === this.oldIndex) { randIndex = parseInt(Math.random() * promotions.length, 10); } this.oldIndex = randIndex; } return promotions[randIndex]; }; /** * Get template opcaity value */ this.getOpacity = function(node) { return G.getStyle(node, "opacity"); }; // set the widget opacity this.opacity = this.getOpacity(node) || 1; //build promotion this.build(); //establish timer G.later(this.interval * 1000, this, this.refresh); }; //END OF PromotionsGadget /** * creates the framework interface * @return the necessary methods * @type Object */ function getInterface() { var D = YAHOO.util.Dom; var E = YAHOO.util.Event; var frameworkInterface = { /** * gets a node by id * @param {String} id node id * @return html node * @type Object */ byId: function(id) { return D.get(id); }, /** * gets nodes by class * @param {String} class name * @param {String} tagName type of tag that holds the class * @param {String|Object} rootNode id of search start node * @return array of html nodes * @type Array */ byClass: function(cssClass, tag, startNode) { return D.getElementsByClassName(cssClass, tag, startNode); }, /** * creates a node with the specified settings * @param {Object} nodeType node tag type (div, span...) * @param {Object} settings node settings (id, className...) * @return the created node * @type html node */ createNode: function(nodeType, settings) { var node = document.createElement(nodeType); for(var s in settings) { node[s] = settings[s]; } return node; }, /** * appends a node * @param {Object} newNode * @param {Object} referenceNode parent node * @return status or domNode */ inject: function(newNode, referenceNode) { if(!newNode || !referenceNode) { return false; } return G.byId(referenceNode).appendChild(newNode); }, /** * set node css style (inline) * @param {Object} node dom node * @param {String} property css property * @param {String|Boolean} value property target value */ setStyle: function(node, property, value) { return YAHOO.util.Dom.setStyle(node, property, value); }, /** * get node css style * @param {Object} node dom node * @param {String} property css property */ getStyle: function(node, property) { return YAHOO.util.Dom.getStyle(node, property); }, /** * detects on dom ready event * @param {Function} callback function * @param {Object} args callback arguments * @param {Boolean} callback run scope * @return status * @type Boolean */ onDOMReady: function(callback, args, scope) { return E.onDOMReady(callback, args, scope); }, /** * add an event to a node * @param {Object} node domNode * @param {String} event trigger * @param {Function} callback function to execute * @param {Object} args arguments * @param {Boolean} scope run in args */ addEvent: function(node, event, callback, args, scope) { return YAHOO.util.Event.addListener(node, event, callback, args, scope); }, /** * parses a string and trasforms it into an object * @param {String} jsonString the json string * @return the resultant json object * @type Object */ parseJSON: function(jsonString) { return YAHOO.lang.JSON.parse(jsonString); }, /** * create an animation * @param {Object} node * @param {Int} time in seconds * @param {Object} obj Animation object * @param {Function} callback function to execute after the animation * @param {Object} scope object where the callback will run */ anim: function(node, time, obj, callback, scope) { var anim = new YAHOO.util.Anim(node, obj, time, YAHOO.util.Easing.easeOut); if(typeof callback == 'function') { var f = function() { anim.onComplete.unsubscribe(f); callback.call(scope, anim); }; anim.onComplete.subscribe(f, anim, true); } return anim.animate(); }, /** * fades in a node * @param {Object} node dom node to fade * @param {Int} time in seconds * @param {Function} callback function to execute after fade * @param {Object} scope object where the callback will run */ fadeIn: function(node, time, callback, scope) { return G.anim(node, time, { opacity: { to: scope.opacity} }, callback, scope); }, /** * fades out a node * @param {Object} node dom node to fade * @param {Int} time in seconds * @param {Function} callback function to execute after fade * @param {Object} scope object where the callback will run */ fadeOut: function(node, time, callback, scope) { return G.anim(node, time, { opacity: { to: 0} }, callback, scope); }, /** * executes a function with a certain delay * @param {Int} time in miliseconds * @param {Object} obj object where the callback function will run * @param {Object} callback function to be executed * @param {Object} args arguments to the callback function */ later: function(time, obj, callback, args) { return YAHOO.lang.later(time, obj, callback, args, true); } }; return frameworkInterface; } //END OF getInterface //check for Guestcentric Gadgets Stack if(!window.gcGadgetStack) { //registering gcGadgetStack gadget.status = "loading"; window.gcGadgetStack = [gadget]; window.gcGadgetStack[0].start(); } else if(gcGadgetStack[gcGadgetStack.length-1].status === "loaded") { //registering gcGadgetStack gadget.status = "loading"; gcGadgetStack.push(gadget); gadget.start(); } else { //adding gadget to Guestcentric Gadgets Stack gcGadgetStack.push(gadget); } })(); window.vars = [];