function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf(‘?’) + 1).split(‘&’);
for(var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } jQuery(document).ready(function() { var checkin = getUrlVars()["checkin"]; var checkout = getUrlVars()["checkout"]; if (checkin && checkout){ var days = datediff(parseDate(checkin ), parseDate(checkout )); jQuery("#bookingframe").attr("src","https://live.ipms247.com/booking/loadroomlisting.php?eZ_chkin=" + checkin + "&eZ_chkout=" + checkout +"&eZ_Nights=" + days + "&eZ_adult=1&eZ_child=0&eZ_room=1&calformat=&promotioncode=&HotelId=9612"); } else { jQuery("#bookingframe").attr("src","https://live.ipms247.com/booking/loadroomlisting.php?eZ_chkin=&eZ_chkout=&eZ_Nights=3&eZ_adult=1&eZ_child=0&eZ_room=1&calformat=&promotioncode=&HotelId=9612" ); }; }); function datediff(first, second) { return Math.round((second-first)/(1000*60*60*24)); } function parseDate(str) { var mdy = str.split('-'); return new Date(mdy[2], mdy[1], mdy[0]); }[/cs_content_seo]