var pgInit = {}; pgInit.vars = { promotions: '[{"id":"68","title":"Mejor tarifa sin desayuno.","description":"Tenga lla mejor tarifa para su estad\u00eda, sin desayuno","linkLabel":"Pulse para m\u00e1s informaci\u00f3n","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=f015b8a3bf26f47b65c38c7dd885e841&l=es&nrNights=2&preselect=promo68&startDay=2020-06-01","image":"https:\/\/secure.guestcentric.net\/bin\/3d43a34739c52bd1\/thumb-hotel-inglaterra-estoril-pack-room-spa25.jpg"},{"id":"67","title":"1 a\u00f1o de estancia","description":"Disfrute una estad\u00eda m\u00e1s larga con nosotros","linkLabel":"Pulse para m\u00e1s informaci\u00f3n","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=f015b8a3bf26f47b65c38c7dd885e841&l=es&nrNights=365&preselect=promo67&startDay=2020-06-01","image":"https:\/\/secure.guestcentric.net\/bin\/3d43a34739c52bd1\/thumb-dbl-premium6.jpg"},{"id":"65","title":"Estancia de 3 meses","description":"Disfrute de una estancia de 3 meses con nosotros y obtenga un precio especial","linkLabel":"Pulse para m\u00e1s informaci\u00f3n","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=f015b8a3bf26f47b65c38c7dd885e841&l=es&nrNights=90&preselect=promo65&startDay=2020-06-01","image":"https:\/\/secure.guestcentric.net\/bin\/3d43a34739c52bd1\/thumb-dbl-premium3.jpg"},{"id":"66","title":"6 Meses de estancia","description":"Disfrute de una estancia de 6 meses con nosotros y obtenga un precio especial","linkLabel":"Pulse para m\u00e1s informaci\u00f3n","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=f015b8a3bf26f47b65c38c7dd885e841&l=es&nrNights=180&preselect=promo66&startDay=2020-06-01","image":"https:\/\/secure.guestcentric.net\/bin\/3d43a34739c52bd1\/thumb-dbl-premium4.jpg"},{"id":"62","title":"LA MEJOR TARIFA DISPONIBLE","description":"S\u00d3LO SITIO WEB","linkLabel":"Pulse para m\u00e1s informaci\u00f3n","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=f015b8a3bf26f47b65c38c7dd885e841&l=es&nrNights=2&preselect=promo62&startDay=","image":"https:\/\/secure.guestcentric.net\/bin\/3d43a34739c52bd1\/thumb-hotelinglaterra2016-16026.jpg"},{"id":"64","title":"Estancia mensual","description":"Disfruta una estad\u00eda m\u00e1s larga con nosotros","linkLabel":"Pulse para m\u00e1s informaci\u00f3n","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=f015b8a3bf26f47b65c38c7dd885e841&l=es&nrNights=30&preselect=promo64&startDay=2020-06-01","image":"https:\/\/secure.guestcentric.net\/bin\/3d43a34739c52bd1\/thumb-dbl-premium2.jpg"},{"id":"72","title":"\u00a1Qu\u00e9date 4 noches, paga 3!","description":"\u00a1Qu\u00e9date 4 noches con nosotros y paga 3!","linkLabel":"Pulse para m\u00e1s informaci\u00f3n","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=f015b8a3bf26f47b65c38c7dd885e841&l=es&nrNights=4&preselect=promo72&startDay=2020-10-20","image":"https:\/\/secure.guestcentric.net\/bin\/3d43a34739c52bd1\/thumb-27808041116_bb9be36b37_k-1-2.jpg"},{"id":"73","title":"\u00a1Qu\u00e9date 7 noches, paga 5!","description":"\u00a1Qu\u00e9date 7 noches con nosotros y paga 5!","linkLabel":"Pulse para m\u00e1s informaci\u00f3n","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=f015b8a3bf26f47b65c38c7dd885e841&l=es&nrNights=7&preselect=promo73&startDay=2020-10-20","image":"https:\/\/secure.guestcentric.net\/bin\/3d43a34739c52bd1\/thumb-hotelinglaterra2013_gf_0329.jpg"}]', displayTime: 10, transitionTime: 1.5, frameworkPath: 'https://secure.guestcentric.net/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 = [];