/* Preload images script */
var myimages=new Array()
var dirArt = ""; // for local testing. set to "" when live.
var dirImg = "";

var lb_imgs = new Array();
lb_imgs.push(dirImg+"bullet.gif");
lb_imgs.push(dirImg+"button_1.gif");
lb_imgs.push(dirImg+"button_1active.gif");
lb_imgs.push(dirImg+"button_2.gif");
lb_imgs.push(dirImg+"button_2active.gif");
lb_imgs.push(dirImg+"button_3.gif");
lb_imgs.push(dirImg+"button_3active.gif");
lb_imgs.push(dirImg+"button_4.gif");
lb_imgs.push(dirImg+"button_4active.gif");
lb_imgs.push(dirImg+"button_5.gif");
lb_imgs.push(dirImg+"button_5active.gif");
lb_imgs.push(dirImg+"button_play.gif");
lb_imgs.push(dirImg+"button_pause.gif");

if (typeof(bigledes) != "undefined") {
	for(var i=0; i<bigledes.length; i++) {
		lb_imgs.push(dirArt+bigledes[i]);
	}
}
function preloadimages(list){ 
//	window.alert("preloading images");
	for (var i=0;i<list.length;i++){
		myimages[i]=new Image();
		al=myimages[i].src=list[i]; 
//		alert(al);
	}
}

/* Get Element by ID or Tagname*/
function getIt(what2get){
	document.getElementById(what2get) == null ? result = document.getElementsByTagName(what2get) : result = document.getElementById(what2get)
	return result
}

// Attaches an event listener to each player control
if(getIt('button_1').addEventListener){ // for non-IE browsers0
	getIt('button_1').addEventListener("click",function(){switchlead('1'); pause(); getIt('button_1').blur()}, false);	
	getIt('button_2').addEventListener("click",function(){switchlead('2'); pause(); getIt('button_2').blur()}, false);
	getIt('button_3').addEventListener("click",function(){switchlead('3'); pause(); getIt('button_3').blur()}, false);
	getIt('button_4').addEventListener("click",function(){switchlead('4'); pause(); getIt('button_4').blur()}, false);
	getIt('button_5').addEventListener("click",function(){switchlead('5'); pause(); getIt('button_5').blur()}, false);
	getIt('button_pause').addEventListener("click",function(){pauseandplay(); getIt('button_pause').blur()}, false);
}else if(getIt('button_1').attachEvent){ // for IE
	getIt('button_1').attachEvent("onclick",function(){switchlead('1'); pause(); getIt('button_1').blur()});
	getIt('button_2').attachEvent("onclick",function(){switchlead('2'); pause(); getIt('button_2').blur()});
	getIt('button_3').attachEvent("onclick",function(){switchlead('3'); pause(); getIt('button_3').blur()});
	getIt('button_4').attachEvent("onclick",function(){switchlead('4'); pause(); getIt('button_4').blur()});
	getIt('button_5').attachEvent("onclick",function(){switchlead('5'); pause(); getIt('button_5').blur()});
	getIt('button_pause').attachEvent("onclick",function(){pauseandplay(); getIt('button_pause').blur()});
}
