
function isEnlargeImage(){
    document.getElementById('enlargeActivate').style.display = 'block';
}

function isZoomImage(){
    document.getElementById('zoomActivate').style.display = 'block';
    document.getElementById('imageLocation').onmouseout = function(){hideZoomImage(event)}
    document.getElementById('imageLocation').onmouseover = function(){showZoomImage(event)}
    document.getElementById('imageLocation').onmousemove = function(){displayOffsets(event)}
}

var activeImage;
function setActiveImage(name){
    activeImage = name;

    setEnlargeImage(name);

    var iurl = document.ProductForm.iurl.value;
    var ico = document.ProductForm.ico.value;

    var ei = new Image();
    ei.onload = isEnlargeImage;
    ei.src = iurl + "/oncirrus/" + ico + "/images/product/super/" + name;

    var zi = new Image();
    zi.onload = isZoomImage;
    zi.src = iurl + "/oncirrus/" + ico + "/images/product/zoom/" + name;
}

var attriboptions;
function setAttribOptions(o){
    attribOptions = o;
}

function setFinanceOption(fp, total, dp, da){

    var my_fd_obj = new FinanceDetails(fp, total, dp, da);
    document.getElementById('financeInstallment').innerHTML = my_fd_obj.m_inst;
    document.getElementById('monthlyPayment').innerHTML = my_fd_obj.m_inst;
    document.getElementById('cashPrice').innerHTML = my_fd_obj.goods_val;
    document.getElementById('depositToPay').innerHTML = my_fd_obj.d_amount;
    document.getElementById('loanAmount').innerHTML = my_fd_obj.l_amount;
    document.getElementById('loanRepayment').innerHTML = my_fd_obj.l_repay;
    document.getElementById('costOfLoan').innerHTML = my_fd_obj.l_cost;
    document.getElementById('totalAmountPayable').innerHTML = my_fd_obj.total;
    document.getElementById('numberMonthlyPayments').innerHTML = my_fd_obj.term;
    document.getElementById('apr').innerHTML = my_fd_obj.apr;
}

function showImage(id){
    document.getElementById(id).style.display = 'block';
}

function hideImage(id){
    document.getElementById(id).style.display = 'none';
}

function updateAttrib(node, pg, index){

    var j;
    var aa = document.ProductForm.attribs.value;
    var attribs = aa.split("@");

    if(index == 0){
        var a = document.ProductForm.attrib0.value;
        var as = a.split("~");

        if(a == 'select'){
            var io = aa.indexOf(ao0);
            if(io != -1)
                aa = aa.replace(ao0 + "@", '');
        }else{
            var found = false;
            for(j = 0; j < attribs.length; j++){
                var split = attribs[j].split("~");
                if(split[0] == as[0]){
                    aa = aa.replace(ao0 + "@", a + "@");
                    found = true;
                    break;
                }
            }

            if(!found)
                aa = aa + a + "@";
            ao0 = a;
        }
    }else if(index == 1){
        a = document.ProductForm.attrib1.value;
        as = a.split("~");

        if(a == 'select'){
            io = aa.indexOf(ao1);
            if(io != -1)
                aa = aa.replace(ao1 + "@", '');
        }else{
            found = false;
            for(j = 0; j < attribs.length; j++){
                split = attribs[j].split("~");
                if(split[0] == as[0]){
                    aa = aa.replace(ao1 + "@", a + "@");
                    found = true;
                    break;
                }
            }

            if(!found)
                aa = aa + a + "@";
            ao1 = a;
        }
    }else if(index == 2){
        a = document.ProductForm.attrib2.value;
        as = a.split("~");

        if(a == 'select'){
            io = aa.indexOf(ao2);
            if(io != -1)
                aa = aa.replace(ao2 + "@", '');
        }else{
            found = false;
            for(j = 0; j < attribs.length; j++){
                split = attribs[j].split("~");
                if(split[0] == as[0]){
                    aa = aa.replace(ao2 + "@", a + "@");
                    found = true;
                    break;
                }
            }

            if(!found)
                aa = aa + a + "@";
            ao2 = a;
        }
    }else if(index == 3){
        a = document.ProductForm.attrib3.value;
        as = a.split("~");

        if(a == 'select'){
            io = aa.indexOf(ao3);
            if(io != -1)
                aa = aa.replace(ao3 + "@", '');
        }else{
            found = false;
            for(j = 0; j < attribs.length; j++){
                split = attribs[j].split("~");
                if(split[0] == as[0]){
                    aa = aa.replace(ao3 + "@", a + "@");
                    found = true;
                    break;
                }
            }

            if(!found)
                aa = aa + a + "@";
            ao3 = a;
        }
    }else if(index == 4){
        a = document.ProductForm.attrib4.value;
        as = a.split("~");

        if(a == 'select'){
            io = aa.indexOf(ao4);
            if(io != -1)
                aa = aa.replace(ao4 + "@", '');
        }else{
            found = false;
            for(j = 0; j < attribs.length; j++){
                split = attribs[j].split("~");
                if(split[0] == as[0]){
                    aa = aa.replace(ao4 + "@", a + "@");
                    found = true;
                    break;
                }
            }

            if(!found)
                aa = aa + a + "@";
            ao4 = a;
        }
    }else if(index == 5){
        a = document.ProductForm.attrib5.value;
        as = a.split("~");

        if(a == 'select'){
            io = aa.indexOf(ao5);
            if(io != -1)
                aa = aa.replace(ao5 + "@", '');
        }else{
            found = false;
            for(j = 0; j < attribs.length; j++){
                split = attribs[j].split("~");
                if(split[0] == as[0]){
                    aa = aa.replace(ao5 + "@", a + "@");
                    found = true;
                    break;
                }
            }

            if(!found)
                aa = aa + a + "@";
            ao5 = a;
        }
    }else if(index == 6){
        a = document.ProductForm.attrib6.value;
        as = a.split("~");

        if(a == 'select'){
            io = aa.indexOf(ao6);
            if(io != -1)
                aa = aa.replace(ao6 + "@", '');
        }else{
            found = false;
            for(j = 0; j < attribs.length; j++){
                split = attribs[j].split("~");
                if(split[0] == as[0]){
                    aa = aa.replace(ao6 + "@", a + "@");
                    found = true;
                    break;
                }
            }

            if(!found)
                aa = aa + a + "@";
            ao6 = a;
        }
    }else if(index == 7){
        a = document.ProductForm.attrib7.value;
        as = a.split("~");

        if(a == 'select'){
            io = aa.indexOf(ao7);
            if(io != -1)
                aa = aa.replace(ao7 + "@", '');
        }else{
            found = false;
            for(j = 0; j < attribs.length; j++){
                split = attribs[j].split("~");
                if(split[0] == as[0]){
                    aa = aa.replace(ao7 + "@", a + "@");
                    found = true;
                    break;
                }
            }

            if(!found)
                aa = aa + a + "@";
            ao7 = a;
        }
    }else if(index == 8){
        a = document.ProductForm.attrib8.value;
        as = a.split("~");

        if(a == 'select'){
            io = aa.indexOf(ao8);
            if(io != -1)
                aa = aa.replace(ao8 + "@", '');
        }else{
            found = false;
            for(j = 0; j < attribs.length; j++){
                split = attribs[j].split("~");
                if(split[0] == as[0]){
                    aa = aa.replace(ao8 + "@", a + "@");
                    found = true;
                    break;
                }
            }

            if(!found)
                aa = aa + a + "@";
            ao8 = a;
        }
    }else if(index == 9){
        a = document.ProductForm.attrib9.value;
        as = a.split("~");

        if(a == 'select'){
            io = aa.indexOf(ao9);
            if(io != -1)
                aa = aa.replace(ao9 + "@", '');
        }else{
            found = false;
            for(j = 0; j < attribs.length; j++){
                split = attribs[j].split("~");
                if(split[0] == as[0]){
                    aa = aa.replace(ao9 + "@", a + "@");
                    found = true;
                    break;
                }
            }

            if(!found)
                aa = aa + a + "@";
            ao9 = a;
        }
    }

    document.ProductForm.attribs.value = aa;

    var q = document.ProductForm.quantity.value;
    doAjax("/Product.do?method=prodAttrib&n=" + node + "&g=" + pg + "&a=" + aa + "&i=" + activeImage + "&q=" + q + "&uid=" + new Date().getTime(), setProdAttrib);
}

function addToBasket(n, g){

    var c = document.ProductForm.code.value;
    var b = document.ProductForm.brand.value;
    var q = document.ProductForm.quantity.value;
    
    if(c.length == 0){
        alert(attribOptions);
    }else{
        doAjax("/Basket.do?method=add&n=" + n + "&g=" + g + "&c=" + c + "&q=" + q + "&b=" + b + "&uid=" + new Date().getTime(), setProductBasket);
        document.ProductForm.quantity.value = 1;
    }
}

function setProductBasket(){
    if(req.readyState == 4){
        if(req.status == 200){
            var response = req.responseText;
            if(response == 'SESSION'){
                window.location.reload();
            }else{
                var split = response.split("@@ebusiness@@");

                if(document.getElementById("basket-dtl"))
                    document.getElementById("basket-dtl").innerHTML = split[0];

                if(document.getElementById("basket-price"))
                    document.getElementById("basket-price").innerHTML = split[1];

                if(document.getElementById("basket-qty"))
                    document.getElementById("basket-qty").innerHTML = split[3];

                if(document.getElementById("addQty"))
                    document.getElementById("addQty").innerHTML = split[2];

                if(document.getElementById("addItems"))
                    document.getElementById("addItems").innerHTML = split[3];

                if(document.getElementById("addTotal"))
                    document.getElementById("addTotal").innerHTML = split[4];

                openAdd();
            }
        }
    }
}

function showAlt(id){
    if(document.getElementById('altItem0')){
        document.getElementById('altItem0').style.backgroundColor = '#FFFFFF';
        document.getElementById('altItem1').style.display = 'none';
    }

    if(document.getElementById('altImage0')){
        document.getElementById('altImage0').style.backgroundColor = '#FFFFFF';
        document.getElementById('altImage1').style.display = 'none';
    }

    if(document.getElementById('altProd0')){
        document.getElementById('altProd0').style.backgroundColor = '#FFFFFF';
        document.getElementById('altProd1').style.display = 'none';
    }

    document.getElementById(id + '0').style.backgroundColor = '#CCCCCC';
    document.getElementById(id + '1').style.display = 'block';
}

function showDesc(id, tab, tabs){

    for(i = 0; i <= tabs + 2; i++){

        if(document.getElementById('extra' + i))
            document.getElementById('extra' + i).style.backgroundImage = 'url(/oncirrus/system/titlebar.jpg)';

        if(document.getElementById('extraDetail' + i))
            document.getElementById('extraDetail' + i).style.display = 'none';
    }

    document.getElementById(tab).style.backgroundImage = 'url(/oncirrus/system/titlebarBack.jpg)';
    document.getElementById(id).style.display = 'block';
}

function showProdOption(name, code, node){
    var iurl = document.ProductForm.iurl.value;
    var ico = document.ProductForm.ico.value;

    document.getElementById('mainImage').src = iurl + "/oncirrus/" + ico + "/images/product/enlarge/" + name;
	changeImageOpac(0, 'mainImage', 50);
    setActiveImage(name);

    document.getElementById('addImage').src = iurl + "/oncirrus/" + ico + "/images/product/summary/" + name;

    selectProdOption(name, code, node);
}

var ao0, ao1, ao2, ao3, ao4, ao5, ao6, ao7, ao8, ao9;
function selectProdOption(name, code, node){
    var a = document.ProductForm.attribs.value;
    var q = document.ProductForm.quantity.value;

    doAjax("/Product.do?method=prodOption&n=" + name + "&c=" + code + "&o=" + node + "&a=" + a + "&q=" + q + "&uid=" + new Date().getTime(), setProdOption);
}

function setProdOption(){
    if(req.readyState == 4){
        if(req.status == 200){
            var response = req.responseText;
            if(response == 'SESSION'){
                window.location.reload();
            }else{
                var iurl = document.ProductForm.iurl.value;
                var ico = document.ProductForm.ico.value;

                var split = response.split("@@ebusiness@@");
                activeImage = split[0];
                document.getElementById('mainImage').src = iurl + "/oncirrus/" + ico + "/images/product/enlarge/" + split[0];
                document.getElementById('addImage').src = iurl + "/oncirrus/" + ico + "/images/product/summary/" + split[0];

                document.getElementById("attribOption").innerHTML = split[2];

                if(document.getElementById("detailOption"))
                    document.getElementById("detailOption").innerHTML = split[1];

                document.ProductForm.attribs.value = split[10];

                if(document.ProductForm.code.value.length > 0){
                    document.getElementById("prodTitle").innerHTML = split[4];
                    document.getElementById("addProdTitle").innerHTML = split[4];

                    if(document.getElementById("prodPrice"))
                        document.getElementById("prodPrice").innerHTML = split[5];

                    if(document.getElementById("prodPriceLower"))
                        document.getElementById("prodPriceLower").innerHTML = split[5];

                    if(document.getElementById("addDiscount"))
                        document.getElementById("addDiscount").innerHTML = split[8];

                    if(split[5] == 'Call for price'){
                        document.getElementById("callForPriceDiv").style.display = 'block';
                        document.getElementById("addToBasketDiv").style.display = 'none';
                    }else{
                        document.getElementById("callForPriceDiv").style.display = 'none';
                        document.getElementById("addToBasketDiv").style.display = 'block';
                    }

                    if(document.getElementById("stockLevel"))
                        document.getElementById("stockLevel").innerHTML = split[6];
                }else if(split[4].length > 0){
                    document.getElementById("prodTitle").innerHTML = split[4];
                    document.getElementById("addProdTitle").innerHTML = "<br/>" + split[4];

                    if(document.getElementById("prodPrice"))
                        document.getElementById("prodPrice").innerHTML = split[5];

                    if(document.getElementById("prodPriceLower"))
                        document.getElementById("prodPriceLower").innerHTML = split[5];

                    if(document.getElementById("addDiscount"))
                        document.getElementById("addDiscount").innerHTML = split[8];

                    if(document.getElementById("stockLevel"))
                        document.getElementById("stockLevel").innerHTML = split[6];
                }else{
                    document.getElementById("prodTitle").innerHTML = '';
                    document.getElementById("addProdTitle").innerHTML = '';

                    if(document.getElementById("stockLevel"))
                        document.getElementById("stockLevel").innerHTML = split[6];
                }

                if(split[7].length == 0){
                    ao0 = '';
                    ao1 = '';
                    ao2 = '';
                    ao3 = '';
                    ao4 = '';
                    ao5 = '';
                    ao6 = '';
                    ao7 = '';
                    ao8 = '';
                    ao9 = '';
                }else{
                    var k;
                    var s = split[7].split("@");
                    for(k = 0; k < s.length; k++){
                        if(s[k].length > 0){
                            var a = s[k].split("~");
                            if(a[0] == 0){
                                ao0 = a[1] + "~" + a[2];
                            }else if(a[0] == 1){
                                ao1 = a[1] + "~" + a[2];
                            }else if(a[0] == 2){
                                ao2 = a[1] + "~" + a[2];
                            }else if(a[0] == 3){
                                ao3 = a[1] + "~" + a[2];
                            }else if(a[0] == 4){
                                ao4 = a[1] + "~" + a[2];
                            }else if(a[0] == 5){
                                ao5 = a[1] + "~" + a[2];
                            }else if(a[0] == 6){
                                ao6 = a[1] + "~" + a[2];
                            }else if(a[0] == 7){
                                ao7 = a[1] + "~" + a[2];
                            }else if(a[0] == 8){
                                ao8 = a[1] + "~" + a[2];
                            }else if(a[0] == 9){
                                ao9 = a[1] + "~" + a[2];
                            }
                        }
                    }
                }

                setActiveImage(activeImage);
            }
        }
    }
}

function setProdAttrib(){
    if(req.readyState == 4){
        if(req.status == 200){
            var response = req.responseText;
            if(response == 'SESSION'){
                window.location.reload();
            }else{
                var iurl = document.ProductForm.iurl.value;
                var ico = document.ProductForm.ico.value;

                var split = response.split("@@ebusiness@@");

                if(split[0].length > 0){
                    activeImage = split[0];
                    document.getElementById('mainImage').src = iurl + "/oncirrus/" + ico + "/images/product/enlarge/" + split[0];
                    document.getElementById('addImage').src = iurl + "/oncirrus/" + ico + "/images/product/summary/" + split[0];
                }

                document.getElementById("attribOption").innerHTML = split[2];

                if(document.getElementById("detailOption"))
                    document.getElementById("detailOption").innerHTML = split[1];

                if(document.ProductForm.code.value.length > 0){
                    document.getElementById("prodTitle").innerHTML = split[4];
                    document.getElementById("addProdTitle").innerHTML = "<br/>" + split[4];

                    if(split[5] == 'Call for price'){
                        document.getElementById("callForPriceDiv").style.display = 'block';
                        document.getElementById("addToBasketDiv").style.display = 'none';
                    }else{
                        document.getElementById("callForPriceDiv").style.display = 'none';
                        document.getElementById("addToBasketDiv").style.display = 'block';
                    }

                    if(document.getElementById("stockLevel"))
                        document.getElementById("stockLevel").innerHTML = split[6];
                }else if(split[4].length > 0){
                    document.getElementById("prodTitle").innerHTML = split[4];
                    document.getElementById("addProdTitle").innerHTML = "<br/>" + split[4];

                    if(document.getElementById("stockLevel"))
                        document.getElementById("stockLevel").innerHTML = split[6];
                }else{
                    document.getElementById("prodTitle").innerHTML = '';
                    document.getElementById("addProdTitle").innerHTML = '';

                    if(document.getElementById("stockLevel"))
                        document.getElementById("stockLevel").innerHTML = split[6];
                }

                if(document.getElementById("prodPrice"))
                    document.getElementById("prodPrice").innerHTML = split[5];

                if(document.getElementById("prodPriceLower"))
                    document.getElementById("prodPriceLower").innerHTML = split[5];

                if(document.getElementById("addDiscount"))
                    document.getElementById("addDiscount").innerHTML = split[8];

                setActiveImage(activeImage);
            }
        }
    }
}

var mi;
var zi;
function showAltImage(name){
    var iurl = document.ProductForm.iurl.value;
    var ico = document.ProductForm.ico.value;

    document.getElementById('mainImage').src = iurl + "/oncirrus/" + ico + "/images/product/enlarge/" + name;
    changeImageOpac(0, 'mainImage', 50);
    clearTimeout(mi);
}

function showAltEnlargeImage(name){
    var iurl = document.ProductForm.iurl.value;
    var ico = document.ProductForm.ico.value;

    document.getElementById('mainEnlargeImage').src = iurl + "/oncirrus/" + ico + "/images/product/super/" + name;
    changeImageOpac(0, 'mainEnlargeImage', 50);
    document.getElementById('zoomSelect').style.display = "none";
    document.getElementById('mainZoomImage').style.display = "none";
    clearTimeout(zi);
}

function hideAltEnlargeImage(){
    zi = setTimeout("doEnlargeImageChange()", 500);
}

function hideAltImage(){
    mi = setTimeout("doMainImageChange()", 500);
}

function changeImageOpac(opacity, id, ms) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";

    if(opacity < 100)
        setTimeout("changeImageOpac(" + (opacity+10) + ",'" + id + "', " + ms + ")", ms);
}

function doMainImageChange(){
    var iurl = document.ProductForm.iurl.value;
    var ico = document.ProductForm.ico.value;

    document.getElementById('mainImage').src = iurl + "/oncirrus/" + ico + "/images/product/enlarge/" + getEnlargeImage();
    changeImageOpac(0, 'mainImage', 50);
}

function doEnlargeImageChange(){
    var iurl = document.ProductForm.iurl.value;
    var ico = document.ProductForm.ico.value;

    document.getElementById('zoomSelect').style.display = "block";
    document.getElementById('mainZoomImage').style.display = "block";
    document.getElementById('mainEnlargeImage').src = iurl + "/oncirrus/" + ico + "/images/product/super/" + getEnlargeImage();
    changeImageOpac(0, 'mainEnlargeImage', 50);
}

function selectFinanceExample(){
    var img = document.getElementById('financeExampleImage').src;
    if(img.endsWith('refineHiddenBlack.png')){
        document.getElementById('financeExampleImage').src = '/oncirrus/system/refineShowBlack.png';
        document.getElementById('financeExample').style.display = '';
    }else{
        document.getElementById('financeExampleImage').src = '/oncirrus/system/refineHiddenBlack.png';
        document.getElementById('financeExample').style.display = 'none';
    }
}

function recalcFinanceOption(total){

    var fp = document.ProductForm.financeLoanDetails.value;
    var dp = document.ProductForm.financeDeposit.value;

    doAjax("/Finance.do?method=change&c=" + fp + "&t=" + total + "&d=" + dp + "&uid=" + new Date().getTime(), setRecalcFinanceOption);
}

function setRecalcFinanceOption(){

    if(req.readyState == 4){
        if(req.status == 200){
            var response = req.responseText;
            if(response == 'SESSION'){
                window.location.reload();
            }else{
                var split = response.split("@@ebusiness@@");

                document.getElementById('depositRange').innerHTML = split[0];

                var fp = document.ProductForm.financeLoanDetails.value;
                var dp = document.ProductForm.financeDeposit.value;
                var da = Math.ceil((dp / 100) * parseFloat(split[1]) * 100)/100;

                var my_fd_obj = new FinanceDetails(split[2], parseFloat(split[1]), parseInt(dp), parseFloat(da));
                document.getElementById('financeInstallment').innerHTML = my_fd_obj.m_inst;
                document.getElementById('monthlyPayment').innerHTML = my_fd_obj.m_inst;
                document.getElementById('cashPrice').innerHTML = my_fd_obj.goods_val;
                document.getElementById('depositToPay').innerHTML = my_fd_obj.d_amount;
                document.getElementById('loanAmount').innerHTML = my_fd_obj.l_amount;
                document.getElementById('loanRepayment').innerHTML = my_fd_obj.l_repay;
                document.getElementById('costOfLoan').innerHTML = my_fd_obj.l_cost;
                document.getElementById('totalAmountPayable').innerHTML = my_fd_obj.total;
                document.getElementById('numberMonthlyPayments').innerHTML = my_fd_obj.term;
                document.getElementById('apr').innerHTML = my_fd_obj.apr;
            }
        }
    }
}

function showDesc(path){

    if(document.getElementById('prod-desc-middle'))
        document.getElementById('prod-desc-middle').style.backgroundImage = "url('" + path + "product-tab-green.png')";
    if(document.getElementById('prod-desc-detail'))
        document.getElementById('prod-desc-detail').style.display = "block";

    for(i = 0; i < 20; i++){
        if(document.getElementById('prod-extra-middle-' + i))
            document.getElementById('prod-extra-middle-' + i).style.backgroundImage = "url('" + path + "product-tab-grey.png')";
        if(document.getElementById('prod-extra-detail-' + i))
            document.getElementById('prod-extra-detail-' + i).style.display = "none";
    }

    if(document.getElementById('prod-spec-middle'))
        document.getElementById('prod-spec-middle').style.backgroundImage = "url('" + path + "product-tab-grey.png')";
    if(document.getElementById('prod-spec-detail'))
        document.getElementById('prod-spec-detail').style.display = "none";
}

function showExtra(id, path){

    if(document.getElementById('prod-desc-middle'))
        document.getElementById('prod-desc-middle').style.backgroundImage = "url('" + path + "product-tab-grey.png')";
    if(document.getElementById('prod-desc-detail'))
        document.getElementById('prod-desc-detail').style.display = "none";

    for(i = 0; i < 20; i++){
        if(i == id){
            if(document.getElementById('prod-extra-middle-' + i))
                document.getElementById('prod-extra-middle-' + i).style.backgroundImage = "url('" + path + "product-tab-green.png')";
            if(document.getElementById('prod-extra-detail-' + i))
                document.getElementById('prod-extra-detail-' + i).style.display = "block";
        }else{
            if(document.getElementById('prod-extra-middle-' + i))
                document.getElementById('prod-extra-middle-' + i).style.backgroundImage = "url('" + path + "product-tab-grey.png')";
            if(document.getElementById('prod-extra-detail-' + i))
                document.getElementById('prod-extra-detail-' + i).style.display = "none";
        }
    }

    if(document.getElementById('prod-spec-middle'))
        document.getElementById('prod-spec-middle').style.backgroundImage = "url('" + path + "product-tab-grey.png')";
    if(document.getElementById('prod-spec-detail'))
        document.getElementById('prod-spec-detail').style.display = "none";
}

function showSpec(path){

    if(document.getElementById('prod-desc-middle'))
        document.getElementById('prod-desc-middle').style.backgroundImage = "url('" + path + "product-tab-grey.png')";
    if(document.getElementById('prod-desc-detail'))
        document.getElementById('prod-desc-detail').style.display = "none";

    for(i = 0; i < 20; i++){
        if(document.getElementById('prod-extra-middle-' + i))
            document.getElementById('prod-extra-middle-' + i).style.backgroundImage = "url('" + path + "product-tab-grey.png')";
        if(document.getElementById('prod-extra-detail-' + i))
            document.getElementById('prod-extra-detail-' + i).style.display = "none";
    }

    if(document.getElementById('prod-spec-middle'))
        document.getElementById('prod-spec-middle').style.backgroundImage = "url('" + path + "product-tab-green.png')";
    if(document.getElementById('prod-spec-detail'))
        document.getElementById('prod-spec-detail').style.display = "block";
}

