//global scope variables
var _active = 0;

w3c = (document.getElementById)? true:false;
if (w3c) {
	ns4 = false;
	ie4 = false;
}
else if (!w3c) {
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
}

var hideMenu = null;
var hideCountries = null;

if (w3c || ie4 || ns4) 	browserOK = true;


//load graphics
pixLoaded = false

function loadPix() {
		if (browserOK) {
		pixLoaded = true;

		theImg = new Array();
		theImgName = new Array();
		
		for(i=0; i<=11; i++) {
			theImg[i] = new Image();
		}
		
		theImg[0].src= "/img/menu/products.gif";
		theImg[1].src= "/img/menu/products_on.gif";
		theImgName[0] = "products";
		theImgName[1] = "products_on";
		theImg[2].src= "/img/menu/downloads.gif";
		theImg[3].src= "/img/menu/downloads_on.gif";
		theImgName[2] = "downloads";
		theImgName[3] = "downloads_on";
		theImg[4].src= "/img/menu/buy.gif";
		theImg[5].src= "/img/menu/buy_on.gif";
		theImgName[4] = "buy";
		theImgName[5] = "buy_on";
		theImg[6].src= "/img/menu/contacts.gif";
		theImg[7].src= "/img/menu/contacts_on.gif";
		theImgName[6] = "contacts";
		theImgName[7] = "contacts_on";
		
		
		//product menu 
		theImg[8].src= "/img/menu/p_hdd.gif";
		theImg[9].src= "/img/menu/p_hdd_on.gif";
		theImg[10].src= "/img/menu/p_dvd.gif";
		theImg[11].src= "/img/menu/p_dvd_on.gif";

        // if add -> change size of array in for cycle
		
		//support menu 
		}		
}

function no_dhtml_rollover(buttonName, imgIndex){
	if (pixLoaded && !ns4) { 
		thePix = "document." + buttonName + ".src = theImg[" + imgIndex + "].src"
		eval(thePix)
	}
}
 
function rollon(buttonName,imgIndex) { 	
	if (pixLoaded && !ns4) { 
		reset();
		clearTimeout(hideMenu);
		thePix = "document." + buttonName + ".src = theImg[" + imgIndex + "].src";
		eval(thePix);
	}
}

function rolloff(){
	if (!ns4) hideMenu=setTimeout('hideAll()',400);
}

function reset(){
	//turn off all rollovers first
	for (i=0; i<8; i=i+2){
		if (pixLoaded) { 
			thePix = "document." + theImgName[i] + ".src = theImg[" + i + "].src";
			eval(thePix);
		}
	}
	return true;
}

function menu_rollon(buttonName,imgIndex){
	
	if (pixLoaded && !ns4) { 
		clearTimeout(hideMenu);
		thePix = "document." + buttonName + ".src = theImg[" + imgIndex + "].src";
		eval(thePix);
	}
}

function menu_rolloff(buttonName,imgIndex){
	if (pixLoaded && !ns4) { 
		thePix = "document." + buttonName + ".src = theImg[" + imgIndex + "].src";
		eval(thePix);

		hideMenu=setTimeout('hideAll()',400);
	}
}

function toggle(id){
	if ((w3c && document.getElementById(id).style.visibility == '') || (ie4 && document.all[id].style.visibility == '')){
		showLayer(id);
	}
	else if (w3c && document.getElementById(id).style.visibility == "hidden"){
		showLayer(id)
	}
	else if (w3c && document.getElementById(id).style.visibility == "visible"){
		hide(id);
	}
	else if (ie4 && document.all[id].style.visibility == "hidden"){
		showLayer(id);
	}
	else if (ie4 && document.all[id].style.visibility == "visible"){
		hide(id);
	}
}
function cleartimer(){
	clearTimeout(hideMenu);
}

function starttimer(id){
	hideMenu=setTimeout('hideAll()',400);
}


nexthide = 'products-menu'
//turns object visibility off/on
function show(id) {
		hide(nexthide); //hide previous layer
		nexthide = id; //set var to this layer for next time
		showLayer(id); //do the css property change
}

function showLayer(id){
	if (w3c) document.getElementById(id).style.visibility = "visible";
	else if (ie4) document.all[id].style.visibility = "visible";
}

function hide(id) {        
        if (w3c) document.getElementById(id).style.visibility = "hidden";
		else if (ie4) document.all[id].style.visibility = "hidden";
}

function clearall() {
		hide(nexthide);
}

function hideAll(){
	hide('products-menu'); rollon('products',0);
//	hide('downloads-menu'); rollon('downloads',2);
//	hide('shop-menu'); rollon('shop',4);
 //   hide('company-menu'); rollon('contacts',6);	
}

// for popup windows
function popup(url,features){
	var curPopupWindow;
	curPopupWindow = window.open(url, 'popupWindow', features, false);
	curPopupWindow.focus();
}

//for tab pages - my account, product pages
var panels = new Array('panel1', 'panel2', 'panel3', 'panel4');
  var selectedTab = null;
  function showPanel(tab, name)	
  {
	if (selectedTab) selectedTab.style.color = '#ffffff';
	
	selectedTab = tab;
	selectedTab.style.color = '#E8AD37';
	
	for(i = 0; i < panels.length; i++)
	{
		document.getElementById(panels[i]).style.display = (name == panels[i]) ? 'block':'none';
	}
	return false;
  }
  
  function hoverColor(thisTab, thisColor){
  	if (selectedTab != thisTab) {
  		thisTab.style.color=thisColor;  
	}
	thisTab.style.cursor='pointer';
  }
