var pgInit = {}; pgInit.vars = { promotions: '[{"id":"68","title":"Custom Rate - Base Consortia ","description":"# Teaser Custom Rate - Base Consortia and some more text to confirm the 120 characters th","linkLabel":"Click for more info","link":"10","bookBtn":"https:\/\/secure.guestcentric.org\/api\/bg\/book.php?apikey=354bb12a43f7584b2ccdfb9f9d239c1d&l=en&nrNights=2&preselect=promo68&startDay=","image":""},{"id":"94","title":"derived free 2nights 5min","description":"","linkLabel":"Click for more info","link":"10","bookBtn":"https:\/\/secure.guestcentric.org\/api\/bg\/book.php?apikey=354bb12a43f7584b2ccdfb9f9d239c1d&l=en&nrNights=5&preselect=promo94&startDay=","image":""},{"id":"1","title":"Early booking","description":"Book 3 days in advance","linkLabel":"Click for more info","link":"10","bookBtn":"https:\/\/secure.guestcentric.org\/api\/bg\/book.php?apikey=354bb12a43f7584b2ccdfb9f9d239c1d&l=en&nrNights=2&preselect=promo1&startDay=2025-07-21","image":"https:\/\/secure.guestcentric.org\/bin\/0d6f8a02e2f4c31f\/thumb-bird-4.webp"},{"id":"86","title":"early booking III","description":"This is the teaser for the new promotion","linkLabel":"Click for more info","link":"10","bookBtn":"https:\/\/secure.guestcentric.org\/api\/bg\/book.php?apikey=354bb12a43f7584b2ccdfb9f9d239c1d&l=en&nrNights=3&preselect=promo86&startDay=2025-07-20","image":""},{"id":"84","title":"Facebook promotion","description":"Teaser text","linkLabel":"Click for more info","link":"10","bookBtn":"https:\/\/secure.guestcentric.org\/api\/bg\/book.php?apikey=354bb12a43f7584b2ccdfb9f9d239c1d&l=en&nrNights=2&preselect=promo84&startDay=","image":"https:\/\/secure.guestcentric.org\/bin\/0d6f8a02e2f4c31f\/thumb-tress-on-landscape-1.webp"},{"id":"91","title":"Free 2nights 5 min","description":"","linkLabel":"Click for more info","link":"10","bookBtn":"https:\/\/secure.guestcentric.org\/api\/bg\/book.php?apikey=354bb12a43f7584b2ccdfb9f9d239c1d&l=en&nrNights=5&preselect=promo91&startDay=","image":""},{"id":"92","title":"Free 3nights 6 min","description":"","linkLabel":"Click for more info","link":"10","bookBtn":"https:\/\/secure.guestcentric.org\/api\/bg\/book.php?apikey=354bb12a43f7584b2ccdfb9f9d239c1d&l=en&nrNights=6&preselect=promo92&startDay=","image":""},{"id":"93","title":"Free combination 6minstay","description":"","linkLabel":"Click for more info","link":"10","bookBtn":"https:\/\/secure.guestcentric.org\/api\/bg\/book.php?apikey=354bb12a43f7584b2ccdfb9f9d239c1d&l=en&nrNights=6&preselect=promo93&startDay=","image":""},{"id":"81","title":"new DERIVED","description":"# new DERIVED","linkLabel":"Click for more info","link":"10","bookBtn":"https:\/\/secure.guestcentric.org\/api\/bg\/book.php?apikey=354bb12a43f7584b2ccdfb9f9d239c1d&l=en&nrNights=2&preselect=promo81&startDay=","image":"https:\/\/secure.guestcentric.org\/bin\/0d6f8a02e2f4c31f\/thumb-pexels-tom-balabaud-1579739-3.webp"}]', 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 = [];