
var ddlDate;
function the_date(){
    var arrivalDate = "-- ArrivalDate --";    
    var shortDayName = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
    var shortMonthName = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');

	var date = new Date();
	var select = ddlDate;

	var firstDay = date.getDate();
	if(parseInt(firstDay) < 10) firstDay = "0" + firstDay;
	var firstMonth = date.getMonth() + 1;
	if(parseInt(firstMonth) < 10) firstMonth = "0" + firstMonth;

	var firstOption = new Option(arrivalDate);
	firstOption.value = date.getFullYear() + firstMonth + firstDay;

    document.writeln("<SELECT name=\"d\" class=\"selbox\">");

    for(var d=0;d<366;d++)
	{
		var day = date.getDate();
	    if(parseInt(day) < 10) day = "0" + day;
		var month = date.getMonth() + 1;
		if(parseInt(month) < 10) month = "0" + month;
		var option = new Option(shortDayName[date.getDay()] + " " + date.getDate() + " " + shortMonthName[date.getMonth()] + " " + date.getFullYear());
		option.value = date.getFullYear() + "" + month +  "" +  day;
		document.writeln("<OPTION value=" + option.value + ">" + shortDayName[date.getDay()] + " " + date.getDate() + " " + shortMonthName[date.getMonth()] + " " + date.getFullYear() + "</option>");
		date.setDate(date.getDate() + 1);
	}

	document.writeln("</SELECT>");
}

function buildLRSearchBanner(partnerid, defaultKeyword)
{
    document.writeln("<style type=\"text/css\">");
    document.writeln("<!--");
    document.writeln("/*LateRooms Search Box CSS */");
    document.writeln("#lateroomssearchbox { font:11px arial, sans-serif; background:transparent; width:310px; height:170px; padding:0 0 5 0; text-align:center; }");
    document.writeln("#lateroomssearchboxinner { padding:1px 10px 0 10px; }");
    document.writeln("div.lrsubhead { font-weight:bold; color:#5f442b; text-align:left; font:11px arial, sans-serif; margin:2px 0 8px 0; }");
    document.writeln("input.lrbutton { margin:4px 0 0; font:12px arial, sans-serif; font-weight:bold; }");
    document.writeln("input.selbox { font:11px arial, sans-serif; width:140px; color:#000; background-color:#fff; }");
    document.writeln("select.selbox { font:11px arial, sans-serif; margin:0 0 7px 0; width:140px; color:#000; background-color:#fff; }");
    document.writeln("h3 { color:#5f442b; font-size:16px; font-weight:bold; padding-bottom:0px; text-align: left; }");
    document.writeln("-->");
    document.writeln("</style>");
    
    
    document.writeln("<!-- BEGIN LATEROOMS SEARCH BOX -->");
    document.writeln("<div id=\"lateroomssearchbox\">");
    document.writeln("<form method=\"get\" action=\"http://www.laterooms.com/en/p" + partnerid + "/Hotels.aspx\">");
    document.writeln("<div id=\"lateroomssearchboxinner\">");
    document.writeln("<h3>Instant Hotel Search</h3>");
    document.writeln("<table id=\"lrsearchfields\" cellpadding=\"0\" cellpading=\"0\" border=\"0\">");
    document.writeln("<tr>");
    document.writeln("<td valign=\"top\">");
    document.writeln("<input name=\"k\" type=\"text\" size=\"17\" class=\"selbox\" value=\"" + defaultKeyword + "\"><br />");
    document.writeln("<div class=\"lrsubhead\">Town, Postcode, Attraction</div>");
    document.writeln("</td>");
    document.writeln("<td width=\"10\"></td>");
    document.writeln("<td valign=\"top\"><SCRIPT>the_date();</SCRIPT></td>");
    document.writeln("</tr>");
    document.writeln("<tr>");
    document.writeln("<td valign=\"top\">");
    document.writeln("<select class='selbox' name=\"n\" class=\"text\">");
    document.writeln("<option selected=\"selected\" value=\"1\">-- No. of nights --</option>");
    var i = 1;
    while (i < 8)
    {
        if (i == 1)
        {
			document.writeln("<option value=\"" + i + "\">" + i + " Night</option>");    
        }
        else
        {
			document.writeln("<option value=\"" + i + "\">" + i + " Nights</option>");    
        }
        
        i++;
    }
    document.writeln("</select>");
    document.writeln("</td>");
    document.writeln("<td width=\"10\"></td>");
    document.writeln("<td valign=\"top\">");        
    document.writeln("<select class='selbox' size=\"1\" name=\"rt\">");
    document.writeln("<option value=\"0,0\">-- Room Sleeps --</option>");
    document.writeln("<option value=\"1,0\">1 person</option>");
    document.writeln("<option value=\"2,0\">2 people</option>");
    document.writeln("<option value=\"2,1\">2 + 1 child</option>");
    document.writeln("<option value=\"2,2\">2 + 2 children</option>");
    document.writeln("<option value=\"2,3\">2 + 3 children</option>");
    document.writeln("<option value=\"3,0\">3 people</option>");
    document.writeln("<option value=\"4,0\">4 people</option>");
    document.writeln("<option value=\"5,0\">5 people</option>");
    document.writeln("<option value=\"6,0\">6 people</option>");
    document.writeln("<option value=\"7,0\">7 people</option>");
    document.writeln("</select>");
    document.writeln("</td>");
    document.writeln("</tr>");
    document.writeln("</table>");
    document.writeln("<input type=\"submit\" value=\"Search\" name=\"_:SearchPanel:search\" id=\"__SearchPanel_search\" class=\"lrbutton\" border=\"0\" />");
    document.writeln("</div>");
    document.writeln("</form>");
    document.writeln("</div>");
    document.writeln("<!-- END LATEROOMS SEARCH BOX -->");
    
    
}
