﻿function ChangeAttrG(oid1){document.getElementById('attrg1').className='vis2';document.getElementById('attrg2').className='vis2';document.getElementById('attrg3').className='vis2';document.getElementById('attrg6').className='vis2';document.getElementById('attrg7').className='vis2';document.getElementById(oid1).className='vis1';}
/****************************** Change Price *******************************/
function ChangeShapRules(opriceid, oqtyid, ototalid, oshapid, oOldPriceid, oOldtotalid,oshaprulesid)
{
    var oSel = document.getElementById(oshapid);
    var oprice = document.getElementById(opriceid);
    oprice.value = oSel.options[oSel.selectedIndex].title;
    document.getElementById(oshaprulesid).value = oSel.value;
    ChangeQty(opriceid, oqtyid, ototalid, oOldPriceid, oOldtotalid);
}

function ChangeQty(opriceid, oqtyid, ototalid, oOldPriceid, oOldtotalid)
{
    var oprice = document.getElementById(opriceid);
    var oqty = document.getElementById(oqtyid);
    var olab = document.getElementById(ototalid);
    var price = oprice.value;
    var qty = oqty.value;
    olab.innerHTML = to2bits(price * qty);
    
    var olab2 = document.getElementById(oOldtotalid);
    if (olab2 != null)
    {
        var oldprice = document.getElementById(oOldPriceid).value;
        olab2.innerHTML = to2bits(oldprice * qty);
    }
}

// Float数据四舍五入到2位小数; 
function to2bits(flt) 
{ 
    if(parseFloat(flt) == flt) 
        return Math.round(flt * 100) / 100; 
        // 到4位小数, return Math.round(flt * 10000) / 10000; 
    else 
        return 0; 
} 
/****************************** Change Price *******************************/
/****************************** Change Long *******************************/
function ChangeLong(oImgId, oDivId, index)
{
    for(i=1;i<=6;i++)
    {
        document.getElementById("longimg"+i.toString()).src = "/Media/images/pro/long"+i.toString()+".gif";
        document.getElementById("longdesc"+i.toString()).className = "plusnone";
    }
    document.getElementById(oImgId).src = "/Media/images/pro/long"+index+".gif";
    document.getElementById(oDivId).className = "plusview";
}
/****************************** Change Long *******************************/