﻿var sysCum=new Object();

sysCum.refTotal=function()
{
   sysCum.getPrice(-sysId,null,sysCum.getOpList());
}
sysCum.addCart=function(sysId,btn)
{
    shopCart.add(-sysId,btn,sysCum.getOpList());
    return;
}
sysCum.getOpList=function()
{
    var op=[];
    $(".sysopt").each(
        function()
        {
           var c=$(this).val();
           if(typeof(c)=="string")
           {
               c=c.split("|");
               op.push(c[0]);
           }
        }
    );
    return op.join(',');
}

sysCum.getPrice=function(itemId,btn,other)
{
    qty=1;
    adInput(false);
    $.post('/ajax.aspx', 
    {'ajaxcmd':'AddSPCart','item': itemId,"qty":qty,"oth":other,"getprice":"1"}, 
    function(json) {
        adInput(true);
        sysCum.getPriceHandler(json,qty,itemId,other);
    });    
}

sysCum.getPriceHandler=function(json,qty,itemId,other)
{
    json="var result="+json;
    eval(json);
    t=parseFloat(result["Msg"]);
    $("input[name='tpexl']").val(t.toFixed(2));
    $("input[name='tpinc']").val((t+t*10/100).toFixed(2));
}
