
var ddlDate;
function the_date(defaultDate){
    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;
		if (defaultDate == option.value)
		{
		        document.writeln("<OPTION value=" + option.value + " selected=\"selected\">" + shortDayName[date.getDay()] + " " + date.getDate() + " " + shortMonthName[date.getMonth()] + " " + date.getFullYear() + "</option>");
		}
		else
		{
		    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, defaultNights, defaultDate)
{
    document.writeln("<style type=\"text/css\">");
    document.writeln("<!--");
    document.writeln("/*LateRooms Search Box CSS */");
    document.writeln("#lateroomssearchbox { font:11px arial, sans-serif; background:#170943 url(http://affiliates.laterooms.com/Images/en/searchBanners/banner2.gif) no-repeat; width:160px; height:270px; padding:0; text-align:center; }");
    document.writeln("#lateroomssearchboxinner { padding:88px 10px 0; }");
    document.writeln("div.lrsubhead { font-weight:bold; color:#fff; 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("-->");
    document.writeln("</style>");
    document.writeln("<!-- BEGIN LATEROOMS SEARCH BOX -->");
    document.writeln("<div id=\"lateroomssearchbox\">");
    document.writeln("<form method=\"get\" action=\"http://visit-fortwilliam.laterooms.com/en/p3094/Hotels.aspx\">");
    document.writeln("<div id=\"lateroomssearchboxinner\">");
    document.writeln("<div class=\"lrsubhead\">Enter your destination</div>");
    document.writeln("<input name=\"k\" type=\"text\" size=\"17\" class=\"selbox\" value=\"" + defaultKeyword + "\">");
    document.writeln("<div class=\"lrsubhead\">Arrival Date:</div>");
    the_date(defaultDate);
    document.writeln("<select name=\"n\" class=\"selbox\">");
    if (defaultNights == null)
    {
        document.writeln("<option selected=\"selected\" value=\"1\">-- No of Nights --</option>");
    }
    else
    {
        document.writeln("<option value=\"1\">-- No of Nights --</option>");
    }
    var i = 1;
    while (i < 8)
    {
        if (i == 1)
        {
            if (defaultNights == i)
            {
                document.writeln("<option value=\"" + i + "\" selected=\"selected\">" + i + " Night</option>");    
            }
            else
            {
                document.writeln("<option value=\"" + i + "\">" + i + " Night</option>");    
            }
        }
        else
        {
            if (defaultNights == i)
            {
                document.writeln("<option value=\"" + i + "\" selected=\"selected\">" + i + " Nights</option>");    
            }
            else
            {
                document.writeln("<option value=\"" + i + "\">" + i + " Nights</option>");    
            }
        }
        
        i++;
    }
    document.writeln("</select>");
    document.writeln("<select name=\"rt\" class=\"selbox\">");
    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("</div>");
    document.writeln("<input type=\"submit\" value=\"Search\" name=\"Submit\" class=\"lrbutton\" border=\"0\" />");
    document.writeln("</form>");
    document.writeln("</div>");    
}


