// JavaScript Document
function viewHiddenAdvancedFormItems(){
	if(document.getElementById('advancedFormItems')){
		if(document.getElementById('advancedFormItems').style.display == "none"){
			document.getElementById('advancedFormItems').style.display = "block";	
			document.getElementById('aAdvanced').className = 'advancedOpen';
		}else{
			document.getElementById('advancedFormItems').style.display = "none";
			document.getElementById('aAdvanced').className = 'advancedClose';
		}
	}
		
}
function copyRow(rowId, date_room, date_int, type, rooms){
	numRow= numRow + 1;
	var table = document.getElementById('supplyTable');
	//var row = document.createElement('tr');
	var row = document.getElementById("supplyTable").insertRow(-1);
	
	row.setAttribute('className', 'copied');
	row.setAttribute('class', 'copied');
	
	var cell1 = document.createElement('td');
	var cell2 = document.createElement('td');
	var cell3 = document.createElement('td');
	var cell4 = document.createElement('td');
	var cell5 = document.createElement('td');
	var cell6 = document.createElement('td');
	var cell7 = document.createElement('td');
	
	var con1 = document.createTextNode(date_room);
	var con2 = document.createElement('select');
	con2.setAttribute('name', 'room_type_'+numRow);
	var con2_options1 = document.createElement('option');
	con2_options1.setAttribute('value', 'singles');
	
	if(type =='singles' ){
		con2_options1.setAttribute('selected', 'selected');
	}
	var con2_options2 = document.createElement('option');
	con2_options2.setAttribute('value', 'doubles');

	if(type =='doubles' ){
		con2_options2.setAttribute('selected', 'selected');
	}
	var con2_options3 = document.createElement('option');
	con2_options3.setAttribute('value', 'suites');
	
	if(type =='suites' ){
		con2_options3.setAttribute('selected', 'selected');
	}
	var con2_options4 = document.createElement('option');
	con2_options4.setAttribute('value', 'staff');
	
	if(type =='staff' ){
		con2_options4.setAttribute('selected', 'selected');
	}
	var optionText1 =  document.createTextNode("Singles");
	var optionText2 =  document.createTextNode("Doubles");
	var optionText3 =  document.createTextNode("Suites");
	var optionText4 =  document.createTextNode("Staff");
	con2_options1.appendChild(optionText1);
	con2_options2.appendChild(optionText2);
	con2_options3.appendChild(optionText3);
	con2_options4.appendChild(optionText4);
	
	//var elOptOld_1 = con2.options[con2.selectedIndex];  
	/*try {
      con2.options.add(con2_options1); // standards compliant; doesn't work in IE
    }
    catch(ex) {
        con2.appendChild(con2_options1); // IE only
	}
	
	try {
      con2.options.add(con2_options2); // standards compliant; doesn't work in IE
    }
    catch(ex) {
      con2.appendChild(con2_options2); // IE only
    }
	try {
      con2.options.add(con2_options3); // standards compliant; doesn't work in IE
    }
    catch(ex) {
      con2.appendChild(con2_options3); // IE only
    }
	try {
      con2.options.add(con2_options4); // standards compliant; doesn't work in IE
    }
    catch(ex) {
      con2.appendChild(con2_options4); // IE only
    }*/
	
	
    con2.appendChild(con2_options1); // IE only
	con2.appendChild(con2_options2); // IE only
    con2.appendChild(con2_options3); // IE only
    con2.appendChild(con2_options4); // IE only
    
	
	/*con2.options.add(con2_options2);
	con2.options.add(con2_options3);
	con2.options.add(con2_options4);*/
	var con3 = document.createElement('input');
	con3.setAttribute('name', 'ofroom_'+numRow);
	con3.setAttribute('type', 'text');
	con3.setAttribute('size', '5');
	con3.setAttribute('value', rooms);
	
	var con4 = document.createElement('input');
	con4.setAttribute('name', 'qutedrate_'+numRow);
	con4.setAttribute('type', 'text');
	con4.setAttribute('size', '5');
	
	var con5 = document.createElement('input');
	con5.setAttribute('name', 'stdgrprate_'+numRow);
	con5.setAttribute('type', 'text');
	con5.setAttribute('size', '5');
	
	var con6 = document.createElement('select');
	con6.setAttribute('name', 'option_'+numRow);
	var con6_options1 = document.createElement('option');
	con6_options1.setAttribute('value', 'Not Specified');
	var con6_options2 = document.createElement('option');
	con6_options2.setAttribute('value', '1st option');
	var con6_options3 = document.createElement('option');
	con6_options3.setAttribute('value', '2nd option');
	
	
	var optionstxt1 = document.createTextNode("Not Specified");
	var optionstxt2 = document.createTextNode("1st option");
	var optionstxt3 = document.createTextNode("2nd option");
	con6_options1.appendChild(optionstxt1);
	con6_options2.appendChild(optionstxt2);
	con6_options3.appendChild(optionstxt3);
	con6.appendChild(con6_options1);
	con6.appendChild(con6_options2);
	con6.appendChild(con6_options3);
	
	var con6_1 = document.createElement('input');
	con6_1.setAttribute('type', 'hidden');
	con6_1.setAttribute('name', 'date_'+numRow);
	con6_1.setAttribute('value', date_int);
	
	var con7 = document.createElement('button');
	con7.setAttribute('className', 'copy');
	con7.setAttribute('class', 'copy');
	con7.onclick =function(){copyRow(table.rows.length, date_room, date_int, type, rooms);};
	var con7_text = document.createTextNode('Copy');
	
	con7.appendChild(con7_text);
	
	cell1.appendChild(con1);
	cell2.appendChild(con2);
	cell3.appendChild(con3);
	cell4.appendChild(con4);
	cell5.appendChild(con5);
	cell6.appendChild(con6);
	cell6.appendChild(con6_1);
	cell7.appendChild(con7);
	
	row.appendChild(cell1);
	row.appendChild(cell2);
	row.appendChild(cell3);
	row.appendChild(cell4);
	row.appendChild(cell5);
	row.appendChild(cell6);
	row.appendChild(cell7);
	//var row = movetable.rows[rowSort].cloneNode(true);
	//table.appendChild(row);
	//alert(table);
	document.getElementById('rows_room').value = numRow;
	//alert(document.getElementById('rows_room').value)
}
