﻿
function showhideTabs(tabname) {
    var tabContainer = document.getElementById('boxContainer');
	var tabs = new Array();
	var activeTab;
	tabs = tabContainer.getElementsByTagName('div');	
	for (var i = 0; i < tabs.length; i++) {
	    if (tabs[i].id != tabname) {
	        if (tabs[i].id.indexOf('box') == 0) {
	            tabs[i].style.visibility = 'hidden';
	            tabs[i].style.display = 'none';
	        }
	    }
        else {
            tabs[i].style.visibility = 'visible';
            tabs[i].style.display = 'block';
            activeTab = document.getElementById(tabs[i].id);
        }	    
	}
	//tabContainer.style.height = activeTab.offsetHeight + 10;
//	if (navigator.appName != 'Netscape') {
//	    tabContainer.style.width = activeTab.offsetWidth + 10;
//	}
	return false;
}
function updatePrices(colorSurcharge,sizesSurcharge,pricingTab) {
    //alert(colorSurcharge);
    var pricingTable = document.getElementById("pricingTable");
    var origPrices = document.getElementById("divProdPrices").innerHTML;
    var prodPrice = new Array();
    prodPrice = origPrices.split(";");
    var prices = new Array();
    prices = pricingTable.rows[1].cells;
    for (var i = 1; i < prices.length; i++) {
        var currPrice = parseFloat(prodPrice[i]);
        var colorPrice = 0
        if (sizesSurcharge != null) {
           colorPrice = currPrice + parseFloat(colorSurcharge) + parseFloat(sizesSurcharge);
        }
        else {
            colorPrice = currPrice + parseFloat(colorSurcharge);
        }
        colorPrice = roundNumber(colorPrice, 2);
//        var cents = "";
//        var currency = "";
//        if (colorPrice.toString().indexOf(".") > 0) {
//            cents = colorPrice.toString().substring(colorPrice.toString().indexOf('.'), colorPrice.toString().length);
//            if (cents.length < 3) {
//                cents = cents + "0";
//                currency = colorPrice.toString().substr(0, colorPrice.toString().indexOf('.')) + cents;
//            }
//        }
//        else {
//            cents = ".00";
//            currency = colorPrice.toString() + cents;
//        }       
        prices[i].innerHTML = "$" + colorPrice;
        
    }
}
function roundNumber(num, dec) {
    var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
    return result;
}
