/* Preload images script */
var myimages=new Array()
var dirAdj = "/dtktest/images/lederbox/"; // for local testing. set to "" when live.

function preloadimages(){ 
	for (i=0;i<preloadimages.arguments.length;i++){
		myimages[i]=new Image();
		al=myimages[i].src=dirAdj+preloadimages.arguments[i]; //alert(al)
	}
}
/* The path of images to be preloaded inside parenthesis: (Extend list as desired.) */

preloadimages("1.jpg","2.jpg","bullet.gif","button_previous.gif","button_1.gif","button_1active.gif","button_2.gif","button_2active.gif","button_3.gif","button_3active.gif","button_4.gif","button_4active.gif","button_5.gif","button_5active.gif","button_next.gif","button_nextactive.gif","button_pause.gif","button_play.gif","button_previous.gif","button_previousactive.gif","3.jpg","4.jpg","5.jpg");



/* Get Element by ID or Tagname*/
function getIt(what2get){
	document.getElementById(what2get) == null ? result = document.getElementsByTagName(what2get) : result = document.getElementById(what2get)
	return result
}
	
/* Handles onclick event and sends to leadswitch() */	
/*
function leadSwitcher(){
	for(i = 0; i < arguments.length; i++){
		if(getIt(arguments[i]).addEventListener){
			getIt(arguments[i]).addEventListener("click",function(){switchlead(this.id)}, false);		
		}else{
			getIt(arguments[i]).attachEvent("onclick",function(){alert(this.id)});
		}
		//getIt(arguments[i]).blur();
	}
}

leadSwitcher('button_1','button_2', 'button_3', 'button_4', 'button_5');

*/


// Attaches an event listener to each player control
if(getIt('button_1').addEventListener){ // for non-IE browsers
//	getIt('button_previous').addEventListener("click",function(){switchleadprevious()},false); getIt('button_previous').blur();	
//	getIt('button_previous').addEventListener("mouseup",function(){getIt('button_previous').src = dirAdj + 'button_previous.gif'},false);
//	getIt('button_previous').addEventListener("mousedown",function(){getIt('button_previous').src = dirAdj + 'button_previousactive.gif'},false);
	getIt('button_1').addEventListener("click",function(){switchlead('button_1'); getIt('button_1').blur()}, false);	
	getIt('button_2').addEventListener("click",function(){switchlead('button_2'); getIt('button_2').blur()}, false);
	getIt('button_3').addEventListener("click",function(){switchlead('button_3'); getIt('button_3').blur()}, false);
	getIt('button_4').addEventListener("click",function(){switchlead('button_4'); getIt('button_4').blur()}, false);
	getIt('button_5').addEventListener("click",function(){switchlead('button_5'); getIt('button_5').blur()}, false);
//	getIt('button_next').addEventListener("click",function(){switchleadnext()},false); getIt('button_next').blur();	
//	getIt('button_next').addEventListener("mouseup",function(){getIt('button_next').src = dirAdj + 'button_next.gif'},false);
//	getIt('button_next').addEventListener("mousedown",function(){getIt('button_next').src = dirAdj + 'button_nextactive.gif'},false);
	getIt('button_pause').addEventListener("click",function(){pauseandplay(); getIt('button_pause').blur()}, false);
}else if(getIt('button_1').attachEvent){ // for IE
//	getIt('button_previous').attachEvent("onclick",function(){switchleadprevious()}); getIt('button_previous').blur();	
//	getIt('button_previous').attachEvent("onmouseup",function(){getIt('button_previous').src = dirAdj + 'button_previous.gif'});
//	getIt('button_previous').attachEvent("onmousedown",function(){getIt('button_previous').src = dirAdj + 'button_previousactive.gif'});
	getIt('button_1').attachEvent("onclick",function(){switchlead('button_1'); getIt('button_1').blur()});
	getIt('button_2').attachEvent("onclick",function(){switchlead('button_2'); getIt('button_2').blur()});
	getIt('button_3').attachEvent("onclick",function(){switchlead('button_3'); getIt('button_3').blur()});
	getIt('button_4').attachEvent("onclick",function(){switchlead('button_4'); getIt('button_4').blur()});
	getIt('button_5').attachEvent("onclick",function(){switchlead('button_5'); getIt('button_5').blur()});
//	getIt('button_next').attachEvent("onclick",function(){switchleadnext()},false); getIt('button_next').blur();	
//	getIt('button_next').attachEvent("onmouseup",function(){getIt('button_next').src = dirAdj + 'button_next.gif'},false);
//	getIt('button_next').attachEvent("onmousedown",function(){getIt('button_next').src = dirAdj + 'button_nextactive.gif'},false);
	getIt('button_pause').attachEvent("onclick",function(){pauseandplay(); getIt('button_pause').blur()});
}