// JavaScript Document

// preLoadRollovers()

	pic1= new Image(); 
	pic1.src="images/top_button_hover.png"; 
	pic2= new Image(); 
	pic2.src="images/sidebutton3.png"; 

var pageFlag = 0;

var prodCat = new Array();
var prodData = new Array();
var pCat = 0;
var pID = 0;

// productCategory[ID] = "menu name, product IDs to show"
prodCat[1]	= ["video", 1,2 ];
prodCat[2] 	= ["audio", 3,4,5 ];
prodCat[3]	= ["control", 6,7,8,9 ];

// productData[ID] = "menu name, pageURL"
prodData[1]	= ["VIDEOWARP",	"videowarp.htm"];
prodData[2]	= ["VIDEOBOX-HD","videobox-hd.htm"];
prodData[3]	= ["AudioCARD",	"audiocard.htm"];
prodData[4]	= ["AmpCARD20",	"ampcard20.htm"];
prodData[5]	= ["APLAYER II",	"aplayer2.htm"];
prodData[6]	= ["ANCOS",	"ancos.htm"];
prodData[7]	= ["CLICKBOX II",	"clickbox.htm"];
prodData[8]	= ["TOUCH-1 THING",	"touch-1thing.htm"];
prodData[9]	= ["X-THING",	"x-thing.htm"];

//NOTE for 'product comming soon' link, use noproduct.htm

function buildProductNavigator()
{
	codeString = "&nbsp;&nbsp;products<div id='prodCat' class='rangeSelector'>";
	
	for(n=1;n<4;n++)
	{
		codeString = codeString + "<span id='cat" + n + "' onMouseOver='showCat(" + n + ")'>" + prodCat[n][0] +"</span>";
		if(n<3)
		{
			codeString = codeString + " | ";
		}
		else
		{
			codeString = codeString + "</div>";
		}
	}
	
	for(n=1;n<4;n++)
	{
		codeString = codeString + "<div id='" + prodCat[n][0] +"products' style='display:none'>";
		
		for(x=1;x<prodCat[n].length;x++)
		{
			prodID = prodCat[n][x];
			//alert(prodData[prodID][0]);
			
			codeString = codeString + "<div id='product" + n + prodID + "' class='productSelector' onMouseOver='prodSelect(this)' onMouseOut='prodDeSelect(this)' onMouseDown=prodSelect(this,'" + prodData[prodID][1] + "?cat=" + n + "&id=" + prodID + "')>" + prodData[prodID][0] + "</div> ";
		}
		
		codeString = codeString + "</div>";
	}
	codeString = codeString + "<img src='images/sidebutton5.png'>";
	//alert(codeString);
	document.getElementById("sb_products").innerHTML = codeString;
}

function initPage()
{
	buildProductNavigator();
	if(pCat==0) return;
	showCat(pCat);
	document.getElementById("product" + pCat + pID).style.backgroundImage = "url(images/prodsel_bk.png)";
	document.getElementById("product" + pCat + pID).style.color = "#FFFFFF";
}


var pageFlag = 0;

function prodSelect(button,url)
{

	//window.event.cancelBubble = true;
	//event.stopPropagation();
	//document.getElementById(button.id).style.backgroundImage = "url(images/prodsel_bk.png)";
	document.getElementById(button.id).style.color = "#FFFFFF";
	
	if(url)
	{
		location.href = url;
		pageFlag = 1;
	}
	
}

function prodDeSelect(button)
{
	//document.getElementById(button.id).style.backgroundImage = "url()";
	document.getElementById(button.id).style.color = "#333366";
	//document.getElementById("product" + pCat + pID).style.backgroundImage = "url(images/prodsel_bk.png)";
	document.getElementById("product" + pCat + pID).style.color = "#FFFFFF";

}


function showCat(mode)
{

	if(mode==1) //video products
	{
	document.getElementById("videoproducts").style.display = "inline";
	document.getElementById("audioproducts").style.display = "none";
	document.getElementById("controlproducts").style.display = "none";
	document.getElementById("cat1").style.color = "#FFFFFF";
	document.getElementById("cat2").style.color = "#333366";
	document.getElementById("cat3").style.color = "#333366";
	}
	if(mode==2) //audio products
	{
	document.getElementById("videoproducts").style.display = "none";
	document.getElementById("audioproducts").style.display = "inline";
	document.getElementById("controlproducts").style.display = "none";
	document.getElementById("cat1").style.color = "#333366";
	document.getElementById("cat2").style.color = "#FFFFFF";
	document.getElementById("cat3").style.color = "#333366";
	}
	if(mode==3) //control products
	{
	document.getElementById("videoproducts").style.display = "none";
	document.getElementById("audioproducts").style.display = "none";
	document.getElementById("controlproducts").style.display = "inline";
	document.getElementById("cat1").style.color = "#333366";
	document.getElementById("cat2").style.color = "#333366";
	document.getElementById("cat3").style.color = "#FFFFFF";
	}
	if(pCat==0)
	{
		if(mode==1) //video products
		{
		document["videoIcon"].src = "images/icon_VideoDevices.png";
		document["audioIcon"].src = "images/icon_AudioDevices2.png";
		document["controlIcon"].src = "images/icon_ControlDevices2.png";
		document.getElementById("videoText").style.display = "inline";
		document.getElementById("audioText").style.display = "none";
		document.getElementById("controlText").style.display = "none";
		}
		if(mode==2) //audio products
		{
		document["videoIcon"].src = "images/icon_VideoDevices2.png";
		document["audioIcon"].src = "images/icon_AudioDevices.png";
		document["controlIcon"].src = "images/icon_ControlDevices2.png";
		document.getElementById("videoText").style.display = "none";
		document.getElementById("audioText").style.display = "inline";
		document.getElementById("controlText").style.display = "none";
		}
		if(mode==3) //control products
		{
		document["videoIcon"].src = "images/icon_VideoDevices2.png";
		document["audioIcon"].src = "images/icon_AudioDevices2.png";
		document["controlIcon"].src = "images/icon_ControlDevices.png"
		document.getElementById("videoText").style.display = "none";
		document.getElementById("audioText").style.display = "none";
		document.getElementById("controlText").style.display = "inline";
		}
	}
}

function showIcon(mode)
{
	showCat(mode);
	
	

}


function sb_press(button,mode)
{
	if(pageFlag==1) return;
	var buttonID = button.id;
	var newPage = buttonID.substring(3);
	
	switch(mode) {
		case 1:
	 	if (newPage == pageRoot){break;}
		document.getElementById(buttonID).className = "sidebar_button_hover";
		break;
		case 2:
		if (newPage == pageRoot){break;}
	 	document.getElementById(buttonID).className = "sidebar_button_deselect";
		break;
		case 3:
	 	document.getElementById(buttonID).className = "sidebar_button_deselect";
		newPage = buttonID.substring(3) + ".htm";
		location.href = newPage;
		break;
	 }
}

function tb_press(button,mode)
{
	var buttonID = button.id;
	var newPage = buttonID.substring(3);
	
	switch(mode) {
		case 1:
	 	if (newPage == pageRoot){break;}	
		document.getElementById(buttonID).className = "top_button_hover";
		break;
		case 2:
		if (newPage == pageRoot){break;}
	 	document.getElementById(buttonID).className = "top_button_deselect";
		break;
		case 3:
	 	document.getElementById(buttonID).className = "top_button_deselect";
		newPage = buttonID.substring(3) + ".htm";
		location.href = newPage;
		break;
	 }
}


