// JavaScript Document
/*
function deleteRow(rows)
{
alert(document.getElementById("row"+rows).innerHTML);
document.getElementById("row"+rows).innerHTML="<td> abra dabrea </td>";
}
*/
function getGender(product_id,tag_id,rows)
{	
    new Ajax.Updater(tag_id, 'ajaxreturn', {
                               method: 'get',
                               parameters: {action: 1, product: document.getElementById(product_id).value, row: rows}
                               });
 
}

function getSize(product_id,tag_id,rows)
{
    //alert("i have ="+product_id+"and this"+tag_id);
    new Ajax.Updater(tag_id, 'ajaxreturn', {
                               method: 'get',
                               parameters: {action: 2, product: document.getElementById(product_id).value, row: rows}
                               });
}


function getQty(product_id, product_size, tag_id, rows)
{
  //alert("i have ="+product_id+"and this"+tag_id);
  new Ajax.Updater(tag_id, 'ajaxreturn', {
                               method: 'get',
                               parameters: {action: 3, product: document.getElementById(product_id).value, size: document.getElementById(product_size).value, row: rows}
                               });

}

function newRow()
{
    $('quick_order_progressbar').show();
    $('quick_order_empty_row').hide();

    new Ajax.Updater('quick_order_row', 'ajaxreturn',{
                              method: 'get',
                              parameters: {action: 4,row_n:row},
                              insertion: Insertion.Bottom,
                              onComplete: function(){
                                  $('quick_order_progressbar').hide();
                              }

                              });
    row++;
}

function quick_order_validation(container,form,store_path)
{
    $$('.fieldError').each(function(element){ element.removeClassName('fieldError'); });
    new Ajax.Updater(container, '/' + store_path + '/store/quickorder',{
                                method:'post',
                                parameters: Form.serialize(form),
                                evalScripts:true,
                                asynchronous:false,
                                onComplete: function(transport){
                                    var response = $('quickOrderResponse').value;
                                    if(response.match(/ok/))
                                    {
                                        setTimeout("location.replace('/" + store_path + "/store/cart')",0000);
                                    }
                                }
    });
}
function removeQuickRow(removeClass)
{
    $$(removeClass).invoke('remove');
    if( $('quick_order_row').empty())
    {
        $('quick_order_empty_row').show();
    }
}


