if (/*IsLive=*/true || /*upper=temp/test/live*/false || window.location.href.search(/upper=(temp|test|live)/) > 0)
{
document.write("<link rel='stylesheet' href='http://upper2.profitroom.pl/compat/styles/submodal.css' />");
//INCLUDE submodal.js START

/**
 * This derivative version of subModal can be downloaded from http://gabrito.com/files/subModal/
 * Original By Seth Banks (webmaster at subimage dot com)  http://www.subimage.com/
 * Contributions by Eric Angel (tab index code), Scott (hiding/showing selects for IE users), Todd Huss (submodal class on hrefs, moving div containers into javascript, phark method for putting close.gif into CSS), Thomas Risberg (safari fixes for scroll amount), Dave Campbell (improved parsing of submodal-width-height class)
 */
var gSubmodalInitialized = false;
var gPopupMask = null;
var gPopupContainer = null;
var gPopFrame = null;
var gReturnFunc;
var gPopupIsShown = false;
var gHideSelects = false;
var gLoading = "about:blank";

/**
 * Override the loading page from loading.html to something else
 */
function setPopUpLoadingPage(loading)
{
    gLoading = loading;
}

var Submodal = {
    initPopUp: function()
    {
    	if (gSubmodalInitialized) return;
    	
        // Add the HTML to the body
        var body = document.getElementsByTagName('body')[0];
        var popmask = document.createElement('div');
        popmask.id = 'popupMask';
        var popcont = document.createElement('div');
        popcont.id = 'popupContainer';
        popcont.innerHTML = '' +
        '<div id="popupInner">' +
        '<div id="popupTitleBar">' +
        '<div id="popupTitle"></div>' +
        '<div id="popupControls">' +
        '<a onclick="Submodal.hidePopWin(false);"><span>Close</span></a>' +
        '</div>' +
        '</div>' +
        '<iframe src="' +
        gLoading +
        '" style="width:100%;height:100%;background-color:transparent;" scrolling="no" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="100%" height="100%"></iframe>' +
        '</div>';
        body.appendChild(popmask);
        body.appendChild(popcont);
        
        gPopupMask = document.getElementById("popupMask");
        gPopupContainer = document.getElementById("popupContainer");
        gPopFrame = document.getElementById("popupFrame");
        
        // check to see if this is IE version 6 or lower. hide select boxes if so
        // maybe they'll fix this in version 7?
        var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
        if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) 
        {
            gHideSelects = true;
        }
        
        gSubmodalInitialized = true;
    },
    showPopWin: function(url, width, height, returnFunc)
    {
    	this.initPopUp();
        gPopupIsShown = true;
        Submodal.disableTabIndexes();
        gPopupMask.style.display = "block";
        gPopupContainer.style.display = "block";
        Submodal.centerPopWin(width, height);
        var titleBarHeight = 0;//Math.max(parseInt(gPopupContainer.offsetHeight, 10) - 2, 0);
		var winH = 0;
		if (parseInt(navigator.appVersion)>3) {
		 if (navigator.appName=="Netscape")
		  winH = window.innerHeight;
		 else 
          winH = document.body.offsetHeight;
		}
		
		if (winH > 26 && winH < (height + 2))
		{
			height = (winH - 26);
		}
		gPopupContainer.style.width = (width + 22) + "px";
		gPopupContainer.style.height = (height + 2) + "px";
		
        //ja	
        //document.getElementById("popupTitleBar").offsetWidth
        //ja
        gPopFrame.style.width = Math.max(parseInt(gPopupContainer.offsetWidth, 10) - 4, 0) + "px";
        gPopFrame.style.height = (height) + "px";
        gPopFrame.src = url;
        gReturnFunc = returnFunc;
        //KK remove scroll from body
        var html = document.documentElement;
        html.style.overflow = 'hidden';
        document.body.style.overflow = 'hidden';
        html.tabIndex = -1;
        // for IE
        if (gHideSelects == true) 
        {
            Submodal.hideSelectBoxes();
        }
        //KK causing browser errors
        //window.setTimeout("setPopTitleAndRewriteTargets();", 100);
        Submodal.ResizeModal();
    },
    centerPopWin: function(width, height)
    {
        if (gPopupIsShown == true) 
        {
            if (width == null || isNaN(width)) 
            {
                width = gPopupContainer.offsetWidth;
            }
            if (height == null) 
            {
                height = gPopupContainer.offsetHeight;
            }
            var fullHeight = Submodal.getViewportHeight();
            var fullWidth = Submodal.getViewportWidth();
            // scLeft and scTop changes by Thomas Risberg
            var scLeft, scTop;
            if (self.pageYOffset) 
            {
                scLeft = self.pageXOffset;
                scTop = self.pageYOffset;
            }
            else 
                if (document.documentElement && document.documentElement.scrollTop) 
                {
                    scLeft = document.documentElement.scrollLeft;
                    scTop = document.documentElement.scrollTop;
                }
                else 
                    if (document.body) 
                    {
                        scLeft = document.body.scrollLeft;
                        scTop = document.body.scrollTop;
                    }
            gPopupMask.style.height = fullHeight + "px";
            gPopupMask.style.width = fullWidth + "px";
            gPopupMask.style.top = scTop + "px";
            gPopupMask.style.left = scLeft + "px";
			
            //window.status = " gPopupContainer: "+gPopupContainer.style.height + " gPopupFrame: " + gPopupFrame.style.height;
            var topMargin = scTop + (fullHeight - height) / 2;
            if (topMargin < 0) 
            {
                topMargin = 0;
            }
            gPopupContainer.style.top = topMargin + "px";
            gPopupContainer.style.left = (scLeft + ((fullWidth - width) / 2)) + "px";
        }
    },
    hidePopWin: function(callReturnFunc)
    {
        stopScripts = false;
        gPopupIsShown = false;
        Submodal.restoreTabIndexes();
        if (gPopupMask == null) 
        {
            return;
        }
        gPopupMask.style.display = "none";
		gPopupMask.style.height = "0px";
        gPopupContainer.style.display = "none";
		gPopupContainer.style.height = "0px";
        if (callReturnFunc == true && gReturnFunc != null) 
        {
            gReturnFunc(window.frames["popupFrame"].returnVal);
        }
        gPopFrame.src = gLoading;
        //KK restore body scrolling
        var html = document.documentElement;
        html.style.overflow = '';
        document.body.style.overflow = '';
        html.tabIndex = 0;
        
        // display all select boxes
        if (gHideSelects == true) 
        {
            Submodal.displaySelectBoxes();
        }
        Booking.RestoreSite();
    },
    setPopTitleAndRewriteTargets: function()
    {
        if (window.frames["popupFrame"].document.title == null) 
        {
            window.setTimeout("Submodal.setPopTitleAndRewriteTargets();", 10);
        }
        else 
        {
            var popupDocument = window.frames["popupFrame"].document;
            document.getElementById("popupTitle").innerHTML = popupDocument.title;
            if (popupDocument.getElementsByTagName('base').length < 1) 
            {
                var aList = window.frames["popupFrame"].document.getElementsByTagName('a');
                for (var i = 0; i < aList.length; i++) 
                {
                    if (aList.target == null) 
                        aList[i].target = '_parent';
                }
                var fList = window.frames["popupFrame"].document.getElementsByTagName('form');
                for (i = 0; i < fList.length; i++) 
                {
                    if (fList.target == null) 
                        fList[i].target = '_parent';
                }
            }
        }
    },
    keyDownHandler: function(e)
    {
        if (gPopupIsShown && e.keyCode == 9) 
            return false;
    },
    disableTabIndexes: function()
    {
        if (document.all) 
        {
            var i = 0;
            for (var j = 0; j < gTabbableTags.length; j++) 
            {
                var tagElements = document.getElementsByTagName(gTabbableTags[j]);
                for (var k = 0; k < tagElements.length; k++) 
                {
                    gTabIndexes[i] = tagElements[k].tabIndex;
                    tagElements[k].tabIndex = "-1";
                    i++;
                }
            }
        }
    },
    restoreTabIndexes: function()
    {
        if (document.all) 
        {
            var i = 0;
            for (var j = 0; j < gTabbableTags.length; j++) 
            {
                var tagElements = document.getElementsByTagName(gTabbableTags[j]);
                for (var k = 0; k < tagElements.length; k++) 
                {
                    tagElements[k].tabIndex = gTabIndexes[i];
                    tagElements[k].tabEnabled = true;
                    i++;
                }
            }
        }
    },
    hideSelectBoxes: function()
    {
        for (var i = 0; i < document.forms.length; i++) 
        {
            for (var e = 0; e < document.forms[i].length; e++) 
            {
                if (document.forms[i].elements[e].tagName == "SELECT") 
                {
                    document.forms[i].elements[e].style.visibility = "hidden";
                }
            }
        }
    },
    displaySelectBoxes: function()
    {
        for (var i = 0; i < document.forms.length; i++) 
        {
            for (var e = 0; e < document.forms[i].length; e++) 
            {
                if (document.forms[i].elements[e].tagName == "SELECT") 
                {
                    document.forms[i].elements[e].style.visibility = "visible";
                }
            }
        }
    },
    addEvent: function(obj, evType, fn)
    {
        if (obj.addEventListener) 
        {
            obj.addEventListener(evType, fn, false);
            return true;
        }
        else 
            if (obj.attachEvent) 
            {
                var r = obj.attachEvent("on" + evType, fn);
                return r;
            }
            else 
            {
                return false;
            }
    },
    getViewportHeight: function()
    {
        if (window.innerHeight != window.undefined) 
            return window.innerHeight;
        if (document.compatMode == 'CSS1Compat') 
            return document.documentElement.clientHeight;
        if (document.body) 
            return document.body.clientHeight;
        return window.undefined;
    },
    getViewportWidth: function()
    {
        if (window.innerWidth != window.undefined) 
            return window.innerWidth;
        if (document.compatMode == 'CSS1Compat') 
            return document.documentElement.clientWidth;
        if (document.body) 
            return document.body.clientWidth;
        return window.undefined;
    },
    ResizeModal: function()
    {
        if (gPopupContainer == null) return;
        //gPopupMask.style.top = parseInt(gPopupMask.style.top)+'px';
        var width = 966;
        var height = Math.min(Submodal.getViewportHeight() - 10, 597);
        Submodal.centerPopWin(width, height);
		
        //gPopupContainer.style.width = 796 + "px";
        gPopupContainer.style.height = (height) + "px";
        //gPopFrame.style.width = Math.max(parseInt(gPopupContainer.offsetWidth, 10) - 4, 0) + "px";
        gPopFrame.style.height = (height) + "px";
    }
    
}

Submodal.addEvent(window, "load", Submodal.initPopUp);
Submodal.addEvent(window, "resize", Submodal.ResizeModal);
Submodal.addEvent(window, "scroll", Submodal.centerPopWin);

var gi = 0;
var gTabIndexes = new Array();
// Pre-defined list of tags we want to disable/enable tabbing into
var gTabbableTags = new Array("A", "BUTTON", "TEXTAREA", "INPUT", "IFRAME");

// If using Mozilla or Firefox, use Tab-key trap.
if (!document.all) 
{
    document.onkeypress = Submodal.keyDownHandler;
}
//INCLUDE submodal.js END

function dhtmlLoadScript(url)
{
	var e = document.createElement("script");
	e.src = url;
	e.type = "text/javascript";
	document.getElementsByTagName("body")[0].appendChild(e);
}

document.write('<scr'+'ipt type="text/javascript" src="http://res.profitroom.pl/channels/242/scripts/site_preload.js"></scr'+'ipt>');
Submodal.addEvent(window, "load", function() {
	dhtmlLoadScript('http://res.profitroom.pl/channels/242/scripts/site.js');
});

var ideaObjectsCollection = new Array();
var Booking = 
{
	OpenSite: function(site, params)
	{
    	var addURL = Booking.ToUrl(params);
		var upper = /upper=(temp|test|live)/.exec(window.location.href);
		if (upper != null)
		{
			addURL += '&upper=' + upper[1];
		}
		else if (false)
		{
			addURL += '&upper=';
		}
		addURL += '&url=' + escape(window.location.href);
    	Booking.FreezeSite();
		var h = Submodal.getViewportHeight()-50;
		var url = 'http://upper2.profitroom.pl/panel/{0}';
		Submodal.showPopWin(url.replace('{0}', site)+'?locale=&channel=242&height='+h+'&'+addURL, 965, 596, 'UPPER');
		
		if (typeof pageTracker!="undefined")
		{
			pageTracker._trackPageview('/panel-open');    
		}
		
		if (typeof _gaq !="undefined")
		{
			_gaq.push(['_trackPageview', '/panel-open']);			
		}
				
	},

	OpenVouchersSite: function(site, params)
	{
    	var addURL = Booking.ToUrl(params);
		var upper = /upper=(temp|test|live)/.exec(window.location.href);
		if (upper != null)
		{
			addURL += '&upper=' + upper[1];
		}
		else if (false)
		{
			addURL += '&upper=';
		}
		addURL += '&url=' + escape(window.location.href);
    	Booking.FreezeSite();
		var h = Submodal.getViewportHeight()-50;
		var url = 'http://upper2.profitroom.pl/vouchers/{0}';
		Submodal.showPopWin(url.replace('{0}', site)+'?locale=&channel=242&height='+h+'&'+addURL, 965, 596, 'UPPER');
		
		if (typeof pageTracker!="undefined")
		{
			pageTracker._trackPageview('/voucher-open');    
		}
				
	},
    
    FreezeSite: function()
    {
    	Booking.showObjects('hide');
    	try
        {
        	Booking.FreezeSiteLocal();
        }
        catch(e)
		{
        	//error
        }
    },
    
    RestoreSite: function()
    {
    	Booking.showObjects();
        try
        {
        	Booking.RestoreSiteLocal();
        }
        catch(e){
        	//error
        }
    },
	
    ToUrl: function(data)
    {
			if (typeof(data) == "string") return data;
			var url = "";
			for (var prop in data)
				url += (url.length>0?'&':'') + prop + '=' + data[prop];
			return url;
    },
	
    showObjects: function(sh)
	{
		if(sh=='hide')
		{
        	var childs;
            if(document.all)
				childs = document.all;
            else 
            	childs = document.getElementsByTagName("body")[0].getElementsByTagName("*");
			
			for (var i=0; i < childs.length; i++)
			{
				if(childs[i].tagName == 'OBJECT')
				{
					childs[i].style.visibility = 'hidden';					
					ideaObjectsCollection[ideaObjectsCollection.length] = childs[i]
					
				}	
			}
			for (var i = 0; i < document.embeds.length; i++)
			{
				 document.embeds[i].style.visibility = 'hidden';
				 ideaObjectsCollection[ideaObjectsCollection.length] = document.embeds[i];
			}
			return;
		}
		else
		{
			for (var i=0; i<ideaObjectsCollection.length; i++)
			{
				ideaObjectsCollection[i].style.visibility = 'visible';
			}			
		}	
	}
};
}
else
{
var Booking =
{
	OpenSite: function(site, params)
	{
		alert('chain inactive');
	}
};
}



if(!Idea)
	var Idea = {}
if(!Idea.Booking)
	Idea.Booking = {}

Idea.Booking.BookNowWrapper = function(config)
{
	if(!config.monthsNames)
		config.monthsNames = ['sty','lut','mar','kwi','maj','cze','lip','sie','wrz','paz','lis','gru']
	if(!config.daysNames)
		config.daysNames = ['nie','pon','wto','sro','czw','pia','sob']
	if(config.Checkin)
	{
		switch(config.Checkin.Mode)
		{
			case 'dropdowns':
				this.checkinDS = new Idea.DateSelector('dropdowns');
				this.checkinDS.dayDropdown = this.$(config.Checkin.DayID);
				this.checkinDS.yearMonthDropdown = this.$(config.Checkin.YearMonthID);
			break;
			case 'datepicker+dropdowns':
				this.checkinDS = new Idea.DateSelector('datepicker+dropdowns');
				this.checkinDS.dayDropdown = this.$(config.Checkin.DayID);
				this.checkinDS.yearMonthDropdown = this.$(config.Checkin.YearMonthID);
				this.checkinDS.datePickerID = config.Checkin.DatePickerID;
				this.checkinDS.datePickerOpener = this.$(config.Checkin.DatePickerOpenerID);
			break;
			case 'datepicker+txt':
				this.checkinDS = new Idea.DateSelector('datepicker+txt');
				this.checkinDS.textInput = this.$(config.Checkin.TextID);
				this.checkinDS.datePickerID = config.Checkin.DatePickerID;
				this.checkinDS.datePickerOpener = this.$(config.Checkin.DatePickerOpenerID);
			break;
		}
		this.checkinDS.monthsNames = config.monthsNames;
		this.checkinDS.daysNames = config.daysNames;
		this.checkinDS.todayText = config.todayText;
		if(config.yearFormat)
			this.checkinDS.yearFormat = config.yearFormat;
		this.checkinDS.init();
		this.checkinMode = config.Checkin.Mode;
	}
	if(config.Checkout)
	{
		switch(config.Checkout.Mode)
		{
			case 'dropdowns':
				this.checkoutDS = new Idea.DateSelector('dropdowns');
				this.checkoutDS.dayDropdown = this.$(config.Checkout.DayID);
				this.checkoutDS.yearMonthDropdown = this.$(config.Checkout.YearMonthID);
			break;
			case 'datepicker+dropdowns':
				this.checkoutDS = new Idea.DateSelector('datepicker+dropdowns');
				this.checkoutDS.dayDropdown = this.$(config.Checkout.DayID);
				this.checkoutDS.yearMonthDropdown = this.$(config.Checkout.YearMonthID);
				this.checkoutDS.datePickerID = config.Checkout.DatePickerID;
				this.checkoutDS.datePickerOpener = this.$(config.Checkout.DatePickerOpenerID);
			break;
			case 'datepicker+txt':
				this.checkoutDS = new Idea.DateSelector('datepicker+txt');
				this.checkoutDS.textInput = this.$(config.Checkout.TextID);
				this.checkoutDS.datePickerID = config.Checkout.DatePickerID;
				this.checkoutDS.datePickerOpener = this.$(config.Checkout.DatePickerOpenerID);
			break;
		}
		this.checkoutDS.monthsNames = config.monthsNames;
		this.checkoutDS.daysNames = config.daysNames;
		this.checkoutDS.todayText = config.todayText;
		if(config.yearFormat)
			this.checkoutDS.yearFormat = config.yearFormat;
		this.checkoutDS.init();
		this.checkoutMode = config.Checkout.Mode;
	}
	if (config.RoomCategory)
	{
		this.RoomCategory = this.$(config.RoomCategory.ID);
	}
	if(config.Checkin&&config.Nights)
	{
		this.nights = this.$(config.Nights.NightsID);
		this.mode = 'checkInNights';
	}
	if(config.Checkin&&config.Checkout)
	{
		this.mode = 'checkInOut';
		this.checkinDS.setSynchronized(this.checkoutDS);
	}
	else 
		this.mode = 'mixed';
}

Idea.Booking.BookNowWrapper.prototype = 
{
	getURLParams:function()
	{
		var params = '';
		if (this.RoomCategory)
		{
			params += '&RoomCategoryID=' + this.RoomCategory.options[this.RoomCategory.selectedIndex].value; 
		}
		if(this.mode == 'checkInOut')
		{
			var checkinDate = this.checkinDS.getURLDate();
			var checkoutDate = this.checkoutDS.getURLDate();
			params += '&Checkin='+checkinDate+'&Checkout='+checkoutDate;
		}
		else if(this.mode == 'checkInNights')
		{
			var checkinDate = this.checkinDS.getURLDate();
			var nights = this.nights.options[this.nights.selectedIndex].value;
			params += '&Checkin='+checkinDate+'&Nights='+nights;
		}
		else 
		{
			try{
				var checkinDate = this.checkinDS.getURLDate();
				params += '&Checkin='+checkinDate+'';
			}catch(e){}
			try{
				var checkoutDate = this.checkoutDS.getURLDate();
				params += '&Checkout='+checkoutDate;
			}catch(e){}
			try{
				var nights = this.nights.options[this.nights.selectedIndex].value;
				params += '&Nights='+nights;
			}catch(e){}
		}
		return params;
	},
	$:function(id)
	{
		return document.getElementById(id);
	}
}// JavaScript Document

if(!Idea)
	var Idea = {}
if(!Idea.Booking)
	Idea.Booking = {}

Idea.DateSelector = function(type)
{
	this.currentDate = new Date();
	this.dayDropdown = null;
	this.yearMonthDropdown = null;
	this.textInput = null;
	this.datePicker = null;
	this.datePickerID = null;
	this.datePickerOpener = null;
	this.yearFormat = 'yyyy';
	this.monthsNames = ['sty','lut','mar','kwi','maj','cze','lip','sie','wrz','paz','lis','gru'];
	this.daysNames = ['nie','pon','wto','sro','czw','pia','sob'];
	this.todayText = 'Dzisiaj';
	this.daysNamesAvailable = true;
	this.MonthsNamesAvailable = true;
	this.synchronizedChildren = false;
	this.synchronizedParent = false;
	this.dateType = type;				// dropdowns / datepicker+dropdowns / datepicker+txt 
}

Idea.DateSelector.prototype = { 
	init:function()
	{
		this.setDate(this.currentDate);
		this.attachEvents();
	},
	renderDays:function(startDate)
	{
		var curDate = new Date(startDate);
		var daysTab = new Array();
		var daysIndexTab = new Array();
		for(var i=curDate.getDate(); i<=this.chckDaysInMonth(curDate.getFullYear(),curDate.getMonth()); i++)
		{
			if(i<10)
				index = 0;
		    else 
				index = '';
			daysTab.push(index+''+i);
			curDate.setDate(i);
			daysIndexTab.push(curDate.getDay());	
		}
		return [daysTab,daysIndexTab];
	},
	populateMonths:function(year,startIndex,lastIndex)
	{
		var monthTab = new Array();
		if(!lastIndex)
			var lastIndex = 11;
		for(var i=startIndex; i<=lastIndex; i++)
		{			
			if(i<9)
				index = 0;
		    else 
				index = '';
			monthTab.push(year+'-'+index+''+(i+1));
		}
		return monthTab;
	},
	renderYearMonths:function(startDate)
	{
		var parseDate = new Date(startDate);
		var monthTab = this.populateMonths(this.formatYear(parseDate.getFullYear()),parseDate.getMonth());
		if(monthTab.length<12)
		{
			parseDate.setFullYear((parseDate.getFullYear()+1));
			var monthTab1 = this.populateMonths(this.formatYear(parseDate.getFullYear()),0,(11-monthTab.length));
			monthTab = (monthTab+','+monthTab1).split(',');
		}
		return monthTab;
	},
	clearDropdown:function(dropdown)
	{
		for(var i=0; i<dropdown.options.length; i++)
			{
				dropdown.remove(i);
			}
	},
	formatYear:function(fullYear)
	{
		var yr = fullYear.toString();
		if(this.yearFormat.toLowerCase() == 'yy')
		{
			
			return yr.substring(2,4)
		}
		if(this.yearFormat.toLowerCase() == 'yyyy')
		{
			return yr;
		}
	},	
	populateDateDropDown:function(date)
	{
		this.clearDropdown(this.dayDropdown);
		var d = this.renderDays(date);
		var days = d[0];	
		var daysIndex = d[1];
		for (var i=0; i<days.length; i++)
		{
			this.dayDropdown.options[i] = new Option();
			this.dayDropdown.options[i].value = days[i];
			if(this.daysNamesAvailable)
				this.dayDropdown.options[i].text = this.translateDays(days[i],daysIndex[i]);
			else
				this.dayDropdown.options[i].text = days[i];
		}
	},
	populateDropdowns:function(date)
	{
		this.populateDateDropDown(date);
		var monthsYears = this.renderYearMonths(date);
		for (var i=0; i<monthsYears.length; i++)
		{
			this.yearMonthDropdown.options[i] = new Option();
			this.yearMonthDropdown.options[i].value = monthsYears[i];
			if(this.MonthsNamesAvailable)
				this.yearMonthDropdown.options[i].text = this.translateMonths(monthsYears[i])
			else
				this.yearMonthDropdown.options[i].text = monthsYears[i];
		}
	},
	populateInput:function(date)
	{
		var date = new Date(date);
		var m = date.getMonth()+1;
		var d = date.getDate();
		if(m<10)
			m = '0'+m;
		if(d<10)
			d = '0'+d;
		
		this.textInput.currentDate = date;
		if(this.MonthsNamesAvailable)
		{
			this.textInput.value = d+' '+this.translateMonths(this.formatYear(date.getFullYear())+'-'+m);
		}
		else
			this.textInput.value = this.formatYear(date.getFullYear())+'-'+m+'-'+d;
	},
	translateDays:function(day,index)
	{
		return day+' '+this.daysNames[index];
	},
	translateMonths:function(date)
	{
		var year = date.split('-')[0];
		var month = date.split('-')[1];
		return this.monthsNames[(parseFloat(month)-1)]+' '+year;
	},
	zeroDate:function(date)
	{
		return date.setDate(1);
	},
	createDatePicker:function()
	{
		this.datePicker = new CalendarPopup(this.datePickerID);
		this.datePicker.setTodayText(this.todayText);
		this.datePicker.setMonthNames(this.monthsNames);
		this.datePicker.setDayHeaders(this.daysNames);
		var $this = this;
		this.datePickerOpener.onclick = function()
			{
				var didi = $this.formatDate($this.currentDate);
				$this.datePicker.select($this,this.name,'yyyy-MM-dd',didi); return false;
			}
	},
	attachEvents:function()
	{
		var $this = this;
		if(this.dateType == 'dropdowns' || this.dateType == 'datepicker+dropdowns')
		{
			this.yearMonthDropdown.onchange = function()
			{
				var v = this.options[this.selectedIndex].value.split('-');
				if(v[0].length < 4)
					v[0] = '20'+v[0];
				var date = new Date(v[0],(parseFloat(v[1])-1),1);
				$this.populateDateDropDown(date);
				$this.upadteCurrentDate();
				$this.synchronize();
			}
			this.dayDropdown.onchange = function()
			{
				$this.upadteCurrentDate();
				$this.synchronize();
			}
			if(this.datePickerID && this.datePickerOpener)
			{
				this.createDatePicker();
			}
		}
		if(this.dateType == 'datepicker+txt')
		{
			this.textInput.onchange = function()
			{
				$this.upadteCurrentDate();
				if($this.synchronizedObj)
					$this.synchronize()
			}
			if(this.datePickerID && this.datePickerOpener)
			{
				this.createDatePicker();
				this.textInput.onclick = function()
				{
					var didi = $this.formatDate($this.currentDate);
					$this.datePicker.select($this,$this.datePickerOpener.name,'yyyy-MM-dd',didi); return false;
				}
			}
		}
	},
	upadteCurrentDate:function(){
		this.currentDate = this.getDate();
	},
	getDate:function()
	{
		var date = this.getURLDate().split('-');	
		return new Date(date[0],(parseFloat(date[1])-1),date[2])
	},
	getURLDate:function()
	{
		switch(this.dateType)
		{
			case 'dropdowns':
				var d = this.dayDropdown.options[this.dayDropdown.selectedIndex].value;
				var my = this.yearMonthDropdown[this.yearMonthDropdown.selectedIndex].value.split('-');
				if(my[0].length < 3)
					my[0] = '20'+my[0];
				return my[0]+'-'+my[1]+'-'+d;
			break;
			case 'datepicker+dropdowns':
				var d = this.dayDropdown.options[this.dayDropdown.selectedIndex].value;
				var my = this.yearMonthDropdown[this.yearMonthDropdown.selectedIndex].value.split('-');
				if(my[0].length < 3)
					my[0] = '20'+my[0];
				return my[0]+'-'+my[1]+'-'+d;
			break;
			case 'datepicker+txt':
				var date = this.textInput.currentDate;
				var m = date.getMonth()+1;
				var d = date.getDate();
				if(m<10)
					m = '0'+m;
				if(d<10)
					d = '0'+d;
				return date.getFullYear()+'-'+m+'-'+d;
			break;
		}
	},
	setDate:function(date)
	{
		switch(this.dateType)
		{
			case 'dropdowns':
				this.populateDropdowns(date);
			break;
			case 'datepicker+dropdowns':
				this.populateDropdowns(date);
			break;
			case 'datepicker+txt':
				this.populateInput(date);
			break;
		}
		this.currentDate = date;
	},
	setSynchronized:function(selector)
	{
		this.synchronizedChildren = selector;
		this.synchronizedChildren.synchronizedParent = this;
		this.synchronize();
	},
	synchronize:function()
	{
		if(this.synchronizedChildren)
			{
				var syncDate = new Date(this.currentDate)
				var syncChildren = this.synchronizedChildren;
				var dd = (this.currentDate.getDate()+1);
				syncChildren.setDate(syncDate.setDate(dd));
				if(syncChildren.datePicker!=null)
				{
					var d = this.formatDate(syncDate);
					syncChildren.datePicker.addDisabledDates(d);
				}
					
			}
		if(this.synchronizedParent)
		{
			var sp = this.synchronizedParent;
			if(this.currentDate<=sp.currentDate)
			{
				var sd = new Date(sp.currentDate);
				if(this.datePicker!=null)
				{
					var d = this.formatDate(sd);
					this.datePicker.addDisabledDates(d);
				}
					
				this.setDate(sd.setDate(sp.currentDate.getDate()+1))
			}
		}
	},
	setDPDate:function(date)
	{
		this.setDate(date);
		this.synchronize();	
	},
	formatDate: function(date,splitter)
	{
		date = new Date(date);
		d = date.getDate();
		m = date.getMonth()+1;
		y = date.getFullYear();
		var sp = '-';
		if(splitter)
		{
			sp = splitter;
		}
		if(d<10)
			d='0'+d;
		if(m<10)
			m='0'+m;
		var formatedDate = y+sp+m+sp+d;
		return formatedDate;
	},
	chckDaysInMonth:function(year,month){
		var intMonth = month;
		var intYear = year;
		
		var dteMonth = new Date(intYear,intMonth);//
		var intDaysInMonth = 28;
		var blnDateFound = false;
		
		while (!blnDateFound)
		{
			dteMonth.setDate(intDaysInMonth+1);
			var intNewMonth = dteMonth.getMonth();
			
			if (intNewMonth != intMonth)
			  blnDateFound = true;
			else
			  intDaysInMonth++;
		}
		return intDaysInMonth;
	}
}

//OUTPUT FORM START
document.write("<div class=\"pf_booknow_holder\"> <div class=\"pf_booknow_inner\"> <!--<form id=\"pf_booknow_form\" action=\"#\">--> <div id=\"pf_reservation\">Rezerwacja online</div> <div id=\"pf_hotel\"> <label for=\"pf_hotel_sel\">Miasto:</label> <select name=\"RegionID\" id=\"SiteSearchRegionID\" onchange=\"LoadRegionSites(this)\"> <option value=\"\">wybierz</option> <option value=\"104\">Gdynia</option><option value=\"105\">Hel</option><option value=\"106\">Kraków</option><option value=\"107\">Leśna</option><option value=\"108\">Lublin</option><option value=\"109\">Łódź</option><option value=\"110\">Malbork</option><option value=\"111\">Olsztyn</option><option value=\"112\">Poznań</option><option value=\"113\">Radom</option><option value=\"114\">Rzeszów</option><option value=\"115\">Szczecin</option><option value=\"117\">Toruń</option><option value=\"118\">Warszawa</option><option value=\"120\">Wejherowo</option><option value=\"121\">Wrocław</option> </select> </div> <div id=\"pf_hotel\"> <label for=\"pf_hotel_sel\">Hotel:</label> <select name=\"SiteID\" id=\"SiteSearchSiteID\"> <option value=\"\">wybierz</option> <option value=\"1269\">Hotel Belwederski</option><option value=\"1270\">Hotel Bliza</option><option value=\"1272\">Hotel Cassubia</option><option value=\"1273\">Hotel Dedal</option><option value=\"1275\">Hotel Hetman</option><option value=\"1276\">Hotel Huzar</option><option value=\"1277\">Hotel Ikar</option><option value=\"1278\">Hotel Iskra</option><option value=\"1279\">Hotel Kapitan</option><option value=\"1280\">Hotel Kopernik</option><option value=\"1281\">Hotel Mazowiecki</option><option value=\"1282\">Hotel Na Skarpie</option><option value=\"1283\">Hotel Neptun</option><option value=\"1285\">Hotel Reymont</option><option value=\"1286\">Hotel Royal</option><option value=\"1274\">Hotel Rycerski</option><option value=\"1267\">Hotel Wieniawa</option><option value=\"1266\">Zamek Czocha</option> </select> </div> <div class=\"pf_checkin\"> <label for='checkin_d'>Przyjazd:</label> <select id=\"checkin_d\"> <option>&nbsp;</option> </select> <select id=\"checkin_ym\"> <option>&nbsp;</option> </select> </div> <div class=\"pf_nights\"> <label for='nights'>Długość pobytu:</label> <select id='nights' name=\"nights\"> <option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option><option value='13'>13</option><option value='14'>14</option><option value='15'>15</option><option value='16'>16</option><option value='17'>17</option><option value='18'>18</option><option value='19'>19</option><option value='20'>20</option><option value='21'>21</option><option value='22'>22</option><option value='23'>23</option><option value='24'>24</option><option value='25'>25</option><option value='26'>26</option><option value='27'>27</option><option value='28'>28</option><option value='29'>29</option><option value='30'>30</option> </select> </div> <div class=\"pf_buttons\"> <input type='button' value='Rezerwuj' onclick='pf_booknow_form_booknow_click(this.form);return false;' /> </div> <script language=\"javascript\" type=\"text/javascript\"> var RegionSites = {}; if (!RegionSites[118]) RegionSites[118] = []; RegionSites[118].push({SiteID:1269, SiteName:'Hotel Belwederski', RegionID:118});if (!RegionSites[120]) RegionSites[120] = []; RegionSites[120].push({SiteID:1270, SiteName:'Hotel Bliza', RegionID:120});if (!RegionSites[105]) RegionSites[105] = []; RegionSites[105].push({SiteID:1272, SiteName:'Hotel Cassubia', RegionID:105});if (!RegionSites[110]) RegionSites[110] = []; RegionSites[110].push({SiteID:1273, SiteName:'Hotel Dedal', RegionID:110});if (!RegionSites[114]) RegionSites[114] = []; RegionSites[114].push({SiteID:1275, SiteName:'Hotel Hetman', RegionID:114});if (!RegionSites[108]) RegionSites[108] = []; RegionSites[108].push({SiteID:1276, SiteName:'Hotel Huzar', RegionID:108});if (!RegionSites[112]) RegionSites[112] = []; RegionSites[112].push({SiteID:1277, SiteName:'Hotel Ikar', RegionID:112});if (!RegionSites[113]) RegionSites[113] = []; RegionSites[113].push({SiteID:1278, SiteName:'Hotel Iskra', RegionID:113});if (!RegionSites[115]) RegionSites[115] = []; RegionSites[115].push({SiteID:1279, SiteName:'Hotel Kapitan', RegionID:115});if (!RegionSites[117]) RegionSites[117] = []; RegionSites[117].push({SiteID:1280, SiteName:'Hotel Kopernik', RegionID:117});if (!RegionSites[118]) RegionSites[118] = []; RegionSites[118].push({SiteID:1281, SiteName:'Hotel Mazowiecki', RegionID:118});if (!RegionSites[111]) RegionSites[111] = []; RegionSites[111].push({SiteID:1282, SiteName:'Hotel Na Skarpie', RegionID:111});if (!RegionSites[104]) RegionSites[104] = []; RegionSites[104].push({SiteID:1283, SiteName:'Hotel Neptun', RegionID:104});if (!RegionSites[109]) RegionSites[109] = []; RegionSites[109].push({SiteID:1285, SiteName:'Hotel Reymont', RegionID:109});if (!RegionSites[106]) RegionSites[106] = []; RegionSites[106].push({SiteID:1286, SiteName:'Hotel Royal', RegionID:106});if (!RegionSites[115]) RegionSites[115] = []; RegionSites[115].push({SiteID:1274, SiteName:'Hotel Rycerski', RegionID:115});if (!RegionSites[121]) RegionSites[121] = []; RegionSites[121].push({SiteID:1267, SiteName:'Hotel Wieniawa', RegionID:121});if (!RegionSites[107]) RegionSites[107] = []; RegionSites[107].push({SiteID:1266, SiteName:'Zamek Czocha', RegionID:107}); function LoadRegionSites(select) { var RegionID = select.value; var i = 0; var SelectSite = document.getElementById('SiteSearchSiteID'); SelectSite.options.length = 0; for (var key in RegionSites) { if (i == 0) { var opt = new Option(); opt.text = 'wybierz'; opt.value = ''; SelectSite.options[i++] = opt; } if (key == RegionID || !RegionID) { for (var j in RegionSites[key]) { var opt = new Option(); opt.text = RegionSites[key][j].SiteName; opt.value = RegionSites[key][j].SiteID; SelectSite.options[i++] = opt; } } } } function pf_booknow_form_booknow_click(form) { if (form.SiteID.selectedIndex == 0) { alert ('Wybierz hotel.'); retutn; } var SiteID = form.SiteID.options[form.SiteID.selectedIndex].value; var params = form.bookNow.getURLParams(); params += \"&SharedStyle=wam\"; Booking.OpenSite(SiteID, params); } document.forms[0].bookNow = new Idea.Booking.BookNowWrapper({ Checkin: { Mode:'dropdowns', YearMonthID: 'checkin_ym', DayID: 'checkin_d' }, Nights: { NightsID: 'nights' }, monthsNames: [\"sty\",\"lut\",\"mar\",\"kwi\",\"maj\",\"cze\",\"lip\",\"sie\",\"wrz\",\"pa\u017a\",\"lis\",\"gru\"], daysNames: [\"ndz.\",\"pn.\",\"wt.\",\"\u015br.\",\"czw.\",\"pt.\",\"sob.\"] }); document.forms[0].bookNow.checkinDS.setDate(new Date(new Date().valueOf()+24*60*60*1000)); </script> <!--</form>--> </div></div> ");//OUTPUT FORM END
