$(document).ready(function(){
	$("body").addClass("Active");
	HomeSlider();
	RoomPageSlider();
	ActivateTabs();
	/*DatePicker();*/
	FadeImages();
	ClickablePanels();
	ClickableOffers();
	/*RotatingHeader();*/
	SpecialOffers();
	RotatingBody();
	BingMap();
	Twitter();
	BookingSystem();	
	Gallery();
	BrilliantCalendar();
});



/* ----- Clickable Panels ----- */

function ClickablePanels(){
	$('.Panel1, .Panel2, .Panel3, .Panel4, .Panel5, .Panel6, .Panel7, .Panel, .HomePanel .MainAreaWrap .Enhance2ContentElement1, .HomePanel .MainAreaWrap .Enhance2ContentElement2, .HomePanel .MainAreaWrap .Enhance2ContentElement3, .HomePanel .MainAreaWrap .Enhance2ContentElement4, .HomePanel .MainAreaWrap .Enhance2ContentElement5, .HomePanel .MainAreaWrap .Enhance2ContentElement6, .HomePanel .MainAreaWrap .Enhance2ContentElement7, .HomePanel .MainAreaWrap .Enhance2ContentElement8, .Home .MainAreaWrap .Enhance2ContentElement2, .Home .MainAreaWrap .Enhance2ContentElement3, .Home .MainAreaWrap .Enhance2ContentElement4, .Home .MainAreaWrap .Enhance2ContentElement5').each(function(){
		MakeClickable($(this));
	});
}

function MakeClickable(element){
	var count = 0;
	element.find('h3 a').each(function(){
		count++;
	});
	if(count == 1){
		var panelurl = element.find('h3 a').attr('href');
		if(panelurl){
			element.css({ 'cursor' : 'pointer' });
			element.attr("onclick", "window.location = '" + panelurl + "'");
			/*element.click(function(){
				window.location = panelurl;		
			});*/
		}
	}
}



/* ----- Clickable Offers ----- */

function ClickableOffers(){
	$('.SpecialOffers table td, .SpecialTest table td').each(function(){
		MakeOfferClickable($(this));
	});
}

function MakeOfferClickable(element){
	var count = 0;
	element.find('a').each(function(){
		count++;
	});
	if(count == 1){
		var panelurl = element.find('a').attr('href');
		if(panelurl){
			element.css({ 'cursor' : 'pointer' });
			element.attr("onclick", "window.location = '" + panelurl + "'");
			/*element.click(function(){
				window.location = panelurl;
			});*/
		}
	}
}



/* ----- Fading Header ----- */

function FadeImages(){
	if($('.PortfolioPanel, .RotatingImages').length == 0){
		$('.Heading').cycle({ 
			fx: 'fade', 
			speed: 2500,
			pause: true,
			slideExpr: 'img'
		 });
	}
}



/* ----- Rotating Header ----- */

function RotatingHeader(){
	if($('.PortfolioPanel').length > 0){
		/* Begin Rotating Header for home page */
		//$('.HomePanel .Heading > .Enhance2ContentElement1 > .EnhanceContentElementWrap > div').wrapInner('<div class="PortfolioPanel"></div>');
		$('.PortfolioPanel').append('<div id="PortfolioNav"></div>');
		$('#PortfolioNav').append('<a id="Prev" href="#">&nbsp;</a>');
		$('#PortfolioNav').append('<div id="PortfolioNavContent"></div>');
		$('#PortfolioNav').append('<a id="Next" href="#">&nbsp;</a>');
		//var count = 1;
		$('.PortfolioPanel p').each(function(){
			if($(this).find('img').length > 0){
				var image = $(this);
				var slide = image;
				var header = $(this).next('.PortfolioBody');
				slide = slide.add(header);
				slide.wrapAll('<div class="Slide"></div>');
			}
		});
		
		$('.PortfolioPanel').cycle({ 
			fx: 'scrollHorz', 
			speed: 5000,
			timeout: 14000,
			pause: true,
			slideExpr: '.Slide',
			next: '#Next', 
			prev: '#Prev',
			pager: '#PortfolioNavContent'
		 });
		/* End Rotating Header for home page */
	}
}


/* ----- Rotating Body ----- */

function RotatingBody() {
	if($('.SpecialOffers, .SpecialTest').length > 0){

		var arVersion = navigator.appVersion.split("MSIE")
		var version = parseFloat(arVersion[1])
		if ((version >= 5.5) && (version < 7.0) && (document.body.filters)) 
		{
		}else{
			$('.Panel1, .Panel2, .Panel3, .Panel4, .Panel5, .Panel6, .Panel7, .Panel, .HomePanel .MainAreaWrap .Enhance2ContentElement1, .HomePanel .MainAreaWrap .Enhance2ContentElement2, .HomePanel .MainAreaWrap .Enhance2ContentElement3, .HomePanel .MainAreaWrap .Enhance2ContentElement4, .HomePanel .MainAreaWrap .Enhance2ContentElement5, .HomePanel .MainAreaWrap .Enhance2ContentElement6, .HomePanel .MainAreaWrap .Enhance2ContentElement7, .HomePanel .MainAreaWrap .Enhance2ContentElement8, .SpecialPrices1, .SpecialPrices2, .SpecialPrices3, .SpecialPrices4, .SpecialPrices5, .SpecialPrices6, .SpecialPrices7, .SpecialPrices8, .SpecialPrices9, .SpecialPrices10, .SpecialPrices11, .SpecialPrices12').wrapAll('<ul></ul>').wrap('<li></li>');
			DatePickerDestroy();
			ReadJCList();
			$('.SpecialOffers .MainAreaWrap .MainContent ul').jcarousel({
				scroll: 1,
				visible: 1,
				initCallback: mycarousel_initCallback,
				wrap: 'circular',
				itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
				itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
			});
			$('.MainAreaWrap').css({'overflow': 'visible'});
		}
		
		$(window).resize(function() {
			$('.MainAreaWrap ul').css({'left': '0px'});
		});
		
		$('.Heading a').click(function(){
			var href = $(this).attr('href');
			if(href.indexOf("#") == 0){
				ScrollToMonth(href);
				return false;	
			}
		});
		
		DatePicker();
	}
}

var mycarousel_itemList = new Array();
var monthlist = new Array();
var monthcount;
var mycarousel;
ReadJCList = function() {
	if($('.SpecialOffers').length > 0){
		var JCList;
		if ($('.MainAreaWrap .MainContent ul').length > 0){
			JCList=$('.MainAreaWrap .MainContent ul li');
			for (var i = 0; i < JCList.length; i++) {
				mycarousel_itemList[i]=JCList[i].innerHTML;
				monthlist[i]=$(JCList[i]).find('h2').text();
			}
			monthcount = JCList.length;
		}
	}
}

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_itemList[idx - 1]);

	if(typeof pngFix == 'function') {
		pngFix();
	}
	
	DatePickerDestroy();
	DatePicker();
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
    carousel.startAuto();
};

function mycarousel_initCallback(carousel)
{
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });			   
	mycarousel = carousel;
};


function SpecialOffers(){
	if($('.SpecialOffers, .SpecialTest').length > 0){
		$('.MainContent td').each(function(){
			var count = 1;
			$(this).find('p').each(function(){
				$(this).addClass('Paragraph'+count);				
				count++;
			});
		});
	}
}

function ScrollToMonth(url){
	var hash = url.substr(1).replace('-',' ');
	var targetid;
	for(var i = 0; i < monthlist.length; i++){
		if(hash.toLowerCase() == monthlist[i].toLowerCase()){
			targetid = (i + 1);
		}
	}
	if(targetid != null){
		mycarousel.scroll(targetid);
	}
}




function SitemapCols(){
	$('.Home1 .FooterWrap .Enhance2ContentElement3 .Enhance2MenuWrap > ul').makeacolumnlists({cols:5,colWidth:189,equalHeight:false,startN:1});
}



/* ----- Tabs ----- */

function ActivateTabs(){
	$(".Tab1 .TabHeading").click(function(){
		if($(".Tab1 .TabContent").height() == 1){
        	$(".Tab1 .TabContent").animate({ height: "350px" }, 1500 );
			collapse($(".Tab2 .TabContent"));
			collapse($(".Tab3 .TabContent"));
			collapse($(".Tab4 .TabContent"));
	  	}
	  	if($(".Tab1 .TabContent").height() == 350){
        	$(".Tab1 .TabContent").animate({ height: "1px" }, 1500 );
	  	}
	});
	
	$(".Tab2 .TabHeading").click(function(){
		if($(".Tab2 .TabContent").height() == 1){
        	$(".Tab2 .TabContent").animate({ height: "350px" }, 1500 );
			collapse($(".Tab1 .TabContent"));
			collapse($(".Tab3 .TabContent"));
			collapse($(".Tab4 .TabContent"));
	  	}
	  	if($(".Tab2 .TabContent").height() == 350){
        	$(".Tab2 .TabContent").animate({ height: "1px" }, 1500 );
	  	}
	});
	
	$(".Tab3 .TabHeading").click(function(){
		if($(".Tab3 .TabContent").height() == 1){
        	$(".Tab3 .TabContent").animate({ height: "350px" }, 1500 );
			collapse($(".Tab1 .TabContent"));
			collapse($(".Tab2 .TabContent"));
			collapse($(".Tab4 .TabContent"));
	  	}
	  	if($(".Tab3 .TabContent").height() == 350){
        	$(".Tab3 .TabContent").animate({ height: "1px" }, 1500 );
	  	}
	});
	
	$(".Tab4 .TabHeading").click(function(){
		if($(".Tab4 .TabContent").height() == 1){
        	$(".Tab4 .TabContent").animate({ height: "350px" }, 1500 );
			collapse($(".Tab1 .TabContent"));
			collapse($(".Tab2 .TabContent"));
			collapse($(".Tab3 .TabContent"));
	  	}
	  	if($(".Tab4 .TabContent").height() == 350){
        	$(".Tab4 .TabContent").animate({ height: "1px" }, 1500 );
	  	}
	});
}

function collapse(element){
	if(element.height() > 10){
		element.animate({ height: "1px" }, 1500 );
	}
}



/* ----- Date Picker ----- */

function DatePicker(){
	//$('#ArrivalDate').datepicker( 'option' , 'dateFormat' , 'dd/mm/yy' );
	//$('#ArrivalDate').datepicker( 'option' , 'showOn' , 'button' );
	//$('#ArrivalDate').datepicker( 'option' , 'buttonImage' , '/skin/images/calendar-icon.gif' );
	//$('#ArrivalDate').datepicker( 'option' , 'buttonImageOnly' , 'true' );
	if(window.location == 'http://www.hermitage-hotel.co.uk/Default.aspx?pagename=Hermitage-Hotel-bournemouth-in-dorset'){	
		if($('.Enhance2BrilliantAvailabilityFeedWrap #ArrivalDate').length > 0){
			$('.Enhance2BrilliantAvailabilityFeedWrap #ArrivalDate').datepicker({
				dateFormat: 'dd/mm/yy',
				showOn: 'button',
				buttonImage: '/skin/images/calendar-icon.gif',
				buttonImageOnly: true
			});
		}
	}
}

function DatePickerDestroy(){
	if(window.location == 'http://www.hermitage-hotel.co.uk/Default.aspx?pagename=Hermitage-Hotel-bournemouth-in-dorset'){	
		if($('.Enhance2BrilliantAvailabilityFeedWrap #ArrivalDate').length > 0){
			$('.Enhance2BrilliantAvailabilityFeedWrap #ArrivalDate').datepicker('destroy');
		}
	}
}




/* ----- Bing Map ----- */
var map = null;
var hermitageMap = null;
var birdsEyeLocation = null;
var pinLocation = null;

function BingMap()
{
	if($('#BingMap').length > 0){
		hermitageMap = new VELatLong(50.71636969271924, -1.876437469676896);
		birdsEyeLocation = new VELatLong(50.71636969271924, -1.876437469676896); 
		pinLocation = new VELatLong(50.717179012377464, -1.8770340085029606);
		
		map = new VEMap('BingMap');
		map.LoadMap(hermitageMap, 15);
		map.SetMapStyle(VEMapStyle.Oblique);
		
		// Pushpin
		var shape = new VEShape(VEShapeType.Pushpin, pinLocation);
		shape.SetTitle("<h2>Hermitage Hotel</h2>");
		shape.SetDescription("<p>This is the location of the hotel</p>");
		map.AddShape(shape);
		
		// Polygon
		var shape = new VEShape(VEShapeType.Polygon, [new VELatLong(50.71761206093467, -1.8767791986465547),
												   new VELatLong(50.71690899184001, -1.8766719102859535),
												   new VELatLong(50.71681728639792, -1.8769884109497177),
												   new VELatLong(50.71697352519169, -1.8775033950805684),
												   new VELatLong(50.71746601363314, -1.8771761655807608)
												   ]);
		shape.SetTitle('<h1>Hermitage Hotel</h1>');
		shape.SetDescription('<p>This is the location of the hotel</p>');
		shape.SetFillColor(new VEColor(255,255,255,0.0));
		shape.SetLineColor(new VEColor(255,255,255,1.0));
		
		// map.AddShape(shape);
		
		// Let me know if a birdseye scene is available
		map.AttachEvent("onobliqueenter", OnObliqueEnterHandler);
	}
}

function OnObliqueEnterHandler()
{
	if(map.IsBirdseyeAvailable())
	{
	   map.SetBirdseyeOrientation(VEOrientation.West);
	   map.SetBirdseyeScene(birdsEyeLocation);
	}
}




/* ----- Twitter ----- */

function Twitter()
{
	$(".TwitterWidget").getTwitter({
		userName: "TheHermitageUK",
		numTweets: 1,
		loaderText: "Loading tweets...",
		slideIn: false,
		slideDuration: 750,
		showHeading: true,
		headingText: "<a href='http://www.twitter.com/TheHermitageUK'>Latest Tweets</a>",
		showProfileLink: false,
		showTimestamp: true
	});
}


/* ----- Booking System ----- */

function BookingSystem(){
	// Custom children option
	$('.Enhance2BrilliantChildrenOptionsWrap *').css({'display': 'none'});
	$('.Enhance2BrilliantChildrenOptionsWrap').append('<p>If you are bringing children please call the hotel in advance on 01202 557363</p>');
	// Removing children from summary
	$('.Enhance2BrilliantSummaryDetailsWrap .Enhance2BrilliantSummaryItem:last').css({'display': 'none'});
	
	// Add Extras Button
	if(window.location == 'http://www.hermitage-hotel.co.uk/Default.aspx?pagename=testbooking'){	
		if($('.Enhance2BrilliantAvailabilitySelectionWrap').length > 0){
			$('.Enhance2BrilliantAvailabilitySearchWrap .SearchButton').after('<a class="SearchButton ExtrasButton" href="/Default.aspx?pagename=Extras-to-your-stay">Extras</a>');
		}
	}
	
	// Move breakfast rate to top
	$('.Enhance2AvailableRateWrap').each(function(){
		if($(this).find('.Enhance2BrilliantArrvialRateTitle').text() == 'Accommodation & Breakfast'){
			// Clone breakfast option (true flag to clone events)
			breakfast = $(this).clone(true);
			// Add clone to after title
			$(this).siblings('.Enhance2BrilliantRoomTitle').after(breakfast);
			// Remove original breakfast option
			$(this).remove();
		}
	});
	
	// Click text to select room type
	$('.Enhance2AvailableRateWrap .Enhance2BrilliantArrvialRate div').click(function(){
		$(this).siblings(':radio').trigger('click');
	});
	// Highlight next button
	$('.Enhance2AvailableRateWrap .Enhance2BrilliantArrvialRate :radio').click(function(){
		$('.NextButton').addClass('Highlight');
	});
	// Changing name of reset button
	$('.CancelButton').val('Restart Booking');
	// Highlight Complete Reservation button
	$('#TermsConditions').click(function(){
		if($(this).is(':checked')){
			$('.NextButton').addClass('Highlight');
		}else{
			$('.NextButton').removeClass('Highlight');
		}
	});
	// Prevent double submit of Complete Reservation button
	$('.Enhance2BrilliantWrap form').submit(function(){
		$('.NextButton').attr('disabled','disabled').addClass('Disabled');
	});
	
}

/* ----- Gallery ----- */

function Gallery(){
	if($('.Gallery').length > 0){
		$('.Gallery .MainContent img').each(function(){
			if($(this).parent('a').length == 0){
				$(this).wrap('<a href="' + $(this).attr('src') + '"></a>');
			}
		});
		var page = null;
		var pagecount = 0;
		numthumbnails = $('.Gallery .MainContent a').not('li a').length;
		$('.Gallery .MainContent a').not('li a')
			.wrapAll('<div class="Thumbnails"></div>')
			.wrap('<div class="Thumbnail"></div>')
			.each(function(index){
				if($(this).parent('.Thumbnail').length > 0){
					var thumb = $(this).find('img');
					var Lx = thumb.height() / $(this).parent().height();
					var Wx = thumb.width() / $(this).parent().width();
					if(Lx > Wx){
						thumb.width($(this).parent().width());
					}else{
						thumb.height($(this).parent().height());
					}
				}
				if(page == null){
					page = $(this).parent('.Thumbnail');
				}else{
					page = page.add($(this).parent('.Thumbnail'));
				}
				if(page.length % 12 == 0 || index + 1 == numthumbnails){
					pagecount++;
					page.wrapAll('<div class="Page Page'+pagecount+'"></div>');
					page = null;
					if($('.Pagination').length == 0){
						$('.Thumbnails').after('<div class="Pagination"></div>');
					}
					$('.Pagination').append('<a href="#" class="PageLink">[' + pagecount + ']</a>');
				}
			})
			.lightBox({
				imageLoading: '/skin/images/lightbox/lightbox-ico-loading.gif',
				imageBtnClose: '/skin/images/lightbox/lightbox-btn-close.gif',
				imageBtnPrev: '/skin/images/lightbox/lightbox-btn-prev.gif',
				imageBtnNext: '/skin/images/lightbox/lightbox-btn-next.gif',
				fixedNavigation: true
			});
		$('.Gallery .Page').hide();
		$('.Gallery .Page:first').show();
		$('.PageLink').each(function(index){
			var pagenum = index + 1;
			$(this).click(function(){
				$('.Gallery .Page').hide();
				$('.Gallery .Page'+pagenum).show();
				$('.PageLink').removeClass('Active');
				$(this).addClass('Active');
				return false;
			});
		});
		$('.PageLink:first').addClass('Active');
		$('.Thumbnails').css({'height': $('.Thumbnails').height()});
	}
}


/* ----- Home Slider ----- */

function HomeSlider(){
	if($('.Home').length > 0){
		$('.Home .PortfolioPanel').galleria({
			autoplay: 5000,
			carousel: true,
			image_crop: false, // crop all images to fit
			thumb_crop: true, // crop all thumbnails to fit
			show_imagenav: false,
			transition: 'fadeslide', // crossfade photos
			transition_speed: 700, // slow down the crossfade
			data_config: function(img) {
				// will extract and return image captions from the source:
				return  {
					title: $(img).parent().next('.PortfolioBody').find('p:first').html(),
					description: $(img).parent().next('.PortfolioBody').find('p:last').html()
				};
			}
		});
	}
}

/* ----- Room Page Slider ----- */

function RoomPageSlider(){
	if($('.RotatingImages').length > 0){
	
		
	
		$('.RotatingImages .Heading').galleria({
			autoplay: 5000,
			carousel: true,
			image_crop: false, // crop all images to fit
			thumb_crop: true, // crop all thumbnails to fit
			show_imagenav: false,
			transition: 'fadeslide', // crossfade photos
			transition_speed: 700, // slow down the crossfade
			data_config: function(img) {
				// will extract and return image captions from the source:
				return  {
					title: $('.Heading h1').html(),
					description: $('.Heading h2').html()
				};
			}
		});
	}
}


/* ----- Brilliant Calendar Control ----- */
calendarlock = false;
function BrilliantCalendar(){
	// Work out current month/year without using system clock
	months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	currentDate = $('.EnhanceTwoBrilliantMonthTitle .EnhanceTwoComponentText').text();
	currentDate = currentDate.split(" ");
	currentMonthName = currentDate[0];
	currentMonth = 0;
	for(var i in months)
	{
		if(months[i] == currentMonthName){
			currentMonth = parseInt(i);
		}
	}
	currentYear = parseInt(currentDate[1]);
	
	// Set up necessary wraps for ajax
	$('.EnhanceTwoComponentCalenderMonth, .EnhanceTwoBrilliantMonthTitle').wrapAll('<div class="CalendarWrap"></div>');
	$('.CalendarWrap').after('<div class="CachedCalendars"></div>');
	
	// Cache first calendar
	newcache = $('.CachedCalendars').append('<div class="CachedCalendar'+currentMonth+'-'+currentYear+'"></div>');
	$('.CachedCalendar'+currentMonth+'-'+currentYear).html($('.CalendarWrap').html());
	
	// Style first calendar
	styleCalendar(currentMonth);
	
	// Show list of next 12 months
	iDate = new Date(currentYear, currentMonth, 1);
	$('.CalendarWrap').after('<div class="MonthList"><ul></ul></div>');
	for(i=1;i<=12;i++)
	{
		$('.MonthList ul').append('<li><a href="#" onclick="if(!calendarlock){selectMonth(this);loadMonth(' + iDate.getMonth() + ', ' + iDate.getFullYear() +');}return false;">' + months[iDate.getMonth()] + ' ' + iDate.getFullYear() + '</a></li>');
		var thisItem = $('.MonthList ul li:last');
		if(currentMonth == iDate.getMonth()){
			thisItem.addClass('Current');
		}
		iDate = new Date(currentYear, currentMonth + i);
	}
}

function selectMonth(pElem){
	$('.Current').removeClass('Current');
	$(pElem).parent('li').addClass('Current');
}

function loadMonth(pMonth, pYear){
	cachename = 'CachedCalendar'+pMonth+'-'+pYear;
	// Load cached version
	if($('.'+cachename).length > 0){
		$('.CalendarWrap').html($('.'+cachename).html());
		styleCalendar(pMonth);
	// Load non-cached version
	}else{
		calendarlock = true;
		$('.CalendarWrap').html('<div class="CalendarLoad"></div>');
		url = '/CWSAPI.aspx?CN=Brilliant&Date=' + (pMonth+1) + '-1-' + pYear;
		$.get(url, function(data) {
			$('.CalendarWrap').html(data);
			newcache = $('.CachedCalendars').append('<div class="'+cachename+'"></div>');
			$('.'+cachename).html(data);
			styleCalendar(pMonth);
			calendarlock = false;
		});
	}
}

disabledMonths = new Array();
// December
disabledMonths[11] = new Array(24, 25, 26, 27, 30, 31);
// January
disabledMonths[0] = new Array(2, 3, 4, 5);

function styleCalendar(pMonth){
	// Adding in fake price and class for past dates
	fakeprice = "&pound;73.50"; // Fake Price
	$('.CalendarWrap .EnhanceTwoCalenderDayPanel').each(function(){
		if($(this).find('.EnhanceTwoBrilliantCalenderPrice').length == 0){
			$(this).addClass('EnhanceTwoCalenderDayPanelPast');
			$(this).append('<div class="EnhanceTwoComponentControl EnhanceTwoBrilliantCalenderPrice"><a class="EnhanceTwoComponentLink EnhanceTwoBrilliantCalenderPrice">' + fakeprice + '</a></div>');
		}
	});

	// CSS Classes for £ sign and pence
	$('.CalendarWrap .EnhanceTwoBrilliantCalenderPrice a').each(function(){
		var pricetext = $(this).text();
		var currencySymbol = pricetext.substr(0,1);
		pricetext = pricetext.substr(1, pricetext.length-1);
		pricetext = pricetext.split('.');
		var pounds = pricetext[0];
		var pence = '.' + pricetext[1];
		$(this).html('<span class="CurrencySymbol">' + currencySymbol + '</span><span class="Pounds">' + pounds + '</span><span class="Pence">' + pence + '</span>');
	});
	
	// Disabling certain calendar months
	/*monthArray = disabledMonths[pMonth];
	if(monthArray){
		$('.CalendarWrap .EnhanceTwoCalenderDayPanel').each(function(){
			for(var disabledDay in monthArray){
				if($(this).find('.EnhanceTwoCalenderDayOfTheMonth .EnhanceTwoComponentText').text() == monthArray[disabledDay]){
					$(this).addClass('EnhanceTwoBrilliantCalenderDayClosed');
					$(this).find('.EnhanceTwoBrilliantCalenderPrice').addClass('EnhanceTwoBrilliantCalenderPriceClosed').text('POA');
				}
			}
		});
	}*/
}

jQuery(document).ready(function() {
	if($('.HomePopUp').length > 0){
		
		$(".HeadingText .EnhanceTwoGenericStyleThree").click(function(){
			$.fancybox({
				'content': $('.RightHeader .Heading .Enhance2ContentElement2').html(),
				'autoDimensions'	: false,
				'width'         	: 435,
				'height'        	: 'auto',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'overlayOpacity'	: 0.3,
				'overlayColor'		: "#000"
			});
		});
		
		$(".HeadingText .EnhanceTwoGenericStyleThree").trigger('click');
		
	}
});
