// ColorBox v1.3.17.1 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(a,b,c){function bc(b){if(!T){O=b,_(a.extend(J,a.data(O,e))),x=a(O),P=0,J.rel!=="nofollow"&&(x=a("."+X).filter(function(){var b=a.data(this,e).rel||this.rel;return b===J.rel}),P=x.index(O),P===-1&&(x=x.add(O),P=x.length-1));if(!R){R=S=!0,q.show();if(J.returnFocus)try{O.blur(),a(O).one(k,function(){try{this.focus()}catch(a){}})}catch(c){}p.css({opacity:+J.opacity,cursor:J.overlayClose?"pointer":"auto"}).show(),J.w=Z(J.initialWidth,"x"),J.h=Z(J.initialHeight,"y"),W.position(0),n&&y.bind("resize."+o+" scroll."+o,function(){p.css({width:y.width(),height:y.height(),top:y.scrollTop(),left:y.scrollLeft()})}).trigger("resize."+o),ba(g,J.onOpen),I.add(C).hide(),H.html(J.close).show()}W.load(!0)}}function bb(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;J.slideshow&&x[1]?(d=function(){E.text(J.slideshowStop).unbind(c).bind(i,function(){if(P<x.length-1||J.loop)a=setTimeout(W.next,J.slideshowSpeed)}).bind(h,function(){clearTimeout(a)}).one(c+" "+j,e),q.removeClass(b+"off").addClass(b+"on"),a=setTimeout(W.next,J.slideshowSpeed)},e=function(){clearTimeout(a),E.text(J.slideshowStart).unbind([i,h,j,c].join(" ")).one(c,d),q.removeClass(b+"on").addClass(b+"off")},J.slideshowAuto?d():e()):q.removeClass(b+"off "+b+"on")}function ba(b,c){c&&c.call(O),a.event.trigger(b)}function _(b){for(var c in b)a.isFunction(b[c])&&c.substring(0,2)!=="on"&&(b[c]=b[c].call(O));b.rel=b.rel||O.rel||"nofollow",b.href=b.href||a(O).attr("href"),b.title=b.title||O.title,typeof b.href=="string"&&(b.href=a.trim(b.href))}function $(a){return J.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(a)}function Z(a,b){b=b==="x"?y.width():y.height();return typeof a=="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function Y(c,d){var e=b.createElement("div");c&&(e.id=f+c),e.style.cssText=d||"";return a(e)}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:!1},e="colorbox",f="cbox",g=f+"_open",h=f+"_load",i=f+"_complete",j=f+"_cleanup",k=f+"_closed",l=f+"_purge",m=a.browser.msie&&!a.support.opacity,n=m&&a.browser.version<7,o=f+"_IE6",p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J={},K,L,M,N,O,P,Q,R,S,T,U,V,W,X=f+"Element";W=a.fn[e]=a[e]=function(b,c){var f=this,g;if(!f[0]&&f.selector)return f;b=b||{},c&&(b.onComplete=c);if(!f[0]||f.selector===undefined)f=a("<a/>"),b.open=!0;f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b)),a(this).addClass(X)}),g=b.open,a.isFunction(g)&&(g=g.call(f)),g&&bc(f[0]);return f},W.init=function(){y=a(c),q=Y().attr({id:e,"class":m?f+(n?"IE6":"IE"):""}),p=Y("Overlay",n?"position:absolute":"").hide(),r=Y("Wrapper"),s=Y("Content").append(z=Y("LoadedContent","width:0; height:0; overflow:hidden"),B=Y("LoadingOverlay").add(Y("LoadingGraphic")),C=Y("Title"),D=Y("Current"),F=Y("Next"),G=Y("Previous"),E=Y("Slideshow").bind(g,bb),H=Y("Close")),r.append(Y().append(Y("TopLeft"),t=Y("TopCenter"),Y("TopRight")),Y(!1,"clear:left").append(u=Y("MiddleLeft"),s,v=Y("MiddleRight")),Y(!1,"clear:left").append(Y("BottomLeft"),w=Y("BottomCenter"),Y("BottomRight"))).children().children().css({"float":"left"}),A=Y(!1,"position:absolute; width:9999px; visibility:hidden; display:none"),a("body").prepend(p,q.append(r,A)),s.children().hover(function(){a(this).addClass("hover")},function(){a(this).removeClass("hover")}).addClass("hover"),K=t.height()+w.height()+s.outerHeight(!0)-s.height(),L=u.width()+v.width()+s.outerWidth(!0)-s.width(),M=z.outerHeight(!0),N=z.outerWidth(!0),q.css({"padding-bottom":K,"padding-right":L}).hide(),F.click(function(){W.next()}),G.click(function(){W.prev()}),H.click(function(){W.close()}),I=F.add(G).add(D).add(E),s.children().removeClass("hover"),p.click(function(){J.overlayClose&&W.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;R&&J.escKey&&b===27&&(a.preventDefault(),W.close()),R&&J.arrowKey&&x[1]&&(b===37?(a.preventDefault(),G.click()):b===39&&(a.preventDefault(),F.click()))})},W.remove=function(){q.add(p).remove(),a("."+X).removeData(e).removeClass(X)},W.position=function(a,c){function g(a){t[0].style.width=w[0].style.width=s[0].style.width=a.style.width,B[0].style.height=B[1].style.height=s[0].style.height=u[0].style.height=v[0].style.height=a.style.height}var d,e=0,f=0;q.hide(),J.fixed&&!n?q.css({position:"fixed"}):(e=y.scrollTop(),f=y.scrollLeft(),q.css({position:"absolute"})),J.right!==!1?f+=Math.max(y.width()-J.w-N-L-Z(J.right,"x"),0):J.left!==!1?f+=Z(J.left,"x"):f+=Math.max(y.width()-J.w-N-L,0)/2,J.bottom!==!1?e+=Math.max(b.documentElement.clientHeight-J.h-M-K-Z(J.bottom,"y"),0):J.top!==!1?e+=Z(J.top,"y"):e+=Math.max(b.documentElement.clientHeight-J.h-M-K,0)/2,q.show(),d=q.width()===J.w+N&&q.height()===J.h+M?0:a,r[0].style.width=r[0].style.height="9999px",q.dequeue().animate({width:J.w+N,height:J.h+M,top:e,left:f},{duration:d,complete:function(){g(this),S=!1,r[0].style.width=J.w+N+L+"px",r[0].style.height=J.h+M+K+"px",c&&c()},step:function(){g(this)}})},W.resize=function(a){if(R){a=a||{},a.width&&(J.w=Z(a.width,"x")-N-L),a.innerWidth&&(J.w=Z(a.innerWidth,"x")),z.css({width:J.w}),a.height&&(J.h=Z(a.height,"y")-M-K),a.innerHeight&&(J.h=Z(a.innerHeight,"y"));if(!a.innerHeight&&!a.height){var b=z.wrapInner("<div style='overflow:auto'></div>").children();J.h=b.height(),b.replaceWith(b.children())}z.css({height:J.h}),W.position(J.transition==="none"?0:J.speed)}},W.prep=function(b){function h(b){W.position(b,function(){function o(){m&&q[0].style.removeAttribute("filter")}var b,d,g,h,j=x.length,k,n;!R||(n=function(){clearTimeout(V),B.hide(),ba(i,J.onComplete)},m&&Q&&z.fadeIn(100),C.html(J.title).add(z).show(),j>1?(typeof J.current=="string"&&D.html(J.current.replace(/\{current\}/,P+1).replace(/\{total\}/,j)).show(),F[J.loop||P<j-1?"show":"hide"]().html(J.next),G[J.loop||P?"show":"hide"]().html(J.previous),b=P?x[P-1]:x[j-1],g=P<j-1?x[P+1]:x[0],J.slideshow&&E.show(),J.preloading&&(h=a.data(g,e).href||g.href,d=a.data(b,e).href||b.href,h=a.isFunction(h)?h.call(g):h,d=a.isFunction(d)?d.call(b):d,$(h)&&(a("<img/>")[0].src=h),$(d)&&(a("<img/>")[0].src=d))):I.hide(),J.iframe?(k=a("<iframe/>").addClass(f+"Iframe")[0],J.fastIframe?n():a(k).one("load",n),k.name=f+ +(new Date),k.src=J.href,J.scrolling||(k.scrolling="no"),m&&(k.frameBorder=0,k.allowTransparency="true"),a(k).appendTo(z).one(l,function(){k.src="//about:blank"})):n(),J.transition==="fade"?q.fadeTo(c,1,o):o(),y.bind("resize."+f,function(){W.position(0)}))})}function g(){J.h=J.h||z.height(),J.h=J.mh&&J.mh<J.h?J.mh:J.h;return J.h}function d(){J.w=J.w||z.width(),J.w=J.mw&&J.mw<J.w?J.mw:J.w;return J.w}if(!!R){var c=J.transition==="none"?0:J.speed;y.unbind("resize."+f),z.remove(),z=Y("LoadedContent").html(b),z.hide().appendTo(A.show()).css({width:d(),overflow:J.scrolling?"auto":"hidden"}).css({height:g()}).prependTo(s),A.hide(),a(Q).css({"float":"none"}),n&&a("select").not(q.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(j,function(){this.style.visibility="inherit"}),J.transition==="fade"?q.fadeTo(c,0,function(){h(0)}):h(c)}},W.load=function(b){var c,d,g=W.prep;S=!0,Q=!1,O=x[P],b||_(a.extend(J,a.data(O,e))),ba(l),ba(h,J.onLoad),J.h=J.height?Z(J.height,"y")-M-K:J.innerHeight&&Z(J.innerHeight,"y"),J.w=J.width?Z(J.width,"x")-N-L:J.innerWidth&&Z(J.innerWidth,"x"),J.mw=J.w,J.mh=J.h,J.maxWidth&&(J.mw=Z(J.maxWidth,"x")-N-L,J.mw=J.w&&J.w<J.mw?J.w:J.mw),J.maxHeight&&(J.mh=Z(J.maxHeight,"y")-M-K,J.mh=J.h&&J.h<J.mh?J.h:J.mh),c=J.href,V=setTimeout(function(){B.show()},100),J.inline?(Y().hide().insertBefore(a(c)[0]).one(l,function(){a(this).replaceWith(z.children())}),g(a(c))):J.iframe?g(" "):J.html?g(J.html):$(c)?(a(Q=new Image).addClass(f+"Photo").error(function(){J.title=!1,g(Y("Error").text("This image could not be loaded"))}).load(function(){var a;Q.onload=null,J.scalePhotos&&(d=function(){Q.height-=Q.height*a,Q.width-=Q.width*a},J.mw&&Q.width>J.mw&&(a=(Q.width-J.mw)/Q.width,d()),J.mh&&Q.height>J.mh&&(a=(Q.height-J.mh)/Q.height,d())),J.h&&(Q.style.marginTop=Math.max(J.h-Q.height,0)/2+"px"),x[1]&&(P<x.length-1||J.loop)&&(Q.style.cursor="pointer",Q.onclick=function(){W.next()}),m&&(Q.style.msInterpolationMode="bicubic"),setTimeout(function(){g(Q)},1)}),setTimeout(function(){Q.src=c},1)):c&&A.load(c,J.data,function(b,c,d){g(c==="error"?Y("Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},W.next=function(){!S&&x[1]&&(P<x.length-1||J.loop)&&(P=P<x.length-1?P+1:0,W.load())},W.prev=function(){!S&&x[1]&&(P||J.loop)&&(P=P?P-1:x.length-1,W.load())},W.close=function(){R&&!T&&(T=!0,R=!1,ba(j,J.onCleanup),y.unbind("."+f+" ."+o),p.fadeTo(200,0),q.stop().fadeTo(300,0,function(){q.add(p).css({opacity:1,cursor:"auto"}).hide(),ba(l),z.remove(),setTimeout(function(){T=!1,ba(k,J.onClosed)},1)}))},W.element=function(){return a(O)},W.settings=d,U=function(a){a.button!==0&&typeof a.button!="undefined"||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),bc(this))},a.fn.delegate?a(b).delegate("."+X,"click",U):a("."+X).live("click",U),a(W.init)})(jQuery,document,this);
(function ($) {

Drupal.behaviors.initColorbox = {
  attach: function (context, settings) {
    if (!$.isFunction($.colorbox)) {
      return;
    }
    $('a, area, input', context)
      .filter('.colorbox')
      .once('init-colorbox-processed')
      .colorbox(settings.colorbox);
  }
};

{
  $(document).bind('cbox_complete', function () {
    Drupal.attachBehaviors('#cboxLoadedContent');
  });
}

})(jQuery);
;
(function ($) {

Drupal.behaviors.initColorboxDefaultStyle = {
  attach: function (context, settings) {
    $(document).bind('cbox_complete', function () {
      // Only run if there is a title.
      if ($('#cboxTitle:empty', context).length == false) {
        setTimeout(function () { $('#cboxTitle', context).slideUp() }, 1500);
        $('#cboxLoadedContent img', context).bind('mouseover', function () {
          $('#cboxTitle', context).slideDown();
        });
        $('#cboxOverlay', context).bind('mouseover', function () {
          $('#cboxTitle', context).slideUp();
        });
      }
      else {
        $('#cboxTitle', context).hide();
      }
    });
  }
};

})(jQuery);
;
/*****
 * Copyright © FASTBOOKING  1999-2007
 * 22/04/2009
 *
 * Please do NOT modify this file
 * Please do NOT use the final IP adress for Fastbooking links:
 *   IP address may be changed at any time
 *
*/

// use following parameters, declared before in a fbparam.js file
// Mandatory parameters:
//var FBRESA = "http://www.fastbookings.biz/DIRECTORY/";
//var FB_nb_day_delay = 7;
// Optional parameters:
//var FB_useGoogleAnalytics = true;

if (typeof(FB_useGoogleAnalytics) == "undefined")
	var FB_useGoogleAnalytics = false;
	var FBRESA;
//////////////////////////////////////////////////////////////
// following code is used to optimize booking access and a better client experience
var FB_book_image = new Image();
FB_book_image.src = FBRESA + "trans.gif";

//////////////////////////////////////////////////////////////
// Fidelity program
var FB_code_interface = "";
var FB_profil = "";
function hhotelProfil(code_interface, profil)
{
	FB_code_interface = code_interface;
	FB_profil = profil;
}
// Form: show arrival date
// this function to replace the traditional start function
// in this case no update is required every year.
function start() {
	var nbm = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
		
	thisform = document.idForm;

	// build_year_select(thisform);

	MD = new Date();
		
	nday = MD.getDate();
	aday = MD.getDay();
	amois = MD.getMonth();
	ayear = takeYear(MD);
	cur_year = ayear;
			
	nday += FB_nb_day_delay;

	if(nday > nbm[amois])
	{
		nday -= nbm[amois];
		amois++;
		if(amois > 11) {
			ayear++;
			amois = 0;
		}
	}

	indexDay = nday - 1;
	indexMois = amois;
	indexYear = ayear - cur_year;
		
	if(indexDay < 0 || indexDay > 30)
		indexDay = 0;
	if(indexMois < 0 || indexMois > 11)
		indexMois = 0;
	if(indexYear < 0 || indexYear > 1)
		indexDay = 0;

	thisform.fromday.selectedIndex = indexDay;
	thisform.frommonth.selectedIndex = indexMois;
	thisform.fromyear.selectedIndex = indexYear;

	update_departure();
}

function generateSession()
{
	var time = new Date();
	var sec  = time.getSeconds();
	f = Math.floor(Math.random() * 1000000000) + '';
	var sess = '' + sec + f;
	return sess;
}

function transferGAdata(sessId, cname)
{
	var waction = FBRESA + "ga.phtml?clusterName="+cname + "&id=" + sessId;
	pageTracker._initData();
	new Image().src = pageTracker._getLinkerUrl(waction);
	pageTracker._trackPageview('/FastBooking/ClicBook'); 
}

function fbOpenWindow(cname, waction, title, width, height)
{
	if(FB_useGoogleAnalytics)
	{
		sessId 	 = generateSession();
		hhotelProfil("GoogleAnalytics", escape("SESSION=" + sessId));
	}
	if(FB_profil != "")
	{
		waction += "&code="+FB_code_interface;
		waction += "&profil="+FB_profil;
	}

	window.open(waction, title, "toolbar=no,width=" + width + ",height=" + height +",menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");

	if(FB_useGoogleAnalytics)
		transferGAdata(sessId, cname);
}

// standard booking function
function hhotelPTC(cname, lg, codeprice, codetrack, cluster)
{
	hhotelResa(cname, lg, codeprice, "", "", codetrack, cluster, "", "");
}

// standard promotion function
function hhotelPromo(cname, lg, theme)
{
	hhotelResa(cname, lg, "DYNPROMO", "", "", "", "", theme, "");
}

// reservation promotion function: To show one promotion
function hhotelOnePromo(cname, lg, codeprice, codetrack, cluster)
{
	hhotelResa(cname, lg, codeprice, "", "", codetrack, cluster, "", "style=DIRECTPROMO");
}

// reservation page WITHOUT the individual access
function hhotelNegociated(cname, lg, codeprice, codetrack, cluster)
{
	hhotelResa(cname, lg, codeprice, "", "", codetrack, cluster, "", "negociated=1");
}

// Main direct reservation function
function hhotelResaDirect(cname, lg, codeprice, firstroom, codetrack, firstdate)
{
	hhotelResa(cname, lg, codeprice, firstroom, firstdate, codetrack, "", "", "style=DIRECT");
}

// standard search availabilities in a group
function hhotelSearchGroup(cluster, lg, price, nights, title)
{
	hhotelSearch(cluster, lg, price, nights, title, "", "");
}

// standard search availabilities in a group for a partner
function hhotelSearchPartner(cluster, lg, price, codetrack, title)
{
	if (codetrack != "") args = "&from="+codetrack;
	else	args = "";
	hhotelSearch(cluster, lg, price, "", title, "", args);
}

// search by giving the initial date
function hhotelSearchPriceDate(cluster, price, nights, title, firstdate)
{
	// firstdate : format "YYMMDD"
	var args="";
	if (firstdate != "") args = "FirstDate="+firstdate;
	hhotelSearch(cluster, "", price, nights, title, "", args);
}

function hhotelSearchPriceDateTrack(cluster, lg, price, codetrack, nights, title, firstdate)
{
	var args="";
	if (codetrack != "") args = "from="+codetrack;
	if (firstdate != "") args += "&FirstDate="+firstdate;
	hhotelSearch(cluster, lg, price, nights, title, "", args);
}

// search availabilities for selected promotions
function hhotelSearchPromo(cluster, lg, theme)
{
	hhotelSearch(cluster, lg, "", "", "", theme, "");
}

// search availabilities with Extra Field
function hhotelSearchExtra(cluster, lg, price, codetrack, extratitle, extraval, extrashow)
{
	var args = "Extrafield=" + escape(extratitle) + ";" + extraval + ";" + extrashow;
	if (codetrack != "") args += "&from="+codetrack;
	hhotelSearch(cluster, lg, price, "", "", "", args);
}

// go to the cancel reservation page
function hhotelcancel(cname,lg)
{
	var waction = FBRESA + "cancel.phtml?state=77&Hotelnames="+cname;
	if (lg != "") waction += "&langue="+lg;
	fbOpenWindow(cname, waction, "reservation", 400, 350);
	//window.open(waction,"reservation","toolbar=no,width=400,height=350,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
}

// go to the extract reservation page
function hhotelExtract(cname, lg)
{
	var waction = FBRESA + "getresa.phtml?Hotelnames="+cname+"&langue="+lg;
	fbOpenWindow(cname, waction, "getresa", 700, 300);
	//window.open(waction, 'getresa', 'toolbar=no,width=700,height=300,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=no');
	return false;
}

// check interface
function hhotelcheckrates(cname, lg)
{
	var waction = FBRESA + "crs.phtml?clusterName="+cname;
	if (lg != "") waction += "&langue="+lg;
	waction += "&checkPromo=1";
	fbOpenWindow(cname, waction, "search", 800, 550);
	//window.open(waction,"search","toolbar=no,width=800,height=550,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
}

// Main standard reservation function MSP
function hhotelResaMSP(cname, lg, codeprice, firstroom, firstdate, codetrack, cluster, theme, args, mastercluster, cartID)
{
	if (mastercluster != "") args += "&mastercluster=" + mastercluster;
	if (cartID != "") args += "&cartID=" + cartID;
	hhotelResa(cname, lg, codeprice, firstroom, firstdate, codetrack, cluster, theme, args);
}

// Main Search function MSP
function hhotelSearchMSP(cluster, lg, price, nights, title, theme, args, mastercluster, cartID)
{
	if (mastercluster != "") args += "&mastercluster=" + mastercluster;
	if (cartID != "") args += "&cartID=" + cartID;
	hhotelSearch(cluster, lg, price, nights, title, theme, args);
}

// Main standard reservation function
function hhotelResa(cname, lg, codeprice, firstroom, firstdate, codetrack, cluster, theme, args)
{
	var waction = FBRESA+"preresa.phtml?Hotelnames="+cname;
	if (lg != "") waction += "&langue="+lg;
	if (firstroom != "") {
		waction += "&FirstRoomName="+firstroom;
		if (codeprice == "")
			codeprice = "DIRECT";
		}
	if (firstdate != "") {
		waction += "&FirstDate="+firstdate;
		if (codeprice == "")
			codeprice = "DIRECT";
		}
	if (codeprice != "") waction += "&FSTBKNGCode="+codeprice;
	if (codetrack != "") waction += "&FSTBKNGTrackLink="+codetrack;
	if (cluster != "") waction += "&clustername="+cluster;
	if (theme != "") waction += "&theme="+theme;
	if (args != "" && (args.indexOf("=")!= -1) ) waction += "&"+args;
	waction += "&HTTP_REFERER="+escape(document.location.href);
	fbOpenWindow(cname, waction, "reservation", 400, 350);
	//window.open(waction,"reservation","toolbar=no,width=400,height=350,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
}

// Main Search function
function hhotelSearch(cluster, lg, price, nights, title, theme, args)
{
	var waction = FBRESA + "crs.phtml?clusterName="+cluster;
	if (lg != "") waction += "&langue="+lg;
	if (price != "") waction += "&FSTBKNGCode="+price;
	if (nights != "") waction += "&nights="+nights;
	if (title != "") waction += "&title="+escape(title);
	if (theme != "") waction += "&theme="+theme;
	if (args != "" && (args.indexOf("=")!= -1) ) waction += "&"+args;
	fbOpenWindow(cluster, waction, "search", 800, 550);
	//window.open(waction,"search","toolbar=no,width=800,height=550,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
}

// Main Search function for Multi Codes
function hhotelSearchMultCode(cluster, lg, clecode, title, codetrack)
{
	var waction = FBRESA + "crs.phtml?clusterName="+cluster;
	if (lg != "") waction += "&langue="+lg;
	if (clecode != "") waction += "&AccessCode="+clecode;
	if (title != "") waction += "&title="+escape(title);
	if (codetrack != "") waction += "&FSTBKNGTrackLink="+codetrack;
	waction += "&crossSelling=NO"; // CROSS SELLING DESACTIVATED
	fbOpenWindow(cluster, waction, "search", 800, 550);
	//window.open(waction,"search","toolbar=no,width=800,height=550,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
}

// Main Search function for Cross Selling

function hhotelSearchCrossSell(cluster, lg, codetrack, crossSelling)
{
	var waction = FBRESA + "crs.phtml?clusterName="+cluster;
	if (lg != "") waction += "&langue="+lg;
	if (codetrack != "") waction += "&FSTBKNGTrackLink="+codetrack;
	if (crossSelling != "") waction += "&crossSelling="+crossSelling;
	fbOpenWindow(cluster, waction, "search", 800, 550);
	//window.open(waction,"search","toolbar=no,width=800,height=550,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
}

// MAIN AVAILABILITY CHECK 
function hhotelDispopriceFHP(cname, lg, codetrack, year, month, day, nights, currency)
{
	var waction = FBRESA+"dispoprice.phtml?clusterName="+cname+"&Hotelnames="+cname;
	if (lg != "") waction += "&langue="+lg;
	if (codetrack != "") waction += "&FSTBKNGTrackLink="+codetrack;
	if (year != "") waction += "&fromyear="+year;
	if (month != "") waction += "&frommonth="+month;
	if (day != "") waction += "&fromday="+day;
	if (nights != "") waction += "&nbdays="+nights;
	if (currency != "") waction += "&CurrencyLabel="+currency;
	waction += "&showPromotions=3";
	fbOpenWindow(cname, waction, "reservation", 750, 600);
	//window.open(waction,"reservation","toolbar=no,width=750,height=600,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
}


///////////////////////////////////////////////////////////////////////////////////////
// Form functions
// Simple form validation (used for compatibility issues)
function hhotelDispoprice(myForm)
{
	hhotelFormValidation(myForm, 0);
}

// Form validation with control
function hhotelFormValidation(myForm, mandatoryCode){
	if (mandatoryCode == 1 && myForm.AccessCode.value == "") {
		alert("You must type in your code ID");
		return (false);
	}
	myForm.action = FBRESA + "dispoprice.phtml";
	if (FB_useGoogleAnalytics) {	
		sessId = generateSession();
		profilValue = escape("SESSION=" + sessId + "&CODE=GoogleAnalytics");
		if ((typeof myForm.profil) == "undefined") {
			var newInput = document.createElement("input");
			newInput.setAttribute("type", "hidden");
			newInput.setAttribute("name", "profil");
			newInput.setAttribute("value", profilValue);
			myForm.appendChild(newInput);
		} else {
			myForm.profil.value = profilValue;
		}
	}
	window.open('','dispoprice', 'toolbar=no,width=800,height=550,menubar=no,scrollbars=yes,resizable=yes');
	myForm.submit();
	if (FB_useGoogleAnalytics) {
		var cname = "";
		if ((typeof myForm.AccountName) != "undefined" && myForm.AccountName.value != "")
			cname = myForm.AccountName.value;
		else 
			cname = myForm.Clusternames.value;
		transferGAdata(sessId, cname);
	}
	return (true);
}

// Form: update the selected hotel name
function hhotelFormUpdateHotelnames(myForm)
{
	menuNum = myForm.HotelList.selectedIndex;
	if (menuNum == null)
		return;
	myForm.Hotelnames.value = myForm.HotelList.options[menuNum].value;
}

// Form: show the cancel page
function hhotelFormCancel(myForm){
	var CName = myForm.Hotelnames.value;
	var languetype = typeof myForm.langue;
	var langue;
	if (languetype == "undefined")
		langue = "";
	else
		langue = myForm.langue.value;
	if (CName == null || CName == 'All' || CName == ''){ alert('Please select a hotel first'); return (false); }
	return hhotelcancel(CName, langue);
}

// Form: show the extract page
function hhotelFormExtract(myForm)
{
	var CName = myForm.Hotelnames.value;
	var languetype = typeof myForm.langue;
	var langue;
	if (languetype == "undefined")
		langue = "";
	else
		langue = myForm.langue.value;
	if (CName == null || CName == 'All' || CName == ''){ alert('Please select a hotel first'); return (false); }
	return hhotelExtract(CName, langue);
}

// Form: show languages ////////////////////////////////////////////
function hhotelShowLang(lang) 
{
	hhotelShowLang__(this.document, lang);
}

function hhotelShowLangOpener(lang)
{
	hhotelShowLang__(window.opener.document, lang);
	window.close();
}

function hhotelShowLang__(mydoc, lang)
{
	mydoc.idForm.langue.value=lang;

	var imgLang = hhotelLang2Img(lang);
	if (imgLang != "") {
		var formFlag = mydoc.selLgFlag;
		if (formFlag != null)
			mydoc.selLgFlag.src= "fastbooking/flags/"+imgLang+".gif";
		var formFlag = mydoc.selLgTxt;
		if (formFlag != null)
			mydoc.selLgTxt.src= "fastbooking/flags/"+imgLang+"lg.gif";
	}
}

// FastBooking language and image code
var FBLangCode = new Array (
	"uk", "france", "germany", "spain", "portuguese", "italy", "nether", "russian",
	"dansk", "svensk", "islensk", "norsk", "turk", "hungria", "greek", "arab",
	"china", "coreen", "japan","croate","czech","poland");
var FBLangImg = new Array (
	"grandbret", "france", "germany", "spain", "portuguese", "italy", "nether", "russia",
	"denmark", "sweeden", "iceland", "norway", "turkey", "hungary", "greek", "arab",
	"china", "coreen", "japan","croate","czech","poland");

function hhotelLang2Img(lang)
{
	for(i = 0; i < FBLangCode.length; i++) {
		if (FBLangCode[i] == lang)
			break;
	}
	return FBLangImg[i];
}

function hhotelLangSelector()
{
	window.open('fastbooking/flags/langSelector.html', '', 'width=330,height=180');
}


var langcodes = new Array("en", "uk", "fr", "france", "de", "germany", "es", "spain ", "pt", "portuguese", "it", "italy", "nl", "nether", "ja", "japan ", "ko", "coreen", "zh", "china", "ar", "arab", "ru", "russian", "tr", "turk", "el", "greek", "hu", "hungria", "da", "dansk", "sv", "svensk", "is", "islensk", "no", "norsk", "hr", "croate", "cs", "czech", "pl", "poland", "iw", "hebrew");

function selectLang()
{
	if(navigator.appName == "Microsoft Internet Explorer") UL = navigator.userLanguage.substring(0, 2);
	else if(navigator.appName == "Netscape") UL = navigator.language;
	else return;

	for(i = 0; i < langcodes.length; i += 2)
		if(UL == langcodes[i])
			break;
			
	lang = (i < langcodes.length) ? langcodes[i+1] : "uk";
	hhotelShowLang(lang);
}


// date manager ////////////////////////////////////////////
// build year select
function build_year_select(thisform) {
	var cur_date = new Date();
	var cur_year = takeYear(cur_date);
		
	cur_y = new Option(cur_year, cur_year, true, true);
	thisform.fromyear.options[0] = cur_y;
	if(thisform.toyear != null) {
		cur_yb = new Option(cur_year, cur_year, true, true);
		thisform.toyear.options[0] = cur_yb;
	}
		
	next_y = new Option(cur_year + 1, cur_year + 1, false, false);
	thisform.fromyear.options[1] = next_y;
	next_yb = new Option(cur_year + 1, cur_year + 1, false, false);
	if(thisform.toyear != null) {
		thisform.toyear.options[1] = next_yb;
	}
}
	
// check departure date to arrival date + 1 day (every time the arrival date is changed)
function check_departure() {
	thisform = document.idForm;

	if(thisform.today == null)
		return;

	var nbm = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
	
	var ar_day = parseInt(thisform.fromday.value) + 1;
	var ar_month = parseInt(thisform.frommonth.value);
	var ar_year = parseInt(thisform.fromyear.value);
			
	if(ar_day > nbm[ar_month - 1]) {
		ar_day = 1;
		ar_month += 1;
		if(ar_month > 12) {
			ar_month = 1;
			ar_year += 1;
		}
	}
			
	var cur_date = new Date();
	var cur_year = takeYear(cur_date);
	
	thisform.today.selectedIndex = ar_day - 1;
	thisform.tomonth.selectedIndex = ar_month - 1;
	thisform.toyear.selectedIndex = ar_year - cur_year;
}

// update departure : check 
function update_departure() {
	thisform = document.idForm;

	if(thisform.today == null)
		return;
		
	var ar_day = parseInt(thisform.fromday.value) + 1;
	var ar_month = parseInt(thisform.frommonth.value);
	var ar_year = parseInt(thisform.fromyear.value);
			
	var de_day = parseInt(thisform.today.value) + 1;
	var de_month = parseInt(thisform.tomonth.value);
	var de_year = parseInt(thisform.toyear.value);
	
	if(de_year < ar_year) {
		check_departure();
	} else {
		if(de_year == ar_year) {
			if(de_month < ar_month) {
				check_departure();
			} else {
				if(de_month == ar_month) {
					if(de_day <= ar_day) {
						check_departure();
					}
				}
			}
		}
	}
}

function takeYear(theDate)
{
	x = theDate.getYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	return y;
}

// popup for quicksearch flash
function popup(url)
{
	fbOpenWindow("", url, "", 800, 550);
	//window.open(url,"","toolbar=no,width=800,height=550,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
};
var FBRESA = "http://www.fastbookings.biz/DIRECTORY/";
var FB_nb_day_delay = 0;
var FB_useGoogleAnalytics = false;;
ï»¿function check_date(x) {	
	var date_input = document.getElementById(x).value;
	var dd = date_input.substring(0,2);
	var mm = date_input.substring(3,5);
	var yy = date_input.substring(6,10);
	document.forms['idForm'].fromday.value = dd;
	document.forms['idForm'].frommonth.value = mm;
	document.forms['idForm'].fromyear.value = yy;
//	alert(dd + "/" + mm + "/" + yy);
};
refname = crefname = document.referrer;
dname = document.location.hostname;
cdname = document.location.href;
motif0 = /.*:\/\//;
motif1 = /\/.*$/;
motif2 = / /;
motif4 = /^[^?]+./;
t1 = dname.replace(motif0, " ");
t2 = t1.replace(motif1, '');
t3 = t2.replace(motif2, '');
dname = t3.toLowerCase();
t1 = refname.replace(motif0, " ");
t2 = t1.replace(motif1, '');
t3 = t2.replace(motif2, '');
refname = t3.toLowerCase();
t1 = crefname.replace(motif4, " ");
t2 = t1.replace(motif0, '');
t3 = t2.replace(motif1, '');
crefname = t3.replace(motif2, '');
t1 = cdname.replace(motif4, " ");
t2 = t1.replace(motif0, '');
t3 = t2.replace(motif1, '');
cdname = t3.replace(motif2, '');
if(dname != refname && refname.length > 0 && dname.length > 0) {
	refname = escape(refname);
	dname = escape(dname);
	crefname = escape(crefname);
	cdname = escape(cdname);
	strg = "<IMG SRC='http://tracking.fastbooking.net/fullorigin.phtml?origin="+refname+"&dname="+dname+"&crefname="+crefname+"&cdname="+cdname+"' height='1' width='1'>";
	document.write(strg);
}
if(dname != refname && dname.length > 0) {
	document.write("<IMG SRC='http://tracking.fastbooking.net/visit.phtml?dname="+dname+"' height='1' width='1' border='0'>");
};

/**
 * Attaches the calendar behavior to all required fields
 */
(function ($) {
Drupal.behaviors.date_popup = {
  attach: function (context) {
  for (var id in Drupal.settings.datePopup) {
    $('#'+ id).bind('focus', Drupal.settings.datePopup[id], function(e) {
      if (!$(this).hasClass('date-popup-init')) {
        var datePopup = e.data;
        // Explicitely filter the methods we accept.
        switch (datePopup.func) {
          case 'datepicker':
            $(this)
              .datepicker(datePopup.settings)
              .addClass('date-popup-init')
            $(this).click(function(){
              $(this).focus();
            });
            break;

          case 'timeEntry':
            $(this)
              .timeEntry(datePopup.settings)
              .addClass('date-popup-init')
            $(this).click(function(){
              $(this).focus();
            });
            break;
        }
      }
    });
  }
  }
};
})(jQuery);;
(function ($) {

$(document).ready(function() {

  // Accepts a string; returns the string with regex metacharacters escaped. The returned string
  // can safely be used at any point within a regex to match the provided literal string. Escaped
  // characters are [ ] { } ( ) * + ? - . , \ ^ $ # and whitespace. The character | is excluded
  // in this function as it's used to separate the domains names.
  RegExp.escapeDomains = function(text) {
    return (text) ? text.replace(/[-[\]{}()*+?.,\\^$#\s]/g, "\\$&") : '';
  }

  // Attach onclick event to document only and catch clicks on all elements.
  $(document.body).click(function(event) {
    // Catch the closest surrounding link of a clicked element.
    $(event.target).closest("a,area").each(function() {

      var ga = Drupal.settings.googleanalytics;
      // Expression to check for absolute internal links.
      var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
      // Expression to check for special links like gotwo.module /go/* links.
      var isInternalSpecial = new RegExp("(\/go\/.*)$", "i");
      // Expression to check for download links.
      var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i");
      // Expression to check for the sites cross domains.
      var isCrossDomain = new RegExp("^(https?|ftp|news|nntp|telnet|irc|ssh|sftp|webcal):\/\/.*(" + RegExp.escapeDomains(ga.trackCrossDomains) + ")", "i");

      // Is the clicked URL internal?
      if (isInternal.test(this.href)) {
        // Is download tracking activated and the file extension configured for download tracking?
        if (ga.trackDownload && isDownload.test(this.href)) {
          // Download link clicked.
          var extension = isDownload.exec(this.href);
          _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]);
        }
        else if (isInternalSpecial.test(this.href)) {
          // Keep the internal URL for Google Analytics website overlay intact.
          _gaq.push(["_trackPageview", this.href.replace(isInternal, '')]);
        }
      }
      else {
        if (ga.trackMailto && $(this).is("a[href^=mailto:],area[href^=mailto:]")) {
          // Mailto link clicked.
          _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]);
        }
        else if (ga.trackOutbound && this.href) {
          if (ga.trackDomainMode == 2 && isCrossDomain.test(this.href)) {
            // Top-level cross domain clicked. document.location is handled by _link internally.
            _gaq.push(["_link", this.href]);
          }
          else if (ga.trackOutboundAsPageview) {
            // Track all external links as page views after URL cleanup.
            // Currently required, if click should be tracked as goal.
            _gaq.push(["_trackPageview", '/outbound/' + this.href.replace(/^(https?|ftp|news|nntp|telnet|irc|ssh|sftp|webcal):\/\//i, '').split('/').join('--')]);
          }
          else {
            // External link clicked.
            _gaq.push(["_trackEvent", "Outbound links", "Click", this.href]);
          }
        }
      }
    });
  });
});

})(jQuery);
;

