

jQueryCode = function(){
	jQuery(document).ready(function($){ 
		var css_link = jQuery("<link>", {rel: "stylesheet", type: "text/css", href: "https://bookings.glampmanager.com/Burrenmore-Nest-26462/External-Calendar-Widget-Css/"});
	   	css_link.appendTo('head');  
	   	
	   	var css_link2 = jQuery("<link>", {rel: "stylesheet", type: "text/css", href: "https://bookings.glampmanager.com/Burrenmore-Nest-26462/External-Calendar-Widget-FontAwesome-Css/"});
	   	css_link2.appendTo('head');  
	   		   	
	  	fnLoadCalendarWidget26462();
	  	
	});
}
		
if(window.jQuery) jQueryCode();
else{   
    var script = document.createElement('script'); 
    document.head.appendChild(script);  
    script.type = 'text/javascript';
    script.src = "https://bookings.glampmanager.com/Js/jquery-3.3.1.min.js";
    script.onload = jQueryCode;
}

function fnLoadCalendarWidget26462()
{
	varCalendarDate = jQuery('#calendar-widget-26462').data("default_date");
	jQuery('body').append('<div id="widget-popup-26462" class="widget-popup"></div>');
    jQuery('body').append('<div id="widget-overlay-26462" class="widget-overlay" onclick="fnCloseWidgetAvailability26462();"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div></div>');
	fnLoadCalendarAvailability26462(varCalendarDate);	
}

function fnLoadCalendarAvailability26462(varCalendarDate)
{			
	try{
		document.getElementById('widget-overlay-26462').style.display = 'block';
	}catch(e){}
	
	varAvailableTxtColour = jQuery('#calendar-widget-26462').data("available_txt_colour");
	varAvailableBgColour = jQuery('#calendar-widget-26462').data("available_bg_colour");
	
	varNoCheckInTxtColour = jQuery('#calendar-widget-26462').data("nocheckin_txt_colour");
	varNoCheckInBgColour = jQuery('#calendar-widget-26462').data("nocheckin_bg_colour");
	
	varBookedTxtColour = jQuery('#calendar-widget-26462').data("booked_txt_colour");
	varBookedBgColour = jQuery('#calendar-widget-26462').data("booked_bg_colour");
	
	varUnavailableTxtColour = jQuery('#calendar-widget-26462').data("unavailable_txt_colour");
	varUnavailableBgColour = jQuery('#calendar-widget-26462').data("unavailable_bg_colour");

	try{xmlHttpStartCalendar26462.abort();}catch(error){}try{xmlHttpStartCalendar26462=new XMLHttpRequest();}catch (e){try{xmlHttpStartCalendar26462=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{xmlHttpStartCalendar26462=new ActiveXObject("Microsoft.XMLHTTP");}catch (e){alert("Your browser does not support AJAX!");return false;}}}xmlHttpStartCalendar26462.onreadystatechange=function(){if(xmlHttpStartCalendar26462.readyState==4)
	{
		try{
			document.getElementById('calendar-widget-26462').innerHTML = xmlHttpStartCalendar26462.responseText;
		}
		catch(e){
			console.error("GlampManager Widget DIV element not found (calendar-widget-26462).");
		}

		try{
			document.getElementById('widget-overlay-26462').style.display = 'none';
		}catch(e){}
		
		try{
			fnPostDivHeight();
		}
		catch(e){}
	}}
    xmlHttpStartCalendar26462.open("GET","https://bookings.glampmanager.com/Burrenmore-Nest-26462/External-Calendar-Widget-Script/?ContainerID=26462&Date=" + varCalendarDate + "&GroupIDs=&SubGroupIDs=&Adults=2&Children=0&Infants=0&Pets=0&atx=" + encodeURIComponent(varAvailableTxtColour) + "&abg=" + encodeURIComponent(varAvailableBgColour) + "&ntx=" + encodeURIComponent(varNoCheckInTxtColour) + "&nbg=" + encodeURIComponent(varNoCheckInBgColour) + "&btx=" + encodeURIComponent(varBookedTxtColour) + "&bbg=" + encodeURIComponent(varBookedBgColour) + "&utx=" + encodeURIComponent(varUnavailableTxtColour) + "&ubg=" + encodeURIComponent(varUnavailableBgColour) + "&d=" + Math.random());
    xmlHttpStartCalendar26462.send(null); 
}

function fnCalendarWidgetChangeMonth26462(varDateYear, varDateMonth){
	varCalendarDate = varDateYear + "/" + varDateMonth + "/01";
	fnLoadCalendarAvailability26462(varCalendarDate);
}

function fnSelectDate26462(varSubGroupID, varDateSelected)
{
	document.getElementById('widget-overlay-26462').style.display = 'block';
	fnCalendarCheckAvailability26462(varSubGroupID, varDateSelected);	
}

function fnCalendarCheckAvailability26462(varSubGroupID, varDateSelected)
{
	try{xmlHttpStartCalendar26462.abort();}catch(error){}try{xmlHttpStartCalendar26462=new XMLHttpRequest();}catch (e){try{xmlHttpStartCalendar26462=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{xmlHttpStartCalendar26462=new ActiveXObject("Microsoft.XMLHTTP");}catch (e){alert("Your browser does not support AJAX!");return false;}}}xmlHttpStartCalendar26462.onreadystatechange=function(){if(xmlHttpStartCalendar26462.readyState==4)
	{
		document.getElementById('widget-popup-26462').innerHTML = xmlHttpStartCalendar26462.responseText;
		document.getElementById('widget-popup-26462').style.display = 'block';
		fnAvailabilityResults26462();
	}}
    xmlHttpStartCalendar26462.open("GET","https://bookings.glampmanager.com/Burrenmore-Nest-26462/External-Calendar-Widget-Durations/?ContainerID=26462&SubGroupID=" + varSubGroupID + "&StartDate=" + varDateSelected + "&Adults=2&Children=0&Infants=0&Pets=0&d=" + Math.random());
    xmlHttpStartCalendar26462.send(null); 
}

function fnAvailabilityResults26462()
{
	if (document.getElementById("idtxtWidgetDurations-26462").value != "")
	{
		var varSubGroupID 		= document.getElementById("idtxtRentalWidgetSubGroupID-26462").value;
		var varStartDate 		= document.getElementById("idtxtRentalWidgetStartDate-26462").value;
		var varDuration 		= document.getElementById("idtxtWidgetDurations-26462").value;
		
		
		varAdults				= 0;
		varChildren				= 0;
		varInfants				= 0;
		varPets					= 0;
		
		try{
			varAdults	= document.getElementById('idtxtRentalWidgetAdults-26462').value;
		}catch(error){} 	
		try{
			varChildren	= document.getElementById('idtxtRentalWidgetChildren-26462').value;
		}catch(error){} 	
		try{
			varInfants	= document.getElementById('idtxtRentalWidgetInfants-26462').value;
		}catch(error){} 	
		try{
			varPets		= document.getElementById('idtxtRentalWidgetPets-26462').value;
		}catch(error){} 		

		varBookButtonTxtColour = jQuery('#calendar-widget-26462').data("book_button_txt_colour");
		varBookButtonBgColour = jQuery('#calendar-widget-26462').data("book_button_bg_colour");

		try{xmlHttpStartCalendar26462.abort();}catch(error){}try{xmlHttpStartCalendar26462=new XMLHttpRequest();}catch (e){try{xmlHttpStartCalendar26462=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{xmlHttpStartCalendar26462=new ActiveXObject("Microsoft.XMLHTTP");}catch (e){alert("Your browser does not support AJAX!");return false;}}}xmlHttpStartCalendar26462.onreadystatechange=function(){if(xmlHttpStartCalendar26462.readyState==4)
		{
			document.getElementById('widget-popup-book-now-26462').innerHTML = xmlHttpStartCalendar26462.responseText;
			
			try{
				fnPostDivHeight();
			}
			catch(e){}
		}}
	    xmlHttpStartCalendar26462.open("GET","https://bookings.glampmanager.com/Burrenmore-Nest-26462/External-Calendar-Widget-Book/?ContainerID=26462&SubGroupID=" + varSubGroupID + "&StartDate=" + varStartDate + "&Duration=" + varDuration + "&Adults=" + varAdults + "&Children=" + varChildren + "&Infants=" + varInfants + "&Pets=" + varPets + "&btx=" + encodeURIComponent(varBookButtonTxtColour) + "&bbg=" + encodeURIComponent(varBookButtonBgColour) + "&d=" + Math.random());
	    xmlHttpStartCalendar26462.send(null); 
	}
	else{
		document.getElementById('widget-popup-book-now-26462').innerHTML = "";
	}
}

function fnCloseWidgetAvailability26462()
{
	document.getElementById('widget-popup-26462').style.display = 'none';
	document.getElementById('widget-overlay-26462').style.display = 'none';
	document.getElementById('widget-popup-book-now-26462').innerHTML = "";
}

function GetLink226462(){
  if(typeof ga !== 'undefined' && typeof ga.getAll === 'function') {
    trackers = ga.getAll();
    if(trackers.length) {
      uaLinker = new window.gaplugins.Linker(trackers[0]);      
	  document.getElementById('frmCalendarWidget').action = uaLinker.decorate(document.getElementById('frmCalendarWidget-26462').action);
    } 
  }
}

function fnValidateCalendarWidget26462()
{
	GetLink226462();
	document.forms['frmCalendarWidget-26462'].submit();
}