function showRoomDetail() {
	document.getElementById("RoomDetail").style.visibility = 'visible';

	
}

function hideRoomDetail() {
	document.getElementById("RoomDetail").style.visibility = 'hidden';
	
}

function changeIMGnxt(divBR) {

	var calcNewLeft = parseInt(document.getElementById('galerieThemeBegrenzung').style.left) - 100;

	var negLeft = calcNewLeft * (-1);
	var stopDiv = parseInt(divBR) - 600;
	if (negLeft > stopDiv) {
		calcNewLeft = stopDiv * (-1);
	}
	document.getElementById('galerieThemeBegrenzung').style.left = calcNewLeft + 'px';
	
}

function changeIMGprev() {

	var calcNewLeft = parseInt(document.getElementById('galerieThemeBegrenzung').style.left) + 100;

	if (calcNewLeft > 0) {
		calcNewLeft = 0;
	}
	document.getElementById('galerieThemeBegrenzung').style.left = calcNewLeft + 'px';
	
}

function changePricenxt(divBR) {

	var calcNewLeft = parseInt(document.getElementById('galeriePriceBegrenzung').style.left) - 100;

	var negLeft = calcNewLeft * (-1);
	var stopDiv = parseInt(divBR) - 600;
	if (negLeft > stopDiv) {
		calcNewLeft = stopDiv * (-1);
	}
	document.getElementById('galeriePriceBegrenzung').style.left = calcNewLeft + 'px';
	document.getElementById('galeriePriceBegrenzungBottom').style.left = calcNewLeft + 'px';
	
}

function changePriceprev() {

	var calcNewLeft = parseInt(document.getElementById('galeriePriceBegrenzung').style.left) + 100;

	if (calcNewLeft > 0) {
		calcNewLeft = 0;
	}
	document.getElementById('galeriePriceBegrenzung').style.left = calcNewLeft + 'px';
	document.getElementById('galeriePriceBegrenzungBottom').style.left = calcNewLeft + 'px';
	
}

// Tigra Calendar v5.1 (10/04/2011)
// http://www.softcomplex.com/products/tigra_calendar/
// License: Public Domain... You're welcome.

// default settins - this structure can be moved in separate file in multilangual applications
var A_TCALCONF = {
	'cssprefix'  : 'tcal',
	'months'     : ['J&auml;nner', 'Februar', 'M&auml;rz', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
	'weekdays'   : ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
	'longwdays'  : ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
	'yearscroll' : true, // show year scroller
	'weekstart'  : 0, // first day of week: 0-Su or 1-Mo
	'prevyear'   : 'Voriges Jahr',
	'nextyear'   : 'N&auml;chstes Jahr',
	'prevmonth'  : 'Voriges Monat',
	'nextmonth'  : 'N&auml;chstes Monat',
	'format'     : 'd/m/Y' // 'd-m-Y', Y-m-d', 'l, F jS Y'
};

var A_TCALTOKENS = [
	 // A full numeric representation of a year, 4 digits
	{'t': 'Y', 'r': '19\\d{2}|20\\d{2}', 'p': function (d_date, n_value) { d_date.setFullYear(Number(n_value)); return d_date; }, 'g': function (d_date) { var n_year = d_date.getFullYear(); return n_year; }},
	 // Numeric representation of a month, with leading zeros
	{'t': 'm', 'r': '0?[1-9]|1[0-2]', 'p': function (d_date, n_value) { d_date.setMonth(Number(n_value) - 1); return d_date; }, 'g': function (d_date) { var n_month = d_date.getMonth() + 1; return (n_month < 10 ? '0' : '') + n_month; }},
	 // A full textual representation of a month, such as January or March
	{'t': 'F', 'r': A_TCALCONF.months.join('|'), 'p': function (d_date, s_value) { for (var m = 0; m < 12; m++) if (A_TCALCONF.months[m] == s_value) { d_date.setMonth(m); return d_date; }}, 'g': function (d_date) { return A_TCALCONF.months[d_date.getMonth()]; }},
	 // Day of the month, 2 digits with leading zeros
	{'t': 'd', 'r': '0?[1-9]|[12][0-9]|3[01]', 'p': function (d_date, n_value) { d_date.setDate(Number(n_value)); if (d_date.getDate() != n_value) d_date.setDate(0); return d_date; }, 'g': function (d_date) { var n_date = d_date.getDate(); return (n_date < 10 ? '0' : '') + n_date; }},
	// Day of the month without leading zeros
	{'t': 'j', 'r': '0?[1-9]|[12][0-9]|3[01]', 'p': function (d_date, n_value) { d_date.setDate(Number(n_value)); if (d_date.getDate() != n_value) d_date.setDate(0); return d_date; }, 'g': function (d_date) { var n_date = d_date.getDate(); return n_date; }},
	 // A full textual representation of the day of the week
	{'t': 'l', 'r': A_TCALCONF.longwdays.join('|'), 'p': function (d_date, s_value) { return d_date; }, 'g': function (d_date) { return A_TCALCONF.longwdays[d_date.getDay()]; }},
	// English ordinal suffix for the day of the month, 2 characters
	{'t': 'S', 'r': 'st|nd|rd|th', 'p': function (d_date, s_value) { return d_date; }, 'g': function (d_date) { var n_date = d_date.getDate(); if (n_date % 10 == 1 && n_date != 11) return 'st'; if (n_date % 10 == 2 && n_date != 12) return 'nd'; if (n_date % 10 == 3 && n_date != 13) return 'rd'; return 'th'; }}
	
];

function f_tcalGetHTML (d_date) {

	var e_input = f_tcalGetInputs(true);
	if (!e_input) return;

	var s_pfx = A_TCALCONF.cssprefix,
		s_format = A_TCALCONF.format;

	// today from config or client date
	var d_today = f_tcalParseDate(A_TCALCONF.today, A_TCALCONF.format);
	if (!d_today)
		d_today = f_tcalResetTime(new Date());

	// selected date from input or config or today 
	var d_selected = f_tcalParseDate(e_input.value, s_format);
	if (!d_selected)
		d_selected = f_tcalParseDate(A_TCALCONF.selected, A_TCALCONF.format);
	if (!d_selected)
		d_selected = new Date(d_today);
	
	// show calendar for passed or selected date
	d_date = d_date ? f_tcalResetTime(d_date) : new Date(d_selected);

	var d_firstDay = new Date(d_date);
	d_firstDay.setDate(1);
	d_firstDay.setDate(1 - (7 + d_firstDay.getDay() - A_TCALCONF.weekstart) % 7);

	var a_class, s_html = '<table id="' + s_pfx + 'Controls"><tbody><tr>'
		+ (A_TCALCONF.yearscroll ? '<td id="' + s_pfx + 'PrevYear" ' + f_tcalRelDate(d_date, -1, 'y') + ' title="' + A_TCALCONF.prevyear + '"></td>' : '')
		+ '<td id="' + s_pfx + 'PrevMonth"' + f_tcalRelDate(d_date, -1) + ' title="' + A_TCALCONF.prevmonth + '"></td><th>'
		+ A_TCALCONF.months[d_date.getMonth()] + ' ' + d_date.getFullYear()
		+ '</th><td id="' + s_pfx + 'NextMonth"' + f_tcalRelDate(d_date, 1) + ' title="' + A_TCALCONF.nextmonth + '"></td>'
		+ (A_TCALCONF.yearscroll ? '<td id="' + s_pfx + 'NextYear"' + f_tcalRelDate(d_date, 1, 'y') + ' title="' + A_TCALCONF.nextyear + '"></td>' : '')
		+ '</tr></tbody></table><table id="' + s_pfx + 'Grid"><tbody><tr>';

	// print weekdays titles
	for (var i = 0; i < 7; i++)
		s_html += '<th>' + A_TCALCONF.weekdays[(A_TCALCONF.weekstart + i) % 7] + '</th>';
	s_html += '</tr>' ;

	// print calendar table
	var n_date, n_month, d_current = new Date(d_firstDay);
	while (d_current.getMonth() == d_date.getMonth() ||
		d_current.getMonth() == d_firstDay.getMonth()) {

		s_html +='<tr>';
		for (var n_wday = 0; n_wday < 7; n_wday++) {

			a_class = [];
			n_date  = d_current.getDate();
			n_month = d_current.getMonth();

			if (d_current.getMonth() != d_date.getMonth())
				a_class[a_class.length] = s_pfx + 'OtherMonth';
			if (d_current.getDay() == 0 || d_current.getDay() == 6)
				a_class[a_class.length] = s_pfx + 'Weekend';
			if (d_current.valueOf() == d_today.valueOf())
				a_class[a_class.length] = s_pfx + 'Today';
			if (d_current.valueOf() == d_selected.valueOf())
				a_class[a_class.length] = s_pfx + 'Selected';

			s_html += '<td' + f_tcalRelDate(d_current) + (a_class.length ? ' class="' + a_class.join(' ') + '">' : '>') + n_date + '</td>';
			d_current.setDate(++n_date);
		}
		s_html +='</tr>';
	}
	s_html +='</tbody></table>';

	return s_html;
}

function f_tcalRelDate (d_date, d_diff, s_units) {

	s_units = (s_units == 'y' ? 'FullYear' : 'Month');
	var d_result = new Date(d_date);
	if (d_diff) {
		d_result['set' + s_units](d_date['get' + s_units]() + d_diff);
		if (d_result.getDate() != d_date.getDate())
			d_result.setDate(0);
	}
	return ' onclick="f_tcalUpdate(' + d_result.valueOf() + (d_diff ? ',1' : '') + ')"';
}

function f_tcalResetTime (d_date) {
	d_date.setMilliseconds(0);
	d_date.setSeconds(0);
	d_date.setMinutes(0);
	d_date.setHours(12);
	return d_date;
}

// closes calendar and returns all inputs to default state
function f_tcalCancel () {
	
	var s_pfx = A_TCALCONF.cssprefix;
	var e_cal = document.getElementById(s_pfx);
	if (e_cal)
		e_cal.style.visibility = '';
	var a_inputs = f_tcalGetInputs();
	for (var n = 0; n < a_inputs.length; n++)
		f_tcalRemoveClass(a_inputs[n], s_pfx + 'Active');
}

function f_tcalUpdate (n_date, b_keepOpen) {

	var e_input = f_tcalGetInputs(true);
	if (!e_input) return;
	
	var d_date = new Date(n_date);
	var s_pfx = A_TCALCONF.cssprefix;

	if (b_keepOpen) {
		var e_cal = document.getElementById(s_pfx);
		if (!e_cal || e_cal.style.visibility != 'visible') return;
		e_cal.innerHTML = f_tcalGetHTML(d_date, e_input);
		e_cal.onselectstart = function () { return false; };
	}
	else {
		e_input.value = f_tcalGenerateDate(d_date, A_TCALCONF.format);
		f_tcalCancel();
	}
}

function f_tcalOnClick () {

	// see if already opened
	var s_pfx = A_TCALCONF.cssprefix;
	var s_activeClass = s_pfx + 'Active';
	var b_close = f_tcalHasClass(this, s_activeClass);

	// close all clalendars
	f_tcalCancel();
	if (b_close) return;

	// get position of input
	f_tcalAddClass(this, s_activeClass);
	
	var n_left = f_getPosition (this, 'Left'),
		n_top  = f_getPosition (this, 'Top') + this.offsetHeight;

	var e_cal = document.getElementById(s_pfx);
	if (!e_cal) {
		e_cal = document.createElement('div');
		e_cal.id = s_pfx;
		document.getElementsByTagName("body").item(0).appendChild(e_cal);
	}
	e_cal.innerHTML = f_tcalGetHTML(null);
	e_cal.style.top = n_top + 'px';
	e_cal.style.left = (n_left + this.offsetWidth - e_cal.offsetWidth) + 'px';
	e_cal.style.visibility = 'visible';
}

function f_tcalParseDate (s_date, s_format) {

	if (!s_date) return;

	var s_char, s_regexp = '^', a_tokens = {}, a_options, n_token = 0;
	for (var n = 0; n < s_format.length; n++) {
		s_char = s_format.charAt(n);
		if (A_TCALTOKENS_IDX[s_char]) {
			a_tokens[s_char] = ++n_token;
			s_regexp += '(' + A_TCALTOKENS_IDX[s_char].r + ')';
		}
		else if (s_char == ' ')
			s_regexp += '\\s';
		else
			s_regexp += (s_char.match(/[\w\d]/) ? '' : '\\') + s_char;
	}
	var r_date = new RegExp(s_regexp + '$');
	if (!s_date.match(r_date)) return;
	
	var s_val, d_date = f_tcalResetTime(new Date());
	d_date.setDate(1);

	for (n = 0; n < A_TCALTOKENS.length; n++) {
		s_char = A_TCALTOKENS[n].t;
		if (!a_tokens[s_char])
			continue;
		s_val = eval('RegExp.$' + a_tokens[s_char]);
		d_date = A_TCALTOKENS[n].p(d_date, s_val);
	}
	
	return d_date;
}

function f_tcalGenerateDate (d_date, s_format) {
	
	var s_char, s_date = '';
	for (var n = 0; n < s_format.length; n++) {
		s_char = s_format.charAt(n);
		s_date += A_TCALTOKENS_IDX[s_char] ? A_TCALTOKENS_IDX[s_char].g(d_date) : s_char;
	}
	return s_date;
}

function f_tcalGetInputs (b_active) {

	var a_inputs = document.getElementsByTagName('input'),
		e_input, s_rel, a_result = [];

	for (var n = 0; n < a_inputs.length; n++) {

		e_input = a_inputs[n];
		if (!e_input.type || e_input.type != 'text')
			continue;

		if (!f_tcalHasClass(e_input, 'tcal'))
			continue;

		if (b_active && f_tcalHasClass(e_input, A_TCALCONF.cssprefix + 'Active'))
			return e_input;

		a_result[a_result.length] = e_input;
	}
	return b_active ? null : a_result;
}

function f_tcalHasClass (e_elem, s_class) {
	var s_classes = e_elem.className;
	if (!s_classes)
		return false;
	var a_classes = s_classes.split(' ');
	for (var n = 0; n < a_classes.length; n++)
		if (a_classes[n] == s_class)
			return true;
	return false;
}

function f_tcalAddClass (e_elem, s_class) {
	if (f_tcalHasClass (e_elem, s_class))
		return;

	var s_classes = e_elem.className;
	e_elem.className = (s_classes ? s_classes + ' ' : '') + s_class;
}

function f_tcalRemoveClass (e_elem, s_class) {
	var s_classes = e_elem.className;
	if (!s_classes || s_classes.indexOf(s_class) == -1)
		return false;

	var a_classes = s_classes.split(' '),
		a_newClasses = [];

	for (var n = 0; n < a_classes.length; n++) {
		if (a_classes[n] == s_class)
			continue;
		a_newClasses[a_newClasses.length] = a_classes[n];
	}
	e_elem.className = a_newClasses.join(' ');
	return true;
}

function f_getPosition (e_elemRef, s_coord) {
	var n_pos = 0, n_offset,
		e_elem = e_elemRef;

	while (e_elem) {
		n_offset = e_elem["offset" + s_coord];
		n_pos += n_offset;
		e_elem = e_elem.offsetParent;
	}

	e_elem = e_elemRef;
	while (e_elem != document.body) {
		n_offset = e_elem["scroll" + s_coord];
		if (n_offset && e_elem.style.overflow == 'scroll')
			n_pos -= n_offset;
		e_elem = e_elem.parentNode;
	}
	return n_pos;
}

function f_tcalInit () {
	
	if (!document.getElementsByTagName)
		return;

	var e_input, a_inputs = f_tcalGetInputs();
	for (var n = 0; n < a_inputs.length; n++) {
		e_input = a_inputs[n];
		e_input.onclick = f_tcalOnClick;
		f_tcalAddClass(e_input, A_TCALCONF.cssprefix + 'Input');
	}
	
	window.A_TCALTOKENS_IDX = {};
	for (n = 0; n < A_TCALTOKENS.length; n++)
		A_TCALTOKENS_IDX[A_TCALTOKENS[n].t] = A_TCALTOKENS[n];
}

function f_tcalAddOnload (f_func) {
	if (document.addEventListener) {
		window.addEventListener('load', f_func, false);
	}
	else if (window.attachEvent) {
		window.attachEvent('onload', f_func);
	}
	else {
		var f_onLoad = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = f_func;
		}
		else {
			window.onload = function() {
				f_onLoad();
				f_func();
			};
		}
	}
}

f_tcalAddOnload (f_tcalInit);



//----------------------------------------------------------------
//javascript date format function thanks to
// http://jacwright.com/projects/javascript/date_format
//
// some modifications to match the calendar script
//----------------------------------------------------------------

// Simulates PHP's date function
Date.prototype.format = function(format) {
	var returnStr = '';
	var replace = Date.replaceChars;
	for (var i = 0; i < format.length; i++) {
		var curChar = format.charAt(i);
		if (replace[curChar]) {
			returnStr += replace[curChar].call(this);
		} else {
			returnStr += curChar;
		}
	}
	return returnStr;
};
Date.replaceChars = {
	shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
	longMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
	shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
	longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],

	// Day
	d: function() { return (this.getDate() < 10 ? '0' : '') + this.getDate(); },
	D: function() { return Date.replaceChars.shortDays[this.getDay()]; },
	j: function() { return this.getDate(); },
	l: function() { return Date.replaceChars.longDays[this.getDay()]; },
	N: function() { return this.getDay() + 1; },
	S: function() { return (this.getDate() % 10 == 1 && this.getDate() != 11 ? 'st' : (this.getDate() % 10 == 2 && this.getDate() != 12 ? 'nd' : (this.getDate() % 10 == 3 && this.getDate() != 13 ? 'rd' : 'th'))); },
	w: function() { return this.getDay(); },
	z: function() { return "Not Yet Supported"; },
	// Week
	W: function() { return "Not Yet Supported"; },
	// Month
	F: function() { return Date.replaceChars.longMonths[this.getMonth()]; },
	m: function() { return (this.getMonth() < 9 ? '0' : '') + (this.getMonth() + 1); },
	M: function() { return Date.replaceChars.shortMonths[this.getMonth()]; },
	n: function() { return this.getMonth() + 1; },
	t: function() { return "Not Yet Supported"; },
	// Year
	L: function() { return "Not Yet Supported"; },
	o: function() { return "Not Supported"; },
	Y: function() { return this.getFullYear(); },
	y: function() { return ('' + this.getFullYear()).substr(2); },
	// Time
	a: function() { return this.getHours() < 12 ? 'am' : 'pm'; },
	A: function() { return this.getHours() < 12 ? 'AM' : 'PM'; },
	B: function() { return "Not Yet Supported"; },
	g: function() { return this.getHours() % 12 || 12; },
	G: function() { return this.getHours(); },
	h: function() { return ((this.getHours() % 12 || 12) < 10 ? '0' : '') + (this.getHours() % 12 || 12); },
	H: function() { return (this.getHours() < 10 ? '0' : '') + this.getHours(); },
	i: function() { return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); },
	s: function() { return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); },
	// Timezone
	e: function() { return "Not Yet Supported"; },
	I: function() { return "Not Supported"; },
	O: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + '00'; },
	T: function() { var m = this.getMonth(); this.setMonth(0); var result = this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); this.setMonth(m); return result;},
	Z: function() { return -this.getTimezoneOffset() * 60; },
	// Full Date/Time
	c: function() { return "Not Yet Supported"; },
	r: function() { return this.toString(); },
	U: function() { return this.getTime() / 1000; }
};


function padString(stringToPad, padLength, padString) {
	if (stringToPad.length < padLength) {
		while (stringToPad.length < padLength) {
			stringToPad = padString + stringToPad;
		}
	}else {}
/*
	if (stringToPad.length > padLength) {
		stringToPad = stringToPad.substring((stringToPad.length - padLength), padLength);
	} else {}
*/
	return stringToPad;
}

function tc_updateDay(objname, yearNum, monthNum, daySelected){
	//var totalDays = (monthNum > 0) ? daysInMonth(monthNum, yearNum) : 31;
	var totalDays = (monthNum > 0 && yearNum > 0) ? daysInMonth(monthNum, yearNum) : ((monthNum > 0) ? daysInMonth(monthNum, 2008) : 31);

	var dayObj = document.getElementById(objname+"_day");
	//var prevSelected = dayObj.value;

	if(dayObj.options[0].value == 0 || dayObj.options[0].value == "")
		dayObj.length = 1;
	else dayObj.length = 0;

	for(d=1; d<=totalDays; d++){
		var newOption = document.createElement("OPTION");
		newOption.text = d;
		newOption.value = d;

		dayObj.options[d] = new Option(newOption.text, padString(newOption.value, 2, "0"));
	}

	if(daySelected > totalDays)
		dayObj.value = padString(totalDays, 2, "0");
	else dayObj.value = padString(daySelected, 2, "0");

	return dayObj.value;
}


function checkPairValue(objname, d){	
	var dp1 = document.getElementById(objname+"_pr1").value;
	var dp2 = document.getElementById(objname+"_pr2").value;
	
	var this_value = document.getElementById(objname).value;
	var this_time = Date.parse(this_value)/1000;
	
	//implementing dp2
	if(dp1 != "" && document.getElementById(dp1) != null){ //imply to date_pair1		
		//set date pair value to date selected
		document.getElementById(dp1+"_prv").value = d;
	
		var dp1_value = document.getElementById(dp1).value;
		var dp1_time = Date.parse(dp1_value)/1000;

		if(this_time < dp1_time){
			//set self date pair value to null			
			document.getElementById(objname+"_prv").value = "";
			
			tc_submitDate(dp1, "00", "00", "0000");
		}else{
			var date_array = document.getElementById(dp1).value.split("-");	
			tc_submitDate(dp1, date_array[2], date_array[1], date_array[0]);
		}
	}

	//implementing dp1
	if(dp2 != "" && document.getElementById(dp2) != null){ //imply to date_pair2		
		//set date pair value to date selected		
		document.getElementById(dp2+"_prv").value = d;
	
		var dp2_value = document.getElementById(dp2).value;
		var dp2_time = Date.parse(dp2_value)/1000;
		
		if(this_time > dp2_time){			
			//set self date pair value to null			
			document.getElementById(objname+"_prv").value = "";
			
			tc_submitDate(dp2, "00", "00", "0000");
		}else{
			var date_array = document.getElementById(dp2).value.split("-");
			tc_submitDate(dp2, date_array[2], date_array[1], date_array[0]);
		}
	}
}

function checkSpecifyDate(objname, strDay, strMonth, strYear){
	var spd = document.getElementById(objname+"_spd").value;
	var spt = document.getElementById(objname+"_spt").value;

	//alert(spd);
	var sp_dates;

	if(typeof(JSON) != "undefined"){
		sp_dates = JSON.parse(spd);
	}else{
		//only array is assume for now
		if(spd != "" && spd.length > 2){
			var tmp_spd = spd.substring(2, spd.length-2);
			//alert(tmp_spd);
			var sp_dates = tmp_spd.split("],[");
			for(i=0; i<sp_dates.length; i++){
				//alert(sp_dates[i]);
				var tmp_str = sp_dates[i]; //.substring(1, sp_dates[i].length-1);
				if(tmp_str == "")
					sp_dates[i] = new Array();
				else sp_dates[i] = tmp_str.split(",");
			}
		}else sp_dates = new Array();
	}
	/*
	for(i=0; i<sp_dates.length; i++){
		for(j=0; j<sp_dates[i].length; j++){
			alert(sp_dates[i][j]);
		}
	}
	*/

	var found = false;

	for (var key in sp_dates[2]) {
	  if (sp_dates[2].hasOwnProperty(key)) {
		this_date = new Date(sp_dates[2][key]*1000);
		//alert(sp_dates[2][key]+","+this_date.getDate());
		if(this_date.getDate() == parseInt(parseFloat(strDay)) && (this_date.getMonth()+1) == parseInt(parseFloat(strMonth))){
			found = true;
			break;
		}
	  }
	}

	if(!found){
		for (var key in sp_dates[1]) {
		  if (sp_dates[1].hasOwnProperty(key)) {
			this_date = new Date(sp_dates[1][key]*1000);
			//alert(sp_dates[2][key]+","+this_date.getDate());
			if(this_date.getDate() == parseInt(parseFloat(strDay))){
				found = true;
				break;
			}
		  }
		}
	}


	if(!found){
		var choose_date = new Date(strYear, strMonth-1, strDay);
		var choose_time = choose_date.getTime()/1000;

		for (var key in sp_dates[0]) {
		  if (sp_dates[0].hasOwnProperty(key)) {
			//alert(key + " -> " + p[key]);
			if(choose_time == sp_dates[0][key]){
				found = true;
				break;
			}
		  }
		}
	}

	//alert("aa:"+found);

	switch(spt){
		case 0:
		default:
			//date is disabled
			if(found){
				alert("You cannot choose this date");
				return false;
			}
			break;
		case 1:
			//other dates are disabled
			if(!found){
				alert("You cannot choose this date");
				return false;
			}
			break;
	}

	return true;
}

function urldecode (str) {
	return decodeURIComponent((str + '').replace(/\+/g, '%20'));
}

function calendar_onchange(objname){
	//you can modify or replace the code below
	var fc = document.getElementById(objname+"_och").value;
	//alert("Date has been set to "+obj.value);
	eval(urldecode(fc));
}

function focusCalendar(objname){
	var obj = document.getElementById("container_"+objname);
	if(obj != null){
		obj.style.zIndex = 999;
	}
}

function unFocusCalendar(objname, zidx){
	var obj = document.getElementById("container_"+objname);
	if(obj != null){
		obj.style.zIndex = zidx;
	}
}



// JavaScript Document
/*  imgFader, version 1.0
 *  (c) 2008 Malte Sieb (http://www.maltesieb.de)
 *
 *  imgFader is freely distributable under the terms of the GPL license.
 *  For details, see my web site: http://www.maltesieb.org/skripte
 *
 *--------------------------------------------------------------------------
 *
 *	c	Container element id
 *  ce	Current visible element
 *  pe	Previous visible element
 *  fps	Frames per second
 *  eo	Current elements opacity
 *  po	Previous elements opacity
 *
 *  _g	Get										Alias for document.getElementById
 *  _a	Append									Append new image element to container
 *  _u	Update									Rebuild container after resorting images
 *  _so	Set opacity (element,aim of opacity)	Set opacity in 2 different methods
 *  _f	Fade function 							is called each frame
 *  _s	Show									Start fading to next image
 */

var Fade=function(c,d) {
	/* Default values */
	this.fDur=1;
	this.delay=5;
	this.imgs=new Array();
	this.mode='random';
	this.clear=true;
	for (var i in d) this[i]=d[i];
	
	/* Prevent longer fade duration than delay */
	if (this.fDur>this.delay) this.fDur=this.delay;

	/* Script variables */
	this.ce=0;
	this.eo=1;
	this.po=0;
	this.fps=25;
	this.c=c;
	
	/* Prepare container element and put all images into it */
	if (this.clear) this._g(this.c).innerHTML='';
	this._g(c).style.position='relative';
	for (i=0;i<this.imgs.length;i++) {
		this._a(i,this.imgs[i]);
	}
	
	/* Start the desaster */
	this.start();
};

Fade.prototype.start=function() {
	var p=this;
	this.stop();
	this.s=window.setInterval(function() {p._s()},this.delay*1000);
};

Fade.prototype.stop=function() {
	window.clearInterval(this.s);
};

Fade.prototype._a=function(i,img) {
	this._g(this.c).innerHTML+='<img src="'+img+'" id="img'+i+'" alt="" />'+"\n";
	this._g('img'+i).style.position='absolute';
	this._so(i,(i==this.ce?this.eo:(i==this.pe?this.po:0)));
};

/**
 * Rebuild container e.g. after resorting images
 */
Fade.prototype._u=function(n) {
	this.imgs=n;
	this._g(this.c).innerHTML='';
	for (i=0;i<n.length;i++) {
		this._a(i,this.imgs[i]);
	}
};

/**
 * Alias for document.getElementById
 */
Fade.prototype._g=function(i){return document.getElementById(i);};

/**
 * Check if URL already exists
 */
Fade.prototype._d=function(n){for(i=0;i<this.imgs.length;i++){if(n==this.imgs[i])return i;}return false;}

Fade.prototype._so=function(i,o){
	var e=this._g('img'+i);
	o=o>1?1:(o<0?0:o);	 
	e.style.opacity=o;
	e.style.filter="alpha(opacity="+(o*100)+")";
};

Fade.prototype._f=function(){
	if (this.eo>=1) {window.clearInterval(this.f);}
	var d=1/(this.fps*this.fDur);
	this._so(this.pe,(this.po-=d));
	this._so(this.ce,(this.eo+=d));
};

Fade.prototype._s = function(ce) {
	if (this.s) {window.clearInterval(this.s);window.clearInterval(this.f);}
	for (i=0;i<this.imgs.length;i++) {
		if (i!=this.ce && i!=this.pe) this._so(i,0);
	}
	var p=this,r;
	if (this.imgs.length>0) {
		this.pe=this.ce;
		if (ce || ce==0) {
			this.ce=ce;
			this.fe=null;
		} else if (this.mode=='random') {
			do r=Math.round((Math.random()*this.imgs.length)-0.499);
			while(r==this.ce);
			this.ce=r;
		} else {
			if (++this.ce>(this.imgs.length-1)) {
				this.ce=0;
			}
		}
		this.eo=0;
		this.po=1;
		this.f=window.setInterval(function() { p._f(); },Math.round(this.fDur*1000/this.fps));
	}
	this.start();
};

Fade.prototype.add = function(img,d) {
	var p,n=new Array();
	p=this._d(img);
	if (!p || d.force) {
		if (d.pos && d.pos=='first') d.pos=1;
		if (d.pos && d.pos<=this.imgs.length) {
			d.pos--;
			for (i=0;i<this.imgs.length;i++) {
				if (i<d.pos) n[i]=this.imgs[i];
				else if (i==d.pos) {n[i]=img;n[(i+1)]=this.imgs[i];}
				else n[(i+1)]=this.imgs[i];
			}
			if (this.ce>=d.pos){this.ce++;}
			if (this.pe>=d.pos){this.pe++;}
			this._u(n);
			p=d.pos;
		} else {
			this.imgs[this.imgs.length]=img;
			p=this.imgs.length-1;
			this._a(p,img);
		}
	}
	if (d.mode && d.mode=='immediate') {this._s(p);}
};

Fade.prototype.go=function(p) {
	if (typeof p=='string' && p.indexOf('+')>-1) {
		p=parseInt(p.substr(1))+this.ce+1;
		if (p>this.imgs.length) p=p-this.imgs.length;
	} else if (typeof p=='string' && p.indexOf('-')>-1) {
		p=this.ce-parseInt(p.substr(1))+1;
		if (p<=0) p=p+this.imgs.length;
	}
	this._s(parseInt(p)-1);
};

Fade.prototype.preload = function(img) {
	var i=new Image;
	i.src=img;
};
