/////////////////////////////////////////////////////////////////////////////////////
// JavaScript Document
/////////////////////////////////////////////////////////////////////////////////////
function SwapImage(layer,imgName,imgObj) {
	if (document.images) {
	if (document.layers && layer!=null) eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src')
	else document.images[imgName].src = eval(imgObj+".src")
	}
}
/////////////////////////////////////////////////////////////////////////////////////
function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function rollOvr(currentColor,normalColor_a, overColor_a, normalColor_rgb, overColor_rgb)	{
	var NOTFOUND = -1;
	var normalColor = "" ;
	var overColor = "" ;
	if ((is_ie || is_opera) && (currentColor.indexOf("#") != NOTFOUND))	{
		normalColor = normalColor_a;
		overColor = overColor_a ;
	}	else if (currentColor.indexOf('rgb') != NOTFOUND)	{
		normalColor = normalColor_rgb ;
		overColor = overColor_rgb ;
	}
	return (currentColor == normalColor) ? overColor : normalColor ;
}
function rollOvrMainM(dis)	{
	dis.style.backgroundColor=rollOvr(dis.style.backgroundColor,"#ffffff", "#e7e7e7", "rgb(255, 255, 255)", "rgb(231, 231, 231)");
	dis.firstChild.style.color=rollOvr(dis.firstChild.style.color,"#666666", "#ee1c23", "rgb(102, 102, 102)", "rgb(238, 28, 35)");
}

function rollOvrSubM(dis, imgName)	{
	dis.style.backgroundImage="url(" + imgName + ")"
	dis.firstChild.style.color=rollOvr(dis.firstChild.style.color,"#666666", "#ee1c23", "rgb(102, 102, 102)", "rgb(238, 28, 35)");
}
function rollOvrSubM_Hm(dis, imgName)	{
	dis.style.backgroundImage="url(" + imgName + ")";
	dis.firstChild.style.color=rollOvr(dis.firstChild.style.color,"#666666", "#47309f", "rgb(102, 102, 102)", "rgb(71, 48, 159)");
}
function initTab(tabId)	{

	var tabElement = top.document.getElementById(tabId);

	rollOvrSubM_Hm(tabElement, '_gfx/tabBgnd_Hm_Blu.jpg');

	if (is_ie || is_opera)	{
		tabElement.onmouseover='';
		tabElement.onmouseout='';
 //		s='';for(ii in tabElement.children[0].attributes) s+=ii+':'+tabElement.children[0].attributes[ii]+'\t';  alert(s);
		tabElement.children[0].href="";
		tabElement.children[0].style.color="#47309f";
	}	else	{
		var ELEMENT_NODE = 1;
		var ATTRIBUTE_NODE = 2;
		if ((tabElement.nodeType == ELEMENT_NODE) && (tabElement.attributes.length >= 2))	{
			tabElement.setAttribute('onmouseover','');
			tabElement.setAttribute('onMouseout','');
			if (tabElement.hasChildNodes() && tabElement.firstChild.nodeName=='A' )	{
				tabElement.firstChild.removeAttribute('href');
				tabElement.firstChild.style.color = "rgb(71, 48, 159)";
			}
		}
//		alert( 'nodeName='+tabElement.nodeName + '   nodeValue=' + tabElement.nodeValue + '  nodeType=' + tabElement.nodeType + '  attributes='+tabElement.attributes.length + '  EN='+ELEMENT_NODE);
	}
	// All tabs should be tested for reset - only one will actually need to be
	resetTab( tabElement, top.document.getElementById('tabVision'), 'vision_products.html') ;
	resetTab( tabElement, top.document.getElementById('tabAPI'), 'api_products.html') ;
	resetTab( tabElement, top.document.getElementById('tab1394'), '1394_products.html') ;
	resetTab( tabElement, top.document.getElementById('tabStorage'), 'storage_products.html') ;
	resetTab( tabElement, top.document.getElementById('tabConsumer'), 'consumer_products.html') ;
}
function resetTab( currentElement, resetElement, href)	{

	//	Do not reset the tab wich was just selected
	if (currentElement.getAttribute('id') == resetElement.getAttribute('id') ) return;

	if (is_ie || is_opera)	{
		if (resetElement.children[0].href=="")	{
			resetElement.onmouseover="rollOvrSubM_Hm(this, '_gfx/tabBgnd_Hm_Blu.jpg');";
			resetElement.onmouseout="rollOvrSubM_Hm(this, '_gfx/tabBgnd_Hm.jpg');";
			resetElement.children[0].href=href;
			rollOvrSubM_Hm(resetElement, '_gfx/tabBgnd_Hm.jpg');
		}
	}	else	{	//	non-Internet Explorer
		if (resetElement.firstChild.getAttribute("href")==null)	{	// if tab being checked needs re-set, then do so
			resetElement.setAttribute("onmouseover","rollOvrSubM_Hm(this, '_gfx/tabBgnd_Hm_Blu.jpg');");
			resetElement.setAttribute("onMouseout","rollOvrSubM_Hm(this, '_gfx/tabBgnd_Hm.jpg');");
			resetElement.firstChild.setAttribute("href", href);
			rollOvrSubM_Hm(resetElement, '_gfx/tabBgnd_Hm.jpg');
		}
	}
}
function ShowHide(divId)	{
	var id = document.getElementById(divId);
	if (id.style.display == "none")		{
		id.style.display = "block";;
	}	else	{
		id.style.display = "none";
	}
}

function ShowHideAll(show)	{
	var divs = document.getElementsByTagName("div");
	for (var ii = 0; ii < divs.length; ii++)	{
		var divId = divs[ii].id;
		if ( divId.indexOf("a_") == 0 )		{
//		alert(divs[ii].id + "   " + (show == true));
			if( show == true ) {
				eval("document.getElementById('" + divId + "').style.display = 'block'");
			} else {
				eval("document.getElementById('" + divId + "').style.display = 'none'");
			}
		}
	}
}

function ToggleAnswers() {

	if( document.getElementById("Toggle").firstChild.nodeValue == "hide") {
//			alert(document.getElementById("Toggle").firstChild.nodeValue);
			ShowHideAll(false);
			document.getElementById("Toggle").firstChild.nodeValue = "show";
//			alert(document.getElementById("Toggle").firstChild.nodeValue);
		} else {
//			alert(document.getElementById("Toggle").firstChild.nodeValue);
			ShowHideAll(true);
			document.getElementById("Toggle").firstChild.nodeValue = "hide";
//			alert(document.getElementById("Toggle").firstChild.nodeValue);
		}
}

function mmLnk(account) {
	document.write("<a href='&#109;&#097;&#105;&#108;to&#58;"+account+"&#064;&#117;&#110;&#105;&#098;&#114;&#097;&#105;&#110;&#046;&#099;&#111;&#109;' onfocus='this.blur();'>"+account+"&#064;&#117;&#110;&#105;&#098;&#114;&#097;&#105;&#110;&#046;&#099;&#111;&#109;</a>");
}
function mmTabLnk(lnkId,account) {
	document.getElementById(lnkId).href=document.getElementById(lnkId).href.replace('a1',account);
	document.getElementById(lnkId).href=document.getElementById(lnkId).href.replace('yewnee','unibrain.com');
}

