isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

function getObj(m)
{
    if (isNS4) {
        elm = document.layers[m];
    } else if (isIE4) {
        elm = document.all[m];
    } else if (isIE5 || isNS6) {
        elm = document.getElementById(m);
    }
    return elm;
}

//Form error handling
function displayDesc(strmsg)
{
    helpWnd = window.open('','','top=150,left=150,width=500,height=450');
    if (!helpWnd.opener) helpWnd.opener = self;
    with (helpWnd.document)
    {
        write('<html>\n');
        write('<head><title>Form Help</title></head>\n');
        write('<body>\n');
        write('<table border="0" height="100%" width="100%">\n<tr><td valign="top">\n');
        write('<p style="font-weight: bold">Listed below is a list of errors that were encountered while processing your form</p>\n');
        write(strmsg);
        write('\n<br><br>\n');
        write('\n</td></tr><tr><td VALIGN="BOTTOM">\n');
        write('<hr />\n');
        write('click <a href="javascript:window.close();">here</a> to close this window\n');
        write('</td></tr>\n</table>\n');
        write('</body>\n</html>\n');
    }
}

//Form functions
function copyBillingInfo()
{
    //Get data from billing
    sName = getObj('bname').value
    sAddr1 = getObj('baddr1').value
    sAddr2 = getObj('baddr2').value
    sCity = getObj('bcity').value
    sState = getObj('bstate').value
    sZip = getObj('bzip').value
    
    //Set shipping data
    getObj('sname').value = sName
    getObj('saddr1').value = sAddr1
    getObj('saddr2').value = sAddr2
    getObj('scity').value = sCity
    getObj('sstate').value = sState
    getObj('szip').value = sZip
}

function confirmDelete()
{
    //
    if(agree=confirm("Are you sure you wish to delete this item?")) {
        return true;
    } else {
        return false;
    }
    
}

function cancelOrder()
{
    //
    if(agree=confirm("Are you sure you wish to cancel this order?")) {
        return true;
    } else {
        return false;
    }

}

