var pgInit = {}; pgInit.vars = { promotions: '[{"id":"61","title":"Day Spa Relax 70\u00b4","description":"alguns minutos inteiramete dedicados a si..","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=1955d4b4adf186ba6c7cc45ded68e689&l=pt&nrNights=2&preselect=promo61&startDay=2020-02-08","image":"https:\/\/secure.guestcentric.net\/bin\/b490f458c41be649\/thumb-13912519_1648293285425984_7268084559862881093_n2.jpg"},{"id":"81","title":"Duplo Deluxe Com Varanda Vista Montanha","description":"Cama de Casal. Sinta o verdadeiro prazer da Natureza...","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=1955d4b4adf186ba6c7cc45ded68e689&l=pt&nrNights=2&preselect=promo81&startDay=2020-02-08","image":"https:\/\/secure.guestcentric.net\/bin\/b490f458c41be649\/thumb-1878805602.jpg"},{"id":"64","title":"Early booking ","description":"Reserve j\u00e1! Melhor oferta online!","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=1955d4b4adf186ba6c7cc45ded68e689&l=pt&nrNights=2&preselect=promo64&startDay=1970-01-01","image":"https:\/\/secure.guestcentric.net\/bin\/b490f458c41be649\/thumb-hotel-monte-prado_2017-220-de-465-5.jpg"},{"id":"45","title":"Estadia com Jantar Inclu\u00eddo","description":"Reserve j\u00e1 e poupe 10%!","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=1955d4b4adf186ba6c7cc45ded68e689&l=pt&nrNights=2&preselect=promo45&startDay=2020-02-08","image":"https:\/\/secure.guestcentric.net\/bin\/b490f458c41be649\/thumb-42430247_2014287742159868_8721071604383088640_o-copia2.jpg"},{"id":"79","title":"Oferta de Banho a dois privado! ","description":"Oferta limitada! Onde o conforto e a Natureza est\u00e3o de m\u00e3os dadas!","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=1955d4b4adf186ba6c7cc45ded68e689&l=pt&nrNights=2&preselect=promo79&startDay=2020-02-09","image":"https:\/\/secure.guestcentric.net\/bin\/b490f458c41be649\/thumb-_mg_7570_easy-resize.com4.jpg"},{"id":"48","title":"Oferta Especial com Massagem para Dois.","description":"Fa\u00e7a uma Pausa e Relaxe no Meio da Natureza.","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=1955d4b4adf186ba6c7cc45ded68e689&l=pt&nrNights=2&preselect=promo48&startDay=2020-01-14","image":"https:\/\/secure.guestcentric.net\/bin\/b490f458c41be649\/thumb-13246160_1075020799236581_6462712864722874524_o1.jpg"},{"id":"82","title":"Pacote Romantico nas portas do Geres..","description":"Cama de Casal. Sinta o verdadeiro prazer da Natureza...","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=1955d4b4adf186ba6c7cc45ded68e689&l=pt&nrNights=2&preselect=promo82&startDay=2020-02-08","image":"https:\/\/secure.guestcentric.net\/bin\/b490f458c41be649\/thumb-1878805602.jpg"},{"id":"62","title":"Passadi\u00e7o do Minho , com Lunch box ","description":"Som da natureza, aprecie a \u00e1gua que corre..","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=1955d4b4adf186ba6c7cc45ded68e689&l=pt&nrNights=2&preselect=promo62&startDay=2020-02-08","image":"https:\/\/secure.guestcentric.net\/bin\/b490f458c41be649\/thumb-p6200056_easy-resize.com5.jpg"},{"id":"55","title":"SUPER FLASH SALE 72H!Reservas limitadas!","description":"Onde o conforto e a Natureza est\u00e3o de m\u00e3os dadas!","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=1955d4b4adf186ba6c7cc45ded68e689&l=pt&nrNights=2&preselect=promo55&startDay=2020-03-01","image":"https:\/\/secure.guestcentric.net\/bin\/b490f458c41be649\/thumb-13912519_1648293285425984_7268084559862881093_n9.jpg"},{"id":"70","title":"Tudo incluido Light *","description":"Restaurante recomendado boa cama boa mesa.","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=1955d4b4adf186ba6c7cc45ded68e689&l=pt&nrNights=2&preselect=promo70&startDay=2020-02-08","image":"https:\/\/secure.guestcentric.net\/bin\/b490f458c41be649\/thumb-66007509_2284260675236715_3797919625711190016_n2.jpg"},{"id":"66","title":"Twin Confort Vista montanha ","description":"Desfrute de o melhor para si! ","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=1955d4b4adf186ba6c7cc45ded68e689&l=pt&nrNights=2&preselect=promo66&startDay=2020-02-08","image":"https:\/\/secure.guestcentric.net\/bin\/b490f458c41be649\/thumb-hotel-monte-prado_2017-138-de-465-2.jpg"},{"id":"80","title":"Twin Deluxe Com Varanda Vista Montanha","description":"Sinta o verdadeiro prazer da Natureza...","linkLabel":"Clique para mais informa\u00e7\u00f5es","link":"10","bookBtn":"https:\/\/secure.guestcentric.net\/api\/bg\/book.php?apikey=1955d4b4adf186ba6c7cc45ded68e689&l=pt&nrNights=2&preselect=promo80&startDay=2020-02-08","image":"https:\/\/secure.guestcentric.net\/bin\/b490f458c41be649\/thumb-pa9.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 = [];