// JavaScript Document

function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features)
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

//pri zmene selectboxu
function go(objName)   {
    var box = MM_findObj(objName);
	destination = box.options[box.selectedIndex].value;
	if (destination) location.href = destination;
}

function gE( id)
{
	var el;
	if(document.getElementById) {
		el = document.getElementById(id);
	} else if(document.all) {
		el = document.all[id];
	} else {
		return null;
	}
	return el;
}


//sponsor logos
var gLogoImgTag = null;	
var gLogoCount = 0;		
var gLogoCache = new Array();	
var gLogoNames = new Array();	
var gLogoIdx = 0;
var log;

function preloadLogoImages( list)
{
	gLogoImgTag = gE( "logoImg");
	log = gE( 'log');

	if( !gLogoImgTag)
		return;
		
	gLogoCount = list.length;
	
	for( i=0; i<gLogoCount; i++)
	{
		gLogoCache[ i] = new Image();
		gLogoCache[ i].src = list[ i][ 1];
		gLogoCache[ i].width = list[ i][ 2];
		gLogoCache[ i].height = list[ i][ 3];
		
		gLogoNames[ i] = list[ i][ 0];
		
	} 
} 

function runLogoSwitch( sec)
{
	if( !gLogoImgTag) return;
	gLogoIdx = 0;
	setTimeout( "logoSwitchCallback(" + sec + ")", sec*1000);
}

function logoSwitchCallback( sec)
{
	gLogoIdx = ((gLogoIdx+1)>=gLogoCount) ? 0 : gLogoIdx+1;
	gLogoImgTag.src = gLogoCache[ gLogoIdx].src;
	gLogoImgTag.width = gLogoCache[ gLogoIdx].width;
	gLogoImgTag.height = gLogoCache[ gLogoIdx].height;
	gLogoImgTag.alt = gLogoNames[ gLogoIdx];
	setTimeout( "logoSwitchCallback(" + sec + ")", sec*1000);
}