/**
* Moke Video 
*
* Moke Video is a joomla video component built specificaly for youJoomla templates
* @author: Kemal Kvakic <kkvakic@gmail.com>
*/
	var my_width	= null;
	var my_height	= null;
	var my_bgcolor	= null;
	var my_videos	= new Array();
	/*
	* Stop Video
	*/
	
	mokeCall = function() {
		this.defaultWidth	= 400;
		this.defaultheight	= 300;
		this.defaultBgColor	= '000000';	
		this.swfPath		= "FAVideo";
		
	}
	
	
	mokeCall.prototype.stopVideo = function(moke_player) {
		moke_player.stop();
		isPlaying = false;
	}
	
	mokeCall.prototype.seekVideo = function(moke_player, p_seek) {
		moke_player.seek(p_player.getPlayheadTime() + p_seek);
	}
	
	mokeCall.prototype.playVideo = function(moke_player) {
		moke_player.play();
	}
	
	mokeCall.prototype.changeVideo = function(moke_player, p_path) {
		stopVideo(p_player);
		moke_player.videoPath	= p_path;
		loadVideo("moke_video", p_path);
	}
	
	mokeCall.prototype.loadVideo = function(my_div, my_path) {
		local_width 	= (this.my_width) 	? this.my_width 	: this.defaultWidth;
		local_height 	= (this.my_height) 	? this.my_height 	: this.defaultheight;
		local_bgcolor 	= (this.my_bgcolor) ? this.my_bgcolor 	: this.defaultBgColor;

		moke_player = new MOKEVideo(my_div, my_path, local_bgcolor, this.swfPath);
		moke_player.DEFAULT_SWF_PATH	= this.swfPath;
		moke_player.setSize(local_width, local_height);
		moke_player.setSkinVisible(true);
		moke_player.setSkinAutoHide(true);
		moke_player.setAutoPlay(true);
	}
	
	/**
	* Scroll the menu content
	*/
	mokeCall.prototype.makeScrollbar = function(content,scrollbar,handle,horizontal,ignoreMouse){
		alert(content.getScrollSize());
		var steps = (horizontal ? (content.getScrollSize().x - content.getSize().x) : (content.getScrollSize().y - content.getSize().y))
		var slider = new Slider(scrollbar, handle, {	
			steps: steps,
			mode: (horizontal ? 'horizontal' : 'vertical'),
			onChange: function(step){
				// Scrolls the content element in x or y direction.
				var x = (horizontal?step:0);
				var y = (horizontal?0:step);
				content.scrollTo(x,y);
			}
		}).set(0);
		if( !(ignoreMouse) ){
			// Scroll the content element when the mousewheel is used within the 
			// content or the scrollbar element.
			$$(content, scrollbar).addEvent('mousewheel', function(e){	
				e = new Event(e).stop();
				var step = slider.step - e.wheel * 50;	
				slider.set(step);					
			});
		}
		// Stops the handle dragging process when the mouse leaves the document body.
		$(document.body).addEvent('mouseleave',function(){slider.drag.stop()});
	}
	
	mokeCall.prototype.addToList = function(content){
		this.my_video.push(content);
	}
