var startDate = new Date();
startDate.setDate(startDate.getDate());
var calstart = new CalendarPopup();
calstart.addDisabledDates(null,formatDate(startDate,'yyyy-MM-dd'));
var calend = new CalendarPopup();
calend.addDisabledDates(null,formatDate(startDate,'yyyy-MM-dd'));

var url = $.url();
var presentquery = url.attr("query");
//console.log(presentquery);

function openIRM() {
	if(presentquery.substring(0,3) != "utm"){//Checking to see if the existing query is a tracking url, if not run the regular path for the IRM window.
    window.open("https://irm.lutsenresort.com/irmnet/res/resmain.aspx?Arrival=" + document.getElementById("arrivedate").value + "&Departure=" + document.getElementById("departdate").value + "&People1=" + (document.getElementById("ddlAdults").selectedIndex) + "&People2=" + (document.getElementById("ddlChildren").selectedIndex -1) + "&request1=LS", "", "scrollbars,resizable,status");
	}else{//If yes, append the query to the end of the existing IRM window path.
		window.open("https://irm.lutsenresort.com/irmnet/res/resmain.aspx?Arrival=" + document.getElementById("arrivedate").value + "&Departure=" + document.getElementById("departdate").value + "&People1=" + (document.getElementById("ddlAdults").selectedIndex) + "&People2=" + (document.getElementById("ddlChildren").selectedIndex -1) + "&request1=LS&"+ presentquery, "", "scrollbars,resizable,status");
		}

}
