
function buildOcc() {
    document.writeln('<option value="2|0">Double/Twin(2 people)</option>');
    document.writeln('<option value="1|0">Single(1 people)</option>');
    document.writeln('<option value="2|1">Double/Twin + kid</option>');
    document.writeln('<option value="3|0">Triple(3 people)</option>');
}

var childAgeInstant = '2|3|4|5|6|7|8|9|10|11';
function buildOptInstant(values,texts) {

    var valuesT = values.split("|");
    var textsT = texts.split("|");
    var j = parseInt(valuesT.length);
    for (var i=0;i<j;i++) {
        document.writeln('<option value="' + valuesT[i] + '">' + textsT[i] + '<\/option>');
    }
}

var childArrayInstant = new Array(0,0,0,0,0,0,0,0,0,0);
function showChildTitleInstant() {
    var c = 0;
    var r = document.f2.rooms[document.f2.rooms.selectedIndex].value;
    for (var i=0;i<r;i++) {
        c = c + childArrayInstant[i];
    }
    return true;
}

function showChildInstant(me,Span,nb) {
    var occ = me[me.selectedIndex].value;
    if (occ == '2|1') {
        alert ('When you select \'Double/Twin + one Kid\', there is no additional bed. \nThe child will need to share the existing bedding. \n The breakfast for the child can not be included in the price. \n If the breakfast is required for the child, please pay directly at the hotel \n\n If you want to guarantee a separate bed, please click on \'Triple (3 people)\'');
        childArrayInstant[nb-1] = 1;
        document.getElementById(Span).style.display = '';
    } else {
        childArrayInstant[nb-1] = 0;
        document.getElementById(Span).style.display = 'none';
    }
    return showChildTitleInstant();
}

function showChildInstantDiv(me,obj,nb) {
    var occ = me.options[me.selectedIndex].value;
    if (occ == '2|1') {
        alert ('When you select \'Double/Twin + one Kid\', there is no additional bed. \nThe child will need to share the existing bedding. \n The breakfast for the child can not be included in the price. \n If the breakfast is required for the child, please pay directly at the hotel \n\n If you want to guarantee a separate bed, please click on \'Triple (3 people)\'');
        childArrayInstant[nb-1] = 1;
        document.getElementById(obj).className = 'show';
    } else {
        childArrayInstant[nb-1] = 0;
        document.getElementById(obj).className = 'hide';	
    }
    return showChildTitleInstant();
}

function showChildDiv(me,obj,nb) {
    var occ = me.options[me.selectedIndex].value;
    if (occ == '2|1') {
        alert ('When you select \'Double/Twin + one Kid\', there is no additional bed. \nThe child will need to share the existing bedding. \n The breakfast for the child can not be included in the price. \n If the breakfast is required for the child, please pay directly at the hotel \n\n If you want to guarantee a separate bed, please click on \'Triple (3 people)\'');
        childArrayInstant[nb-1] = 1;
        document.getElementById(obj).className = 'float_l show';
    } else {
        childArrayInstant[nb-1] = 0;
        document.getElementById(obj).className = 'float_l hide';	
    }
    return showChildTitleInstant();
}


function showRoomInstant() {
    var nbR = document.f2.rooms.options[document.f2.rooms.selectedIndex].value;
    var j;
   
    for (var i=1; i<=10; i++) {		
		document.getElementById('rI'+i).className = 'hide';		
		document.getElementById('kidI_'+i).className = 'hide';					
    }

    for (i=1; i<=nbR; i++) {		
		document.getElementById('rI'+i).className = 'show';
		document.getElementById('roomO_'+i).selectedIndex = 0;
		
    }

    return showChildTitleInstant();
}

function showRoom() {
	var rooms = document.myForm.rooms;
    var nbR = rooms.options[rooms.selectedIndex].value;

    var j;
    for (var i=1; i<=10; i++) {		
		document.getElementById('r'+i).style.display = 'none';	
		document.getElementById('kid_'+i).style.display = 'none';			
    }
    for (i=1; i<=nbR; i++) {		
		document.getElementById('r'+i).style.display = '';
		document.getElementById('roomO_'+i).selectedIndex = 0;
		
    }
}

function buildRoomListInstantDiv() {
    for (var i=2;i<=10;i++) {
		document.writeln('<p id="rI'+i+'" class="hide">');
		document.writeln('<label for="roomO_'+i+'">#'+i+':</label><select name="roomO_'+i+'" id="roomO_'+i+'" onChange="return showChildInstantDiv(this,\'kidI_'+i+'\','+i+');">');
		document.writeln('<script>');
		document.writeln('	buildOcc();');
		document.writeln('</script>');
		document.writeln('</select>');
		document.writeln('</p>');
		document.writeln('<p id="kidI_'+i+'" class="hide">');
		document.writeln('<label for="room_'+i+'_1">child aged:</label>');
		document.writeln('<select name="room_'+i+'_1" id="room_'+i+'_1">');
		document.writeln('	<script>');
		document.writeln('		buildOptInstant(childAgeInstant,childAgeInstant);');
		document.writeln('	</script>');
		document.writeln('</select>');
		document.writeln('</p>');       
    }
    showRoomInstant();
    return true;
}

function buildRoomListDiv() {
    for (var i=2;i<=10;i++) {
		document.writeln('<div id="r'+i+'" class="hide">');
		document.writeln('<p class="label" style="margin-left:42px;">Room #'+i+':</p>');
		document.writeln('<p style="width:185px;">');
		document.writeln('<select name="room_'+i+'" id="room_'+i+'" onChange="return showChildDiv(this,\'kid_'+i+'\','+i+');">');
		document.writeln('<script>');
		document.writeln('	buildOcc();');
		document.writeln('</script>');
		document.writeln('</select>');
		document.writeln('</p>');
		document.writeln('<p class="hide" id="kid_'+i+'">');
		document.writeln('<label for="roomC_'+i+'">child aged:</label>');
		document.writeln('<select name="roomC_'+i+'" id="roomC_'+i+'">');
		document.writeln('	<script>');
		document.writeln('		buildOptInstant(childAgeInstant,childAgeInstant);');
		document.writeln('	</script>');
		document.writeln('</select>');
		document.writeln('</p></div>');       
    }
    showRoom();
    return true;
}

function buildRoomListInstant() {
    for (var i=2;i<=10;i++) {
        document.writeln('<tr id="rI'+i+'" style="display:none;">');
        document.writeln('<td style="font-size:11px;padding-top:3px; padding-bottom:3px;" nowrap><font style="font-size:11px; color:rgb(140,140,140);">#'+i+':</font><\/td>');
        document.writeln('<td><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td align="right" style="padding-top:2px; padding-bottom:2px;"><select style="font-size:10px;" name="roomO_'+i+'" onChange="return showChildInstant(this,\'kidI_'+i+'\','+i+');">');
        document.writeln('<script>');
        document.writeln('buildOcc();');
        document.writeln('<\/script>');
        document.writeln('<\/select><\/td><\/tr>');
        document.writeln('<tr><td colspan="2" align="right"><span id="kidI_'+i+'" style="display:none;"><font style="font-size:11px; color:rgb(140,140,140);">Child age : </font><select style="font-size:10px;"  name="room_'+i+'_1">');
        document.writeln('<script>');
        document.writeln('buildOptInstant(childAgeInstant,childAgeInstant);');
        document.writeln('<\/script>');
        document.writeln('<\/select>');
        document.writeln('<\/span><\/td><\/tr><\/table><\/td>');
    }
    return true;
}

function L(a,b,c,d,e) {
	document.writeln('<tr>');
	K(a);
	W(b);
	W(c);
	W(d);
	W(e);
	document.writeln('</tr>');
}
function W(x) {
	document.writeln('<td nowrap style="background-color:rgb(255,251,234); font-size:11px;">&nbsp;'+x+'&nbsp;</td>');
}
function K(x) {
	document.writeln('<td nowrap style="background-color:rgb(255,251,234); font-size:12px;">&nbsp;'+x+'&nbsp;</td>');
}