/* divs
details//default
geometry
fix_reveiws
customer_reviews
size_fit_guide

tabs are named the same but suffixed with _tab

tab and mode are exactly the same
*/

//variable to hold tabs/divs
var tabs = new Array();

//tabs.push('description'); //default - will always appear

//determine which tabs to show
function showTabs()
{
	//find data divs, if found add tabs to array
	if(document.getElementById("details")) {tabs.push('details');toggle('details');}
	if(document.getElementById("geometry"))  tabs.push('geometry');
	if(document.getElementById("fix_reveiws"))  tabs.push('fix_reveiws');
	if(document.getElementById("customer_reviews"))  tabs.push('customer_reviews');
	if(document.getElementById("size_fit_guide"))  tabs.push('size_fit_guide');
	
	//show tabs for found data divs
	for(t in tabs){
		document.getElementById(tabs[t]+"_tab").className = "product_menu_off";		
	}
	if (tabs.length>0)
	{
		document.getElementById(tabs[0]+"_tab").className = "product_menu_on";
	}
}

// toggle different divs to show/hide
//param: mode - name of the div/tab/section to display
function toggle(mode)
{		
	for(tab in tabs)
	{
		if(mode == tabs[tab])
		{
			//turn on tab
			document.getElementById(tabs[tab]+"_tab").className = "product_menu_on";
			//turn on div
			document.getElementById(tabs[tab]).className = "displayedDiv";
		}
		else
		{
			//turn off tab
			document.getElementById(tabs[tab]+"_tab").className = "product_menu_off";
			//turn off div
			document.getElementById(tabs[tab]).className = "hiddenDiv";
		}
	}
    return;
}

function draw_sku_option()
{
	if (product_var.length >= 1 ){
		if(product_var.length==1){
			document.write("<TD> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>");
			document.write("<TR VALIGN=TOP ><TD class=ProductAttrlabel></TD><TD>");
			document.write("&nbsp;" + product_var[0].attr_value1 + "</TD></TR>");
			document.write("<TR VALIGN=TOP ><TD class=ProductAttrlabel></TD><TD>");
			document.write("&nbsp;" + product_var[0].attr_value2 + "</TD></TR>");
			document.write("<TR><TD colspan=2>" + product_var[0].avail_msg + "</TD>");
			document.write("<INPUT TYPE=HIDDEN id=\"sku\" NAME=sku VALUE=\"" + product_var[0].sku + "\" >");
			document.write("</TR></TABLE></TD>");
		}else{	
			document.write("<TD> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>");
			document.write("<TR VALIGN=TOP ><TD class=ProductAttrlabel ><b>Select From:</b><br></TD></TR><TR><TD>");
			document.write("<SELECT class=ProductAttr NAME=sku  >");
			i=0;
			labelstr="";
			while (attr_label[i]!= "" && i < attr_values.length ) {
				labelstr=labelstr + attr_label[i] + " ";
				i++;
			}
			writeoption("",labelstr ,sel_values[0]);
			for (atn=0;atn< product_var.length ;atn++){
				if (useVariantPrice=="True"){
					if (on_sale=="True"){
						writeoption(product_var[atn].sku,(product_var[atn].attr_value1 + " - " + product_var[atn].attr_value2 + " - $"+ OKStrOfPenny(product_var[atn].price_sale)) + " - " + product_var[atn].avail_msg + "" ,sel_values[0]);
					}else{
						writeoption(product_var[atn].sku,(product_var[atn].attr_value1 + " - " + product_var[atn].attr_value2 + " - $"+ OKStrOfPenny(product_var[atn].price_list)) + " - " + product_var[atn].avail_msg + "" ,sel_values[0]);
					}
				}else{
					if (product_var[atn].avail_msg==""){
						product_var[atn].avail_msg="on back order";
					}
					writeoption(product_var[atn].sku,(product_var[atn].attr_value1 + " - " + product_var[atn].attr_value2) + " - " + product_var[atn].avail_msg + "",sel_values[0]);
				}
			}
			document.write("</SELECT></TD>");	
			document.write("</TR></TABLE></TD>");
		}
	}
} //end draw_sku_option