/* 

	Easy Scroll v1.0
	written by Alen Grakalic, provided by Css Globe (cssglobe.com)
	please visit http://cssglobe.com/post/1495/easy-scroll-accessible-content-scroller
	
*/

this.es_video = function(){
	
	// id of the container element 
	var id = "esvContent";
	
	// navigation buttons text
	var nav = ["", "", ""];
	
	//	id for each navigation button (OPTIONAL)
	var navId = ["esvUp", "esvDown", "esvReset"];

	// movement speed
	var speed = 4;
	
	// desired height of the container element (in pixels)
	var height = 120;
	
	//
	// END CONFIG
	// do not edit below this line (unless you want to of course :) )
	//

	var obj = document.getElementById(id);
	
	obj.up = false;
	obj.down = false;
	obj.fast = false;

	var container = document.createElement("div");
	var parent = obj.parentNode;
	container.id="es_video";
	parent.insertBefore(container,obj);
	parent.removeChild(obj);	
	
	container.style.position = "relative";
	container.style.height = height + "px";
	container.style.overflow = "hidden";
	obj.style.position = "absolute";
	obj.style.top = "0";
	obj.style.left = "0";
	container.appendChild(obj);
	
	var btns = new Array();
	for (var i=0;i<nav.length;i++){
		var esv_nav = document.createElement("div");
		esv_nav.innerHTML = nav[i];
		esv_nav.id = navId[i];
		btns.push(esv_nav);
		parent.insertBefore(esv_nav,container);
	};
	
	btns[0].onmouseover = function(){
		obj.up = true;
		this.className = "over";
	};
	btns[0].onmouseout = function(){
		obj.up = false;
		this.className = "";
	};
	btns[1].onmouseover = function(){
		obj.down = true;
		this.className = "over";
	};
	btns[1].onmouseout = function(){
		obj.down = false;
		this.className = "";
	};
	btns[0].onmousedown = btns[1].onmousedown = function(){
		obj.fast = true;
	};
	btns[0].onmouseup = btns[1].onmouseup = function(){
		obj.fast = false;
	};
	btns[2].onmouseover = function(){
		this.className = "over";
	};
	btns[2].onmouseout = function(){
		this.className = "";
	};
	btns[2].onclick = function(){
		obj.style.top = "0px";
	};

	this.esv_start = function(){
		var newTop;
		var objHeight = obj.offsetHeight;
		var top = obj.offsetTop;
		var fast = (obj.fast) ? 2 : 1;
		if(obj.down){		 
			newTop = ((objHeight+top) > height) ? top-(speed*fast) : top;
			obj.style.top = newTop + "px";
		};
		if(obj.up){
			newTop = (top < 0) ? top+(speed*fast) : top;
			obj.style.top = newTop + "px";
		};
	};
	obj.interval = setInterval("esv_start()",50);
	obj.style.display = "block";
};


this.es_interview = function(){
	
	// id of the container element 
	var id = "esiContent";
	
	// navigation buttons text
	var nav = ["", "", ""];
	
	//	id for each navigation button (OPTIONAL)
	var navId = ["esiUp", "esiDown", "esiReset"];

	// movement speed
	var speed = 4;
	
	// desired height of the container element (in pixels)
	var height = 120;
	
	//
	// END CONFIG
	// do not edit below this line (unless you want to of course :) )
	//

	var obj = document.getElementById(id);
	
	obj.up = false;
	obj.down = false;
	obj.fast = false;

	var container = document.createElement("div");
	var parent = obj.parentNode;
	container.id="es_interview";
	parent.insertBefore(container,obj);
	parent.removeChild(obj);	
	
	container.style.position = "relative";
	container.style.height = height + "px";
	container.style.overflow = "hidden";
	obj.style.position = "absolute";
	obj.style.top = "0";
	obj.style.left = "0";
	container.appendChild(obj);
	
	var btns = new Array();
	for (var i=0;i<nav.length;i++){
		var esi_nav = document.createElement("div");
		esi_nav.innerHTML = nav[i];
		esi_nav.id = navId[i];
		btns.push(esi_nav);
		parent.insertBefore(esi_nav,container);
	};
	
	btns[0].onmouseover = function(){
		obj.up = true;
		this.className = "over";
	};
	btns[0].onmouseout = function(){
		obj.up = false;
		this.className = "";
	};		
	btns[1].onmouseover = function(){
		obj.down = true;
		this.className = "over";		
	};
	btns[1].onmouseout = function(){
		obj.down = false;
		this.className = "";
	};		
	btns[0].onmousedown = btns[1].onmousedown = function(){
		obj.fast = true;
	};	
	btns[0].onmouseup = btns[1].onmouseup = function(){
		obj.fast = false;
	};		
	btns[2].onmouseover = function(){
		this.className = "over";
	};	
	btns[2].onmouseout = function(){
		this.className = "";
	};		
	btns[2].onclick = function(){
		obj.style.top = "0px";
	};		
		
	this.esi_start = function(){
		var newTop;
		var objHeight = obj.offsetHeight;
		var top = obj.offsetTop;
		var fast = (obj.fast) ? 2 : 1;
		if(obj.down){
			newTop = ((objHeight+top) > height) ? top-(speed*fast) : top;
			obj.style.top = newTop + "px";
		};
		if(obj.up){
			newTop = (top < 0) ? top+(speed*fast) : top;
			obj.style.top = newTop + "px";
		};
	};	
	obj.interval = setInterval("esi_start()",50);
	obj.style.display = "block";
};

this.es_gallery = function(){
	
	// id of the container element 
	var id = "esgContent";
	
	// navigation buttons text
	var nav = ["", "", ""];
	
	//	id for each navigation button (OPTIONAL)
	var navId = ["esgUp", "esgDown", "esgReset"];

	// movement speed
	var speed = 4;
	
	// desired height of the container element (in pixels)
	var height = 120;
	
	//
	// END CONFIG
	// do not edit below this line (unless you want to of course :) )
	//

	var obj = document.getElementById(id);
	
	obj.up = false;
	obj.down = false;
	obj.fast = false;

	var container = document.createElement("div");
	var parent = obj.parentNode;
	container.id="es_gallery";
	parent.insertBefore(container,obj);
	parent.removeChild(obj);	
	
	container.style.position = "relative";
	container.style.height = height + "px";
	container.style.overflow = "hidden";
	obj.style.position = "absolute";
	obj.style.top = "0";
	obj.style.left = "0";
	container.appendChild(obj);
	
	var btns = new Array();
	for (var i=0;i<nav.length;i++){
		var esg_nav = document.createElement("div");
		esg_nav.innerHTML = nav[i];
		esg_nav.id = navId[i];
		btns.push(esg_nav);
		parent.insertBefore(esg_nav,container);
	};
	
	btns[0].onmouseover = function(){
		obj.up = true;
		this.className = "over";
	};
	btns[0].onmouseout = function(){
		obj.up = false;
		this.className = "";
	};		
	btns[1].onmouseover = function(){
		obj.down = true;
		this.className = "over";		
	};
	btns[1].onmouseout = function(){
		obj.down = false;
		this.className = "";
	};		
	btns[0].onmousedown = btns[1].onmousedown = function(){
		obj.fast = true;
	};	
	btns[0].onmouseup = btns[1].onmouseup = function(){
		obj.fast = false;
	};		
	btns[2].onmouseover = function(){ 		
		this.className = "over";
	};	
	btns[2].onmouseout = function(){ 		
		this.className = "";
	};		
	btns[2].onclick = function(){ 		
		obj.style.top = "0px";
	};		
		
	this.esg_start = function(){				
		var newTop;
		var objHeight = obj.offsetHeight;
		var top = obj.offsetTop;
		var fast = (obj.fast) ? 2 : 1;
		if(obj.down){		 
			newTop = ((objHeight+top) > height) ? top-(speed*fast) : top;	
			obj.style.top = newTop + "px";
		};	
		if(obj.up){		 
			newTop = (top < 0) ? top+(speed*fast) : top;
			obj.style.top = newTop + "px";
		};
	};	
	obj.interval = setInterval("esg_start()",50);		
	obj.style.display = "block";		
};

