var getdata = [];
if (location.search.length > 1) {
  var ls = location.search.substring(1);
  var namevalue = ls.split("&");
  for (var i=0; i<namevalue.length; i++) {
    var data = namevalue[i].split("=");
    getdata[data[0]] = data[1];
  }
}
var inday,inmonth,outmonth,outday,inmonthyear,outmonthyear,hotel,thisyear,thismonth,nextyear;
var framesrc = "";
for (var el in getdata) {
	if (el =='inday'){
		inday = getdata[el];
		continue;
	}
	if (el =='inmonth'){
		inmonth = getdata[el];
		continue;
	}
	if (el =='outday'){
		outday = getdata[el];
		continue;
	}
	if (el =='outmonth'){
		outmonth = getdata[el];
		continue;
	}
}

var d = new Date();
thismonth = d.getMonth()+1;
thisyear  = d.getFullYear();
nextyear  = thisyear+1;
if (inmonth < thismonth){
	inmonthyear = nextyear + '-' + inmonth;
} else {
	inmonthyear = thisyear + '-' + inmonth;
}

if (outmonth < thismonth){
	outmonthyear = nextyear + '-' + outmonth;
} else {
	outmonthyear = thisyear + '-' + outmonth;
}

framesrc += 'http://www.bookassist.com/conduit/bookassist.do?inday=';
framesrc += inday;
framesrc += '&inmonthyear='   + inmonthyear;
framesrc += '&outday=' + outday;
framesrc += '&outmonthyear='  + outmonthyear ;
framesrc += '&inmonthyear='   + inmonthyear ;
framesrc += '&hotel_id=1742' ;
framesrc += '&guide_id=2' ;
framesrc += '&service_model=2';
framesrc += '&action=c_1&ca=center&cv=[object Object]';

document.getElementById('bookiframe').src = framesrc;
