
function addRoomSelectionToLink(accType, link) 
{
    var table = document.getElementById("acc-room-list");
    var selectionString = null;

     //2 - Apartment
    if (accType != 2)
    {
        var ddlList = table.getElementsByTagName("SELECT");
         
        for (var i = 0; i < ddlList.length; i++) {
            
            if (ddlList[i].selectedIndex > 0)
            {
                var option = ddlList[i].options[ddlList[i].selectedIndex];
                
                if (selectionString != null)
                {
                    selectionString += "|" + option.value;
                }
                else 
                {
                    selectionString = option.value;
                }
            }       
        }
    }
    else 
    {
        var inputs = table.getElementsByTagName("INPUT");
        
        var i = 0;
         
        while (i < inputs.length && selectionString == null) {
            
            if (inputs[i].type == "radio" && inputs[i].checked)
            {
                selectionString = inputs[i].value;
            }
            
            i++;
        }
    }
    
    if (selectionString != null)
    {
        link.href = link.href.replace("BookStep2", "BookStep3") + "&AccRooms=" + selectionString;
    }
}
