/***************************************************************************************************************************************/
//    Routines for working with the quote forms on kelticwindows.com
// 
//    (c) 2008 3legs ltd. (roman@3legs.com)
/**************************************************************************************************************************************/


function add_row (window_style) {
       
    clone_first_row('info_table', window_style);

}

/**************************************************************************************************************************************/

function clone_first_row (table_id, style) {
    
    //Do the row clone
    var tblBody = document.getElementById(table_id).tBodies[0];
    var newNode = tblBody.rows[0].cloneNode(true);

    //Attach this new node into the table
    //I would rather do this at the end, but ie 6 will not give the cells.length a value until it is attached
    tblBody.appendChild(newNode);

    //Clear any data that was copied
    for (var i=0; i<=newNode.cells.length - 1; i++) { //Itterate over each cell
        var cell = newNode.cells[i];
        var form_control = cell.firstChild;
                
        if (form_control.type == 'text') {
            form_control.value = '';
        }
        
        if (form_control.name == 'style') {
            form_control.value = style;
        }
    }
    
    //Make the new row visible
    newNode.style.display = '';
    
}

/**************************************************************************************************************************************/

function remove_row (remove_button) {
    
    var this_row = remove_button.parentNode.parentNode;
    
    this_row.parentNode.removeChild(this_row);
    
}

/**************************************************************************************************************************************/
