/**
 * Ultimate Video Player PACKAGED v9.1
 * Advertisement button.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
var FWDUVPAdsButton = function(
			prt,
			icon_img,
			iconOverPath_str,
			text_str,
			position_str,
			borderColorN_str,
			borderColorS_str,
			adsBackgroundPath_str,
			textNormalColor,
			textSelectedColor,
			useHEX,
		    nBC,
		    sBC
		){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPAdsButton.prototype;
		
		
		_s.icon_img = icon_img;
		
		_s.useHEX = useHEX; 
		_s.nBC = nBC;
		_s.sBC = sBC;
		
		_s.borderNColor_str = borderColorN_str;
		_s.borderSColor_str = borderColorS_str;
		_s.adsBackgroundPath_str = adsBackgroundPath_str;
		_s.position_str = position_str;
		_s.textNormalColor_str = textNormalColor;
		_s.textSelectedColor_str = textSelectedColor;
		_s.text_str = text_str;
		_s.iconOverPath_str = iconOverPath_str;
		_s.totalWidth = 215;
		_s.totalHeight = 64;
		_s.fontSize = 12;
		
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		

	
		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.setOverflow("visible");
			_s.setupMainContainers();
			_s.hide(false, true);
		};
		

		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.setupMainContainers = function(){
			
			_s.main_do = new FWDUVPDisplayObject("div");
			_s.main_do.hasTransform3d_bl = false;
			_s.main_do.hasTransform2d_bl = false;
			_s.main_do.setBackfaceVisibility();
			
			_s.bk_do = new FWDUVPDisplayObject("div");
			_s.bk_do.getStyle().background = "url('" + _s.adsBackgroundPath_str + "')";
		
			_s.text_do = new FWDUVPDisplayObject("div");
			_s.text_do.screen.className = 'UVP-skip';
			_s.text_do.hasTransform3d_bl = false;
			_s.text_do.hasTransform2d_bl = false;
			_s.text_do.setBackfaceVisibility();
			_s.text_do.setOverflow("visible");
			_s.text_do.getStyle().display = "inline";
			_s.text_do.getStyle().fontFamily = "Arial";
			_s.text_do.getStyle().fontSize= "22px";
			_s.text_do.getStyle().whiteSpace= "nowrap";
			_s.text_do.getStyle().color = _s.textNormalColor_str;
			_s.text_do.getStyle().fontSmoothing = "antialiased";
			_s.text_do.getStyle().webkitFontSmoothing = "antialiased";
			_s.text_do.getStyle().textRendering = "optimizeLegibility";
			
			_s.thumbHolder_do = new FWDUVPDisplayObject("div");
			_s.thumbHolder_do.setWidth(_s.totalHeight - 8);
			_s.thumbHolder_do.setHeight(_s.totalHeight - 8);
			_s.thumbHolder_do.setX(_s.totalWidth - _s.thumbHolder_do.w - 4);
			_s.thumbHolder_do.setY(4);
			
			_s.border_do = new FWDUVPDisplayObject("div");
			_s.border_do.getStyle().border = "1px solid " + _s.borderNColor_str + "";
			_s.border_do.setButtonMode(true);
			_s.main_do.setWidth(_s.totalWidth);
			_s.main_do.setHeight(_s.totalHeight);
			_s.bk_do.setWidth(_s.totalWidth);
			_s.bk_do.setHeight(_s.totalHeight);

			if(_s.position_str == "left"){
				_s.border_do.setX(-1);
				_s.border_do.setWidth(_s.totalWidth - 1);
				_s.border_do.setHeight(_s.totalHeight -2);
			}else{
				_s.border_do.setWidth(_s.totalWidth);
				_s.border_do.setHeight(_s.totalHeight -2);
			}
			_s.setWidth(_s.totalWidth);
			_s.setHeight(_s.totalHeight);
			
			if(_s.useHEX){
				_s.icon_do = new FWDUVPDisplayObject("div");
				_s.icon_do.setWidth(_s.icon_img.width);
				_s.icon_do.setHeight(_s.icon_img.height);
				_s.icon_do_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.icon_img, _s.nBC).canvas;
				_s.icon_do.screen.appendChild(_s.icon_do_canvas);
			}else{
				_s.icon_do = new FWDUVPDisplayObject("img");
				_s.icon_do.setScreen(_s.icon_img);
				_s.icon_do.setWidth(_s.icon_img.width);
				_s.icon_do.setHeight(_s.icon_img.height);
			}
			
			_s.iconS_img =  new Image();
			_s.iconS_img.src = _s.iconOverPath_str;
			
			if(_s.useHEX){
				_s.iconS_do = new FWDUVPDisplayObject("div");
				_s.iconS_do.setWidth(_s.icon_do.w);
				_s.iconS_do.setHeight(_s.icon_do.h);
				_s.iconS_img.onload = function(){
					_s.iconS_do_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.iconS_img, _s.sBC).canvas;
					_s.iconS_do.screen.appendChild(_s.iconS_do_canvas);
				}
			}else{
				_s.iconS_do = new FWDUVPDisplayObject("img");
				_s.iconS_do.setScreen(_s.iconS_img);
				_s.iconS_do.setWidth(_s.icon_do.w);
				_s.iconS_do.setHeight(_s.icon_do.h);
			}
			
			_s.iconS_do.setAlpha(0);
		
			_s.main_do.addChild(_s.bk_do);
			_s.main_do.addChild(_s.text_do);
			_s.main_do.addChild(_s.thumbHolder_do);
			_s.main_do.addChild(_s.icon_do);
			_s.main_do.addChild(_s.iconS_do);
			_s.main_do.addChild(_s.border_do);
			
			if(FWDUVPUtils.isIEAndLessThen9){
				_s.dumy_do = new FWDUVPDisplayObject("div");
				_s.dumy_do.setBkColor("#00FF00");
				_s.dumy_do.setAlpha(.0001);
				_s.dumy_do.setWidth(_s.totalWidth);
				_s.dumy_do.setHeight(_s.totalHeight);
				_s.dumy_do.setButtonMode(true);
				_s.main_do.addChild(_s.dumy_do);
			}
			
			_s.addChild(_s.main_do);
			_s.updateText(_s.text_str);

			
			if(FWDUVPUtils.isIEAndLessThen9){
				if(_s.isMbl){
					if(_s.hasPointerEvent_bl){
						_s.dumy_do.screen.addEventListener("pointerup", _s.onMouseUp);
						_s.dumy_do.screen.addEventListener("pointerover", _s.onMouseOver);
						_s.dumy_do.screen.addEventListener("pointerout", _s.onMouseOut);
					}else{
						_s.dumy_do.screen.addEventListener("touchend", _s.onMouseUp);
					}
				}else if(_s.dumy_do.screen.addEventListener){	
					_s.dumy_do.screen.addEventListener("mouseover", _s.onMouseOver);
					_s.dumy_do.screen.addEventListener("mouseout", _s.onMouseOut);
					_s.dumy_do.screen.addEventListener("mouseup", _s.onMouseUp);
				}else if(_s.dumy_do.screen.attachEvent){
					_s.dumy_do.screen.attachEvent("onmouseover", _s.onMouseOver);
					_s.dumy_do.screen.attachEvent("onmouseout", _s.onMouseOut);
					_s.dumy_do.screen.attachEvent("onmouseup", _s.onMouseUp);
				}
			}else{
				if(_s.isMbl){
					if(_s.hasPointerEvent_bl){
						_s.border_do.screen.addEventListener("pointerup", _s.onMouseUp);
						_s.border_do.screen.addEventListener("pointerover", _s.onMouseOver);
						_s.border_do.screen.addEventListener("pointerout", _s.onMouseOut);
					}else{
						_s.border_do.screen.addEventListener("touchend", _s.onMouseUp);
					}
				}else if(_s.border_do.screen.addEventListener){	
					_s.border_do.screen.addEventListener("mouseover", _s.onMouseOver);
					_s.border_do.screen.addEventListener("mouseout", _s.onMouseOut);
					_s.border_do.screen.addEventListener("mouseup", _s.onMouseUp);
				}else if(_s.border_do.screen.attachEvent){
					_s.border_do.screen.attachEvent("onmouseover", _s.onMouseOver);
					_s.border_do.screen.attachEvent("onmouseout", _s.onMouseOut);
					_s.border_do.screen.attachEvent("onmouseup", _s.onMouseUp);
				}
			}
			
		};
		
		_s.onMouseOver = function(e){
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE || e.pointerType == "mouse"){
				_s.setSelectedState();
			}
		};
			
		_s.onMouseOut = function(e){
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE || e.pointerType == "mouse"){
				_s.setNormalState();
			}
		};
		
		_s.onMouseUp = function(e){
			if(e.preventDefault) e.preventDefault();
			if(e.button == 2 || !_s.isShowed_bl) return;
			_s.dispatchEvent(FWDUVPAdsButton.MOUSE_UP);
		};

		
		//#####################################//
		/* Update text */
		//#####################################//
		_s.updateText = function(text){
			
			_s.text_do.setInnerHTML(text);
			_s.positionInside();
		};

		_s.positionInside = function(){
			var totalWidth;
			totalWidth = _s.text_do.getWidth() + 8 + _s.iconS_do.w;
			_s.text_do.setX(parseInt(_s.totalWidth - totalWidth)/2);
			_s.text_do.setY(parseInt((_s.totalHeight - _s.text_do.getHeight())/2) + 2);
			_s.icon_do.setX(_s.text_do.x + totalWidth - _s.iconS_do.w);
			_s.icon_do.setY(parseInt((_s.totalHeight - _s.iconS_do.h)/2) + 2);
			_s.iconS_do.setX(_s.text_do.x + totalWidth - _s.iconS_do.w);
			_s.iconS_do.setY(parseInt((_s.totalHeight - _s.iconS_do.h)/2) + 2);
		}

		//Resize button.
		_s.prevW;
		_s.resize = function(mbl){
			var mbl;
			var tt = _s.totalWidth;
			
			_s.prvW = prt.sW;
			if(prt.sW < 600) mbl = true;

			if(mbl){
				_s.totalWidth = 64;
				tt = 64;	
			}else{
				_s.totalWidth = 215;
				tt = 215;
			}

			if(!_s.isShWithDl){
				if(_s.position_str == "right"){
					_s.main_do.setX(-_s.totalWidth)
				}
			}

			if(_s.prevW != _s.totalWidth){
				_s.positionInside();
			}
			_s.prevW = _s.totalWidth

			if(mbl){
				_s.text_do.setVisible(false);
				_s.icon_do.setX(Math.round((tt - _s.iconS_do.w)/2) - 1);
				_s.icon_do.setY(Math.round((_s.totalHeight - _s.iconS_do.h)/2));
			}else{
				_s.text_do.setVisible(true);
				_s.icon_do.setX(_s.text_do.x + _s.text_do.getWidth() + 8 + _s.iconS_do.w - _s.iconS_do.w);
				_s.icon_do.setY(parseInt((_s.totalHeight - _s.iconS_do.h)/2) + 2);
			}

			_s.iconS_do.setX(_s.icon_do.x);
			_s.iconS_do.setY(_s.icon_do.y);
			_s.setWidth(tt);
			_s.main_do.setWidth(tt);
			_s.bk_do.setWidth(tt);
			_s.border_do.setWidth(tt - 1);
		}

		
		//####################################//
		/* Set normal / selected state */
		//####################################//
		_s.setNormalState = function(){
			FWDAnimation.to(_s.iconS_do, .5, {alpha:0, ease:Expo.easeOut});	
			FWDAnimation.to(_s.text_do.screen, .5, {css:{color:_s.textNormalColor_str}, ease:Expo.easeOut});	
			FWDAnimation.to(_s.border_do.screen, .5, {css:{borderColor:_s.borderNColor_str}, ease:Expo.easeOut});	
		};
		
		_s.setSelectedState = function(){
			FWDAnimation.to(_s.iconS_do, .5, {alpha:1, ease:Expo.easeOut});	
			FWDAnimation.to(_s.text_do.screen, .5, {css:{color:_s.textSelectedColor_str}, ease:Expo.easeOut});	
			FWDAnimation.to(_s.border_do.screen, .5, {css:{borderColor:_s.borderSColor_str}, ease:Expo.easeOut});	
		};
	
		_s.show = function(animate){
			if(_s.isShowed_bl) return;
			_s.isShowed_bl = true;
			_s.isShWithDl = true;
			_s.resize();
			
			setTimeout(function(){
				_s.isShWithDl = false;
			}, 500);
			_s.setVisible(true);
			
			FWDAnimation.killTweensOf(_s.main_do);
			if(animate && !_s.isMobile_bl){
				if(_s.position_str == "left"){
					FWDAnimation.to(_s.main_do, .8, {x:0, delay:.8, ease:Expo.easeInOut});
				}else{
					FWDAnimation.to(_s.main_do, .8, {x:-_s.totalWidth, delay:.8,  ease:Expo.easeInOut});
				}
			}else{
				if(_s.position_str == "left"){
					_s.main_do.setX(0);
				}else{
					_s.main_do.setX(-_s.totalWidth);
				}
			}
		};	
			
		_s.hide = function(animate, overwrite){
			if(!_s.isShowed_bl && !overwrite) return;
			_s.isShowed_bl = false;
			_s.isShWithDl = true;
			_s.hasThumbanil_bl = false;
			
			FWDAnimation.killTweensOf(_s.main_do);
			if(animate && !_s.isMobile_bl){
				if(_s.position_str == "left"){
					FWDAnimation.to(_s.main_do, .8, {x:-_s.totalWidth, ease:Expo.easeInOut, onComplete:_s.hideCompleteHandler});
				}else{
					FWDAnimation.to(_s.main_do, .8, {x:0, ease:Expo.easeInOut, onComplete:_s.hideCompleteHandler});
				}
			}else{
				if(_s.position_str == "left"){
					_s.main_do.setX(-_s.totalWidth);
				}else{
					_s.main_do.setX(0);
				} 
				_s.hideCompleteHandler();
			}
		};
		
		_s.hideCompleteHandler = function(){
			if(_s.smallImage_img){
				_s.smallImage_img.onload = null;
				_s.smallImage_img.src = "";
				FWDAnimation.killTweensOf(_s.icon_do);
			}
			if(_s.main_do.alpha != 1) _s.main_do.setAlpha(1);
			_s.thumbHolder_do.setVisible(false);
			_s.setVisible(false);
			_s.setX(-500);
		};
		
		
		//###########################################//
		/* hide / show  opacity */
		//###########################################//
		_s.hideWithOpacity = function(){
			if(!FWDUVPUtils.isIEAndLessThen9){
				FWDAnimation.to(_s.main_do, .8, {alpha:.5});
			}
		};
		
		_s.showWithOpacity = function(){
			if(!FWDUVPUtils.isIEAndLessThen9){
				FWDAnimation.to(_s.main_do, .8, {alpha:1});
			}
		};
			
		_s.init();
	};
	
	/* set prototype */
	FWDUVPAdsButton.setPrototype = function(){
		FWDUVPAdsButton.prototype = null;
		FWDUVPAdsButton.prototype = new FWDUVPTransformDisplayObject("div");
	};
	
	FWDUVPAdsButton.CLICK = "onClick";
	FWDUVPAdsButton.MOUSE_OVER = "onMouseOver";
	FWDUVPAdsButton.SHOW_TOOLTIP = "showTooltip";
	FWDUVPAdsButton.MOUSE_OUT = "onMouseOut";
	FWDUVPAdsButton.MOUSE_UP = "onMouseDown";
	
	FWDUVPAdsButton.prototype = null;
	window.FWDUVPAdsButton = FWDUVPAdsButton;
}(window));﻿/**
 * Ultimate Video Player PACKAGED v9.1
 * Advertisement info window.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
var FWDUVPAdsStart = function(
			position_str,
			borderColorN_str,
			borderColorS_str,
			adsBackgroundPath_str,
			timeColor_str
		){
		
		'use strict';

		var _s = this;
		var prototype = FWDUVPAdsStart.prototype;
		
		_s.borderNColor_str = borderColorN_str;
		_s.borderSColor_str = borderColorS_str;
		_s.adsBackgroundPath_str = adsBackgroundPath_str;
		_s.position_str = position_str;
		_s.timeColor_str = timeColor_str;
		
		_s.totalWidth = 215;
		_s.totalHeight = 64;
		_s.fontSize = 12;

		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		
	
		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.setOverflow("visible");
			_s.setupMainContainers();
			_s.hide(false, true);
		};
		

		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.setupMainContainers = function(){
			
			_s.main_do = new FWDUVPDisplayObject("div");
			_s.main_do.hasTransform3d_bl = false;
			_s.main_do.hasTransform2d_bl = false;
			_s.main_do.setBackfaceVisibility();
			
			_s.bk_do = new FWDUVPDisplayObject("div");
			_s.bk_do.getStyle().background = "url('" + _s.adsBackgroundPath_str + "')";
			
			_s.text_do = new FWDUVPDisplayObject("div");
			_s.text_do.screen.className = 'UVP-skip-in';
			_s.text_do.hasTransform3d_bl = false;
			_s.text_do.hasTransform2d_bl = false;
			_s.text_do.setBackfaceVisibility();
			_s.text_do.getStyle().fontFamily = "Arial";
			_s.text_do.getStyle().fontSize= "12px";
			_s.text_do.getStyle().lineHeight = "18px";
			_s.text_do.getStyle().textAlign = "center";
			_s.text_do.getStyle().color = _s.timeColor_str;
			_s.text_do.getStyle().fontSmoothing = "antialiased";
			_s.text_do.getStyle().webkitFontSmoothing = "antialiased";
			_s.text_do.getStyle().textRendering = "optimizeLegibility";
			_s.text_do.setInnerHTML("...");
			
			_s.thumbHolder_do = new FWDUVPDisplayObject("div");
			_s.thumbHolder_do.setWidth(_s.totalHeight - 8);
			_s.thumbHolder_do.setHeight(_s.totalHeight - 8);
			_s.thumbHolder_do.setX(_s.totalWidth - _s.thumbHolder_do.w - 4);
			_s.thumbHolder_do.setY(4);
			
			_s.border_do = new FWDUVPDisplayObject("div");
			_s.border_do.getStyle().border = "1px solid " + _s.borderNColor_str + "";
		
			_s.main_do.setWidth(_s.totalWidth);
			_s.main_do.setHeight(_s.totalHeight);
			_s.bk_do.setWidth(_s.totalWidth);
			_s.bk_do.setHeight(_s.totalHeight);
			if(_s.position_str == "left"){
				_s.border_do.setX(-1);
				_s.border_do.setWidth(_s.totalWidth - 1);
				_s.border_do.setHeight(_s.totalHeight -2);
			}else{
				_s.border_do.setWidth(_s.totalWidth);
				_s.border_do.setHeight(_s.totalHeight -2);
			}
			_s.setWidth(_s.totalWidth);
			_s.setHeight(_s.totalHeight);
		
			_s.main_do.addChild(_s.bk_do);
			_s.main_do.addChild(_s.text_do);
			_s.main_do.addChild(_s.thumbHolder_do);
			_s.main_do.addChild(_s.border_do);
			
			_s.addChild(_s.main_do);
		};

		
		//#####################################//
		/* load thumbnail */
		//#####################################//
		_s.loadThumbnail = function(path){
			_s.hasThumbanil_bl = true;
			
			if(_s.smallImage_img){
				_s.smallImage_img.removeAttribute("width");
				_s.smallImage_img.removeAttribute("height");
				_s.smallImage_img.onload = null;
				_s.smallImage_img.src = "";
				try{
					if(!FWDUVPUtils.isIE) _s.thumbHolder_do.removeChild(_s.thumbnail_do);
				}catch(e){}
			}
			
			if(!_s.thumbnail_do){
				_s.thumbnail_do = new FWDUVPDisplayObject("img");
				_s.smallImage_img = new Image();
			}
			
			_s.thumbHolder_do.setVisible(true);
			_s.smallImage_img.onload = _s.onSmallImageLoad;
			_s.smallImage_img.src = path;
		};
		
		_s.onSmallImageLoad = function(){
			
			_s.smallImageOriginalW = _s.smallImage_img.width;
			_s.smallImageOriginalH = _s.smallImage_img.height;
			_s.thumbnail_do.setScreen(_s.smallImage_img);
			_s.thumbHolder_do.addChild(_s.thumbnail_do);
			
			var scaleX = _s.thumbHolder_do.w/_s.smallImageOriginalW;
			var scaleY = _s.thumbHolder_do.h/_s.smallImageOriginalH;
			var totalScale = 0;
			
			if(scaleX >= scaleY){
				totalScale = scaleX;
			}else if(scaleX <= scaleY){
				totalScale = scaleY;
			}
			
			_s.thumbnail_do.setWidth(Math.round(_s.smallImageOriginalW * totalScale));
			_s.thumbnail_do.setHeight(Math.round(_s.smallImageOriginalH * totalScale));
			_s.thumbnail_do.setX(Math.round((_s.thumbHolder_do.w - _s.thumbnail_do.w)/2));
			_s.thumbnail_do.setY(Math.round((_s.thumbHolder_do.h - _s.thumbnail_do.h)/2));
			_s.thumbnail_do.setAlpha(0);
			FWDAnimation.to(_s.thumbnail_do, .8, {alpha:1});
			_s.updateText();
		};
		

		//#####################################//
		/* Update text */
		//#####################################//
		_s.updateText = function(text){
			if(text) _s.text_do.setInnerHTML(text);
			
			if(_s.hasThumbanil_bl){
				_s.text_do.setX(16);
				_s.text_do.setWidth(_s.totalWidth - _s.totalHeight - 26);
			}else{
				_s.text_do.setX(8);
				_s.text_do.setWidth(_s.totalWidth - 16);
			}
			
			_s.text_do.setY(parseInt((_s.totalHeight - _s.text_do.getHeight())/2));
		};
	

		//#####################################//
		/* show / hide */
		//#####################################//
		_s.show = function(animate){
			if(_s.isShowed_bl) return;
			
			_s.isShowed_bl = true;
			_s.setVisible(true);
			
			FWDAnimation.killTweensOf(_s.main_do);
			if(animate && !_s.isMbl){
				if(_s.position_str == "left"){
					FWDAnimation.to(_s.main_do, .8, {x:0, delay:.2, ease:Expo.easeInOut});
				}else{
					FWDAnimation.to(_s.main_do, .8, {x:-_s.totalWidth + 1, delay:.2,  ease:Expo.easeInOut});
				}
			}else{
				if(_s.position_str == "left"){
					_s.main_do.setX(0);
				}else{
					_s.main_do.setX(-_s.totalWidth);
				}
			}
		};	
			
		_s.hide = function(animate, overwrite){
			if(!_s.isShowed_bl && !overwrite) return;
			
			_s.isShowed_bl = false;
			_s.hasThumbanil_bl = false;
			
			FWDAnimation.killTweensOf(_s.main_do);
			if(animate && !_s.isMbl){
				if(_s.position_str == "left"){
					FWDAnimation.to(_s.main_do, .8, {x:-_s.totalWidth, ease:Expo.easeInOut, onComplete:_s.hideCompleteHandler});
				}else{
					FWDAnimation.to(_s.main_do, .8, {x:0, ease:Expo.easeInOut, onComplete:_s.hideCompleteHandler});
				}
			}else{
				if(_s.position_str == "left"){
					_s.main_do.setX(-_s.totalWidth);
				}else{
					_s.main_do.setX(0);
				} 
				_s.hideCompleteHandler();
			}
		};
		
		_s.hideCompleteHandler = function(){
			if(_s.smallImage_img){
				_s.smallImage_img.onload = null;
				_s.smallImage_img.src = "";
				FWDAnimation.killTweensOf(_s.thumbnail_do);
			}
			
			if(_s.main_do.alpha != 1) _s.main_do.setAlpha(1);
			_s.thumbHolder_do.setVisible(false);
			_s.setVisible(false);
		};
		

		//###########################################//
		/* hide / show  opacity */
		//###########################################//
		_s.hideWithOpacity = function(){
			if(!FWDUVPUtils.isIEAndLessThen9){
				FWDAnimation.to(_s.main_do, .8, {alpha:.5});
			}
		};
		
		_s.showWithOpacity = function(){
			if(!FWDUVPUtils.isIEAndLessThen9){
				FWDAnimation.to(_s.main_do, .8, {alpha:1});
			}
		};
		
		_s.init();
	};
	
	
	/* set prototype */
	FWDUVPAdsStart.setPrototype = function(){
		FWDUVPAdsStart.prototype = null;
		FWDUVPAdsStart.prototype = new FWDUVPTransformDisplayObject("div");
	};
	
	FWDUVPAdsStart.CLICK = "onClick";
	FWDUVPAdsStart.MOUSE_OVER = "onMouseOver";
	FWDUVPAdsStart.SHOW_TOOLTIP = "showTooltip";
	FWDUVPAdsStart.MOUSE_OUT = "onMouseOut";
	FWDUVPAdsStart.MOUSE_UP = "onMouseDown";
	
	FWDUVPAdsStart.prototype = null;
	window.FWDUVPAdsStart = FWDUVPAdsStart;
}(window));﻿/**
 * Ultimate Video Player PACKAGED v9.1
 * Annotation item.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
var FWDUVPAnnotation = function(props_obj){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPAnnotation.prototype;
		
		_s.id = props_obj.id;
		_s.startTime = props_obj.start;
		_s.endTime = props_obj.end;
		_s.htmlContent_str = props_obj.content;
		_s.left = props_obj.left;
		_s.top = props_obj.top;
		_s.showCloseButton_bl = props_obj.showCloseButton_bl;
		_s.clickSource = props_obj.clickSource;
		_s.clickSourceTarget = props_obj.clickSourceTarget;
		_s.closeButtonNpath = props_obj.closeButtonNpath;
		_s.closeButtonSPath = props_obj.closeButtonSPath;
		_s.normalStateClass = props_obj.normalStateClass;
		_s.selectedStateClass = props_obj.selectedStateClass;
		_s.showAnnotationsPositionTool_bl = props_obj.showAnnotationsPositionTool_bl;
		_s.prt = props_obj.prt;
		_s.curX = _s.left;
		_s.curY = _s.top;
		_s._d = props_obj._d;
		
		_s.useHEX = props_obj.useHEX;
		_s.nBC = props_obj.nBC;
		_s.sBC = props_obj.sBC;
		
		_s.handPath_str = props_obj.handPath_str;
		_s.grabPath_str = props_obj.grabPath_str;

	
		//##########################################//
		/* initialize  */
		//##########################################//
		_s.init = function(){
			if(_s._d.sknPth.indexOf("hex_white") != -1){
				_s.sBC = "#FFFFFF";
			}
			
			_s.setOverflow("visible");
			_s.setAlpha(0);
			_s.setVisible(false);
			
			if(FWDUVPUtils.hasTransform2d){
				_s.getStyle().transformOrigin = "0% 0%";
			}
			
			_s.screen.innerHTML = _s.htmlContent_str;
			_s.screen.className = _s.normalStateClass;
			_s.setBackfaceVisibility();
			_s.getStyle().fontSmoothing = "antialiased";
			_s.getStyle().webkitFontSmoothing = "antialiased";
			_s.getStyle().textRendering = "optimizeLegibility";
			
			_s.dummy_do = new FWDUVPDisplayObject("div");
			_s.dummy_do.getStyle().width = "100%";
			_s.dummy_do.getStyle().height = "100%";
			_s.addChild(_s.dummy_do);
		
			setTimeout(function(){
				_s.w = _s.getWidth();
				_s.h = _s.getHeight();
			}, 100);
			
			if(_s.showCloseButton_bl && !_s.showAnnotationsPositionTool_bl){
				FWDUVPSimpleSizeButton.setPrototype();
				_s.clsBtn = new FWDUVPSimpleSizeButton(
						_s.closeButtonNpath, 
						_s.closeButtonSPath,
						26,
						26,
						_s.useHEX,
						_s.nBC,
						_s.sBC,
						true
						);
			    _s.clsBtn.setScale2(0);
				_s.clsBtn.addListener(FWDUVPSimpleSizeButton.MOUSE_UP, _s.closeClickButtonCloseHandler);
				_s.clsBtn.getStyle().position = "absolute";
				_s.addChild(_s.clsBtn);
			}
			
			if(_s.showAnnotationsPositionTool_bl){
				_s.info_do = new FWDUVPDisplayObject("div");
				_s.info_do.getStyle().backgroundColor = "#FFFFFF";
				_s.info_do.getStyle().boxShadow = "2px 2px 2px #888888;";
				
				_s.info_do.getStyle().fontSmoothing = "antialiased";
				_s.info_do.getStyle().webkitFontSmoothing = "antialiased";
				_s.info_do.getStyle().textRendering = "optimizeLegibility";
				_s.addChild(_s.info_do);
				
				setTimeout(function(){
					_s.info_do.screen.innerHTML = "<div style='padding:4px; maring:4px; color:#000000'> _d-left=" + Math.round(_s.curX * _s.prt.scaleInverse)  + "</div><div style='padding:4px; margin:4px; color:#000000;'> _d-top=" + Math.round(_s.curY * _s.prt.scaleInverse)  + "</div>";
					
					_s.setX(Math.round(_s.curX * _s.prt.scale));
					_s.setY(Math.round(_s.curY * _s.prt.scale));
				}, 100)
				if(_s.isMbl){
				if(_s.hasPointerEvent_bl){
						_s.screen.addEventListener("pointerdown", _s.selfOnDownHandler);
					}else{
						_s.screen.addEventListener("touchdown", _s.selfOnDownHandler);
					}
				}else{
					if(window.addEventListener){
						_s.screen.addEventListener("mousedown", _s.selfOnDownHandler);		
					}
				}
				_s.getStyle().cursor = 'url(' + _s.handPath_str + '), default';
			}
		
			if(_s.clickSource && !_s.showAnnotationsPositionTool_bl){
				_s.dummy_do.setButtonMode(true);
				_s.dummy_do.screen.addEventListener("click", _s.onClickHandler);
				_s.dummy_do.screen.addEventListener("mouseover", _s.onMouseOverHandler);
				_s.dummy_do.screen.addEventListener("mouseout", _s.onMouseOutHandler);
			}
		};
		
		_s.selfOnDownHandler =  function(e){
			if(e.preventDefault) e.preventDefault();
			
			_s.getStyle().cursor = 'url(' + _s.grabPath_str + '), default';
			_s.prt.addChild(_s);
			
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			_s.startX = vc.screenX - _s.prt.getGlobalX();
			_s.startY = vc.screenY - _s.prt.getGlobalY();
			_s.curX = _s.x;
			_s.curY = _s.y;
		
			if(_s.isMbl){
				if(_s.hasPointerEvent_bl){
					window.addEventListener("pointermove", _s.selfMoveHandler);
					window.addEventListener("pointerup", _s.selfEndHandler);
				}else{
					window.addEventListener("touchmove", _s.selfMoveHandler);
					window.addEventListener("touchend", _s.selfEndHandler);
				}
			}else{
				if(window.addEventListener){
					window.addEventListener("mousemove", _s.selfMoveHandler);
					window.addEventListener("mouseup", _s.selfEndHandler);		
				}
			}
		};
		
		_s.selfMoveHandler = function(e){
			if(e.preventDefault) e.preventDefault();
			
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			_s.localX = vc.screenX - _s.prt.getGlobalX();
			_s.localY = vc.screenY - _s.prt.getGlobalY();
			
			_s.curX = _s.x;
			_s.curY = _s.y;
			_s.curX += (_s.localX - _s.startX);
			_s.curY += (_s.localY - _s.startY);
			
			_s.setX(_s.curX);
			_s.setY(_s.curY);
			_s.startX = vc.screenX - _s.prt.getGlobalX();
			_s.startY = vc.screenY - _s.prt.getGlobalY();
			
			_s.info_do.screen.innerHTML = "<div style='padding:4px; maring:4px; color:#000000'> _d-left=" + Math.round(_s.curX * _s.prt.scaleInverse)  + "</div><div style='padding:4px; margin:4px; color:#000000;'> _d-top=" + Math.round(_s.curY * _s.prt.scaleInverse)  + "</div>";
		};
		
		_s.selfEndHandler = function(e){
			_s.getStyle().cursor = 'url(' + _s.handPath_str + '), default';
			if(_s.isMbl){
				if(_s.hasPointerEvent_bl){
					window.removeEventListener("pointermove", _s.selfMoveHandler);
					window.removeEventListener("pointerup", _s.selfEndHandler);
				}else{
					window.removeEventListener("touchmove", _s.selfMoveHandler);
					window.removeEventListener("touchend", _s.selfEndHandler);
				}
			}else{
				if(window.removeEventListener){
					window.removeEventListener("mousemove", _s.selfMoveHandler);
					window.removeEventListener("mouseup", _s.selfEndHandler);		
				}
			}
		};
		
		_s.onMouseOverHandler = function(e){
			_s.setSelectedAtate();
		};
		
		_s.onMouseOutHandler = function(e){
			_s.setNormalState();
		};
		
		_s.onClickHandler = function(){
		
			if(_s.clickSource.indexOf("https") != -1 || _s.clickSource.indexOf("http") != -1){
				window.open(_s.clickSource, _s.clickSourceTarget);
			}else{
				eval(_s.clickSource);
			}
		};
		
		_s.closeClickButtonCloseHandler = function(){
			_s.hide();
			_s.isClsd = true;
		};
	
		_s.show = function(){
			if(_s.isShowed_bl || _s.isClsd) return;
			_s.isShowed_bl = true;
			_s.setVisible(true);
			FWDAnimation.killTweensOf(_s);
			FWDAnimation.to(_s, .8, {alpha:1, ease:Quint.easeOut});
			if(_s.clsBtn) FWDAnimation.to(_s.clsBtn, .8, {scale:1, delay:.2, ease:Elastic.easeOut});
		};
		
		_s.hide = function(){
			if(!_s.isShowed_bl) return;
			FWDAnimation.killTweensOf(_s);
			_s.isShowed_bl = false;
			_s.setVisible(false);
			_s.setAlpha(0);
			if(_s.clsBtn){
				FWDAnimation.killTweensOf(_s.clsBtn);
				_s.clsBtn.setScale2(0);
			}
		};
		
		_s.setNormalState = function(){
			if(!_s.selectedStateClass) return;
			FWDAnimation.to(_s.screen, .8, {className:_s.normalStateClass, ease:Quint.easeOut});
		};
		
		_s.setSelectedAtate = function(){
			if(!_s.selectedStateClass) return;
			FWDAnimation.to(_s.screen, .8, {className:_s.selectedStateClass, ease:Quint.easeOut});
		};

		
		//##########################################//
		/* Update HEX color of a canvaas */
		//##########################################//
		_s.updateHEXColors = function(nBC, sBC){
			if(_s.clsBtn) _s.clsBtn.updateHEXColors(nBC, sBC, _s.buttonWidth, _s.buttonHeight);
		}
		
		_s.init();
	};
	

	/* set prototype */
	FWDUVPAnnotation.setPrototype = function(){
		FWDUVPAnnotation.prototype = null;
		if(FWDUVPUtils.hasTransform2d){
			FWDUVPAnnotation.prototype = new FWDUVPTransformDisplayObject("div");
		}else{
			FWDUVPAnnotation.prototype = new FWDUVPDisplayObject("div");
		}
	};

	FWDUVPAnnotation.prototype = null;
	window.FWDUVPAnnotation = FWDUVPAnnotation;
}(window));﻿/**
 * Ultimate Video Player PACKAGED v9.1
 * Annotations.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
var FWDUVPAnnotations = function(prt, _d){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPAnnotations.prototype;
		
		_s.nBC = _d.nBC;
		_s.sBC = _d.sBC;
		
		_s.ann_ar = [];
		_s.showAnnotationsPositionTool_bl = _d.showAnnotationsPositionTool_bl;
	

		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.setOverflow("visible");
		};
		

		//##########################################//
		/* setup text containers */
		//##########################################//
		_s.setupAnnotations = function(source_ar){
			
			if(_s.ann_ar){
				for(var i=0; i<_s.ann_ar.length; i++){
					try{
						_s.removeChild(_s.ann_ar[i]);
					}catch(e){}
				}
			}
			
			_s.source_ar = source_ar;
			
			if(source_ar == undefined){
				_s.setVisible(false);
				return;
			}else{
				_s.setVisible(true);
			}
			
			_s.source_ar = source_ar;
			_s.ann_ar = [];
			_s.totalAnnotations = _s.source_ar.length;
			var pth = _d.annotationAddCloseNPath_str;
			if(window['isWhite']){
				pth = 'content/hex_white/annotation-close-button-normal.png';
			}
			
			for(var i=0; i<_s.totalAnnotations; i++){
				
				FWDUVPAnnotation.setPrototype();
				var ann = new FWDUVPAnnotation({
					id:i,
					start:_s.source_ar[i].start,
					end:_s.source_ar[i].end,
					left:_s.source_ar[i].left,
					top:_s.source_ar[i].top,
					clickSource:_s.source_ar[i].clickSource,
					clickSourceTarget:_s.source_ar[i].clickSourceTarget,
					content:_s.source_ar[i].content,
					showCloseButton_bl:_s.source_ar[i].showCloseButton_bl,
					closeButtonNpath:pth,
					closeButtonSPath:_d.annotationAddCloseSPath_str,
					normalStateClass:_s.source_ar[i].normalStateClass,
					selectedStateClass:_s.source_ar[i].selectedStateClass,
					showAnnotationsPositionTool_bl:_s.showAnnotationsPositionTool_bl,
					prt:_s,
					handPath_str:_d.handPath_str,
					grabPath_str:_d.grabPath_str,
					useHEX:_d.useHEX,
					nBC:_s.nBC,
					sBC:_s.sBC,
					_d:_d
				}) 
				
				_s.ann_ar[i] = ann;
				
				_s.addChild(ann);
			}	
		};
		
		_s.update = function(duration){

			if(_s.totalAnnotations == 0) return;
			var annotation;
			
			for(var i=0; i<_s.totalAnnotations; i++){
				annotation = _s.ann_ar[i];
				if(duration <=0){
					annotation.hide();
				}else if(duration >= annotation.startTime && duration <= annotation.endTime){
					annotation.show();
					_s.position();
					
				}else{
					annotation.hide();
				}
			}	
		
		};
		
		_s.position = function(animate){
			
			var selfScale = prt.sW/prt.maxWidth;
			_s.setX(Math.round((prt.sW - (selfScale * prt.maxWidth))/2));
			_s.setY(Math.round((prt.tempVidStageHeight - (selfScale * prt.maxHeight))/2));
			
			_s.scale = prt.sW/prt.maxWidth;
			_s.scaleY = _s.scale;
			_s.scaleX = _s.scale;
			
			_s.scaleInverse = prt.maxWidth/prt.sW;
			
			if(_s.showAnnotationsPositionTool_bl) return;
			for(var i=0; i<_s.totalAnnotations; i++){
				var ann_do = _s.ann_ar[i];
				
				var finalX = 0;
				var finalY = 0;
				
				ann_do.setScale2(_s.scale);
			
				ann_do.finalX = Math.floor(ann_do.left * _s.scaleX);
				if(prt.playlist_do && prt.isPlaylistShowed_bl && prt.tempPlaylistPosition_str == "right" && !prt.isFullScreen_bl && ann_do.left > prt.maxWidth/3){
					ann_do.finalX -= (prt.playlistWidth + prt.spaceBetweenControllerAndPlaylist);
				}
				
				ann_do.finalY = Math.floor(ann_do.top * _s.scaleY);
				
				if(ann_do.clsBtn){
					
					ann_do.clsBtn.setWidth(Math.round(ann_do.clsBtn.buttonWidth * _s.scaleInverse));
					ann_do.clsBtn.setHeight(Math.round(ann_do.clsBtn.buttonHeight * _s.scaleInverse));
					ann_do.clsBtn.n_do.setWidth(Math.round(ann_do.clsBtn.buttonWidth * _s.scaleInverse));
					ann_do.clsBtn.n_do.setHeight(Math.round(ann_do.clsBtn.buttonHeight * _s.scaleInverse));
					if(ann_do.clsBtn.n_do_canvas){
						ann_do.clsBtn.n_do_canvas.style.width = Math.round(ann_do.clsBtn.buttonWidth * _s.scaleInverse) + "px";
						ann_do.clsBtn.n_do_canvas.style.height = Math.round(ann_do.clsBtn.buttonheight * _s.scaleInverse) + "px";
						ann_do.clsBtn.s_do_canvas.style.width = Math.round(ann_do.clsBtn.buttonWidth * _s.scaleInverse) + "px";
						ann_do.clsBtn.s_do_canvas.style.height = Math.round(ann_do.clsBtn.buttonheight * _s.scaleInverse) + "px";
					}
					ann_do.clsBtn.s_do.setWidth(Math.round(ann_do.clsBtn.buttonWidth * _s.scaleInverse));
					ann_do.clsBtn.s_do.setHeight(Math.round(ann_do.clsBtn.buttonHeight * _s.scaleInverse));
					ann_do.clsBtn.setX(Math.floor(ann_do.getWidth() - ((ann_do.clsBtn.w/2))));
					ann_do.clsBtn.setY(Math.floor(-(ann_do.clsBtn.h/2)));
				}
				
				if(ann_do.prevFinalX != ann_do.finalX){
					if(animate){
						FWDAnimation.to(ann_do, .8, {x:ann_do.finalX, ease:Expo.easeInOut});
					}else{
						ann_do.setX(ann_do.finalX);
					}
					
				}
			
				if(ann_do.prevFinalY != ann_do.finalY){
					if(animate){
						FWDAnimation.to(ann_do, .8, {y:ann_do.finalY, ease:Expo.easeInOut});
					}else{
						ann_do.setY(ann_do.finalY);
					}
				}
				
				ann_do.prevFinalX = ann_do.finalX;
				ann_do.prevFinalY = ann_do.finalY
			}
		};
	
		_s.updateHEXColors =  function(nBC, sBC){
			
			_s.nBC = nBC;
			_s.sBC = sBC;
			if(_s.ann_ar){
				for(var i=0; i<_s.ann_ar.length; i++){
					_s.ann_ar[i].updateHEXColors(nBC, sBC);	
				}
			}
		}
		_s.init();
	};

	
	/* set prototype */
	FWDUVPAnnotations.setPrototype = function(){
		FWDUVPAnnotations.prototype = null;
		FWDUVPAnnotations.prototype = new FWDUVPDisplayObject("div", "absolute");
	};
	
	FWDUVPAnnotations.prototype = null;
	window.FWDUVPAnnotations = FWDUVPAnnotations;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Audio screen.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function(window){
	
	var FWDUVPAudioScreen = function(prt, volume){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPAudioScreen.prototype;
	
		_s.lastPercentPlayed = 0;
		_s.volume = volume;
		_s.curDuration = 0;
		_s.countNormalMp3Errors = 0;
		_s.countShoutCastErrors = 0;
		_s.maxShoutCastCountErrors = 5;
		_s.maxNormalCountErrors = 1;
		_s.testShoutCastId_to;
		_s.audioVisualizerLinesColor_str = FWDUVPUtils.hexToRgb(prt._d.audioVisualizerLinesColor_str);
		_s.audioVisualizerCircleColor_str = FWDUVPUtils.hexToRgb(prt._d.audioVisualizerCircleColor_str);
		_s.hasError_bl = true;
		_s.isStopped_bl = true;

		
		//###############################################//
		/* init */
		//###############################################//
		_s.init = function(){
			_s.setupAudio();
		};

		
		//##############################################//
		/* Resize and position */
		//##############################################//
		_s.resizeAndPosition = function(width, height){
			if(width){
				_s.sW = width;
				_s.sH = height;
			}
			
			_s.setWidth(_s.sW);
			_s.setHeight(_s.sH);
			_s.resizeSpectrumCanvas()
		};
	

		//###############################################//
		/* Setup audio element */
		//##############################################//
		_s.setupAudio = function(){
			if(_s.audio_el == null){
				_s.audio_el = document.createElement("audio");
				_s.screen.appendChild(_s.audio_el);
				_s.audio_el.controls = false;
				_s.audio_el.preload = "auto";
				_s.audio_el.volume = _s.volume;
				if(!FWDUVPUtils.isLocal) _s.audio_el.crossOrigin = "*";
				_s.setPlaybackRate(prt._d.defaultPlaybackRate_ar[prt._d.startAtPlaybackIndex]);
			}
			
			_s.audio_el.addEventListener("error", _s.errorHandler);
			_s.audio_el.addEventListener("canplay", _s.safeToBeControlled);
			_s.audio_el.addEventListener("canplaythrough", _s.safeToBeControlled);
			_s.audio_el.addEventListener("progress", _s.updateProgress);
			_s.audio_el.addEventListener("timeupdate", _s.updateAudio);
			_s.audio_el.addEventListener("pause", _s.pauseHandler);
			_s.audio_el.addEventListener("play", _s.playHandler);
			_s.audio_el.addEventListener("ended", _s.endedHandler);
		};
		
		_s.destroyAudio = function(){
			if(_s.audio_el){
				_s.audio_el.removeEventListener("error", _s.errorHandler);
				_s.audio_el.removeEventListener("canplay", _s.safeToBeControlled);
				_s.audio_el.removeEventListener("canplaythrough", _s.safeToBeControlled);
				_s.audio_el.removeEventListener("progress", _s.updateProgress);
				_s.audio_el.removeEventListener("timeupdate", _s.updateAudio);
				_s.audio_el.removeEventListener("pause", _s.pauseHandler);
				_s.audio_el.removeEventListener("play", _s.playHandler);
				_s.audio_el.removeEventListener("ended", _s.endedHandler);
				_s.audio_el.removeEventListener("waiting", _s.startToBuffer);
				_s.audio_el.removeEventListener("playing", _s.stopToBuffer);
				_s.audio_el.src = "";
				_s.audio_el.load();
			}
		};
		
		_s.startToBuffer = function(overwrite){
			_s.dispatchEvent(FWDUVPVideoScreen.START_TO_BUFFER);
		};
		
		_s.stopToBuffer = function(){
			_s.dispatchEvent(FWDUVPVideoScreen.STOP_TO_BUFFER);
		};
		
		_s.togglePlayPause = function(){
			if(_s == null) return;
			if(!_s.isSafeToBeControlled_bl) return;
			if(_s.isPlaying_bl){
				_s.pause();
			}else{
				_s.play();
			}
		};

		_s.updateLinesColor = function(lc){
			_s.audioVisualizerLinesColor_str = lc;
		}
		

		//##########################################//
		/* Video error handler. */
		//##########################################//
		_s.errorHandler = function(e){
			if(_s.sourcePath_str == null || _s.sourcePath_str == undefined) return;
			
			if(_s.isNormalMp3_bl && _s.countNormalMp3Errors <= _s.maxNormalCountErrors){
				_s.stop();
				_s.testShoutCastId_to = setTimeout(_s.play, 200);
				_s.countNormalMp3Errors ++;
				return;
			}
			
			if(_s.isShoutcast_bl && _s.countShoutCastErrors <= _s.maxShoutCastCountErrors && _s.audio_el.networkState == 0){
				_s.testShoutCastId_to = setTimeout(_s.play, 200);
				_s.countShoutCastErrors ++;
				return;
			}
			
			var error_str;
			_s.hasError_bl = true;
			_s.stop();
			
			if(_s.audio_el.networkState == 0){
				error_str = "error '_s.audio_el.networkState = 1'";
			}else if(_s.audio_el.networkState == 1){
				error_str = "error '_s.audio_el.networkState = 1'";
			}else if(_s.audio_el.networkState == 2){
				error_str = "'_s.audio_el.networkState = 2'";
			}else if(_s.audio_el.networkState == 3){
				error_str = "source not found";
			}else{
				error_str = e;
			}
			
			if(window.console) window.console.log(_s.audio_el.networkState);
			
			_s.dispatchEvent(FWDUVPAudioScreen.ERROR, {text:error_str });
		};
		

		//##############################################//
		/* Set path */
		//##############################################//
		_s.setSource = function(sourcePath){
			
			_s.sourcePath_str = sourcePath;
			clearTimeout(_s.testShoutCastId_to);
			
			if(_s.sourcePath_str.indexOf(";") != -1){
				_s.isShoutcast_bl = true;
				_s.countShoutCastErrors = 0;
			}else{
				_s.isShoutcast_bl = false;
			}
			
			if(_s.sourcePath_str.indexOf(";") == -1){
				_s.isNormalMp3_bl = true;
				_s.countNormalMp3Errors = 0;
			}else{
				_s.isNormalMp3_bl = false;
			}
			
			_s.lastPercentPlayed = 0;
			if(_s.audio_el) _s.stop(true);
		};

	
		//##########################################//
		/* Play / pause / stop methods */
		//##########################################//
		_s.play = function(overwrite){
			if(_s.isStopped_bl){
				_s.isPlaying_bl = false;
				_s.hasError_bl = false;
				_s.allowScrubing_bl = false;
				_s.isStopped_bl = false;
				_s.setupAudio();
				_s.audio_el.src = _s.sourcePath_str;
				_s.play();
				_s.setVisible(true);
			}else if(!_s.audio_el.ended || overwrite){
				try{
					_s.isPlaying_bl = true;
					_s.hasPlayedOnce_bl = true;
					var prm = _s.audio_el.play();
					if(prm !== undefined) {
					    prm.then(function(){}, function(){});
					}
					if(FWDUVPUtils.isIE) _s.dispatchEvent(FWDUVPAudioScreen.PLAY);
				}catch(e){console.log(e)};
			}
		};
		
		_s.resume = function(){
			if(_s.isStopped_bl) return;
			_s.play();
		};

		_s.pause = function(){
			if(_s == null) return;
			if(_s.audio_el == null) return;
			if(!_s.audio_el.ended){
				_s.audio_el.pause();
				_s.isPlaying_bl = false;
				if(FWDUVPUtils.isIE) _s.dispatchEvent(FWDUVPAudioScreen.PAUSE);				
			}
		};
		
		_s.pauseHandler = function(){
			if(_s.allowScrubing_bl) return;
			_s.stopSpectrum();
			_s.dispatchEvent(FWDUVPAudioScreen.PAUSE);
		};
		
		_s.playHandler = function(){
			if(_s.allowScrubing_bl) return;
			if(!_s.isStartEventDispatched_bl){
				_s.dispatchEvent(FWDUVPAudioScreen.START);
				_s.isStartEventDispatched_bl = true;
			}
		
			_s.startSpectrum();
			_s.dispatchEvent(FWDUVPAudioScreen.PLAY);
		};
		
		_s.endedHandler = function(){
			_s.dispatchEvent(FWDUVPAudioScreen.PLAY_COMPLETE);
		};
		
		_s.stop = function(overwrite){
		
			if((_s == null || _s.audio_el == null || _s.isStopped_bl) && !overwrite) return;
			_s.isPlaying_bl = false;
			_s.isStopped_bl = true;
			_s.hasPlayedOnce_bl = true;
			_s.isSafeToBeControlled_bl = false;
			_s.isStartEventDispatched_bl = false;
			_s.setVisible(false);
			clearTimeout(_s.testShoutCastId_to);
			_s.stopToUpdateSubtitles();
			_s.stopSpectrum();
			_s.audio_el.pause();
			_s.destroyAudio();
			_s.dispatchEvent(FWDUVPAudioScreen.STOP);
			_s.dispatchEvent(FWDUVPAudioScreen.LOAD_PROGRESS, {percent:0});
		};


		//###########################################//
		/* Check if audio is safe to be controlled */
		//###########################################//
		_s.safeToBeControlled = function(){
			if(!_s.isSafeToBeControlled_bl){
				_s.hasHours_bl = Math.floor(_s.audio_el.duration / (60 * 60)) > 0;
				_s.isPlaying_bl = true;
				_s.isSafeToBeControlled_bl = true;
				_s.startToUpdateSubtitles();
				_s.dispatchEvent(FWDUVPAudioScreen.SAFE_TO_SCRUBB);
				_s.dispatchEvent(FWDUVPAudioScreen.SAFE_TO_UPDATE_VOLUME);
			}
		};
	

		//###########################################//
		/* Update progress */
		//##########################################//
		_s.updateProgress = function(){
			var buffered;
			var percentLoaded = 0;
			
			if(_s.audio_el.buffered.length > 0){
				buffered = _s.audio_el.buffered.end(_s.audio_el.buffered.length - 1);
				percentLoaded = buffered.toFixed(1)/_s.audio_el.duration.toFixed(1);
				if(isNaN(percentLoaded) || !percentLoaded) percentLoaded = 0;
			}
			
			if(percentLoaded == 1) _s.audio_el.removeEventListener("progress", _s.updateProgress);
			
			_s.dispatchEvent(FWDUVPAudioScreen.LOAD_PROGRESS, {percent:percentLoaded});
		};

		
		//##############################################//
		/* Update audio */
		//#############################################//
		_s.updateAudio = function(){
			
			var percentPlayed; 
			if (!_s.allowScrubing_bl) {
				percentPlayed = _s.audio_el.currentTime /_s.audio_el.duration;
				_s.dispatchEvent(FWDUVPAudioScreen.UPDATE, {percent:percentPlayed});
			}
			
			var totalTime = FWDUVPUtils.formatTime(_s.audio_el.duration);
			var curTime = FWDUVPUtils.formatTime(_s.audio_el.currentTime);
			
			
			if(!isNaN(_s.audio_el.duration)){
				_s.dispatchEvent(FWDUVPVideoScreen.UPDATE_TIME, {curTime: curTime, totalTime:totalTime, seconds:_s.audio_el.currentTime, totalTimeInSeconds:_s.audio_el.duration});
			}else{
				_s.dispatchEvent(FWDUVPVideoScreen.UPDATE_TIME, {curTime:"00:00" , totalTime:"00:00", seconds:0, totalTimeInSeconds:0});
			}
			_s.lastPercentPlayed = percentPlayed;
			_s.curDuration = curTime;
		};

		
		//###############################################//
		/* Scrub */
		//###############################################//
		_s.startToScrub = function(){
			_s.allowScrubing_bl = true;
		};
		
		_s.stopToScrub = function(){
			_s.allowScrubing_bl = false;
		};
		
		_s.scrubbAtTime = function(duration){
			_s.audio_el.currentTime = duration;
			var totalTime = FWDUVPUtils.formatTime(_s.audio_el.duration);
			var curTime = FWDUVPUtils.formatTime(_s.audio_el.currentTime);
			_s.dispatchEvent(FWDUVPVideoScreen.UPDATE_TIME, {curTime: curTime, totalTime:totalTime});
		};
		
		_s.scrub = function(percent, e){
			if(_s.audio_el == null || !_s.audio_el.duration) return;
			if(e) _s.startToScrub();
			try{
				_s.audio_el.currentTime = _s.audio_el.duration * percent;
				var totalTime = FWDUVPUtils.formatTime(_s.audio_el.duration);
				var curTime = FWDUVPUtils.formatTime(_s.audio_el.currentTime);
				_s.dispatchEvent(FWDUVPAudioScreen.UPDATE_TIME, {curTime: curTime, totalTime:totalTime});
			}catch(e){}
		};

		
		//###############################################//
		/* replay */
		//###############################################//
		_s.replay = function(){
			_s.scrub(0);
			_s.play();
		};

		
		//##################################################//
		/* Subtitles */
		//##################################################//
		_s.stopToUpdateSubtitles = function(){
			clearInterval(_s.startToUpdateSubtitleId_int);	
		}
		
		_s.startToUpdateSubtitles = function(){
			clearInterval(_s.startToUpdateSubtitleId_int);
			_s.startToUpdateSubtitleId_int = setInterval(_s.updateSubtitleHandler, 10);
		}
		
		_s.updateSubtitleHandler = function(){
			_s.dispatchEvent(FWDUVPAudioScreen.UPDATE_SUBTITLE, {curTime:_s.audio_el.currentTime});
		}
		

		//###############################################//
		/* Volume */
		//###############################################//
		_s.setVolume = function(vol){
			if(vol != undefined) _s.volume = vol;
			if(_s.audio_el) _s.audio_el.volume = _s.volume;
		};
		
		_s.setPlaybackRate = function(rate){
			if(!_s.audio_el) return;
			if(rate == 0.25) rate = "0.5";
			
			_s.audio_el.defaultPlaybackRate = rate;
			_s.audio_el.playbackRate = rate;
		}

		
		//####################################################//
		/* Spectrum visualizer */
		//###################################################//
		_s.setupSpectrum = function(){
			if(FWDUVPUtils.isIOS) return;
			if(prt.useWithoutVideoScreen_bl) return;
			var audioContextTest = window.AudioContext || window.webkitAudioContext;
			if(_s.canvas_do || !audioContextTest) return;
			if(FWDUVPAudioScreen.countAudioContext > 3) return;
			FWDUVPAudioScreen.countAudioContext ++;
			_s.canvas_do = new FWDUVPDisplayObject("canvas");
			
			_s.addChild(_s.canvas_do);
			
			_s.canvas = _s.canvas_do.screen;
			_s.ctx = _s.canvas.getContext("2d");
			
			_s.resizeSpectrumCanvas();
			
			if(!audioContextTest) return;
			_s.context = new audioContextTest();
			_s.analyser = _s.context.createAnalyser();
			
			_s.source = _s.context.createMediaElementSource(_s.audio_el);
			
			_s.source.connect(_s.analyser);
			_s.analyser.connect(_s.context.destination);
			
			_s.fbc_array = new Uint8Array(_s.analyser.frequencyBinCount);
			_s.renderSpectrum();
		}
		
		_s.resizeSpectrumCanvas =  function(){
			if(!_s.canvas_do) return;
			_s.canvas_do.setWidth(_s.sW);
			_s.canvas_do.setHeight(_s.sH);
			_s.canvas.width  = _s.sW;
			_s.canvas.height = _s.sH;
		}
		
		
		// give vars an initial real value to validate
		_s.bars = 200;
		if(FWDUVPUtils.isMobile) _s.bars = 100;
		_s.react_x = 0;
		_s.react_y = 0;
		_s.radius = 0;
		_s.deltarad = 0;
		_s.shockwave = 0;
		_s.rot = 0;
		_s.intensity = 0;
		_s.isSeeking = 0;
		_s.center_x;
		_s.center_y;
		
		
		_s.renderSpectrum = function() {
			
			if(!_s.canvas_do) return;
			_s.resizeSpectrumCanvas(); // for some reason i have to resize the _s.canvas every update or else the framerate decreases over time
						
			var grd = _s.ctx.createLinearGradient(0, 0, 0, _s.canvas.height);
			grd.addColorStop(0, "rgba(0, 0, 0, 1)");
			grd.addColorStop(1, "rgba(0, 0, 0, 1)");

			_s.ctx.fillStyle = grd;
			_s.ctx.fillRect(0, 0, _s.canvas.width, _s.canvas.height);
			
			_s.ctx.fillStyle = "rgba(255, 255, 255, " + (_s.intensity * 0.0000125 - 0.4) + ")";
			_s.ctx.fillRect(0, 0, _s.canvas.width, _s.canvas.height);
				
			_s.rot = _s.rot + _s.intensity * 0.0000001;
				
			_s.react_x = 0;
			_s.react_y = 0;
						
			_s.intensity = 0;
						
			_s.analyser.getByteFrequencyData(_s.fbc_array);
			
			for (var i = 0; i < _s.bars; i++) {
				var rads = Math.PI * 2 / _s.bars;
								
				var bar_x = _s.center_x;
				var bar_y = _s.center_y;
			
				var limit =  _s.sH/3;
				if(isNaN(limit)) limit = 10;
				var bar_height = Math.round(_s.fbc_array[i]/256 * limit)
				var bar_width = Math.round(bar_height * 0.02);
								
				var bar_x_term = _s.center_x + Math.cos(rads * i + _s.rot) * (_s.radius + bar_height);
				var bar_y_term = _s.center_y + Math.sin(rads * i + _s.rot) * (_s.radius + bar_height);
								
				_s.ctx.save();
				
				var lineColor = _s.audioVisualizerLinesColor_str;
								
				_s.ctx.strokeStyle = lineColor;
				_s.ctx.lineWidth = bar_width;
				_s.ctx.beginPath();
				_s.ctx.moveTo(bar_x, bar_y);
				_s.ctx.lineTo(bar_x_term, bar_y_term);
				_s.ctx.stroke();
							
				_s.react_x += Math.cos(rads * i + _s.rot) * (_s.radius + bar_height);
				_s.react_y += Math.sin(rads * i + _s.rot) * (_s.radius + bar_height);
							
				_s.intensity += bar_height;
			}
						
			_s.center_x = _s.canvas.width / 2 - (_s.react_x * 0.007);
			_s.center_y = _s.canvas.height / 2 - (_s.react_y * 0.007);
						
			var radius_old = _s.radius;
			_s.radius =  25 + (_s.intensity * 0.002);
			_s.deltarad = _s.radius - radius_old;
						
			_s.ctx.fillStyle = _s.audioVisualizerCircleColor_str;
			_s.ctx.beginPath();
			_s.ctx.arc(_s.center_x, _s.center_y, _s.radius + 2, 0, Math.PI * 2, false);
			_s.ctx.fill();
			
			// _s.shockwave effect			
			_s.shockwave += 60;
						
			_s.ctx.lineWidth = 15;
			_s.ctx.strokeStyle = _s.audioVisualizerCircleColor_str;
			_s.ctx.beginPath();
			_s.ctx.arc(_s.center_x, _s.center_y, _s.shockwave + _s.radius, 0, Math.PI * 2, false);
			_s.ctx.stroke();
								
			if (_s.deltarad > 15) {
				_s.shockwave = 0;
				
				_s.ctx.fillStyle = "rgba(255, 255, 255, 0.7)";
				_s.ctx.fillRect(0, 0, _s.canvas.width, _s.canvas.height);
				
				_s.rot = _s.rot + 0.4;
			}
			
			_s.startSpectrum();
			
		}
		
		_s.startSpectrum = function(){
			if(!_s.canvas_do) return;
			_s.stopSpectrum();
			_s.spectrumAnimationFrameId = window.requestAnimationFrame(_s.renderSpectrum);
		}
		
		_s.stopSpectrum = function(){
			if(!_s.canvas_do) return;
			cancelAnimationFrame(_s.spectrumAnimationFrameId);
		}

		_s.init();
	};

	/* set prototype */
	FWDUVPAudioScreen.setPrototype = function(){
		FWDUVPAudioScreen.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPAudioScreen.UPDATE_SUBTITLE = "updateSubtitle"
	FWDUVPAudioScreen.ERROR = "error";
	FWDUVPAudioScreen.UPDATE = "update";
	FWDUVPAudioScreen.UPDATE = "update";
	FWDUVPAudioScreen.UPDATE_TIME = "updateTime";
	FWDUVPAudioScreen.SAFE_TO_SCRUBB = "safeToControll";
	FWDUVPAudioScreen.SAFE_TO_UPDATE_VOLUME = "safeToUpdateVolume";
	FWDUVPAudioScreen.LOAD_PROGRESS = "loadProgress";
	FWDUVPAudioScreen.START = "start";
	FWDUVPAudioScreen.PLAY = "play";
	FWDUVPAudioScreen.PAUSE = "pause";
	FWDUVPAudioScreen.STOP = "stop";
	FWDUVPAudioScreen.PLAY_COMPLETE = "playComplete";
	FWDUVPAudioScreen.countAudioContext = 0;
	
	window.FWDUVPAudioScreen = FWDUVPAudioScreen;

}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Categories window.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function(){
var FWDUVPCategories = function(_d, prt){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPCategories.prototype;
		
		_s.image_img;
		_s.catThumbBk_img = _d.catThumbBk_img;
		_s.catNextN_img = _d.catNextN_img;
		_s.catPrevN_img = _d.catPrevN_img;
		_s.catCloseN_img = _d.catCloseN_img;
	
		_s.thumbs_ar = [];
		_s.categories_ar = _d.cats_ar;	
		_s.catBkPath_str = _d.catBkPath_str;
		
		_s.id = 0;
		_s.mouseX = 0;
		_s.mouseY = 0;
		_s.dif = 0;
		_s.tempId = _s.id;
		_s.sW = 0;
		_s.sH = 0;
		_s.thumbW = 0;
		_s.thumbH = 0;
		_s.buttonsMargins = _d.buttonsMargins;
		_s.thumbnailMaxWidth = _d.thumbnailMaxWidth;
		_s.thumbnailMaxHeight = _d.thumbnailMaxHeight;
		_s.spacerH = _d.horizontalSpaceBetweenThumbnails;
		_s.spacerV = _d.verticalSpaceBetweenThumbnails;
		_s.dl;
		_s.howManyThumbsToDisplayH = 0;
		_s.howManyThumbsToDisplayV = 0;
		if(_s.catNextN_img){
			_s.categoriesOffsetTotalWidth = _s.catNextN_img.width * 2 + 40 + _s.buttonsMargins * 2; 
			_s.categoriesOffsetTotalHeight = _s.catNextN_img.height + 40;
		}
		_s.totalThumbnails = _s.categories_ar.length;
		_s.delayRate = .06;
		_s.countLoadedThumbs = 0;
		
		_s.inputBackgroundColor_str = _d.searchInputBackgroundColor_str;
		_s.inputColor_str = _d.searchInputColor_str;
	
		_s.showSearchInpt = _d.showPlaylistsSearchInput_bl;
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		_s.useVectorIcons_bl = _d.useVectorIcons_bl;


		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.screen.className = 'fwduvp fwduvp-categories';
			if(_d.sknPth.indexOf("hex_white") != -1){
				_s.sBC = "#FFFFFF";
			}else{
				_s.sBC = _d.sBC;
			}
			
			_s.getStyle().zIndex = 2147483647;
			_s.getStyle().msTouchAction = "none";
			_s.getStyle().webkitTapHighlightColor = "rgba(0, 0, 0, 0)";
			_s.getStyle().width = "100%";
			
			_s.mainHld = new FWDUVPDisplayObject("div");
			_s.mainHld.screen.className = 'fwduvp-categories-background';
			_s.mainHld.getStyle().background = "url('" + _s.catBkPath_str + "')";
			_s.mainHld.setY(- 3000);
			_s.addChild(_s.mainHld);
			_s.setupButtons();
			_s.setupDisable();
			if(_s.isMbl){
				_s.setupMobileMove();
			}
			
			if(!_s.isMbl || (_s.isMbl && _s.hasPointerEvent_bl)) _s.setSelectable(false);
			
			if(window.addEventListener){
				_s.screen.addEventListener ("mousewheel", _s.mouseWheelDumyHandler);
				_s.screen.addEventListener('DOMMouseScroll', _s.mouseWheelDumyHandler);
			}else if(document.attachEvent){
				_s.screen.attachEvent ("onmousewheel", _s.mouseWheelDumyHandler);
			}
			if(_s.showSearchInpt) _s.setupInput();

		};
		
		_s.mouseWheelDumyHandler = function(e){	
			var thumb;
			if(FWDAnimation.isTweening(_s.mainHld)){
				if(e.preventDefault){
					e.preventDefault();
				}
				return false;
			}
			
			for (var i = 0; i<_s.totalThumbnails; i++) {
				thumb = _s.thumbs_ar[i];
				if(FWDAnimation.isTweening(thumb)){
					if(e.preventDefault){
						e.preventDefault();
					}
					return false;
				}
			}
			
			var dir = e.detail || e.wheelDelta;	
			if(e.wheelDelta) dir *= -1;
			if(FWDUVPUtils.isOpera) dir *= -1;
			
			if(dir > 0){
				_s.nextButtonOnMouseUpHandler();
			}else if(dir < 0){
				if(_s.leftId <= 0) return;
				_s.prevButtonOnMouseUpHandler();
			}
		
		
			if(e.preventDefault){
				e.preventDefault();
			}else{
				return false;
			}
		};
		

		//###########################################//
		// Resize and position.
		//###########################################//
		_s.resizeAndPosition = function(overwrite){
			if(!_s.isShowed_bl && !overwrite) return;
			
			var scrollOffsets = FWDUVPUtils.getScrollOffsets();
			var viewportSize = FWDUVPUtils.getViewportSize();
			
			_s.sW = viewportSize.w;
			_s.sH = viewportSize.h;
			
			FWDAnimation.killTweensOf(_s.mainHld);
			_s.mainHld.setX(0);
			_s.mainHld.setWidth(_s.sW);
			_s.mainHld.setHeight(_s.sH);
			
			_s.setX(scrollOffsets.x);
			_s.setY(scrollOffsets.y);
			
			_s.setHeight(_s.sH);
			if(_s.isMbl || prt.isEmbedded_bl) _s.setWidth(_s.sW);
			_s.positionButtons();
			_s.tempId = _s.id;
			_s.resizeAndPositionThumbnails();
			_s.disableEnableNextAndPrevButtons();
			
			if(_s.input_do){
				_s.input_do.setX(_s.sW - _s.input_do.getWidth() - _s.buttonsMargins);
				_s.input_do.setY(_s.sH - _s.input_do.getHeight() - _s.buttonsMargins);
				_s.inputArrow_do.setX(_s.input_do.x +  _s.input_do.getWidth() - 20);
				_s.inputArrow_do.setY(_s.input_do.y + _s.input_do.getHeight()/2 - _s.inputArrow_do.getHeight()/2 );
			}
		};

		
		//##########################################//
		/* resize and scroll handler */
		//##########################################//
		_s.onScrollHandler = function(){
			var scrollOffsets = FWDUVPUtils.getScrollOffsets();
			_s.setX(scrollOffsets.x);
			_s.setY(scrollOffsets.y);
		};
		

		//################################################//
		/* setup input */
		//################################################//
		_s.setupInput = function(){
			
			_s.input_do = new FWDUVPDisplayObject("input");
			_s.input_do.screen.className = 'fwduvp-search';
			_s.input_do.screen.maxLength = 20;
			_s.input_do.getStyle().textAlign = "left";
			_s.input_do.getStyle().outline = "none";
			_s.input_do.getStyle().boxShadow  = "none";
			_s.input_do.getStyle().fontFamily = "Arial";
			_s.input_do.getStyle().fontSize= "12px";
			_s.input_do.getStyle().padding = "14px 10px";
			_s.input_do.getStyle().boxSizing = 'border-box';
			_s.input_do.getStyle().backgroundColor = _s.inputBackgroundColor_str;
			_s.input_do.getStyle().color = _s.inputColor_str;
			_s.input_do.screen.value = "Search";
			_s.input_do.setHeight(20);
			_s.input_do.setX(18);
			
			_s.noSearchFound_do = new FWDUVPDisplayObject("div");
			_s.noSearchFound_do.screen.className = 'fwduvp-search-not-found';
			_s.noSearchFound_do.setX(0);
			_s.noSearchFound_do.getStyle().textAlign = "center";
			_s.noSearchFound_do.getStyle().width = "100%";
			_s.noSearchFound_do.getStyle().fontFamily = "Arial";
			_s.noSearchFound_do.getStyle().fontSize= "12px";
			_s.noSearchFound_do.getStyle().color = _s.inputColor_str;
			_s.noSearchFound_do.setInnerHTML("NOTHING FOUND!");
			_s.noSearchFound_do.setVisible(false);
			_s.addChild(_s.noSearchFound_do);
			
			var img = new Image();
			img.src = _d.inputArrowPath_str;
			
			_s.inputArrow_do = new FWDUVPDisplayObject("img"); 
			_s.inputArrow_do.setScreen(img);
			_s.inputArrow_do.setWidth(12);
			_s.inputArrow_do.setHeight(12);
			
			if(_s.hasPointerEvent_bl){
				_s.input_do.screen.addEventListener("pointerdown", _s.inputFocusInHandler);
			}else if(_s.input_do.screen.addEventListener){
				_s.input_do.screen.addEventListener("mousedown", _s.inputFocusInHandler);
				_s.input_do.screen.addEventListener("touchstart", _s.inputFocusInHandler);
			}
			
			_s.input_do.screen.addEventListener("keyup", _s.keyUpHandler);
			_s.mainHld.addChild(_s.input_do);
			_s.mainHld.addChild(_s.inputArrow_do);
		};
		
		_s.inputFocusInHandler = function(){
			if(_s.hasInputFocus_bl) return;
			_s.hasInputFocus_bl = true;
			
			if(_s.input_do.screen.value == "Search"){
				_s.input_do.screen.value = "";
			}
			
			_s.input_do.screen.focus();
			
			setTimeout(function(){
				if(_s.hasPointerEvent_bl){
					window.addEventListener("pointerdown", _s.inputFocusOutHandler);
				}else if(window.addEventListener){
					window.addEventListener("mousedown", _s.inputFocusOutHandler);
					window.addEventListener("touchstart", _s.inputFocusOutHandler);
				}
			}, 50);
		};
		
		_s.inputFocusOutHandler = function(e){
			if(!_s.hasInputFocus_bl) return;
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			if(!FWDUVPUtils.hitTest(_s.input_do.screen, vc.screenX, vc.screenY)){
				_s.hasInputFocus_bl = false;
				if(_s.input_do.screen.value == ""){
					_s.input_do.screen.value = "Search";
					if(_s.hasPointerEvent_bl){
						window.removeEventListener("pointerdown", _s.inputFocusOutHandler);
					}else if(window.removeEventListener){
						window.removeEventListener("mousedown", _s.inputFocusOutHandler);
						window.removeEventListener("touchstart", _s.inputFocusOutHandler);
					}
				}
				return;
			}
		};
		
		_s.keyUpHandler = function(e){
			if(e.stopPropagation) e.stopPropagation();
			if(_s.prevInputValue_str != _s.input_do.screen.value){
				clearTimeout(_s.keyPressedId_to);
				_s.keyPressed_bl = true;
				clearTimeout(_s.rsId_to);
				_s.rsId_to = setTimeout(function(){
					_s.resizeAndPositionThumbnails(true);
					_s.disableEnableNextAndPrevButtons();
				}, 400);
			}
			_s.prevInputValue_str = _s.input_do.screen.value;
			_s.keyPressedId_to = setTimeout(function(){
				_s.keyPressed_bl = false;
			}, 450)
		};
		
		_s.showNothingFound = function(){
			if(_s.isShowNothingFound_bl) return;
			
			_s.isShowNothingFound_bl = true;
			
			_s.noSearchFound_do.setVisible(true);
			_s.noSearchFound_do.setY(parseInt((_s.sH - _s.noSearchFound_do.getHeight())/2));
			_s.noSearchFound_do.setAlpha(0);
			FWDAnimation.to(_s.noSearchFound_do, .1, {alpha:1, yoyo:true, repeat:4});
		};
		
		_s.hideNothingFound = function(){
			if(!_s.isShowNothingFound_bl) return;
			_s.isShowNothingFound_bl = false;
			
			FWDAnimation.killTweensOf(_s.noSearchFound_do);
			_s.noSearchFound_do.setVisible(false);
		};
		

		//###############################//
		/* setup disable */
		//##############################//
		_s.setupDisable = function(){
			_s.disable_do = new FWDUVPDisplayObject("div");
			if(FWDUVPUtils.isIE){
				_s.disable_do.setBkColor("#FFFFFF");
				_s.disable_do.setAlpha(0.01);
			}
			_s.addChild(_s.disable_do);
		};
		
		_s.showDisable = function(){
			if(_s.disable_do.w == _s.sW) return;
			_s.disable_do.setWidth(_s.sW);
			_s.disable_do.setHeight(_s.sH);
		};
		
		_s.hideDisable = function(){
			if(_s.disable_do.w == 0) return;
			_s.disable_do.setWidth(0);
			_s.disable_do.setHeight(0);
		};

		
		//############################################//
		/* setup buttons */
		//############################################//
		_s.setupButtons = function(){
			if(_s.clsBtn) return;

			//setup close button
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.clsBtn = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<div class='table-fwduvp-button'><span class='table-cell-fwduvp-button fwdicon-close'></span></div>",
						undefined,
						"UVPCategoriesNextAndPrevNormalState",
						"UVPCategoriesNextAndPrevSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.clsBtn = new FWDUVPSimpleButton(_s.catCloseN_img, _d.catCloseSPath_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						_s.sBC,
						false, false, false, false, true);

			}
			_s.clsBtn.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.closeButtonOnMouseUpHandler);
			
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.nextButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<div class='table-fwduvp-button'><span class='table-cell-fwduvp-button fwdicon-FF-right'></span></div>",
						undefined,
						"UVPCategoriesNextAndPrevNormalState",
						"UVPCategoriesNextAndPrevSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.nextButton_do = new FWDUVPSimpleButton(_s.catNextN_img, _d.catNextSPath_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						_s.sBC,
						false, false, false, false, true);
			}
			_s.nextButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.nextButtonOnMouseUpHandler);
			
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.prevButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<div class='table-fwduvp-button'><span class='table-cell-fwduvp-button fwdicon-FF-left'></span></div>",
						undefined,
						"UVPCategoriesNextAndPrevNormalState",
						"UVPCategoriesNextAndPrevSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.prevButton_do = new FWDUVPSimpleButton(_s.catPrevN_img, _d.catPrevSPath_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						_s.sBC,
						false, false, false, false, true);
			}
			_s.prevButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.prevButtonOnMouseUpHandler);
		};
		
		_s.closeButtonOnMouseUpHandler = function(){
			 _s.hide();
		};
		
		_s.nextButtonOnMouseUpHandler = function(){
			var availableThumbsPerSection = (_s.howManyThumbsToDisplayH * _s.howManyThumbsToDisplayV);
			_s.tempId += availableThumbsPerSection;
			if(_s.tempId > _s.totalThumbnails - 1) _s.tempId = _s.totalThumbnails - 1;
			var curSet = Math.floor(_s.tempId / availableThumbsPerSection);
			_s.tempId = curSet * availableThumbsPerSection;
			_s.resizeAndPositionThumbnails(true, "next");
			_s.disableEnableNextAndPrevButtons(false, true);
		};
		
		_s.prevButtonOnMouseUpHandler = function(){
			var availableThumbsPerSection = (_s.howManyThumbsToDisplayH * _s.howManyThumbsToDisplayV);
			_s.tempId -= availableThumbsPerSection;
			if(_s.tempId < 0) _s.tempId = 0;
			var curSet = Math.floor(_s.tempId / availableThumbsPerSection);
			_s.tempId = curSet * availableThumbsPerSection;
			_s.resizeAndPositionThumbnails(true, "prev");
			_s.disableEnableNextAndPrevButtons(true, false);
		};
		
		_s.positionButtons = function(){
			_s.clsBtn.setX(_s.sW - _s.clsBtn.w - _s.buttonsMargins);
			_s.clsBtn.setY(_s.buttonsMargins);
			_s.nextButton_do.setX(_s.sW - _s.nextButton_do.w - _s.buttonsMargins);
			_s.nextButton_do.setY(parseInt((_s.sH - _s.nextButton_do.h)/2));
			_s.prevButton_do.setX(_s.buttonsMargins);
			_s.prevButton_do.setY(parseInt((_s.sH - _s.prevButton_do.h)/2));
		};
		
		_s.disableEnableNextAndPrevButtons = function(hitTestLeft, hitTestRight){
			var availableThumbsPerSection = (_s.howManyThumbsToDisplayH * _s.howManyThumbsToDisplayV);
			var curSet = Math.floor(_s.tempId / availableThumbsPerSection);
			var totalSets = Math.ceil(_s.totalThumbnails / availableThumbsPerSection) - 1;
			var currentLeftColId = _s.howManyThumbsToDisplayH * curSet;
			var maxId = totalSets * _s.howManyThumbsToDisplayH;
		
			if(availableThumbsPerSection >= _s.totalThumbnails){
				_s.nextButton_do.disable();
				_s.prevButton_do.disable();
				_s.nextButton_do.setDisabledState();
				_s.prevButton_do.setDisabledState();
			}else if(curSet == 0){
				_s.nextButton_do.enable();
				_s.prevButton_do.disable();
				_s.nextButton_do.setEnabledState();
				_s.prevButton_do.setDisabledState();
			}else if(curSet == totalSets){
				_s.nextButton_do.disable();
				_s.prevButton_do.enable();
				_s.nextButton_do.setDisabledState();
				_s.prevButton_do.setEnabledState();
			}else{
				_s.nextButton_do.enable();
				_s.prevButton_do.enable();
				_s.nextButton_do.setEnabledState();
				_s.prevButton_do.setEnabledState();
			}
			
			if(!hitTestLeft){
				_s.prevButton_do.setNormalState();
			}
			
			if(!hitTestRight){
				_s.nextButton_do.setNormalState();
			}
		};
		
		//##########################################//
		/* setup mobile scrollbar */
		//##########################################//
		_s.setupMobileMove = function(){	
			if(_s.hasPointerEvent_bl){
				_s.screen.addEventListener("pointerdown", _s.mobileDownHandler);
			}else{
				_s.screen.addEventListener("touchstart", _s.mobileDownHandler);
			}
		};
		
		_s.mobileDownHandler = function(e){
			if (e.touches) if(e.touches.length != 1) return;
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			_s.mouseX = vc.screenX;;
			_s.mouseY = vc.screenY;
			if(_s.hasPointerEvent_bl){
				window.addEventListener("pointerup", _s.mobileUpHandler);
				window.addEventListener("pointermove", _s.mobileMoveHandler);
			}else{
				window.addEventListener("touchend", _s.mobileUpHandler);
				window.addEventListener("touchmove", _s.mobileMoveHandler, {passive:false});
			}
		};
		
		_s.mobileMoveHandler = function(e){
			if(e.preventDefault) e.preventDefault();
			if (e.touches) if(e.touches.length != 1) return;
			_s.showDisable();
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);
			_s.dif = _s.mouseX - vc.screenX;
			_s.mouseX = vc.screenX;
			_s.mouseY = vc.screenY;
		};
		
		_s.mobileUpHandler = function(e){
			_s.hideDisable();
			if(_s.dif > 10){
				_s.nextButtonOnMouseUpHandler();
			}else if(_s.dif < -10){
				_s.prevButtonOnMouseUpHandler();
			}
			_s.dif = 0;
			
			if(_s.hasPointerEvent_bl){
				window.removeEventListener("pointerup", _s.mobileUpHandler);
				window.removeEventListener("pointermove", _s.mobileMoveHandler);
			}else{
				window.removeEventListener("touchend", _s.mobileUpHandler);
				window.removeEventListener("touchmove", _s.mobileMoveHandler);
			}
		};
		

		//######################################//
		/* setup thumbnails */
		//######################################//
		_s.setupThumbnails = function(){
			if(_s.areThumbnailsCreated_bl) return;

			_s.areThumbnailsCreated_bl = true;
			var thumb;
			for(var i=0; i<_s.totalThumbnails; i++){
				FWDUVPCategoriesThumb.setPrototype();
				thumb = new FWDUVPCategoriesThumb(_s,
						i,
						_d.catThumbBkPath_str,
						_d.catThumbBkTextPath_str,
						_d.thumbnailSelectedType_str, 
						_s.categories_ar[i].htmlContent,
						_s.categories_ar[i].htmlText_str);
				thumb.addListener(FWDUVPCategoriesThumb.MOUSE_UP, _s.thumbnailOnMouseUpHandler);
				_s.thumbs_ar[i] = thumb;
				_s.mainHld.addChild(thumb);
			}
			_s.mainHld.addChild(_s.clsBtn); 
			_s.mainHld.addChild(_s.nextButton_do); 
			_s.mainHld.addChild(_s.prevButton_do);
		};
		
		_s.thumbnailOnMouseUpHandler = function(e){
			_s.id = e.id;
			_s.disableOrEnableThumbnails();
			_s.hide();
		};
		

		//#############################################//
		/* set _d for resize */
		//#############################################//
		_s.resizeAndPositionThumbnails = function(animate, direction){
			if(!_s.areThumbnailsCreated_bl) return;
			var thumb;
			var totalWidth;
			var curSet;
			var tempSet;
			var newX;
			var newY;
			var totalWidth;
			var totalHeight;
			var remainWidthSpace;
			var firsId;
			var lastId;
			var addToX;
			var currentLeftColId;
			var availableThumbsPerSection;
			
			var copy_ar = [].concat(_s.thumbs_ar);
			_s.isSearched_bl = false;
		
			if(_s.input_do){
				var inputValue = _s.input_do.screen.value.toLowerCase();
				if(inputValue != "Search".toLowerCase()){
					for(var i=0; i<copy_ar.length; i++){
						thumb = copy_ar[i];
						if(thumb.htmlText_str.toLowerCase().indexOf(inputValue.toLowerCase()) == -1){
							FWDAnimation.killTweensOf(thumb);
							thumb.hide();
							copy_ar.splice(i, 1);
							i--;
						}
					}
				}
			}
		
			_s.totalThumbnails = copy_ar.length;
			if(_s.totalThumbnails != _s.thumbs_ar.length) _s.isSearched_bl = true;
			
			if(_s.totalThumbnails == 0){
				_s.showNothingFound();
			}else{
				_s.hideNothingFound();
			}
			
			_s.remainWidthSpace = (_s.sW - totalWidth);
			
			var widthToResize = _s.sW - _s.categoriesOffsetTotalWidth;
			var heightToResize = _s.sH - _s.categoriesOffsetTotalHeight;
			
			_s.howManyThumbsToDisplayH = Math.ceil((widthToResize - _s.spacerH)/(_s.thumbnailMaxWidth + _s.spacerH));
			_s.thumbW = Math.floor(((widthToResize - _s.spacerH * (_s.howManyThumbsToDisplayH - 1)))/_s.howManyThumbsToDisplayH);
			if(_s.thumbW > _s.thumbnailMaxWidth){
				_s.howManyThumbsToDisplayH += 1;
				_s.thumbW = Math.floor(((widthToResize - _s.spacerH * (_s.howManyThumbsToDisplayH - 1)))/_s.howManyThumbsToDisplayH);
			}
			
			_s.thumbH = Math.floor((_s.thumbW/_s.thumbnailMaxWidth) * _s.thumbnailMaxHeight);
			
			_s.howManyThumbsToDisplayV = Math.floor(heightToResize/(_s.thumbH + _s.spacerV));
			if(_s.howManyThumbsToDisplayV < 1) _s.howManyThumbsToDisplayV = 1;
			
			totalWidth = (Math.min(_s.howManyThumbsToDisplayH, _s.totalThumbnails) * (_s.thumbW + _s.spacerH)) - _s.spacerH;
			totalHeight = Math.min(Math.ceil(_s.totalThumbnails/_s.howManyThumbsToDisplayH), _s.howManyThumbsToDisplayV) * (_s.thumbH + _s.spacerV) - _s.spacerV;
			
			if(_s.howManyThumbsToDisplayH > _s.totalThumbnails){
				remainWidthSpace = 0;
			}else{
				remainWidthSpace = (widthToResize - totalWidth);
			}
			
			if(_s.howManyThumbsToDisplayH > _s.totalThumbnails) _s.howManyThumbsToDisplayH = _s.totalThumbnails;
			availableThumbsPerSection = (_s.howManyThumbsToDisplayH * _s.howManyThumbsToDisplayV);
	
			curSet = Math.floor(_s.tempId / availableThumbsPerSection);
			if(_s.isSearched_bl) curSet = 0;
			currentLeftColId = _s.howManyThumbsToDisplayH * curSet;
			
			var firstId = curSet * availableThumbsPerSection;
			
			var lastId = firstId + availableThumbsPerSection;
			if(lastId > _s.totalThumbnails)  lastId = _s.totalThumbnails;
			
			for (var i = 0; i<_s.totalThumbnails; i++) {
				
				thumb = copy_ar[i];
				
				thumb.finalW = _s.thumbW;
				if(i % _s.howManyThumbsToDisplayH == _s.howManyThumbsToDisplayH - 1) thumb.finalW += remainWidthSpace;
				thumb.finalH = _s.thumbH;
				
				thumb.finalX = (i % _s.howManyThumbsToDisplayH) * (_s.thumbW + _s.spacerH);
				thumb.finalX += Math.floor((i / availableThumbsPerSection)) * _s.howManyThumbsToDisplayH * (_s.thumbW + _s.spacerH);
				thumb.finalX += (_s.sW - totalWidth)/2;
				thumb.finalX = Math.floor(thumb.finalX - currentLeftColId * (_s.thumbW + _s.spacerH));
				
				thumb.finalY = i % availableThumbsPerSection;
				thumb.finalY = Math.floor((thumb.finalY / _s.howManyThumbsToDisplayH)) * (_s.thumbH + _s.spacerV);
				thumb.finalY += (heightToResize - totalHeight)/2;
				thumb.finalY += _s.categoriesOffsetTotalHeight/2;
				thumb.finalY = Math.floor(thumb.finalY);
				
				tempSet = Math.floor((i / availableThumbsPerSection));
			
				if(tempSet > curSet){
					thumb.finalX += 150;
				}else if(tempSet < curSet){
					thumb.finalX -= 150;
				}
				
				if(animate){
					if ((i >= firstId) && (i < lastId)){
						if(direction == "next"){
							var dl = (i % availableThumbsPerSection) * _s.delayRate + .1;
						}else{
							var dl = (availableThumbsPerSection -  (i % availableThumbsPerSection)) * _s.delayRate + .1;
						}
						if(_s.keyPressed_bl) dl = 0;
						thumb.resizeAndPosition(true, dl);
					}else{
						thumb.resizeAndPosition(true, 0);
					}
					
				}else{
					thumb.resizeAndPosition();
				}	
				thumb.show();
			}
			if((_s.howManyThumbsToDisplayH * _s.howManyThumbsToDisplayV) >= _s.totalThumbnails){
				_s.nextButton_do.setVisible(false);
				_s.prevButton_do.setVisible(false);
				
			}else{
				_s.nextButton_do.setVisible(true);
				_s.prevButton_do.setVisible(true);
				
			}
		};
		

		//#############################################//
		/* load images */
		//#############################################//
		_s.loadImages = function(){

			if(_s.countLoadedThumbs > _s.totalThumbnails-1) return;
			
			if(_s.image_img){
				_s.image_img.onload = null;
				_s.image_img.onerror = null;
			}
			
			_s.image_img = new Image();
			_s.image_img.onerror = _s.onImageLoadError;
			_s.image_img.onload = _s.onImageLoadComplete;
			_s.image_img.src = _s.categories_ar[_s.countLoadedThumbs].thumbnailPath;
		};
		
		_s.onImageLoadError = function(e){};
		
		_s.onImageLoadComplete = function(e){
			var thumb = _s.thumbs_ar[_s.countLoadedThumbs];
			thumb.setImage(_s.image_img);
			_s.countLoadedThumbs++;
			_s.loadWithDelayId_to = setTimeout(_s.loadImages, 40);	
		};

		
		//###########################################//
		/* disable / enable thumbnails */
		//###########################################//
		_s.disableOrEnableThumbnails = function(){
			var thumb;
			for(var i = 0; i<_s.totalThumbnails; i++) {
				thumb = _s.thumbs_ar[i];	
				if(i == _s.id){
					thumb.disable();
				}else{
					thumb.enable();
				}
			}
		};
		

		//###########################################//
		/* show / hide */
		//###########################################//
		_s.show = function(id){
			if(_s.isShowed_bl) return;
			_s.isShowed_bl = true;
			_s.isOnDOM_bl = true;
			_s.id = id;
			
			if(prt.isFullScreen_bl){
				prt.main_do.addChild(_s);
			}else{
				document.documentElement.appendChild(_s.screen);
			}	
					
			if(window.addEventListener){
				window.addEventListener("scroll", _s.onScrollHandler);
			}else if(window.attachEvent){
				window.attachEvent("onscroll", _s.onScrollHandler);
			}
				
			_s.setupThumbnails();	
			
			if(_s.useVectorIcons_bl){
			
				_s.clsBtn.setFinalSize(true);
				_s.nextButton_do.setFinalSize(true);
				_s.prevButton_do.setFinalSize(true);

				_s.checkButtonsId_to = setInterval(function(){
					if(_s.clsBtn.w != 0){
						_s.categoriesOffsetTotalWidth = _s.clsBtn.w * 2 + 40 + _s.buttonsMargins * 2;
						_s.categoriesOffsetTotalHeight = _s.clsBtn.h;
						_s.resizeAndPosition(true);
						_s.showDisable();
						_s.disableOrEnableThumbnails();
						clearTimeout(_s.hideCompleteId_to);
						clearTimeout(_s.showCompleteId_to);
						_s.mainHld.setY(- _s.sH);
						
						if(_s.isMbl){
							_s.showCompleteId_to = setTimeout(_s.showCompleteHandler, 1200);
							FWDAnimation.to(_s.mainHld, .8, {y:0, delay:.4, ease:Expo.easeInOut});
						}else{
							_s.showCompleteId_to = setTimeout(_s.showCompleteHandler, 800);
							FWDAnimation.to(_s.mainHld, .8, {y:0, ease:Expo.easeInOut});
						}
					
						clearInterval(_s.checkButtonsId_to);
					}
				
				}, 50);
			}else{
				_s.resizeAndPosition(true);
				_s.showDisable();
				_s.disableOrEnableThumbnails();
				clearTimeout(_s.hideCompleteId_to);
				clearTimeout(_s.showCompleteId_to);
				_s.mainHld.setY(- _s.sH);
				
				if(_s.isMbl){
					_s.showCompleteId_to = setTimeout(_s.showCompleteHandler, 1200);
					FWDAnimation.to(_s.mainHld, .8, {y:0, delay:.4, ease:Expo.easeInOut});
				}else{
					_s.showCompleteId_to = setTimeout(_s.showCompleteHandler, 800);
					FWDAnimation.to(_s.mainHld, .8, {y:0, ease:Expo.easeInOut});
				}
				
			}
		};
		
		_s.showCompleteHandler = function(){
			_s.mainHld.setY(0);
			_s.hideDisable();
			if(FWDUVPUtils.isIphone){
				if(prt.videoScreen_do) prt.videoScreen_do.setY(-5000);
				if(prt.ytb_do) prt.ytb_do.setY(-5000);
			}
			_s.resizeAndPosition(true);
			if(!_s.areThumbnailsLoaded_bl){
				_s.loadImages();
				_s.areThumbnailsLoaded_bl = true;
			}
		};
		
		_s.hide = function(){
			if(!_s.isShowed_bl) return;
			_s.isShowed_bl = false;
			
			if(FWDUVPUtils.isIphone){
				if(prt.videoScreen_do) prt.videoScreen_do.setY(0);
				if(prt.ytb_do) prt.ytb_do.setY(0);
			}
			
			clearTimeout(_s.hideCompleteId_to);
			clearTimeout(_s.showCompleteId_to);
			_s.showDisable();
			_s.hideCompleteId_to = setTimeout(_s.hideCompleteHandler, 800);
			FWDAnimation.killTweensOf(_s.mainHld);
			FWDAnimation.to(_s.mainHld, .8, {y:-_s.sH, ease:Expo.easeInOut});
			
			if(window.addEventListener){
				window.removeEventListener("scroll", _s.onScrollHandler);
			}else if(window.detachEvent){
				window.detachEvent("onscroll", _s.onScrollHandler);
			}
			_s.resizeAndPosition();
		};
		
		_s.hideCompleteHandler = function(){
			
			if(prt.main_do.contains(_s)){
				prt.main_do.removeChild(_s);
			}else{
				document.documentElement.removeChild(_s.screen);
			}	
			
			_s.isOnDOM_bl = false;
			_s.dispatchEvent(FWDUVPCategories.HIDE_COMPLETE);
		};
		
		_s.init();
	};
	
	
	/* set prototype */
	FWDUVPCategories.setPrototype = function(){
		FWDUVPCategories.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPCategories.HIDE_COMPLETE = "hideComplete";

	FWDUVPCategories.prototype = null;
	window.FWDUVPCategories = FWDUVPCategories;
	
}());/**
 * Ultimate Video Player PACKAGED v9.1
 * Categories thumbnail.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	var FWDUVPCategoriesThumb = function(
			prt,
			pId, 
			catThumbBkTextPath_str,
			catThumbTextBkPath_str,
			thumbnailSelectedType_str,
			htmlContent,
			htmlText
		){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPCategoriesThumb.prototype;
	
		_s.backgroundImagePath_str = catThumbBkTextPath_str;
		_s.catThumbTextBkPath_str = catThumbTextBkPath_str;
		_s.canvas_el = null;
		_s.htmlContent = htmlContent;
		_s.htmlText_str = htmlText;
		_s.thumbnailSelectedType_str = thumbnailSelectedType_str;
		
		_s.id = pId;
		
		_s.isDark = true;
		if(catThumbBkTextPath_str.indexOf('dark') == -1){
			_s.isDark = false;
		}
		
		_s.dispatchShowWithDelayId_to;
		_s.hasCanvas_bl = FWDUVPlayer.hasCanvas;
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;

		_s.init = function(){
			_s.getStyle().background = "url('" + _s.backgroundImagePath_str + "')";
			_s.screen.className = 'fwduvp-categories-thumbnail-background';
			_s.setupMainContainers();
			_s.setupDescription();
			_s.setupDumy();
		};

		
		//#################################//
		/* set image */
		//#################################//
		_s.setupMainContainers = function(){
			_s.imageHolder_do = new FWDUVPDisplayObject("div");
			_s.addChild(_s.imageHolder_do);
		};
		

		//#################################//
		/* setup dumy */
		//#################################//
		_s.setupDumy = function(){
			_s.dumy_do = new FWDUVPDisplayObject("div");
			if(FWDUVPUtils.isIE){
				_s.dumy_do.setBkColor("#FFFFFF");
				_s.dumy_do.setAlpha(0);
			}
			_s.addChild(_s.dumy_do);
		};
		

		//################################################//
		/* Setup title bar */
		//###############################################//
		_s.setupDescription = function(){
			_s.simpleText_do = new FWDUVPDisplayObject("div");
			_s.simpleText_do.getStyle().background = "url('" + _s.catThumbTextBkPath_str + "')";
			var cls = 'fwduvp-categories-white-text';
			if(_s.isDark){
				cls = 'fwduvp-categories-dark-text';
			}
			_s.simpleText_do.screen.className = cls;
			_s.slTitle = _s.simpleText_do.screen.className;

			if(FWDUVPUtils.isFirefox){
				_s.simpleText_do.hasTransform3d_bl = false;
				_s.simpleText_do.hasTransform2d_bl = false;
			}
			_s.simpleText_do.setBackfaceVisibility();
			_s.simpleText_do.getStyle().width = "100%";
			_s.simpleText_do.getStyle().fontFamily = "Arial";
			_s.simpleText_do.getStyle().fontSize= "12px";
			_s.simpleText_do.getStyle().textAlign = "left";
			_s.simpleText_do.getStyle().color = "#FFFFFF";	
			_s.simpleText_do.setInnerHTML(_s.htmlContent);
			_s.addChild(_s.simpleText_do);
		};
		
		_s.positionDescription = function(){
			_s.simpleText_do.setY(parseInt(_s.finalH - _s.simpleText_do.getHeight()));
		};

		
		//#################################//
		/* setup black an white image */
		//#################################//
		_s.setupBlackAndWhiteImage = function(image){
			if(!_s.hasCanvas_bl || _s.thumbnailSelectedType_str == "opacity") return;
			var canvas = document.createElement("canvas");

			var ctx = canvas.getContext("2d");
			
			canvas.width = _s.imageOriginalW;
			canvas.height = _s.imageOriginalH; 
			ctx.drawImage(image, 0, 0); 
			
			var imgPixels = ctx.getImageData(0, 0, canvas.width, canvas.height);
			
			var d = imgPixels._d;
			
			if(_s.thumbnailSelectedType_str == "threshold"){
				//treshhold
				for (var i=0; i<d.length; i+=4) {
				    var r = d[i];
				    var g = d[i+1];
				    var b = d[i+2];
				    var v = (0.2126*r + 0.7152*g + 0.0722*b >= 150) ? 255 : 0;
				    d[i] = d[i+1] = d[i+2] = v;
				}
			}else if(_s.thumbnailSelectedType_str == "blackAndWhite"){
				//grayscale
				for (var i=0; i<d.length; i+=4) {
					var r = d[i];
				    var g = d[i+1];
				    var b = d[i+2];
				    // CIE luminance for the RGB
				    // The human eye is bad at seeing red and blue, so we de-emphasize them.
				    var v = 0.2126*r + 0.7152*g + 0.0722*b;
				    d[i] = d[i+1] = d[i+2] = v;
				}
			}
		
			ctx.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
			
			_s.effectImage_do = new FWDUVPDisplayObject("canvas");
			_s.effectImage_do.screen = canvas;
			_s.effectImage_do.setAlpha(.9);
			
			_s.effectImage_do.setMainProperties();
		};

	
		//#################################//
		/* set image */
		//#################################//
		_s.setImage = function(image){
			_s.normalImage_do = new FWDUVPDisplayObject("img");
			_s.normalImage_do.setScreen(image);
			
			_s.imageOriginalW = _s.normalImage_do.w;
			_s.imageOriginalH = _s.normalImage_do.h;
			
			_s.setButtonMode(true);
			_s.setupBlackAndWhiteImage(image);
			
			_s.resizeImage();
			
			_s.imageHolder_do.setX(parseInt(_s.finalW/2));
			_s.imageHolder_do.setY(parseInt(_s.finalH/2));
			_s.imageHolder_do.setWidth(0);
			_s.imageHolder_do.setHeight(0);
			
			_s.normalImage_do.setX(- parseInt(_s.normalImage_do.w/2));
			_s.normalImage_do.setY(- parseInt(_s.normalImage_do.h/2));
			_s.normalImage_do.setAlpha(0);
			
			if(_s.effectImage_do){
				_s.effectImage_do.setX(- parseInt(_s.normalImage_do.w/2));
				_s.effectImage_do.setY(- parseInt(_s.normalImage_do.h/2));
				_s.effectImage_do.setAlpha(0.01);
			}
			
			FWDAnimation.to(_s.imageHolder_do, .8, {
				x:0, 
				y:0,
				w:_s.finalW,
				h:_s.finalH, 
				ease:Expo.easeInOut});
			
			FWDAnimation.to(_s.normalImage_do, .8, {
				alpha:1,
				x:_s.imageFinalX, 
				y:_s.imageFinalY, 
				ease:Expo.easeInOut});
			
			if(_s.effectImage_do){
				FWDAnimation.to(_s.effectImage_do, .8, {
					x:_s.imageFinalX, 
					y:_s.imageFinalY, 
					ease:Expo.easeInOut});
			}
			
			if(_s.hasPointerEvent_bl){
				_s.screen.addEventListener("pointerup", _s.onMouseUp);
				_s.screen.addEventListener("pointerover", _s.onMouseOver);
				_s.screen.addEventListener("pointerout", _s.onMouseOut);
			}else if(_s.screen.addEventListener){	
				if(!_s.isMbl){
					_s.screen.addEventListener("mouseover", _s.onMouseOver);
					_s.screen.addEventListener("mouseout", _s.onMouseOut);
					_s.screen.addEventListener("mouseup", _s.onMouseUp);
				}
				_s.screen.addEventListener("touchend", _s.onMouseUp);
			}
		
			_s.imageHolder_do.addChild(_s.normalImage_do);
			if(_s.effectImage_do) _s.imageHolder_do.addChild(_s.effectImage_do);
			
			_s.hasImage_bl = true;
			
			if(_s.id == prt.id){
				_s.disable();
			}
			
		};
		
		_s.onMouseOver = function(e, animate){
			if(_s.isDisabled_bl) return;
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE){
				_s.setSelectedState(true);
			}
		};
			
		_s.onMouseOut = function(e){
			if(_s.isDisabled_bl) return;
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE){
				_s.setNormalState(true);
			}
		};
		
		_s.onMouseUp = function(e){
			if(_s.isDisabled_bl || e.button == 2) return;
			if(e.preventDefault) e.preventDefault();
			_s.dispatchEvent(FWDUVPCategoriesThumb.MOUSE_UP, {id:_s.id});
		};

	
		//#################################//
		/* resize thumbnail*/
		//#################################//
		_s.resizeAndPosition = function(animate, dl){
			
			FWDAnimation.killTweensOf(_s);
			FWDAnimation.killTweensOf(_s.imageHolder_do);
			
			if(animate){
				FWDAnimation.to(_s, .8, {
					x:_s.finalX, 
					y:_s.finalY,
					delay:dl,
					ease:Expo.easeInOut});
			}else{
				_s.setX(_s.finalX);
				_s.setY(_s.finalY);
			}
			
			_s.setWidth(_s.finalW);
			_s.setHeight(_s.finalH);
			_s.imageHolder_do.setX(0);
			_s.imageHolder_do.setY(0);
			_s.imageHolder_do.setWidth(_s.finalW);
			_s.imageHolder_do.setHeight(_s.finalH);
			
			_s.dumy_do.setWidth(_s.finalW);
			_s.dumy_do.setHeight(_s.finalH);
			
			_s.resizeImage();
			_s.positionDescription();
		};
	

		//#################################//
		/* resize image*/
		//#################################//
		_s.resizeImage = function(animate){
			
			if(!_s.normalImage_do) return;
			FWDAnimation.killTweensOf(_s.normalImage_do);
			var scX = _s.finalW/_s.imageOriginalW;
			var scY = _s.finalH/_s.imageOriginalH;
			var ttsc;
			
			if(scX >= scY){
				ttsc = scX;
			}else{
				ttsc = scY;
			}
			
			_s.imageFinalW = Math.ceil(ttsc * _s.imageOriginalW);
			_s.imageFinalH = Math.ceil(ttsc * _s.imageOriginalH);
			_s.imageFinalX = Math.round((_s.finalW - _s.imageFinalW)/2);
			_s.imageFinalY = Math.round((_s.finalH - _s.imageFinalH)/2);
			
			if(_s.effectImage_do){
				FWDAnimation.killTweensOf(_s.effectImage_do);
				_s.effectImage_do.setX(_s.imageFinalX);
				_s.effectImage_do.setY(_s.imageFinalY);
				_s.effectImage_do.setWidth(_s.imageFinalW);
				_s.effectImage_do.setHeight(_s.imageFinalH);
				if(_s.isDisabled_bl) _s.setSelectedState(false, true);
			}
			
			_s.normalImage_do.setX(_s.imageFinalX);
			_s.normalImage_do.setY(_s.imageFinalY);
			_s.normalImage_do.setWidth(_s.imageFinalW + 1);
			_s.normalImage_do.setHeight(_s.imageFinalH);
			
			if(_s.isDisabled_bl){
				_s.normalImage_do.setAlpha(.3);
			}else{
				_s.normalImage_do.setAlpha(1);
			}
		};
		

		//##############################//
		/* set normal/selected state*/
		//##############################//
		_s.setNormalState = function(animate){
			if(!_s.isSelected_bl) return;
			_s.isSelected_bl = false;
			if(_s.slTitle){
				_s.simpleText_do.screen.className = _s.slTitle;
			}

			if(_s.thumbnailSelectedType_str == "threshold" || _s.thumbnailSelectedType_str == "blackAndWhite"){
				if(animate){
					FWDAnimation.to(_s.effectImage_do, 1, {alpha:.01, ease:Quart.easeOut});
				}else{
					_s.effectImage_do.setAlpha(.01);
				}
			}else if(_s.thumbnailSelectedType_str == "opacity"){
				if(animate){
					FWDAnimation.to(_s.normalImage_do, 1, {alpha:1, ease:Quart.easeOut});
				}else{
					_s.normalImage_do.setAlpha(1);
				}
			}
		};
		
		_s.setSelectedState = function(animate, overwrite){
			if(_s.isSelected_bl && !overwrite) return;
			_s.isSelected_bl = true;
			_s.setTitleSelectedClass();
			if(_s.thumbnailSelectedType_str == "threshold" || _s.thumbnailSelectedType_str == "blackAndWhite"){
				if(animate){
					FWDAnimation.to(_s.effectImage_do, 1, {alpha:1, ease:Expo.easeOut});
				}else{
					_s.effectImage_do.setAlpha(1);
				}
			}else if(_s.thumbnailSelectedType_str == "opacity"){
				if(animate){
					FWDAnimation.to(_s.normalImage_do, 1, {alpha:.3, ease:Expo.easeOut});
				}else{
					_s.normalImage_do.setAlpha(.3);
				}
			}
		};
		

		//###############################//
		/* Hide / show */
		//###############################//
		_s.show = function(){
			FWDAnimation.to(_s, .8, {scale:1, ease:Expo.easeInOut});
		}
		
		_s.hide = function(){
			FWDAnimation.to(_s, .8, {scale:0, ease:Expo.easeInOut});
		}
		

		//###############################//
		/* enable / disable */
		//##############################//
		_s.enable = function(){
			if(!_s.hasImage_bl) return;
			_s.isDisabled_bl = false;
			_s.setButtonMode(true);
			_s.setNormalState(true);
		};
		
		_s.disable = function(){
			if(!_s.hasImage_bl) return;
			_s.isDisabled_bl = true;
			_s.setButtonMode(false);
			_s.setSelectedState(true);
			_s.setTitleSelectedClass();
		};

		_s.setTitleSelectedClass = function(){
			if(_s.slTitle){
				_s.simpleText_do.screen.className = _s.slTitle  + ' active';
			}
		}
	
		_s.init();
	};
	
	
	/* set prototype */
	FWDUVPCategoriesThumb.setPrototype = function(){
		FWDUVPCategoriesThumb.prototype = new FWDUVPTransformDisplayObject("div");
	};
	
	
	FWDUVPCategoriesThumb.MOUSE_UP = "onMouseUp";
	
	FWDUVPCategoriesThumb.prototype = null;
	window.FWDUVPCategoriesThumb = FWDUVPCategoriesThumb;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Playlist select box.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPComboBox = function(prt, props_obj){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPComboBox.prototype;
		
		_s.categories_ar = props_obj.categories_ar;
		_s.buttons_ar = [];
		
		_s.arrowW = props_obj.arrowW;
		_s.arrowH = props_obj.arrowH;
		
		_s.useHEX = prt._d.useHEX; 
		_s.nBC = prt._d.nBC;
		_s.sBC = prt._d.sBC;
	
		_s.arrowN_str = props_obj.arrowN_str 
		_s.arrowS_str = props_obj.arrowS_str;
		
		_s.selLabel = props_obj.selectorLabel;
		_s.selBkColN = props_obj.selectorBackgroundNormalColor;
		_s.selBkColS = props_obj.selectorBackgroundSelectedColor;
		_s.selTxtColN = props_obj.selectorTextNormalColor;
		_s.selTxtColS = props_obj.selectorTextSelectedColor;
		
		_s.itmBkClrN = props_obj.buttonBackgroundNormalColor;
		_s.itmBkClrS = props_obj.buttonBackgroundSelectedColor;
		_s.itmTxtClrN = props_obj.buttonTextNormalColor;
		_s.itmTxtClrS = props_obj.buttonTextSelectedColor;
		
		_s.scrBarHandY = 0;
		_s.ttBtns = _s.categories_ar.length;
		_s.curId = props_obj.startAtPlaylist;
		_s.btnsHldW = 0;
		_s.btnsHldH = 0;
		_s.totalWidth = prt.sW;
		_s.buttonHeight = props_obj.buttonHeight;
		
		_s.ttBtnH = 0;
		_s.spcBtwBtns = 1;
		_s.thmbsFinY = 0;
		_s.vy = 0;
		_s.vy2 = 0;
		_s.frc = .9;
	
		_s.addMouseWheelSupport_bl = prt._d.addMouseWheelSupport_bl;
		_s.scollbarSpeedSensitivity = prt._d.scollbarSpeedSensitivity;
		_s.hasPointEvt = FWDUVPUtils.hasPointerEvent;
		_s.isMbl = FWDUVPUtils.isMobile;
		

		//#####################################//
		/* Initialize */
		//####################################//
		_s.init = function(){
			_s.setOverflow("visible");
			_s.setupMainContainers();
			_s.setupScrollLogic();
			_s.getMaxWidthResizeAndPosition();
			_s.mainButtonsHolder_do.setVisible(false);
			_s.bk_do.setVisible(false);
			
		};
		

		//#####################################//
		/* setup main containers */
		//####################################//
		_s.setupMainContainers = function(){
			var button_do;
			
			_s.mainHld = new FWDUVPDisplayObject("div");
			_s.mainHld.setOverflow("visible");
			_s.addChild(_s.mainHld);
			
			_s.bk_do = new FWDUVPDisplayObject("div");
			_s.bk_do.screen.className = 'fwduvp-combobox-background';
			_s.bk_do.setY(_s.buttonHeight);
			_s.bk_do.setBkColor(prt.playlistBackgroundColor_str);
			_s.bk_do.setAlpha(0);
			
			_s.mainHld.addChild(_s.bk_do);
			
			_s.mainButtonsHolder_do = new FWDUVPDisplayObject("div");
			_s.mainButtonsHolder_do.setY(_s.buttonHeight);
			_s.mainHld.addChild(_s.mainButtonsHolder_do);
			
			if(prt.repeatBackground_bl){
				_s.dummyBk_do =  new FWDUVPDisplayObject("div");
				_s.dummyBk_do.getStyle().background = "url('" + prt.bkPath_str +  "')";
			}else{
				_s.dummyBk_do = new FWDUVPDisplayObject("img");
				var imageBk_img = new Image();
				imageBk_img.src = prt.bkPath_str;
				_s.dummyBk_do.setScreen(imageBk_img);
			}
	
			_s.dummyBk_do.setHeight(_s.buttonHeight);
			_s.mainHld.addChild(_s.dummyBk_do);
			
			_s.buttonsHolder_do = new FWDUVPDisplayObject("div");
			_s.mainButtonsHolder_do.addChild(_s.buttonsHolder_do);
			
			var selLabel = _s.selLabel;
			
			if (_s.selLabel == "default"){
				selLabel = _s.categories_ar[_s.curId];
			}
			
			FWDUVPComboBoxSelector.setPrototype();
			_s.selector_do = new FWDUVPComboBoxSelector(
					11,
					6,
					props_obj.arrowN_str,
					props_obj.arrowS_str,
					selLabel,
					_s.selBkColN,
					_s.selBkColS,
					_s.selTxtColN,
					_s.selTxtColS,
					_s.buttonHeight,
					_s.useHEX,
					_s.nBC,
					_s.sBC);
			_s.mainHld.addChild(_s.selector_do);
			_s.selector_do.setNormalState(false);
			_s.selector_do.addListener(FWDUVPComboBoxSelector.CLICK, _s.openMenuHandler);
			
			for(var i=0; i<_s.ttBtns; i++){
				FWDUVPComboBoxButton.setPrototype();


				button_do = new FWDUVPComboBoxButton(
						_s,
						_s.categories_ar[i],
						_s.itmBkClrN,
						_s.itmBkClrS,
						_s.itmTxtClrN,
						_s.itmTxtClrS,
						i,
						_s.buttonHeight);
				_s.buttons_ar[i] = button_do;
				button_do.addListener(FWDUVPComboBoxButton.CLICK, _s.buttonOnMouseDownHandler);
				_s.buttonsHolder_do.addChild(button_do);
			}
		};

		_s.buttonOnMouseDownHandler = function(e){
			_s.curId = e.id;
			clearTimeout(_s.hideMenuTimeOutId_to);
			_s.hide(true);
			_s.selector_do.enable(); 
			if(_s.hasPointEvt){
				window.removeEventListener("pointerdown", _s.checkOpenedMenu);
			}else{
				window.removeEventListener("touchstart", _s.checkOpenedMenu);
				if(!_s.isMbl){
					window.removeEventListener("mousedown", _s.checkOpenedMenu);
					window.removeEventListener("mousemove", _s.checkOpenedMenu);
				}
			}
		
			_s.selector_do.setText(_s.buttons_ar[_s.curId].label1_str);
			_s.dispatchEvent(FWDUVPComboBox.BUTTON_PRESSED, {id:_s.curId});
		};

		_s.openMenuHandler = function(e){
			if(FWDAnimation.isTweening(_s.mainButtonsHolder_do)) return;
			if(_s.isShd){
				_s.checkOpenedMenu(e.e, true);
			}else{
				_s.selector_do.disable();
				_s.show(true);
				_s.startToCheckOpenedMenu();
				_s.dispatchEvent(FWDUVPComboBox.OPEN);
			}
		};
		

		//#######################################//
		/* Disable or enable buttons */
		//#######################################//
		_s.setButtonsStateBasedOnId = function(id){
			_s.curId = id;
			for(var i=0; i<_s.ttBtns; i++){
				var button_do = _s.buttons_ar[i];
				if(i == _s.curId){
					button_do.disable();
				}else{
					button_do.enable();
				}
			}
			_s.selector_do.setText(_s.buttons_ar[_s.curId].label1_str);
			if(_s.scrHandler_do){
				_s.updateScrollBarSizeActiveAndDeactivate();
				_s.updateScrollBarHandlerAndContent(false, true);
			}else{
				_s.thmbsFinY = 0;
			}
		};
		
		_s.setValue = function(id){
			_s.curId = id;
			_s.setButtonsStateBasedOnId();
		};


		//#######################################//
		/* Start to check if mouse is over menu */
		//#######################################//
		_s.startToCheckOpenedMenu = function(e){
			if(_s.hasPointEvt){
				window.addEventListener("pointerdown", _s.checkOpenedMenu);
			}else{
				window.addEventListener("touchstart", _s.checkOpenedMenu);
				if(!_s.isMbl){
					window.addEventListener("mousedown", _s.checkOpenedMenu);
				}
			}
		};
		_s.checkOpenedMenu = function(e, forceHide){
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			var hideDelay  = 1000;
			if(e.type == "mousedown") hideDelay = 0;

			if(!FWDUVPUtils.hitTest(_s.screen, vc.screenX, vc.screenY) &&
			   !FWDUVPUtils.hitTest(_s.mainButtonsHolder_do.screen, vc.screenX, vc.screenY)
			   || forceHide
			){
				_s.hide(true);
				_s.selector_do.enable();
				if(_s.hasPointEvt){
					window.removeEventListener("pointerdown", _s.checkOpenedMenu);
				}else{
					if(!_s.isMbl){
						window.removeEventListener("touchstart", _s.checkOpenedMenu);
						window.removeEventListener("mousemove", _s.checkOpenedMenu);
					}
					window.removeEventListener("mousedown", _s.checkOpenedMenu);
				}
			}else{
				clearTimeout(_s.hideMenuTimeOutId_to);
			}

			if(FWDUVPUtils.hitTest(_s.selector_do.screen, vc.screenX, vc.screenY) && !_s.isMbl){
				setTimeout(function(){
					_s.selector_do.setSelectedState(true);
				}, 50)
			}
		};
		
		
		//########################################//
		/* Get max width and position */
		//#######################################//
		_s.getMaxWidthResizeAndPosition = function(){
			
			var button_do;
			var finalX;
			var finalY;
			_s.ttBtnH = 0;		
			
			for(var i=0; i<_s.ttBtns; i++){
				button_do = _s.buttons_ar[i];
				button_do.setY((i * (button_do.totalHeight + _s.spcBtwBtns)));
				if(_s.allowToScrollAndScrollBarIsActive_bl && !_s.isMbl){
					_s.totalWidth = prt.sW ;
				}else{
					_s.totalWidth = prt.sW;
				}
				
				button_do.totalWidth =  _s.totalWidth;
				button_do.setWidth(_s.totalWidth);
				button_do.centerText();
			}
		
			_s.ttBtnH = button_do.getY() + button_do.totalHeight - _s.spcBtwBtns;
			var offset = 2;
			if(_s.isMbl){
				offset = 0;
			}
			
			_s.dummyBk_do.setWidth(_s.totalWidth + offset);
			_s.setWidth(_s.totalWidth);
			_s.setHeight(_s.buttonHeight);
			_s.selector_do.totalWidth =  _s.totalWidth + offset;
			_s.selector_do.setWidth(_s.totalWidth + offset);
			_s.selector_do.centerText();
			_s.buttonsHolder_do.setWidth(_s.totalWidth);
			_s.buttonsHolder_do.setHeight(_s.ttBtnH);	
		};

		//######################################//
		/* position */
		//######################################//
		_s.position = function(){		
			if (FWDUVPUtils.isAndroid){
				_s.setX(Math.floor(_s.finalX));
				_s.setY(Math.floor(_s.finalY-1));
				setTimeout(_s.poscombo-box, 100);
			}else{
				_s.poscombo-box();
			}
		};
			
		_s.resizeAndPosition = function(){
			_s.sW = prt.sW;
			_s.sH = prt.sH;
			_s.bk_do.setWidth(_s.sW);
			_s.bk_do.setHeight(_s.sH - prt.removeFromThumbsHolderHeight + 5);
			_s.mainButtonsHolder_do.setWidth(_s.sW);
			_s.mainButtonsHolder_do.setHeight(_s.sH - prt.removeFromThumbsHolderHeight);

			if(_s.ttBtnH > _s.mainButtonsHolder_do.h){
				_s.allowToScrollAndScrollBarIsActive_bl = true;
			}else{
				_s.allowToScrollAndScrollBarIsActive_bl = false;
			}
			
			if(!_s.allowToScrollAndScrollBarIsActive_bl && _s.scrMainHolder_do){
				_s.scrMainHolder_do.setVisible(false);
			}else if(_s.allowToScrollAndScrollBarIsActive_bl && _s.scrMainHolder_do && _s.isShd){
				_s.scrMainHolder_do.setVisible(true);
			}
			
			if(_s.scrHandler_do) _s.updateScrollBarSizeActiveAndDeactivate();
			_s.getMaxWidthResizeAndPosition();
			_s.updateScrollBarHandlerAndContent();
		};
		
		_s.hide = function(animate, overwrite){
			if(!_s.isShd && !overwrite) return;
			FWDAnimation.killTweensOf(_s);
			_s.isShd = false;
			FWDAnimation.killTweensOf(_s.mainButtonsHolder_do);
			FWDAnimation.killTweensOf(_s.bk_do);
			if(animate){
				FWDAnimation.to(_s.mainButtonsHolder_do, .8, {y:-_s.ttBtnH, ease:Expo.easeInOut, onComplete:_s.hideComplete});	
				FWDAnimation.to(_s.bk_do, .8, {alpha:0});	
			}else{
				_s.mainButtonsHolder_do.setY(_s.buttonHeight - _s.ttBtnH);
				_s.bk_do.setAlpha(0);
				_s.setHeight(_s.buttonHeight);
			}
		};
		
		_s.hideComplete = function(){
			_s.mainButtonsHolder_do.setVisible(false);
			_s.bk_do.setVisible(false);
		}

		_s.show = function(animate, overwrite){
			if(_s.isShd && !overwrite) return;
			FWDAnimation.killTweensOf(_s);
			_s.mainButtonsHolder_do.setY(- _s.ttBtnH);
			_s.isShd = true;
			_s.mainButtonsHolder_do.setVisible(true);
			_s.bk_do.setVisible(true);
			_s.resizeAndPosition();
			FWDAnimation.killTweensOf(_s.mainButtonsHolder_do);
			FWDAnimation.killTweensOf(_s.bk_do);
			if(_s.scrMainHolder_do && _s.allowToScrollAndScrollBarIsActive_bl) _s.scrMainHolder_do.setVisible(true);
		
			if(animate){
				FWDAnimation.to(_s.bk_do, .8, {alpha:1});
				FWDAnimation.to(_s.mainButtonsHolder_do, .8, {y:_s.buttonHeight + prt.spaceBetweenThumbnails, ease:Expo.easeInOut});
			}else{
				_s.bk_do.setAlpha(1);
				_s.mainButtonsHolder_do.setY(_s.buttonHeight + prt.spaceBetweenThumbnails);
			}
		};
		_s.setupScrollLogic = function(){
			
			_s.setupMobileScrollbar();
			if(!_s.isMbl) _s.setupScrollbar();
			if(_s.addMouseWheelSupport_bl) _s.addMouseWheelSupport();
		};
		

		//##########################################//
		/* setup mobile scrollbar */
		//##########################################//
		_s.setupMobileScrollbar = function(){
			if(_s.hasPointEvt){
				_s.mainButtonsHolder_do.screen.addEventListener("pointerdown", _s.scrollBarTouchStartHandler);
			}else{
				_s.mainButtonsHolder_do.screen.addEventListener("touchstart", _s.scrollBarTouchStartHandler);
			}
			if(_s.isMbl) _s.updateMobileScrollBarId_int = setInterval(_s.updateMobileScrollBar, 16);
		};

		_s.scrollBarTouchStartHandler = function(e){
			if(e.preventDefault) e.preventDefault();
			_s.isScrollingOnMove_bl = false;
			FWDAnimation.killTweensOf(_s.buttonsHolder_do);
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);		
			_s.isDragging_bl = true;
			_s.lastPresedY = vc.screenY;
			_s.checkLastPresedY = vc.screenY;
			if(_s.hasPointEvt){
				window.addEventListener("pointerup", _s.scrollBarTouchEndHandler);
				window.addEventListener("pointermove", _s.scrollBarTouchMoveHandler);
			}else{
				window.addEventListener("touchend", _s.scrollBarTouchEndHandler);
				window.addEventListener("touchmove", _s.scrollBarTouchMoveHandler, {passive:false});
			}
			window.addEventListener("mouseup", _s.scrollBarTouchEndHandler);
			window.addEventListener("mousemove", _s.scrollBarTouchMoveHandler);
			clearInterval(_s.updateMoveMobileScrollbarId_int);
			_s.updateMoveMobileScrollbarId_int = setInterval(_s.updateMoveMobileScrollbar, 20);
		};

		_s.scrollBarTouchMoveHandler = function(e){
			if(e.preventDefault) e.preventDefault();
			e.stopImmediatePropagation();
			if(_s.ttBtnH < _s.mainButtonsHolder_do.h) return;
			prt.prt.showDisable();
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			if(vc.screenY >= _s.checkLastPresedY + 6 || vc.screenY <= _s.checkLastPresedY - 6) _s.isScrollingOnMove_bl = true;
			var toAdd = vc.screenY - _s.lastPresedY;
			_s.thmbsFinY += toAdd;
			_s.thmbsFinY = Math.round(_s.thmbsFinY);
			_s.lastPresedY = vc.screenY;
			_s.vy = toAdd  * 2;
			
			if(!_s.isMobile){
				if(_s.thmbsFinY > 0){
					_s.thmbsFinY = 0;
				}else if(_s.thmbsFinY < _s.mainButtonsHolder_do.h - _s.ttBtnH){
					_s.thmbsFinY = _s.mainButtonsHolder_do.h - _s.ttBtnH;
				}	
				
				var percentScrolled = Math.max(0,(_s.thmbsFinY/(_s.mainButtonsHolder_do.h - _s.ttBtnH)));
				
				if(_s.scrMainHolder_do){
					_s.scrBarHandY = Math.round((_s.scrMainHolder_do.h - _s.scrHandler_do.h) * percentScrolled);
					
					if(_s.scrBarHandY < 0){
						_s.scrBarHandY = 0;
					}else if(_s.scrBarHandY > _s.scrMainHolder_do.h - _s.scrHandler_do.h - 1){
						_s.scrBarHandY = _s.scrMainHolder_do.h - _s.scrHandler_do.h - 1;
					}
					
					FWDAnimation.killTweensOf(_s.scrHandler_do);
					FWDAnimation.killTweensOf(_s.scrHandlerLines_do);
					
						_s.scrHandler_do.setY(_s.scrBarHandY);
						_s.scrHandlerLines_do.setY(_s.scrBarHandY + parseInt((_s.scrHandler_do.h - _s.scrHandlerLinesN_do.h)/2));
					
				}
			}
		};

		_s.scrollBarTouchEndHandler = function(e){
			_s.isDragging_bl = false;
			clearInterval(_s.updateMoveMobileScrollbarId_int);
			clearTimeout(_s.disableOnMoveId_to);
			_s.disableOnMoveId_to = setTimeout(function(){
				prt.prt.hideDisable();
			},100);
			if(_s.hasPointEvt){
				window.removeEventListener("pointerup", _s.scrollBarTouchEndHandler);
				window.removeEventListener("pointermove", _s.scrollBarTouchMoveHandler);
			}else{
				window.removeEventListener("touchend", _s.scrollBarTouchEndHandler);
				window.removeEventListener("touchmove", _s.scrollBarTouchMoveHandler);
			}
			window.removeEventListener("mousemove", _s.scrollBarTouchMoveHandler);
		};

		_s.updateMoveMobileScrollbar = function(){
			_s.buttonsHolder_do.setY(_s.thmbsFinY);
		};

		_s.updateMobileScrollBar = function(animate){
			if(!_s.isDragging_bl){
				if(_s.ttBtnH < _s.mainButtonsHolder_do.h) _s.thmbsFinY = 0.01;
				_s.vy *= _s.frc;
				_s.thmbsFinY += _s.vy;	
				if(_s.thmbsFinY > 0){
					_s.vy2 = (0 - _s.thmbsFinY) * .3;
					_s.vy *= _s.frc;
					_s.thmbsFinY += _s.vy2;
				}else if(_s.thmbsFinY < _s.mainButtonsHolder_do.h - _s.ttBtnH){
					_s.vy2 = (_s.mainButtonsHolder_do.h - _s.ttBtnH - _s.thmbsFinY) * .3;
					_s.vy *= _s.frc;
					_s.thmbsFinY += _s.vy2;
				}
				_s.buttonsHolder_do.setY(Math.round(_s.thmbsFinY));
			}
		};

		//#################################//
		/* setup mouse scrollbar */
		//#################################//
		_s.setupScrollbar = function(){
			_s.scrMainHolder_do = new FWDUVPDisplayObject("div");
			_s.scrMainHolder_do.setVisible(false);
			
			_s.scrMainHolder_do.setWidth(prt.scrWidth);
			
			//track
			_s.scrTrack_do = new FWDUVPDisplayObject("div");
			_s.scrTrack_do.setWidth(prt.scrWidth);
			
			var scrBkTop_img = new Image();
			scrBkTop_img.src = prt.scrBkTop_img.src;
			_s.scrTrackTop_do = new FWDUVPDisplayObject("img");
			_s.scrTrackTop_do.setWidth(prt.scrTrackTop_do.w);
			_s.scrTrackTop_do.setHeight(prt.scrTrackTop_do.h);
			_s.scrTrackTop_do.setScreen(scrBkTop_img);
			
			_s.scrTrackMiddle_do = new FWDUVPDisplayObject("div");
			_s.scrTrackMiddle_do.getStyle().background = "url('" + prt._d.scrBkMiddlePath_str + "')";
			_s.scrTrackMiddle_do.setWidth(prt.scrWidth);
			_s.scrTrackMiddle_do.setY(_s.scrTrackTop_do.h);
		
			var scrTrackBottomImage_img = new Image();
			scrTrackBottomImage_img.src = prt._d.scrBkBottomPath_str;
			_s.scrTrackBottom_do = new FWDUVPDisplayObject("img");
			_s.scrTrackBottom_do.setScreen(scrTrackBottomImage_img);
			_s.scrTrackBottom_do.setWidth(_s.scrTrackTop_do.w);
			_s.scrTrackBottom_do.setHeight(_s.scrTrackTop_do.h);
			
			//handler
			_s.scrHandler_do = new FWDUVPDisplayObject("div");
			_s.scrHandler_do.setWidth(prt.scrWidth);
		
			_s.scrDragTop_img = new Image();
			_s.scrDragTop_img.src = prt.scrDragTop_img.src;
			_s.scrDragTop_img.width = prt.scrDragTop_img.width;
			_s.scrDragTop_img.height = prt.scrDragTop_img.height;
			
			_s.scrHandlerTop_do = new FWDUVPDisplayObject("img");
			if(_s.useHEX){
				_s.scrHandlerTop_do = new FWDUVPDisplayObject("div");
				_s.scrHandlerTop_do.setWidth(_s.scrDragTop_img.width);
				_s.scrHandlerTop_do.setHeight(_s.scrDragTop_img.height);
				_s.mainScrubberDragTop_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.scrDragTop_img, _s.nBC).canvas;
				_s.scrHandlerTop_do.screen.appendChild(_s.mainScrubberDragTop_canvas);	
			}else{
				_s.scrHandlerTop_do = new FWDUVPDisplayObject("img");
				_s.scrHandlerTop_do.setScreen(_s.scrDragTop_img);
			}
			
			_s.scrHandlerMiddle_do = new FWDUVPDisplayObject("div");
			_s.middleImage = new Image();
			_s.middleImage.src = prt._d.scrDragMiddlePath_str;
			if(_s.useHEX){
				_s.middleImage.onload = function(){
					_s.scrubberDragMiddle_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.middleImage, _s.nBC, true);
					_s.scrubberDragImage_img = _s.scrubberDragMiddle_canvas.image;
					_s.scrHandlerMiddle_do.getStyle().background = "url('" + _s.scrubberDragImage_img.src + "') repeat-y";
				}
			}else{
				_s.scrHandlerMiddle_do.getStyle().background = "url('" + prt._d.scrDragMiddlePath_str + "')";
			}
	
			_s.scrHandlerMiddle_do.setWidth(prt.scrWidth);
			_s.scrHandlerMiddle_do.setY(_s.scrHandlerTop_do.h);
			
			_s.scrHandlerBottom_do = new FWDUVPDisplayObject("div");
			_s.bottomImage = new Image();
			_s.bottomImage.src = prt._d.scrDragMiddlePath_str;
			if(_s.useHEX){
				_s.bottomImage.onload = function(){
					_s.scrubberDragBottom_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.bottomImage, _s.nBC, true);
					_s.scrubberDragBottomImage_img = _s.scrubberDragBottom_canvas.image;
					_s.scrHandlerBottom_do.getStyle().background = "url('" + _s.scrubberDragBottomImage_img.src + "') repeat-y";
					
				}
			}else{
				_s.scrHandlerBottom_do.getStyle().background = "url('" + prt._d.scrDragBottomPath_str + "')";
			}
			_s.scrHandlerBottom_do.setWidth(prt.scrWidth);
			_s.scrHandlerBottom_do.setY(_s.scrHandlerTop_do.h);
			
			_s.scrHandlerBottom_do.setWidth(_s.scrHandlerTop_do.w);
			_s.scrHandlerBottom_do.setHeight(_s.scrHandlerTop_do.h);
			_s.scrHandler_do.setButtonMode(true);
			
			_s.scrLinesN_img = new Image();
			_s.scrLinesN_img.src = prt.scrLinesN_img.src;
			_s.scrLinesN_img.width = prt.scrLinesN_img.width;
			_s.scrLinesN_img.height = prt.scrLinesN_img.height;
			
			if(_s.useHEX){
				_s.scrHandlerLinesN_do = new FWDUVPDisplayObject("div");
				_s.scrHandlerLinesN_do.setWidth(_s.scrLinesN_img.width);
				_s.scrHandlerLinesN_do.setHeight(_s.scrLinesN_img.height);
				_s.mainhandlerN_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.scrLinesN_img, _s.sBC).canvas;
				_s.scrHandlerLinesN_do.screen.appendChild(_s.mainhandlerN_canvas);	
			}else{
				_s.scrHandlerLinesN_do = new FWDUVPDisplayObject("img");
				_s.scrHandlerLinesN_do.setScreen(_s.scrLinesN_img);
			}
			
			_s.scrHandlerLinesS_img = new Image();
			_s.scrHandlerLinesS_img.src = prt._d.scrLinesSPath_str;
			if(_s.useHEX){
				_s.scrHandlerLinesS_do = new FWDUVPDisplayObject("div");
				_s.scrHandlerLinesS_img.onload = function(){
					_s.scrHandlerLinesS_do.setWidth(_s.scrHandlerLinesN_do.w);
					_s.scrHandlerLinesS_do.setHeight(_s.scrHandlerLinesN_do.h);
					_s.scrubberLines_s_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.scrHandlerLinesS_img, _s.sBC, true);
					_s.scrubbelinesSImage_img = _s.scrubberLines_s_canvas.image;
					_s.scrHandlerLinesS_do.getStyle().background = "url('" + _s.scrubbelinesSImage_img.src + "') repeat-y";
				}
			}else{
				_s.scrHandlerLinesS_do = new FWDUVPDisplayObject("img");
				_s.scrHandlerLinesS_do.setScreen(_s.scrHandlerLinesS_img);
				_s.scrHandlerLinesS_do.setWidth(_s.scrHandlerLinesN_do.w);
				_s.scrHandlerLinesS_do.setHeight(_s.scrHandlerLinesN_do.h);
			}
			_s.scrHandlerLinesS_do.setAlpha(0);
			
			_s.scrHandlerLines_do = new FWDUVPDisplayObject("div");
			_s.scrHandlerLines_do.setWidth(_s.scrHandlerLinesN_do.w);
			_s.scrHandlerLines_do.setHeight(_s.scrHandlerLinesN_do.h);
			_s.scrHandlerLines_do.setButtonMode(true);
				
			_s.scrTrack_do.addChild(_s.scrTrackTop_do);
			_s.scrTrack_do.addChild(_s.scrTrackMiddle_do);
			_s.scrTrack_do.addChild(_s.scrTrackBottom_do);
			_s.scrHandler_do.addChild(_s.scrHandlerTop_do);
			_s.scrHandler_do.addChild(_s.scrHandlerMiddle_do);
			_s.scrHandler_do.addChild(_s.scrHandlerBottom_do);
			_s.scrHandlerLines_do.addChild(_s.scrHandlerLinesN_do);
			_s.scrHandlerLines_do.addChild(_s.scrHandlerLinesS_do);
			_s.scrMainHolder_do.addChild(_s.scrTrack_do);
			_s.scrMainHolder_do.addChild(_s.scrHandler_do);
			_s.scrMainHolder_do.addChild(_s.scrHandlerLines_do);
			_s.mainButtonsHolder_do.addChild(_s.scrMainHolder_do);
			
			_s.scrHandler_do.screen.addEventListener("mouseover", _s.scrollBarHandlerOnMouseOver);
			_s.scrHandler_do.screen.addEventListener("mouseout", _s.scrollBarHandlerOnMouseOut);
			_s.scrHandler_do.screen.addEventListener("mousedown", _s.scrollBarHandlerOnMouseDown);
			_s.scrHandlerLines_do.screen.addEventListener("mouseover", _s.scrollBarHandlerOnMouseOver);
			_s.scrHandlerLines_do.screen.addEventListener("mouseout", _s.scrollBarHandlerOnMouseOut);
			_s.scrHandlerLines_do.screen.addEventListener("mousedown", _s.scrollBarHandlerOnMouseDown);
		
		};
		
		_s.scrollBarHandlerOnMouseOver = function(e){
			if(!_s.allowToScrollAndScrollBarIsActive_bl) return; 
			FWDAnimation.killTweensOf(_s.scrHandlerLinesN_do);
			FWDAnimation.killTweensOf(_s.scrHandlerLinesS_do);
			FWDAnimation.to(_s.scrHandlerLinesN_do, .8, {alpha:0, ease:Expo.easeOut});
			FWDAnimation.to(_s.scrHandlerLinesS_do, .8, {alpha:1, ease:Expo.easeOut});
		};
		
		_s.scrollBarHandlerOnMouseOut = function(e){
			if(_s.isDragging_bl || !_s.allowToScrollAndScrollBarIsActive_bl) return;
			FWDAnimation.killTweensOf(_s.scrHandlerLinesN_do);
			FWDAnimation.killTweensOf(_s.scrHandlerLinesS_do);
			FWDAnimation.to(_s.scrHandlerLinesN_do, .8, {alpha:1, ease:Expo.easeOut});
			FWDAnimation.to(_s.scrHandlerLinesS_do, .8, {alpha:0, ease:Expo.easeOut});
		};
		
		_s.scrollBarHandlerOnMouseDown = function(e){
			if(!_s.allowToScrollAndScrollBarIsActive_bl) return;
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);		
			_s.isDragging_bl = true;
			_s.yPositionOnPress = _s.scrHandler_do.y;
			_s.lastPresedY = vc.screenY;
			FWDAnimation.killTweensOf(_s.scrHandler_do);
			prt.prt.showDisable();
			
			if(window.addEventListener){
				window.addEventListener("mousemove", _s.scrollBarHandlerMoveHandler);
				window.addEventListener("mouseup", _s.scrollBarHandlerEndHandler);	
			}else if(document.attachEvent){
				document.attachEvent("onmousemove", _s.scrollBarHandlerMoveHandler);
				document.attachEvent("onmouseup", _s.scrollBarHandlerEndHandler);
			}
		};
		
		_s.scrollBarHandlerMoveHandler = function(e){
			if(e.preventDefault) e.preventDefault();
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			var linesY = _s.scrBarHandY + parseInt((_s.scrHandler_do.h - _s.scrHandlerLines_do.h)/2);
	
			_s.scrBarHandY = Math.round(_s.yPositionOnPress + vc.screenY - _s.lastPresedY);
			if(_s.scrBarHandY >= _s.scrTrack_do.h - _s.scrHandler_do.h){
				_s.scrBarHandY = _s.scrTrack_do.h -  _s.scrHandler_do.h;
			}else if(_s.scrBarHandY <= 0){
				_s.scrBarHandY = 0;
			}
			
			_s.scrHandler_do.setY(_s.scrBarHandY);
			FWDAnimation.killTweensOf(_s.scrHandler_do);
			FWDAnimation.to(_s.scrHandlerLines_do, .8, {y:linesY, ease:Quart.easeOut});
			_s.updateScrollBarHandlerAndContent(true);
		};
		
		_s.scrollBarHandlerEndHandler = function(e){
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			_s.isDragging_bl = false;
			
			if(!FWDUVPUtils.hitTest(_s.scrHandler_do.screen, vc.screenX, vc.screenY)){
				FWDAnimation.killTweensOf(_s.scrHandlerLinesN_do);
				FWDAnimation.killTweensOf(_s.scrHandlerLinesS_do);
				FWDAnimation.to(_s.scrHandlerLinesN_do, .8, {alpha:1, ease:Expo.easeOut});
				FWDAnimation.to(_s.scrHandlerLinesS_do, .8, {alpha:0, ease:Expo.easeOut});
			}
			
			prt.prt.hideDisable();
			FWDAnimation.killTweensOf(_s.scrHandler_do);
			FWDAnimation.to(_s.scrHandler_do, .4, {y:_s.scrBarHandY, ease:Quart.easeOut});
			
			if(window.removeEventListener){
				window.removeEventListener("mousemove", _s.scrollBarHandlerMoveHandler);
				window.removeEventListener("mouseup", _s.scrollBarHandlerEndHandler);	
			}else if(document.detachEvent){
				document.detachEvent("onmousemove", _s.scrollBarHandlerMoveHandler);
				document.detachEvent("onmouseup", _s.scrollBarHandlerEndHandler);
			}
		};
		
		_s.updateScrollBarSizeActiveAndDeactivate = function(){
			if(_s.disableForAWhileAfterThumbClick_bl) return;
		
			if(_s.allowToScrollAndScrollBarIsActive_bl){
				_s.allowToScrollAndScrollBarIsActive_bl = true;
				_s.scrMainHolder_do.setX(_s.sW - _s.scrMainHolder_do.w);
				_s.scrMainHolder_do.setHeight(_s.mainButtonsHolder_do.h);
				_s.scrTrack_do.setHeight(_s.scrMainHolder_do.h);
				_s.scrTrackMiddle_do.setHeight(_s.scrTrack_do.h - (_s.scrTrackTop_do.h * 2));
				_s.scrTrackBottom_do.setY(_s.scrTrackMiddle_do.y + _s.scrTrackMiddle_do.h);
				_s.scrMainHolder_do.setAlpha(1);
				_s.scrHandler_do.setButtonMode(true);
				_s.scrHandlerLines_do.setButtonMode(true);
			}else{
				_s.allowToScrollAndScrollBarIsActive_bl = false;
				_s.scrMainHolder_do.setX(_s.sW - _s.scrMainHolder_do.w);
				_s.scrMainHolder_do.setHeight(_s.mainButtonsHolder_do.h);
				_s.scrTrack_do.setHeight(_s.scrMainHolder_do.h);
				_s.scrTrackMiddle_do.setHeight(_s.scrTrack_do.h - (_s.scrTrackTop_do.h * 2));
				_s.scrTrackBottom_do.setY(_s.scrTrackMiddle_do.y + _s.scrTrackMiddle_do.h);
				_s.scrMainHolder_do.setAlpha(.5);
				_s.scrHandler_do.setY(0);
				_s.scrHandler_do.setButtonMode(false);
				_s.scrHandlerLines_do.setButtonMode(false);
			}
			
			_s.scrHandler_do.setHeight(Math.max(120, Math.round(Math.min(1,(_s.scrMainHolder_do.h/_s.ttBtnH)) * _s.scrMainHolder_do.h)));
			_s.scrHandlerMiddle_do.setHeight(_s.scrHandler_do.h - (_s.scrHandlerTop_do.h * 2));
			_s.scrHandlerBottom_do.setY(_s.scrHandlerMiddle_do.y + _s.scrHandlerMiddle_do.h);
			FWDAnimation.killTweensOf(_s.scrHandlerLines_do);
			_s.scrHandlerLines_do.setY(_s.scrBarHandY + parseInt((_s.scrHandler_do.h - _s.scrHandlerLines_do.h)/2));
			_s.scrHandlerBottom_do.setY(_s.scrHandler_do.h - _s.scrHandlerBottom_do.h);
		};

		
		//###########################################//
		/* Add mousewheel support */
		//###########################################//
		_s.addMouseWheelSupport = function(){
			if(_s.screen.addEventListener){
				_s.screen.addEventListener('DOMMouseScroll', _s.mouseWheelHandler);
				_s.screen.addEventListener ("mousewheel", _s.mouseWheelHandler);
			}else if(_s.screen.attachEvent){
				_s.screen.attachEvent('onmousewheel', _s.mouseWheelHandler);
			}
		};
	
		_s.mouseWheelHandler = function(e){
			if(e.preventDefault) e.preventDefault();
			if(_s.disableMouseWheel_bl || _s.isDragging_bl) return false;
			var dir = e.detail || e.wheelDelta;	
			if(e.wheelDelta) dir *= -1;
			if(dir > 0){
				_s.scrBarHandY += Math.round((160 * _s.scollbarSpeedSensitivity)  * (_s.mainButtonsHolder_do.h/_s.ttBtnH));
			}else if(dir < 0){
				_s.scrBarHandY -= Math.round((160 * _s.scollbarSpeedSensitivity)  * (_s.mainButtonsHolder_do.h/_s.ttBtnH));
			}
			
			if(_s.scrBarHandY >= _s.scrTrack_do.h - _s.scrHandler_do.h){
				_s.scrBarHandY = _s.scrTrack_do.h -  _s.scrHandler_do.h;
			}else if(_s.scrBarHandY <= 0){
				_s.scrBarHandY = 0;
			}
			
			var linesY = _s.scrBarHandY + parseInt((_s.scrHandler_do.h - _s.scrHandlerLines_do.h)/2);
			FWDAnimation.killTweensOf(_s.scrHandler_do);
			FWDAnimation.killTweensOf(_s.scrHandlerLines_do);
			FWDAnimation.to(_s.scrHandlerLines_do, .8, {y:linesY, ease:Quart.easeOut});
			FWDAnimation.to(_s.scrHandler_do, .5, {y:_s.scrBarHandY, ease:Quart.easeOut});
			_s.isDragging_bl = true;
			_s.updateScrollBarHandlerAndContent(true);
			_s.isDragging_bl = false;
		
			if(e.preventDefault){
				e.preventDefault();
			}else{
				return false;
			}
		};
		
		_s.updateScrollBarHandlerAndContent = function(animate, overwrite){
			if(_s.disableForAWhileAfterThumbClick_bl) return;
			if(!_s.allowToScrollAndScrollBarIsActive_bl && !overwrite) return;

			var percentScrolled = 0;
			var thumb;
			if(_s.isDragging_bl && !_s.isMbl){
				percentScrolled = (_s.scrBarHandY/(_s.scrMainHolder_do.h - _s.scrHandler_do.h));
				if(percentScrolled == "Infinity"){
					percentScrolled = 0;
				}
				_s.thmbsFinY = Math.round(percentScrolled * (_s.ttBtnH - _s.mainButtonsHolder_do.h)) * -1;
				if(_s.mainButtonsHolder_do.h == 0) _s.thmbsFinY = 0;
			}else{
				percentScrolled = _s.curId/(_s.ttBtns - 1);
				_s.thmbsFinY = Math.min(0, Math.round(percentScrolled * (_s.ttBtnH - _s.mainButtonsHolder_do.h)) * -1);
				if(_s.mainButtonsHolder_do.h == 0) _s.thmbsFinY = 0;
				if(_s.scrMainHolder_do){
					_s.scrBarHandY = Math.round((_s.scrMainHolder_do.h - _s.scrHandler_do.h) * percentScrolled);
					if(_s.scrBarHandY < 0){
						_s.scrBarHandY = 0;
					}else if(_s.scrBarHandY > _s.scrMainHolder_do.h - _s.scrHandler_do.h - 1){
						_s.scrBarHandY = _s.scrMainHolder_do.h - _s.scrHandler_do.h - 1;
					}
					
					FWDAnimation.killTweensOf(_s.scrHandler_do);
					FWDAnimation.killTweensOf(_s.scrHandlerLines_do);
					if(animate){
						FWDAnimation.to(_s.scrHandler_do, .4, {y:_s.scrBarHandY, ease:Quart.easeOut});
						FWDAnimation.to(_s.scrHandlerLines_do, .8, {y:_s.scrBarHandY + parseInt((_s.scrHandler_do.h - _s.scrHandlerLinesN_do.h)/2), ease:Quart.easeOut});
					}else{
						_s.scrHandler_do.setY(_s.scrBarHandY);
						_s.scrHandlerLines_do.setY(_s.scrBarHandY + parseInt((_s.scrHandler_do.h - _s.scrHandlerLinesN_do.h)/2));
					}
				}
			}
			
			if(_s.lastThumbnailFinalY != _s.thmbsFinY){
				FWDAnimation.killTweensOf(_s.buttonsHolder_do);
				if(animate){
					FWDAnimation.to(_s.buttonsHolder_do, .5, {y:_s.thmbsFinY, ease:Quart.easeOut});
				}else{
					_s.buttonsHolder_do.setY(_s.thmbsFinY);
				}
			}
			
			_s.lastThumbnailFinalY = _s.thmbsFinY;
		};
		
		_s.init();
	};
	
	
	/* set prototype */
	FWDUVPComboBox.setPrototype =  function(){
		FWDUVPComboBox.prototype = new FWDUVPDisplayObject("div");
	};
	FWDUVPComboBox.OPEN = "open";
	FWDUVPComboBox.HIDE_COMPLETE = "infoWindowHideComplete";
	FWDUVPComboBox.BUTTON_PRESSED = "buttonPressed";
	FWDUVPComboBox.prototype = null;
	window.FWDUVPComboBox = FWDUVPComboBox;
	
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Playlist select box button.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (){
var FWDUVPComboBoxButton = function(
			prt,
			label1, 
			backgroundNormalColor,
			backgroundSelectedColor,
			textNormalColor,
			textSelectedColor,
			id,
			totalHeight
		){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPComboBoxButton.prototype;
		
		_s.label1_str = label1;
		_s.bkNClr = backgroundNormalColor;
		_s.bkSClr = backgroundSelectedColor;
		_s.txtNClr = textNormalColor;
		_s.txtSClr = textSelectedColor;
		
		_s.totalWidth = 400;
		_s.totalHeight = totalHeight;
		_s.id = id;
		
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		_s.isMbl = FWDUVPUtils.isMobile;

	
		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.setBackfaceVisibility();
			_s.setButtonMode(true);
			_s.setupMainContainers();
			_s.setWidth(_s.totalWidth);
			_s.setHeight(_s.totalHeight);
			_s.setNormalState();
		};

		
		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.setupMainContainers = function(){
			
			_s.bk_sdo = new FWDUVPDisplayObject("div");
			_s.bk_sdo.setBkColor(_s.bkNClr);
			_s.addChild(_s.bk_sdo);
			
			_s.text_sdo = new FWDUVPDisplayObject("div");
			_s.text_sdo.getStyle().whiteSpace = "nowrap";
			_s.text_sdo.screen.className = 'fwduvp-cb-button'
			_s.text_sdo.setBackfaceVisibility();
			_s.text_sdo.setOverflow("visible");
			_s.text_sdo.setDisplay("inline-block");
			_s.text_sdo.getStyle().fontFamily = "Arial";
			_s.text_sdo.getStyle().fontSize= "13px";
			_s.text_sdo.getStyle().padding = "6px";
			_s.text_sdo.getStyle().fontWeight = "100";
			_s.text_sdo.getStyle().color = _s.nBC;
			_s.text_sdo.getStyle().fontSmoothing = "antialiased";
			_s.text_sdo.getStyle().webkitFontSmoothing = "antialiased";
			_s.text_sdo.getStyle().textRendering = "optimizeLegibility";	
			
			if (FWDUVPUtils.isIEAndLessThen9){
				_s.text_sdo.screen.innerText = _s.label1_str;
			}else{
				_s.text_sdo.setInnerHTML(_s.label1_str);
			}
			
			_s.addChild(_s.text_sdo);
			
			_s.dumy_sdo = new FWDUVPDisplayObject("div");
			if(FWDUVPUtils.isIE){
				_s.dumy_sdo.setBkColor("#FF0000");
				_s.dumy_sdo.setAlpha(0);
			};
			_s.addChild(_s.dumy_sdo);
			
			
			if(_s.hasPointerEvent_bl){
				_s.screen.addEventListener("pointerup", _s.onClick);
				_s.screen.addEventListener("pointerover", _s.onMouseOver);
				_s.screen.addEventListener("pointerout", _s.onMouseOut);
			}else if(_s.screen.addEventListener){	
				if(!_s.isMbl){
					_s.screen.addEventListener("mouseover", _s.onMouseOver);
					_s.screen.addEventListener("mouseout", _s.onMouseOut);
					_s.screen.addEventListener("mouseup", _s.onClick);
				}
				_s.screen.addEventListener("touchend", _s.onClick);
			}
		};
		
		_s.onMouseOver = function(e){
			if(_s.isDisabled_bl) return;
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE){
				FWDAnimation.killTweensOf(_s.text_sdo);
				_s.setSelectedState(true);
				_s.dispatchEvent(FWDUVPComboBoxButton.MOUSE_OVER);
			}
		};
			
		_s.onMouseOut = function(e){
			if(_s.isDisabled_bl) return;
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE){
				FWDAnimation.killTweensOf(_s.text_sdo);
				_s.setNormalState(true);
				_s.dispatchEvent(FWDUVPComboBoxButton.MOUSE_OUT);
			}
		};
		
		_s.onClick = function(e){
			if(_s.isDisabled_bl || prt.isScrollingOnMove_bl) return;
			if(e.preventDefault) e.preventDefault();
			_s.dispatchEvent(FWDUVPComboBoxButton.CLICK, {id:_s.id});
		};
		
		_s.onMouseDown = function(e){
			if(_s.isDisabled_bl || prt.isScrollingOnMove_bl) return;
			if(e.preventDefault) e.preventDefault();
			_s.dispatchEvent(FWDUVPComboBoxButton.MOUSE_DOWN, {id:_s.id});
		};
		

		//###########################################//
		/* set selected / normal state */
		//###########################################//
		_s.setSelectedState = function(animate){
			FWDAnimation.killTweensOf(_s.bk_sdo.screen);
			FWDAnimation.killTweensOf(_s.text_sdo.screen);
			if(animate){
				FWDAnimation.to(_s.bk_sdo.screen, .6, {css:{backgroundColor:_s.bkSClr}, ease:Quart.easeOut});
				FWDAnimation.to(_s.text_sdo.screen, .6, {css:{color:_s.txtSClr}, ease:Quart.easeOut});
			}else{
				_s.bk_sdo.setBkColor(_s.bkSClr);
				_s.text_sdo.getStyle().color = _s.txtSClr;
			}
		};
		
		_s.setNormalState = function(animate){
			FWDAnimation.killTweensOf(_s.bk_sdo.screen);
			FWDAnimation.killTweensOf(_s.text_sdo.screen);
			if(animate){
				FWDAnimation.to(_s.bk_sdo.screen, .6, {css:{backgroundColor:_s.bkNClr}, ease:Quart.easeOut});
				FWDAnimation.to(_s.text_sdo.screen, .6, {css:{color:_s.txtNClr}, ease:Quart.easeOut});
			}else{
				_s.bk_sdo.setBkColor(_s.bkNClr);
				_s.text_sdo.getStyle().color = _s.txtNClr;
			}
		};
		

		//##########################################//
		/* center text */
		//##########################################//
		_s.centerText = function(){
			
			_s.dumy_sdo.setWidth(_s.totalWidth);
			_s.dumy_sdo.setHeight(_s.totalHeight);
			_s.bk_sdo.setWidth(_s.totalWidth);
			_s.bk_sdo.setHeight(_s.totalHeight);
			_s.text_sdo.setX(4);
			_s.text_sdo.setY(Math.round((_s.totalHeight - _s.text_sdo.getHeight())/2));
		};
		

		//###############################//
		/* get max text width */
		//###############################//
		_s.getMaxTextWidth = function(){
			return _s.text_sdo.getWidth();
		};

		
		//##############################//
		/* disable / enable */
		//#############################//
		_s.disable = function(){
			_s.isDisabled_bl = true;
			_s.setButtonMode(false);
			_s.setSelectedState(true);
		};
		
		_s.enable = function(){
			_s.isDisabled_bl = false;
			_s.setNormalState(true);
			_s.setButtonMode(true);
		};
		
		_s.init();
	};
	
	
	/* set prototype */
	FWDUVPComboBoxButton.setPrototype = function(){
		FWDUVPComboBoxButton.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPComboBoxButton.FIRST_BUTTON_CLICK = "onFirstClick";
	FWDUVPComboBoxButton.SECOND_BUTTON_CLICK = "secondButtonOnClick";
	FWDUVPComboBoxButton.MOUSE_OVER = "onMouseOver";
	FWDUVPComboBoxButton.MOUSE_OUT = "onMouseOut";
	FWDUVPComboBoxButton.MOUSE_DOWN = "onMouseDown";
	FWDUVPComboBoxButton.CLICK = "onClick";
	
	FWDUVPComboBoxButton.prototype = null;
	window.FWDUVPComboBoxButton = FWDUVPComboBoxButton;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Playlist select box selector.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (){
var FWDUVPComboBoxSelector = function(
			arrowW,
			arrowH,
			arrowN_str,
			arrowS_str,
			label1, 
			backgroundNormalColor,
			backgroundSelectedColor,
			textNormalColor,
			textSelectedColor,
			totalHeight,
			useHEX,
			nBC,
			sBC
		){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPComboBoxSelector.prototype;
		
		_s.arrowN_str = arrowN_str;
		_s.arrowS_str = arrowS_str;
		
		_s.label1_str = label1;
		_s.bkNColor = backgroundNormalColor;
		_s.bkSColor = backgroundSelectedColor;
		_s.tNColor = textNormalColor;
		_s.tSColor = textSelectedColor;
		
		_s.useHEX = useHEX;
		_s.nBC = nBC;
		_s.sBC = sBC;
		
		_s.totalWidth = 400;
		
		_s.totalHeight = totalHeight;
		_s.arrowWidth = arrowW;
		_s.arrowHeight = arrowH;
		
		_s.hasPointEvt = FWDUVPUtils.hasPointerEvent;
		_s.isMbl = FWDUVPUtils.isMobile;
		
		
		//##########################################//
		/* initialize  */
		//##########################################//
		_s.init = function(){
			_s.setBackfaceVisibility();
			_s.setButtonMode(true);
			_s.setupMainContainers();
			_s.setWidth(_s.totalWidth);
			_s.setHeight(_s.totalHeight);
		};
	
		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.setupMainContainers = function(){
			
			_s.bk_sdo = new FWDUVPDisplayObject("div");
			_s.bk_sdo.getStyle().backgroundColor = _s.bkNColor;
			_s.addChild(_s.bk_sdo);
			
			_s.text_sdo = new FWDUVPDisplayObject("div");
			_s.text_sdo.getStyle().whiteSpace = "nowrap";
			_s.text_sdo.screen.className = 'fwduvp-cb-selector';
			_s.text_sdo.setBackfaceVisibility();
			_s.text_sdo.setOverflow("visible");
			_s.text_sdo.setDisplay("inline-block");
			_s.text_sdo.getStyle().fontFamily = "Arial";
			_s.text_sdo.getStyle().fontSize= "13px";
			_s.text_sdo.getStyle().fontWeight = "100";
			_s.text_sdo.getStyle().padding = "6px";
			_s.text_sdo.getStyle().color = _s.nBC;
			_s.text_sdo.getStyle().fontSmoothing = "antialiased";
			_s.text_sdo.getStyle().webkitFontSmoothing = "antialiased";
			_s.text_sdo.getStyle().textRendering = "optimizeLegibility";
			
			if (FWDUVPUtils.isIEAndLessThen9){
				_s.text_sdo.screen.innerText = _s.label1_str;
			}else{
				_s.text_sdo.setInnerHTML(_s.label1_str);
			}
			
			_s.addChild(_s.text_sdo);
			
			_s.arrow_do = new FWDUVPDisplayObject("div");
			_s.arrow_do.screen.className = "arrow";
			_s.arrow_do.setOverflow("visible");
			
			if(_s.useHEX){
				_s.arrowN_img = new Image();
				_s.arrowN_img.src = _s.arrowN_str;
				_s.arrowS_img = new Image();
				_s.arrowS_img.src = _s.arrowS_str;
				_s.arrowN_sdo = new FWDUVPDisplayObject("div");
				_s.arrowS_sdo = new FWDUVPDisplayObject("div");
				
				_s.arrowS_img.onload = function(){
					_s.arrowN_sdo.setWidth(_s.arrowN_img.width);
					_s.arrowN_sdo.setHeight(_s.arrowN_img.height);
					_s.nBC = _s.bkNColor;		

					_s.scrubberLines_n_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.arrowN_img, _s.nBC, true);
					_s.scrubbelinesNImage_img = _s.scrubberLines_n_canvas.image;
					_s.arrowN_sdo.getStyle().background = "url('" + _s.scrubbelinesNImage_img.src + "') repeat-y";
					
					_s.arrowS_sdo.setWidth(_s.arrowS_img.width);
					_s.arrowS_sdo.setHeight(_s.arrowS_img.height);
					_s.sBC = _s.arrowS_str;	
					_s.scrubberLines_s_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.arrowS_img, _s.sBC, true);
					_s.scrubbelinesSImage_img = _s.scrubberLines_s_canvas.image;
					_s.arrowS_sdo.getStyle().background = "url('" + _s.scrubbelinesSImage_img.src + "') repeat-y";
				}
			}else{
				_s.arrowN_sdo = new FWDUVPDisplayObject("div");
				_s.arrowN_sdo.screen.style.backgroundImage = "url(" + _s.arrowN_str + ")";
				_s.arrowS_sdo = new FWDUVPDisplayObject("div");
				_s.arrowS_sdo.screen.style.backgroundImage = "url(" + _s.arrowS_str + ")";
			}
			
			_s.arrowS_sdo.setAlpha(0);
			_s.arrow_do.addChild(_s.arrowN_sdo);
			_s.arrow_do.addChild(_s.arrowS_sdo);
			_s.addChild(_s.arrow_do);
			
			_s.arrowN_sdo.setWidth(_s.arrowWidth);
			_s.arrowN_sdo.setHeight(_s.arrowHeight);
			_s.arrowS_sdo.setWidth(_s.arrowWidth);
			_s.arrowS_sdo.setHeight(_s.arrowHeight);
			
			_s.dumy_sdo = new FWDUVPDisplayObject("div");
			if(FWDUVPUtils.isIE){
				_s.dumy_sdo.setBkColor("#FF0000");
				_s.dumy_sdo.setAlpha(0);
			};
			_s.addChild(_s.dumy_sdo);
			
			if(_s.hasPointEvt){
				_s.screen.addEventListener("pointerup", _s.onClick);
				_s.screen.addEventListener("pointerover", _s.onMouseOver);
				_s.screen.addEventListener("pointerout", _s.onMouseOut);
			}else if(_s.screen.addEventListener){	
				_s.screen.addEventListener("mouseover", _s.onMouseOver);
				_s.screen.addEventListener("mouseout", _s.onMouseOut);
				_s.screen.addEventListener("mouseup", _s.onClick);
				_s.screen.addEventListener("touchend", _s.onClick);
			}
		};
		
		_s.onMouseOver = function(e){
			if(_s.isDble) return;
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE){
				FWDAnimation.killTweensOf(_s.text_sdo);
				_s.setSelectedState(true, 0);
				_s.dispatchEvent(FWDUVPComboBoxSelector.MOUSE_OVER);
			}
		};
			
		_s.onMouseOut = function(e){
			if(_s.isDble) return;
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE){
				FWDAnimation.killTweensOf(_s.text_sdo);
				_s.setNormalState(true, true);
				_s.dispatchEvent(FWDUVPComboBoxSelector.MOUSE_OUT);
			}
		};
		
		_s.onClick = function(e){
			
			if(_s.isDeveleper_bl){
				window.open("http://www.webdesign-flash.ro", "_blank");
				return;
			}

			if(e.preventDefault) e.preventDefault();
			_s.dispatchEvent(FWDUVPComboBoxSelector.CLICK, {e:e});
		};
		
		_s.onMouseDown = function(e){
			if(e.preventDefault) e.preventDefault();
			_s.dispatchEvent(FWDUVPComboBoxSelector.MOUSE_DOWN, {e:e});
		};
		

		//###########################################//
		/* set selected / normal state */
		//###########################################//
		_s.setSelectedState = function(animate, dl){
			
			if(animate){
				FWDAnimation.to(_s.bk_sdo, .6, {alpha:1, ease:Expo.easeOut});	
				FWDAnimation.to(_s.text_sdo.screen, .6, {css:{color:_s.tSColor}, ease:Expo.easeOut});
				FWDAnimation.to(_s.arrowS_sdo, .6, {alpha:1, ease:Expo.easeOut});
			}else{
				_s.bk_sdo.setAlpha(1);
				_s.text_sdo.getStyle().color = _s.tSColor;
				_s.arrowS_sdo.alpha = 1;
			}
		};
		
		_s.setNormalState = function(animate, removeDelay){
			var dll = .6;
			if(removeDelay) dll = 0;
			dll = 0;
			FWDAnimation.killTweensOf(_s.bk_sdo);
			FWDAnimation.killTweensOf(_s.text_sdo.screen);
			FWDAnimation.killTweensOf(_s.arrowS_sdo);

			if(animate){
				FWDAnimation.to(_s.bk_sdo, .6, {alpha:0, delay:dll, ease:Expo.easeOut});	
				FWDAnimation.to(_s.text_sdo.screen, .6, {css:{color:_s.tNColor}, delay:dll, ease:Expo.easeOut});
				FWDAnimation.to(_s.arrowS_sdo, .6, {alpha:0, delay:dll, ease:Expo.easeOut});
			}else{
				_s.bk_sdo.setAlpha(0);
				_s.text_sdo.getStyle().color = _s.tNColor;
				_s.arrowS_sdo.alpha = 0;
			}
		};

		
		//##########################################//
		/* center text */
		//##########################################//
		_s.centerText = function(){
			_s.dumy_sdo.setWidth(_s.totalWidth);
			_s.dumy_sdo.setHeight(_s.totalHeight);
			_s.bk_sdo.setWidth(_s.totalWidth);
			_s.bk_sdo.setHeight(_s.totalHeight);
			
			_s.text_sdo.setX(2);
			
			_s.text_sdo.setY(Math.round((_s.totalHeight - _s.text_sdo.getHeight())/2));
			
			_s.arrow_do.setX(_s.totalWidth - _s.arrowWidth - 5);
			_s.arrow_do.setY(Math.round((_s.totalHeight - _s.arrowHeight)/2));
		};

		
		//###############################//
		/* get max text width */
		//###############################//
		_s.getMaxTextWidth = function(){
			return _s.text_sdo.getWidth();
		};

		
		//##############################//
		/* disable / enable */
		//#############################//
		_s.disable = function(){
			_s.isDble = true;
			_s.setSelectedState(true);
			if(FWDUVPUtils.hasTransform2d){
				FWDAnimation.to(_s.arrowN_sdo.screen, .8, {css:{rotation:180}, ease:Quart.easeOut});
				FWDAnimation.to(_s.arrowS_sdo.screen, .8, {css:{rotation:180}, ease:Quart.easeOut});
			}
			_s.setNormalState(true);

		};
		
		_s.enable = function(){
			_s.isDble = false;
			if(FWDUVPUtils.hasTransform2d){
				FWDAnimation.to(_s.arrowN_sdo.screen, .8, {css:{rotation:0}, ease:Quart.easeOut});
				FWDAnimation.to(_s.arrowS_sdo.screen, .8, {css:{rotation:0}, ease:Quart.easeOut});
			}
			_s.setButtonMode(true);
		};
		
		_s.setText = function(text){
			if (FWDUVPUtils.isIEAndLessThen9){
				_s.text_sdo.screen.innerText = text;
			}else{
				_s.text_sdo.setInnerHTML(text);
			}
		};
	
		_s.init();
	};
	

	/* set prototype */
	FWDUVPComboBoxSelector.setPrototype = function(){
		FWDUVPComboBoxSelector.prototype = new FWDUVPDisplayObject ("div");
	};
	
	FWDUVPComboBoxSelector.FIRST_BUTTON_CLICK = "onFirstClick";
	FWDUVPComboBoxSelector.SECOND_BUTTON_CLICK = "secondButtonOnClick";
	FWDUVPComboBoxSelector.MOUSE_OVER = "onMouseOver";
	FWDUVPComboBoxSelector.MOUSE_OUT = "onMouseOut";
	FWDUVPComboBoxSelector.MOUSE_DOWN = "onMouseDown";
	FWDUVPComboBoxSelector.CLICK = "onClick";
	
	FWDUVPComboBoxSelector.prototype = null;
	window.FWDUVPComboBoxSelector = FWDUVPComboBoxSelector;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Complex button.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (){
var FWDUVPComplexButton = function(
			n1Img, 
			s1Path, 
			n2Img, 
			s2Path, 
			disptachMainEvent_bl,
			useHEX,
		    nBC,
		    sBC,
			iconCSSString, 
			icon2CSSString, 
			normalCalssName,
			selectedCalssName
		){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPComplexButton.prototype;
		
		_s.iconCSSString = iconCSSString;
		_s.icon2CSSString = icon2CSSString;
		_s.normalCalssName = normalCalssName;
		_s.selectedCalssName = selectedCalssName;
		
		_s.n1Img = n1Img;
		_s.s1Path_str = s1Path;
		_s.n2Img = n2Img;
		_s.s2Path_str = s2Path;
		
		if(_s.n1Img){
			_s.buttonWidth = _s.n1Img.width;
			_s.buttonHeight = _s.n1Img.height;
		}
		
		_s.useHEX = useHEX;
		_s.nBC = nBC;
		_s.sBC = sBC;
		_s.currentState = 1;
		_s.disptachMainEvent_bl = disptachMainEvent_bl;
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		_s.allowToCreateSecondButton_bl = !_s.isMbl || _s.hasPointerEvent_bl;
		_s.useFontAwesome_bl = Boolean(_s.iconCSSString);
		

		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.hasTransform2d_bl = false;
			_s.setButtonMode(true);
			_s.setWidth(_s.buttonWidth);
			_s.setHeight(_s.buttonHeight);
			_s.setupMainContainers();
			_s.secondButton_do.setVisible(false);
			_s.setNormalState();
		};
		

		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.setupMainContainers = function(){
			if(_s.useFontAwesome_bl){
				_s.setOverflow('visible');
				_s.firstButton_do = new FWDUVPDisplayObject("div");
				_s.firstButton_do.setOverflow('visible');
				_s.n1_do = new FWDUVPDisplayObject("div");	
				_s.n1_do.setInnerHTML(_s.iconCSSString);
				_s.firstButton_do.addChild(_s.n1_do);
				
				//Second button
				_s.secondButton_do = new FWDUVPDisplayObject("div");
				_s.secondButton_do.setOverflow('visible');
				_s.n2_do = new FWDUVPDisplayObject("div");	
				_s.n2_do.setInnerHTML(_s.icon2CSSString);
				_s.secondButton_do.addChild(_s.n2_do);
				
				_s.setFinalSize();
				
			}else{
			
				_s.firstButton_do = new FWDUVPDisplayObject("div");
				_s.firstButton_do.setWidth(_s.buttonWidth);
				_s.firstButton_do.setHeight(_s.buttonHeight);
				
				if(_s.useHEX){
					_s.n1_do = new FWDUVPDisplayObject("div");
					_s.n1_do.setWidth(_s.buttonWidth);
					_s.n1_do.setHeight(_s.buttonHeight);
					_s.n1_sdo_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.n1Img, _s.nBC).canvas;
					_s.n1_do.screen.appendChild(_s.n1_sdo_canvas);			
				}else{
					_s.n1_do = new FWDUVPDisplayObject("img");	
					_s.n1_do.setScreen(_s.n1Img);
				}
				_s.firstButton_do.addChild(_s.n1_do);
				
				if(_s.allowToCreateSecondButton_bl){
					
					_s.s1_img = new Image();
					_s.s1_img.src = _s.s1Path_str;
					
					if(_s.useHEX){
						_s.s1_do = new FWDUVPTransformDisplayObject("div");
						_s.s1_do.setWidth(_s.buttonWidth);
						_s.s1_do.setHeight(_s.buttonHeight);
						_s.s1_img.onload = function(){
							_s.s1_do_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.s1_img, _s.sBC).canvas;
							_s.s1_do.screen.appendChild(_s.s1_do_canvas);
						}
						_s.s1_do.setAlpha(0);
					}else{
						_s.s1_do = new FWDUVPDisplayObject("img");
						_s.s1_do.setScreen(_s.s1_img);
						_s.s1_do.setWidth(_s.buttonWidth);
						_s.s1_do.setHeight(_s.buttonHeight);
						_s.s1_do.setAlpha(0);
					}
					_s.firstButton_do.addChild(_s.s1_do);
				}
							
				//Second button
				_s.secondButton_do = new FWDUVPDisplayObject("div");
				_s.secondButton_do.setWidth(_s.buttonWidth);
				_s.secondButton_do.setHeight(_s.buttonHeight);
				
				if(_s.useHEX){
					_s.n2_do = new FWDUVPDisplayObject("div");
					_s.n2_do.setWidth(_s.buttonWidth);
					_s.n2_do.setHeight(_s.buttonHeight);
					_s.n2_sdo_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.n2Img, _s.nBC).canvas;
					_s.n2_do.screen.appendChild(_s.n2_sdo_canvas);			
				}else{
					_s.n2_do = new FWDUVPDisplayObject("img");	
					_s.n2_do.setScreen(_s.n2Img);
				}
				_s.secondButton_do.addChild(_s.n2_do);
				
				if(_s.allowToCreateSecondButton_bl){
					
					_s.s2_img = new Image();
					_s.s2_img.src = _s.s2Path_str;
					
					if(_s.useHEX){
						_s.s2_do = new FWDUVPTransformDisplayObject("div");
						_s.s2_do.setWidth(_s.buttonWidth);
						_s.s2_do.setHeight(_s.buttonHeight);
						_s.s2_img.onload = function(){
							_s.s2_do_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.s2_img, _s.sBC).canvas;
							_s.s2_do.screen.appendChild(_s.s2_do_canvas);
						}
						_s.s2_do.setAlpha(0);
					}else{
						_s.s2_do = new FWDUVPDisplayObject("img");
						_s.s2_do.setScreen(_s.s2_img);
						_s.s2_do.setWidth(_s.buttonWidth);
						_s.s2_do.setHeight(_s.buttonHeight);
						_s.s2_do.setAlpha(0);
					}
					_s.secondButton_do.addChild(_s.s2_do);
				}	
			}
			
			_s.addChild(_s.secondButton_do);
			_s.addChild(_s.firstButton_do);
			
			if(_s.hasPointerEvent_bl){
				_s.screen.addEventListener("pointerup", _s.onMouseUp);
				_s.screen.addEventListener("pointerover", _s.onMouseOver);
				_s.screen.addEventListener("pointerout", _s.onMouseOut);
			}else if(_s.screen.addEventListener){	
				if(!_s.isMbl){
					_s.screen.addEventListener("mouseover", _s.onMouseOver);
					_s.screen.addEventListener("mouseout", _s.onMouseOut);
					_s.screen.addEventListener("mouseup", _s.onMouseUp);
				}
				_s.screen.addEventListener("toustart", _s.onDown);
				_s.screen.addEventListener("touchend", _s.onMouseUp);
			}
		};
		
		_s.onMouseOver = function(e, animate){
			if(_s.isDisabled_bl || _s.isSelectedState_bl) return;
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE || e.pointerType == "mouse"){
				_s.dispatchEvent(FWDUVPComplexButton.MOUSE_OVER, {e:e});
				_s.dispatchEvent(FWDUVPComplexButton.SHOW_TOOLTIP, {e:e});
				_s.setSelectedState(true);
			}
		};
			
		_s.onMouseOut = function(e){
			if(_s.isDisabled_bl || !_s.isSelectedState_bl) return;
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE || e.pointerType == "mouse"){
				_s.setNormalState(true);
				_s.dispatchEvent(FWDUVPComplexButton.MOUSE_OUT);
			}
		};
		
		_s.onDown = function(e){
			if(e.preventDefault) e.preventDefault();
		};
	
		_s.onMouseUp = function(e){
			if(_s.isDisabled_bl || e.button == 2) return;
			if(e.preventDefault) e.preventDefault();
			if(!_s.isMbl) _s.onMouseOver(e, false);
			if(_s.disptachMainEvent_bl) _s.dispatchEvent(FWDUVPComplexButton.MOUSE_UP, {e:e});
		};
		
		_s.checkCount = 0;
		_s.setFinalSize = function(){
			
			clearInterval(_s.checkId_int);
			_s.lastWidth = _s.n1_do.screen.firstChild.offsetWidth;
			if(_s.checkCount > 5) return;
			_s.checkCount ++;
				
			_s.checkId_int = setInterval(function(){
				_s.setFinalSize();
			},100);
			
			if(_s.prevWidth == _s.lastWidth || _s.lastWidth == 0) return;
			var maxWidth = Math.max(_s.n1_do.screen.firstChild.offsetWidth, _s.n2_do.screen.firstChild.offsetWidth); 
			var maxHeight = Math.max(_s.n1_do.screen.offsetHeight, _s.n2_do.screen.firstChild.offsetHeight); 
			_s.buttonWidth = maxWidth;
			_s.buttonHeight = maxHeight;
			
			_s.setWidth(maxWidth);
			_s.setHeight(maxHeight);
			_s.firstButton_do.setWidth(_s.w);
			_s.firstButton_do.setHeight(_s.h);
			_s.secondButton_do.setWidth(_s.w);
			_s.secondButton_do.setHeight(_s.h);
			
			_s.n1_do.setX(Math.round((maxWidth - _s.n1_do.getWidth())/2));
			_s.n1_do.setY(Math.round((maxHeight - _s.n1_do.getHeight())/2));
			_s.n2_do.setX(Math.round((maxWidth - _s.n2_do.getWidth())/2));
			_s.n2_do.setY(Math.round((maxHeight - _s.n2_do.getHeight())/2));
		
		
			_s.prevWidth = _s.lastWidth;
		}

		
		//##############################//
		/* toggle button */
		//#############################//
		_s.toggleButton = function(){
			if(_s.currentState == 1){
				_s.firstButton_do.setVisible(false);
				_s.secondButton_do.setVisible(true);
				_s.currentState = 0;
				_s.dispatchEvent(FWDUVPComplexButton.FIRST_BUTTON_CLICK);
			}else{
				_s.firstButton_do.setVisible(true);
				_s.secondButton_do.setVisible(false);
				_s.currentState = 1;
				_s.dispatchEvent(FWDUVPComplexButton.SECOND_BUTTON_CLICK);
			}
		};
		

		//##############################//
		/* set second buttons state */
		//##############################//
		_s.setButtonState = function(state){
			if(state == 1){
				_s.firstButton_do.setVisible(true);
				_s.secondButton_do.setVisible(false);
				_s.currentState = 1; 
			}else{
				_s.firstButton_do.setVisible(false);
				_s.secondButton_do.setVisible(true);
				_s.currentState = 0; 
			}
			
		};

		
		//###############################//
		/* set normal state */
		//################################//
		_s.setNormalState = function(animate){
			if(_s.isMbl && !_s.hasPointerEvent_bl && !_s.useFontAwesome_bl) return;
			_s.isSelectedState_bl = false;
			FWDAnimation.killTweensOf(_s.s1_do);
			FWDAnimation.killTweensOf(_s.s2_do);
				
			if(_s.useFontAwesome_bl){
				FWDAnimation.killTweensOf(_s.n1_do.screen);
				FWDAnimation.killTweensOf(_s.n2_do.screen);
					
				if(animate){
					FWDAnimation.to(_s.n1_do.screen, .8, {className:_s.normalCalssName, ease:Expo.easeOut});	
					FWDAnimation.to(_s.n2_do.screen, .8, {className:_s.normalCalssName, ease:Expo.easeOut});
				}else{
					_s.n1_do.screen.className = _s.normalCalssName;
					_s.n2_do.screen.className = _s.normalCalssName;
				}
			}else{
				FWDAnimation.to(_s.s1_do, .5, {alpha:0, ease:Expo.easeOut});	
				FWDAnimation.to(_s.s2_do, .5, {alpha:0, ease:Expo.easeOut});
			}
		};
		
		_s.setSelectedState = function(animate){
			_s.isSelectedState_bl = true;
			FWDAnimation.killTweensOf(_s.s1_do);
			FWDAnimation.killTweensOf(_s.s2_do);
			
			if(_s.useFontAwesome_bl){
				
					FWDAnimation.killTweensOf(_s.n1_do.screen);
					FWDAnimation.killTweensOf(_s.n2_do.screen);
					if(animate){
						FWDAnimation.to(_s.n1_do.screen, .8, {className:_s.selectedCalssName, ease:Expo.easeOut});	
						FWDAnimation.to(_s.n2_do.screen, .8, {className:_s.selectedCalssName, ease:Expo.easeOut});	
					}else{
						_s.n1_do.screen.className = _s.selectedCalssName;
						_s.n2_do.screen.className = _s.selectedCalssName;
					}
			}else{
				FWDAnimation.to(_s.s1_do, .5, {alpha:1, delay:.1, ease:Expo.easeOut});
				FWDAnimation.to(_s.s2_do, .5, {alpha:1, delay:.1, ease:Expo.easeOut});
			}
		};
		
		_s.disable = function(){
			if(_s.isDisabled_bl) return;
			_s.isDisabled_bl = true;
			_s.setButtonMode(false);
			FWDAnimation.killTweensOf(_s);
			FWDAnimation.to(_s, .6, {alpha:.4});
			_s.setNormalState();
		};
		
		_s.enable = function(){
			if(!_s.isDisabled_bl) return;
			_s.isDisabled_bl = false;
			_s.setButtonMode(true);
			FWDAnimation.killTweensOf(_s);
			FWDAnimation.to(_s, .6, {alpha:1});
		};

		
		//##########################################//
		/* Update HEX color of a canvaas */
		//##########################################//
		_s.updateHEXColors = function(nBC, sBC){
			FWDUVPUtils.changeCanvasHEXColor(_s.n1Img, _s.n1_sdo_canvas, nBC);
			FWDUVPUtils.changeCanvasHEXColor(_s.s1_img, _s.s1_do_canvas, sBC);
			FWDUVPUtils.changeCanvasHEXColor(_s.n2Img, _s.n2_sdo_canvas, nBC);
			FWDUVPUtils.changeCanvasHEXColor(_s.s2_img, _s.s2_do_canvas, sBC);
		}
		
		_s.init();
	};
	
	
	/* set prototype */
	FWDUVPComplexButton.setPrototype = function(){
		FWDUVPComplexButton.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPComplexButton.FIRST_BUTTON_CLICK = "onFirstClick";
	FWDUVPComplexButton.SECOND_BUTTON_CLICK = "secondButtonOnClick";
	FWDUVPComplexButton.MOUSE_OVER = "onMouseOver";
	FWDUVPComplexButton.MOUSE_OUT = "onMouseOut";
	FWDUVPComplexButton.MOUSE_UP = "onMouseUp";
	FWDUVPComplexButton.CLICK = "onClick";
	FWDUVPComplexButton.SHOW_TOOLTIP = "showTooltip";
	
	FWDUVPComplexButton.prototype = null;
	window.FWDUVPComplexButton = FWDUVPComplexButton;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Right click context menu.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (){
	var FWDUVPContextMenu = function(prt, _d){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPContextMenu.prototype;
		_s.prt = prt;
		
		_s.buttonsTest_ar = ['copy_url', 'copy_url_time', 'fullscreen'];
		_s.itemsLabels_ar = ['Copy video URL', 'Copy video URL at current time', 'Fullscreen/Normalscreen'];
		_s.items_ar = [];
		_s.spacers_ar = [];

		_s.backgroundColor_str = _d.contextMenuBackgroundColor_str;
		_s.borderColor_str = _d.contextMenuBorderColor_str;
		_s.spacerColor_str = _d.contextMenuSpacerColor_str;
		_s.itemNormalColor_str = _d.contextMenuItemNormalColor_str;
		_s.itemSelectedColor_str = _d.contextMenuItemSelectedColor_str;
		_s.itemDisabledColor_str = _d.contextMenuItemDisabledColor_str;
		_s.draggingMode_str = _d.startDraggingMode_str;
		_s.link_str = _d.link_str;
		
		_s.borderRadius = 0;
		_s.biggestWidth;
		_s.totalWidth = 400;
		_s.totalHeight = 400;
		_s.sapaceBetweenButtons = 7;
		_s.padding = 6;
			
		_s.inverseNextAndPrevRotation_bl = _d.inverseNextAndPrevRotation_bl;
		_s.showScriptDeveloper_bl = _d.showScriptDeveloper_bl;
		
		_s.init = function(){
			
			if(_s.itemsLabels_ar || _s.showScriptDeveloper_bl){
				_s.show_bl = true;
				_s.setWidth(_s.totalWidth);
				_s.setHeight(_s.totalHeight);
				_s.setBkColor(_s.backgroundColor_str);
				_s.getStyle().borderColor = _s.borderColor_str;
				_s.getStyle().borderStyle = "solid";
				_s.getStyle().borderRadius = _s.borderRadius + "px";
				_s.getStyle().borderWidth = "1px";
				_s.setVisible(false);
				_s.setY(-2000);
				_s.prt.main_do.addChild(_s);
				
				_s.setupLabels();	
				_s.setupDeveloperButton();
				_s.setupSpacers();
				_s.disable();
				_s.getMaxWidthResizeAndPositionId_to = setTimeout(_s.getMaxWidthResizeAndPosition, 200);
			}
			
			_s.addContextEvent();
		};
		
		_s.copyText = function(str){
		 	var el = document.createElement('textarea');
		 	el.value = str;
		  	document.body.appendChild(el);
		  	el.select();
		  	document.execCommand('copy');
		  	document.body.removeChild(el);
		};
		

		//##########################################//
		/* Setup context items. */
		//##########################################//
		_s.setupLabels = function(){
			var len = _s.buttonsTest_ar.length;
			var res;
			var label1_str = "";
			var label2_str = "";
			
			if(!_s.itemsLabels_ar) return;
			
			for(var i=0; i<len; i++){
				res = _s.buttonsTest_ar[i];	
				if(res == "copy_url"){
					label1_str = _s.itemsLabels_ar[i];
					FWDUVPContextMenuButton.setPrototype();
					_s.copyURL_do = new FWDUVPContextMenuButton(label1_str, undefined, _s.itemNormalColor_str, _s.itemSelectedColor_str, _s.itemDisabledColor_str);
					_s.items_ar.push(_s.copyURL_do);
					_s.copyURL_do.addListener(FWDUVPContextMenuButton.MOUSE_DOWN, _s.copyURLHandler);
					_s.addChild(_s.copyURL_do);
				}else if(res == "copy_url_time"){
					label1_str = _s.itemsLabels_ar[i];
					FWDUVPContextMenuButton.setPrototype();
					_s.copyURLTime_do = new FWDUVPContextMenuButton(label1_str, undefined, _s.itemNormalColor_str, _s.itemSelectedColor_str, _s.itemDisabledColor_str);
					_s.items_ar.push(_s.copyURLTime_do);
					_s.copyURLTime_do.addListener(FWDUVPContextMenuButton.MOUSE_DOWN, _s.copyURLAtTimeHandler);
					_s.addChild(_s.copyURLTime_do);
				}else if(res == "fullscreen"){
					if(_d.showFullScreenButton_bl){
						var str =  _s.itemsLabels_ar[i];
						label1_str = str.substr(0, str.indexOf("/"));
						label2_str = str.substr(str.indexOf("/") + 1);
						
						FWDUVPContextMenuButton.setPrototype();
						_s.fullScreenButton_do = new FWDUVPContextMenuButton(label1_str, label2_str, _s.itemNormalColor_str, _s.itemSelectedColor_str, _s.itemDisabledColor_str);
						_s.items_ar.push(_s.fullScreenButton_do);
						_s.fullScreenButton_do.addListener(FWDUVPContextMenuButton.MOUSE_DOWN, _s.fullScreenStartHandler);
						_s.addChild(_s.fullScreenButton_do);
					}
				}
			}
		};
		
		_s.setupDeveloperButton = function(){
			if(_s.showScriptDeveloper_bl){
				if(!_s.itemsLabels_ar) _s.itemsLabels_ar = [];
				_s.itemsLabels_ar.push("&#0169; made by FWD");
				var label1_str = "&#0169; made by FWD";
				FWDUVPContextMenuButton.setPrototype();
				_s.developerButton_do = new FWDUVPContextMenuButton(label1_str, undefined, _s.itemNormalColor_str, _s.itemSelectedColor_str, _s.itemDisabledColor_str);
				_s.developerButton_do.isDeveleper_bl = true;
				_s.items_ar.push(_s.developerButton_do);
				_s.addChild(_s.developerButton_do);

			}
		};
		
		_s.copyURLAtTimeHandler = function(e){
			var curTime = prt.curTime;
			if(curTime.length == 5) curTime = '00:' + curTime;
			var time_ar = String(curTime).split(':');
			for(var i=0; i<time_ar.length; i++){
				if(time_ar[i] == '00') time_ar[i] = '0';
			}
			var args = FWDUVPUtils.getHashUrlArgs(window.location.hash);
			var href = location.href;

			href = href.replace(/&uvpi=.*/i, '');
			href = href.replace(/&playlistId=.*/i, '');
			href = href.replace(/playlistId=.*/i, '');
			href = href.replace(/&t=.*/i, '');
			
			if(location.href.indexOf('?') == -1){
				if(FWDUVPlayer.instaces_ar.length > 1){
					curTime = href + '?uvpi=' + prt.instanceName_str + '&playlistId=' + prt.catId + '&videoId=' + prt.id;
				}else{
					curTime = href + '?playlistId=' + prt.catId + '&videoId=' + prt.id;
				}
			}else{
				if(FWDUVPlayer.instaces_ar.length > 1){
					curTime =href + '&uvpi=' + prt.instanceName_str + '&playlistId=' + prt.catId + '&videoId=' + prt.id;
				}else{
					curTime = href + '&playlistId=' + prt.catId + '&videoId=' + prt.id;
				}
			}
			if(curTime.indexOf('t=') == -1) curTime = curTime + '&t=' + time_ar[0] +'h' + time_ar[1] +'m' + time_ar[2] +'s';
			_s.copyText(curTime);
			_s.removeMenuId_to = setTimeout(_s.removeFromDOM, 150);
		};
		
		
		_s.copyURLHandler = function(e){
			_s.copyText(location.href);
			_s.removeMenuId_to = setTimeout(_s.removeFromDOM, 150);
		};

		//full screen.
		_s.fullScreenStartHandler = function(e){
			if(_s.fullScreenButton_do.currentState == 0){
				prt.goFullScreen();
			}else if(_s.fullScreenButton_do.currentState == 1){
				prt.goNormalScreen();
			}
			_s.fullScreenButton_do.onMouseOut();
		};
		
		_s.updateFullScreenButton = function(currentState){
			if(!_s.fullScreenButton_do) return;
			if(currentState == 0){
				_s.fullScreenButton_do.setButtonState(0);
			}else{
				_s.fullScreenButton_do.setButtonState(1);
			}
			_s.removeMenuId_to = setTimeout(_s.removeFromDOM, 150);
		};
		
		
		//########################################//
		/* setup sapcers */
		//########################################//
		_s.setupSpacers = function(){
			var totalSpacers = _s.items_ar.length - 1;
			var spacer_sdo;
			
			for(var i=0; i<totalSpacers; i++){
				spacer_sdo = new FWDUVPDisplayObject("div");
				_s.spacers_ar[i] = spacer_sdo;
				spacer_sdo.setHeight(1);
				spacer_sdo.setBkColor(_s.spacerColor_str);
				_s.addChild(spacer_sdo);
			};
		};
		
		//########################################//
		/* Get max width and position */
		//#######################################//
		_s.getMaxWidthResizeAndPosition = function(){
			var totalItems = _s.items_ar.length;
			var item_do;
			var spacer;
			var finalX;
			var finalY;
			_s.totalWidth = 0;
			_s.totalHeight = 0;
			for(var i=0; i<totalItems; i++){
				item_do = _s.items_ar[i];
				if(item_do.getMaxTextWidth() > _s.totalWidth) _s.totalWidth = item_do.getMaxTextWidth();
			};
			
			for(var i=0; i<totalItems; i++){
				spacer = _s.spacers_ar[i - 1];
				item_do = _s.items_ar[i];
				item_do.setX(_s.padding);
				item_do.setY(10 + (i * (item_do.totalHeight + _s.sapaceBetweenButtons)) - _s.padding);
				
				if(spacer){
					spacer.setWidth(_s.totalWidth + 2);
					spacer.setX(_s.padding);
					spacer.setY(parseInt(item_do.getY() - _s.sapaceBetweenButtons/2) - 1);
				};
				
				item_do.setWidth(_s.totalWidth + 2);
				item_do.centerText();
			}
			
			_s.totalHeight = item_do.getY() + item_do.totalHeight + 2;
			
			_s.setWidth(_s.totalWidth + _s.padding * 2 + 4);
			_s.setHeight(_s.totalHeight);
			
			_s.setVisible(true);
			_s.removeMenuId_to = setTimeout(_s.removeFromDOM, 150);
		};

		
		//##########################################//
		/* Add context events. */
		//##########################################//
		_s.addContextEvent = function(){
			if(_s.prt.main_do.screen.addEventListener){
				_s.prt.main_do.screen.addEventListener("contextmenu", _s.contextMenuHandler);
			}else{
				_s.prt.main_do.screen.attachEvent("oncontextmenu", _s.contextMenuHandler);
			}
		};
		
		_s.contextMenuHandler = function(e){	

			if(!_s.show_bl || !_d.showContextmenu_bl){
				if(e.preventDefault){
					e.preventDefault();
				}else{
					return false;
				}	
				return;
			}
			clearTimeout(_s.removeMenuId_to);
			_s.prt.main_do.addChild(_s);

			_s.positionButtons(e);
			_s.setAlpha(0);
			FWDAnimation.to(_s, .4, {alpha:1, ease:Quart.easeOut});
			
			if(window.addEventListener){
				window.addEventListener("mousedown", _s.contextMenuWindowOnMouseDownHandler);
				window.addEventListener("mouseup", _s.contextMenuWindowOnMouseDownHandler);
			}else{
				document.documentElement.attachEvent("onmousedown", _s.contextMenuWindowOnMouseDownHandler);
				document.documentElement.attachEvent("onmouseup", _s.contextMenuWindowOnMouseDownHandler);
			}
			
			if(e.preventDefault){
				e.preventDefault();
			}else{
				return false;
			}
		};
		
		_s.contextMenuWindowOnMouseDownHandler = function(e){
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);
			
			var screenX =  vc.screenX;
			var screenY =  vc.screenY;
			
			
			if(!FWDUVPUtils.hitTest(_s.screen, screenX, screenY)){
				if(window.removeEventListener){
					window.removeEventListener("mousedown", _s.contextMenuWindowOnMouseDownHandler);
					window.removeEventListener("mouseup", _s.contextMenuWindowOnMouseDownHandler);
				}else{
					document.documentElement.detachEvent("onmousedown", _s.contextMenuWindowOnMouseDownHandler);
					document.documentElement.detachEvent("onmouseup", _s.contextMenuWindowOnMouseDownHandler);
				}
				_s.removeMenuId_to = setTimeout(_s.removeFromDOM, 150);
			}
		};

	
		//####################################//
		/* position buttons */
		//####################################//
		_s.positionButtons = function(e){
		
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);
			var parentWidth = _s.prt.main_do.getWidth();
			var parentHeight = _s.prt.main_do.getHeight();
		
			var localX = vc.screenX - _s.prt.main_do.getGlobalX();
			var localY = vc.screenY - _s.prt.main_do.getGlobalY();
			var finalX = localX - 2;
			var finalY = localY - 2;
			_s.totalWidth = _s.getWidth();
			_s.totalHeight = _s.getHeight();
			
			if(finalX + _s.totalWidth > parentWidth - 2) finalX = localX - _s.totalWidth;
			if(finalX < 0) finalX = parseInt((parentWidth - _s.totalWidth)/2);
			if(finalX < 0) finalX = 0;
			
			if(finalY + _s.totalHeight > parentHeight - 2) finalY = localY - _s.totalHeight;
			if(finalY < 0) finalY = parseInt((parentHeight - _s.totalHeight)/2);
			if(finalY < 0) finalY = 0;
	
			_s.setX(finalX);
			_s.setY(finalY);			
		};
		

		//########################################//
		/* disable / enable */
		//########################################//
		_s.disable = function(){
			if(_s.copyURL_do) _s.copyURL_do.disable();
			if(_s.copyURLTime_do) _s.copyURLTime_do.disable();
			
		};
		
		_s.enable = function(){
			if(_s.copyURL_do) _s.copyURL_do.enable();
			if(_s.copyURLTime_do) _s.copyURLTime_do.enable();
		};

		
		//######################################//
		/* remove from DOM */
		//######################################//
		_s.removeFromDOM = function(){
			_s.setX(-5000);
		};
		
		_s.init();
	};
	
	FWDUVPContextMenu.setPrototype = function(){
		FWDUVPContextMenu.prototype = new FWDUVPDisplayObject("div");
	};
	
	
	FWDUVPContextMenu.prototype = null;
	window.FWDUVPContextMenu = FWDUVPContextMenu;
	
}(window));
/**
 * Ultimate Video Player PACKAGED v9.1
 * Right click context menu button.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (){
var FWDUVPContextMenuButton = function(
			label1, 
			label2, 
			normalColor,
			selectedColor,
			disabledColor,
			padding
		){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPContextMenuButton.prototype;
		
		_s.label1_str = label1;
		_s.label2_str = label2;
		_s.nBC = normalColor;
		_s.sBC = selectedColor;
		_s.disabledColor_str = disabledColor;
		
		_s.totalWidth = 400;
		_s.totalHeight = 20;		
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.currentState = 1;
		_s.showSecondButton_bl = label2 != undefined;


		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.setBackfaceVisibility();
			_s.setButtonMode(true);
			_s.setupMainContainers();
			_s.setWidth(_s.totalWidth);
			_s.setHeight(_s.totalHeight);
			_s.setButtonState(0);
		};

		
		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.setupMainContainers = function(){
			
			_s.text1_sdo = new FWDUVPDisplayObject("div");
			_s.text1_sdo.setBackfaceVisibility();
			_s.text1_sdo.setDisplay("inline-block");
			_s.text1_sdo.getStyle().fontFamily = "Arial";
			_s.text1_sdo.getStyle().fontSize= "12px";
			_s.text1_sdo.getStyle().color = _s.nBC;
			_s.text1_sdo.getStyle().fontSmoothing = "antialiased";
					_s.text1_sdo.setInnerHTML(_s.label1_str);
			_s.addChild(_s.text1_sdo);
			
			if(_s.showSecondButton_bl){
				_s.text2_sdo = new FWDUVPDisplayObject("div");
				_s.text2_sdo.setBackfaceVisibility();
				_s.text2_sdo.setDisplay("inline-block");
				_s.text2_sdo.getStyle().fontFamily = "Arial";
				_s.text2_sdo.getStyle().fontSize= "12px";
				_s.text2_sdo.getStyle().color = _s.nBC;
				_s.text2_sdo.getStyle().fontSmoothing = "antialiased";
				_s.text2_sdo.setInnerHTML(_s.label2_str);
				_s.addChild(_s.text2_sdo);
			}
			
			_s.dumy_sdo = new FWDUVPDisplayObject("div");
			if(FWDUVPUtils.isIE){
				_s.dumy_sdo.setBkColor("#FF0000");
				_s.dumy_sdo.setAlpha(0);
			};
			_s.addChild(_s.dumy_sdo);
			
			if(_s.isMbl){
				_s.screen.addEventListener("touchstart", _s.onMouseDown);
			}else if(_s.screen.addEventListener){
				_s.screen.addEventListener("mouseover", _s.onMouseOver);
				_s.screen.addEventListener("mouseout", _s.onMouseOut);
				_s.screen.addEventListener("mousedown", _s.onMouseDown);
				_s.screen.addEventListener("click", _s.onClick);
			}
		};
		
		_s.onMouseOver = function(animate){
			if(_s.isDisabled_bl) return;
			FWDAnimation.killTweensOf(_s.text1_sdo);
			if(animate){
				FWDAnimation.to(_s.text1_sdo.screen, .5, {css:{color:_s.sBC}, ease:Expo.easeOut});
				if(_s.showSecondButton_bl) FWDAnimation.to(_s.text2_sdo.screen, .5, {css:{color:_s.sBC}, ease:Expo.easeOut});
			}else{
				_s.text1_sdo.getStyle().color = _s.sBC;
				if(_s.showSecondButton_bl){
					FWDAnimation.killTweensOf(_s.text2_sdo);
					_s.text2_sdo.getStyle().color = _s.sBC;
				}
			}
			_s.dispatchEvent(FWDUVPContextMenuButton.MOUSE_OVER);
		};
			
		_s.onMouseOut = function(e){
			if(_s.isDisabled_bl) return;
			FWDAnimation.killTweensOf(_s.text1_sdo);
			FWDAnimation.to(_s.text1_sdo.screen, .5, {css:{color:_s.nBC}, ease:Expo.easeOut});
			
			if(_s.showSecondButton_bl){
				FWDAnimation.killTweensOf(_s.text2_sdo);
				FWDAnimation.to(_s.text2_sdo.screen, .5, {css:{color:_s.nBC}, ease:Expo.easeOut});
			}
			_s.dispatchEvent(FWDUVPContextMenuButton.MOUSE_OUT);
		};
		
		_s.onClick = function(e){
			if(_s.isDeveleper_bl){
				window.open("http://www.webdesign-flash.ro", "_blank");
				return;
			}
			if(_s.isDisabled_bl) return;
			if(e.preventDefault) e.preventDefault();
			_s.dispatchEvent(FWDUVPContextMenuButton.CLICK);
		};
		
		_s.onMouseDown = function(e){
			if(_s.isDisabled_bl) return;
			if(e.preventDefault) e.preventDefault();
			_s.dispatchEvent(FWDUVPContextMenuButton.MOUSE_DOWN, {e:e});
		};
		

		//##############################//
		/* toggle button */
		//#############################//
		_s.toggleButton = function(){
			if(!_s.showSecondButton_bl ) return;
			if(_s.currentState == 1){
				_s.text1_sdo.setVisible(true);
				_s.text2_sdo.setVisible(false);
				_s.currentState = 0;
				_s.dispatchEvent(FWDUVPContextMenuButton.FIRST_BUTTON_CLICK);
			}else{
				_s.text1_sdo.setVisible(false);
				_s.text2_sdo.setVisible(true);
				_s.currentState = 1;
				_s.dispatchEvent(FWDUVPContextMenuButton.SECOND_BUTTON_CLICK);
			}
		};
		

		//##############################//
		/* set second buttons state */
		//##############################//
		_s.setButtonState = function(state){
			if(state == 0){
				_s.text1_sdo.setVisible(true);
				if(_s.showSecondButton_bl) _s.text2_sdo.setVisible(false);
				_s.currentState = 0;
			}else if(state == 1){
				_s.text1_sdo.setVisible(false);
				if(_s.showSecondButton_bl) _s.text2_sdo.setVisible(true);
				_s.currentState = 1;
			}
		};		


		//##########################################//
		/* center text */
		//##########################################//
		_s.centerText = function(){
			_s.dumy_sdo.setWidth(_s.totalWidth);
			_s.dumy_sdo.setHeight(_s.totalHeight);
			if(FWDUVPUtils.isIEAndLessThen9){
				_s.text1_sdo.setY(Math.round((_s.totalHeight - _s.text1_sdo.getHeight())/2) - 1);
				if(_s.showSecondButton_bl) _s.text2_sdo.setY(Math.round((_s.totalHeight - _s.text2_sdo.getHeight())/2) - 1);
			}else{
				_s.text1_sdo.setY(Math.round((_s.totalHeight - _s.text1_sdo.getHeight())/2));
				if(_s.showSecondButton_bl) _s.text2_sdo.setY(Math.round((_s.totalHeight - _s.text2_sdo.getHeight())/2));
			}
			_s.text1_sdo.setHeight(_s.totalHeight + 2);
			if(_s.showSecondButton_bl) _s.text2_sdo.setHeight(_s.totalHeight + 2);
		};
		

		//###############################//
		/* get max text width */
		//###############################//
		_s.getMaxTextWidth = function(){
			var w1 = _s.text1_sdo.getWidth();
			var w2 = 0;
			if(_s.showSecondButton_bl) w2 = _s.text2_sdo.getWidth();
			return Math.max(w1, w2);
		};

		
		//##############################//
		/* disable /enable button */
		//##############################//
		_s.disable = function(){
			_s.isDisabled_bl = true;
			FWDAnimation.killTweensOf(_s.text1_sdo);
			FWDAnimation.to(_s.text1_sdo.screen, .5, {css:{color:_s.disabledColor_str}, ease:Expo.easeOut});
			_s.setButtonMode(false);
		};
		
		_s.enable = function(){
			_s.isDisabled_bl = false;
			FWDAnimation.killTweensOf(_s.text1_sdo);
			FWDAnimation.to(_s.text1_sdo.screen, .5, {css:{color:_s.nBC}, ease:Expo.easeOut});
			_s.setButtonMode(true);
		};
		
		_s.init();
	};

	
	/* set prototype */
	FWDUVPContextMenuButton.setPrototype = function(){
		FWDUVPContextMenuButton.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPContextMenuButton.FIRST_BUTTON_CLICK = "onFirstClick";
	FWDUVPContextMenuButton.SECOND_BUTTON_CLICK = "secondButtonOnClick";
	FWDUVPContextMenuButton.MOUSE_OVER = "onMouseOver";
	FWDUVPContextMenuButton.MOUSE_OUT = "onMouseOut";
	FWDUVPContextMenuButton.MOUSE_DOWN = "onMouseDown";
	FWDUVPContextMenuButton.CLICK = "onClick";
	
	FWDUVPContextMenuButton.prototype = null;
	window.FWDUVPContextMenuButton = FWDUVPContextMenuButton;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Video controller.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function(){
var FWDUVPController = function(
			_d,
			prt
		){
			
		'use strict';

		var _s = this;
		var prototype = FWDUVPController.prototype;
		
		_s._d = _d;
		_s.bkLeft_img = _d.bkLeft_img;
		_s.bkRight_img = _d.bkRight_img;
		_s.playN_img = _d.playN_img;
		_s.pauseN_img = _d.pauseN_img;
		_s.mainScrubberBkLeft_img = _d.mainScrubberBkLeft_img;
		_s.mainScrubberDragLeft_img = _d.mainScrubberDragLeft_img;
		_s.mainScrubberDragLeftSource = _d.mainScrubberDragLeft_img.src;
		_s.mainScrubberLine_img = _d.mainScrubberLine_img;
		_s.volumeScrubberBkLeft_img = _d.volumeScrubberBkLeft_img;
		_s.volumeScrubberDragBottom_img = _d.volumeScrubberDragBottom_img;
		_s.volumeScrubberLine_img = _d.volumeScrubberLine_img;
		_s.volumeN_img = _d.volumeN_img;
		_s.progressLeft_img = _d.progressLeft_img;
		_s.categoriesN_img = _d.categoriesN_img;
		_s.prt = prt;
		
		_s.playlistN_img = _d.playlistN_img;
		
		_s.ytbQualityN_img = _d.ytbQualityN_img;
		_s.infoN_img = _d.infoN_img;
		_s.downloadN_img = _d.downloadN_img;
		_s.facebookN_img = _d.facebookN_img;
		_s.fullScreenN_img = _d.fullScreenN_img;
		_s.normalScreenN_img = _d.normalScreenN_img;
		_s.hidePlaylistN_img = _d.hidePlaylistN_img;
		_s.showPlaylistN_img = _d.showPlaylistN_img;
		_s.embedN_img = _d.embedN_img;
	
		_s.buttons_ar = [];
		
		_s.useHEX = _d.useHEX; 
		_s.nBC = _d.nBC;
		_s.sBC = _d.sBC;
		
		_s.bkMiddlePath_str = _d.bkMiddlePath_str;
		_s.mainScrubberBkMiddlePath_str = _d.mainScrubberBkMiddlePath_str;
		_s.volumeScrubberBkMiddlePath_str = _d.volumeScrubberBkMiddlePath_str;
		_s.mainScrubberDragMiddlePath_str = _d.mainScrubberDragMiddlePath_str;
		_s.volumeScrubberDragMiddlePath_str = _d.volumeScrubberDragMiddlePath_str;
		_s.timeColor_str = _d.timeColor_str;
		_s.progressMiddlePath_str = _d.progressMiddlePath_str;
		_s.youtubeQualityButtonNormalColor_str = _d.youtubeQualityButtonNormalColor_str;
		_s.youtubeQualityButtonSelectedColor_str = _d.youtubeQualityButtonSelectedColor_str;
		_s.youtubeQualityArrowPath_str = _d.youtubeQualityArrowPath_str;
		_s.controllerBkPath_str = _d.controllerBkPath_str;
		_s.ytbQualityButtonPointerPath_str = _d.ytbQualityButtonPointerPath_str;
		_s.buttonsToolTipFontColor_str = _d.buttonsToolTipFontColor_str;
		
		_s.buttonsToolTipHideDelay = _d.buttonsToolTipHideDelay;
		_s.ttYtbBtns = 0;
		_s.sW = 0;
		_s.sH = _d.controllerHeight;
		_s.scrbsBkLARW = _s.mainScrubberBkLeft_img.width;
		_s.maiScrbW = 0;
		_s.mainScrbMinW = 100;
		_s.volumeScrubberOfsetHeight = _d.volumeScrubberOfsetHeight;
		_s.volumeScrubberHeight = _d.volumeScrubberHeight + _s.volumeScrubberOfsetHeight;
		_s.volScrbW = _s.mainScrubberBkLeft_img.height;
		_s.mainScrbH = _s.mainScrubberBkLeft_img.height;
		_s.mainScrbDrgLW = _s.mainScrubberDragLeft_img.width;
		_s.scrubbersOffsetWidth = _d.scrubbersOffsetWidth;
		_s.volume = _d.volume;
		
		_s.lastVolume = _s.volume;
		_s.startSpaceBetweenButtons = _d.startSpaceBetweenButtons;
		_s.spaceBetweenButtons = _d.spaceBetweenButtons;
		_s.percentPlayed = 0;
		_s.percentLoaded = 0;
		_s.lastTimeLength = 0;
		_s.prevYtbQualityButtonsLength = 0;
		_s.pointerWidth = 8;
		_s.pointerHeight = 5;
		_s.timeOffsetLeftWidth = _d.timeOffsetLeftWidth;
		_s.timeOffsetRightWidth = _d.timeOffsetRightWidth;
		_s.timeOffsetTop = _d.timeOffsetTop;
		_s.mainScrubberOffestTop = _d.mainScrubberOffestTop;
		
		_s.isVolumeScrubberShowed_bl = true;
		_s.volumeScrubberIsDragging_bl = false;
		_s.showButtonsToolTip_bl = _d.showButtonsToolTip_bl;
		_s.showPlaylistsButtonAndPlaylists_bl = _d.showPlaylistsButtonAndPlaylists_bl;
		_s.showPlaylistButtonAndPlaylist_bl = _d.showPlaylistButtonAndPlaylist_bl;
		_s.showEmbedButton_bl = _d.showEmbedButton_bl;
		_s.showPlaylistByDefault_bl = _d.showPlaylistByDefault_bl;
		_s.showShuffleButton_bl = _d.showShuffleButton_bl;
		_s.showLoopButton_bl = _d.showLoopButton_bl;
		
		_s.showNP_bl = prt._d.showNextAndPrevButtonsInController_bl;
		_s.showNextAndPrevButtonsInController_bl = _d.showNextAndPrevButtonsInController_bl;
		_s.showFullScreenButton_bl = _d.showFullScreenButton_bl;
		_s.disableVideoScrubber_bl = _d.disableVideoScrubber_bl;
		_s.showYoutubeQualityButton_bl = _d.showYoutubeQualityButton_bl;
		_s.showShareButton_bl = _d.showShareButton_bl;
		_s.showInfoButton_bl = _d.showInfoButton_bl;
		_s.showDownloadVideoButton_bl = _d.showDownloadVideoButton_bl;
		_s.showVolumeScrubber_bl = _d.showVolumeScrubber_bl;
		_s.allowToChangeVolume_bl = _d.allowToChangeVolume_bl;
		_s.showTime_bl = _d.showTime_bl;
		_s.showVolumeButton_bl = _d.showVolumeButton_bl;
		_s.showControllerWhenVideoIsStopped_bl = _d.showControllerWhenVideoIsStopped_bl;
		_s.showRewindButton_bl = _d.showRewindButton_bl;
		_s.showSubBtn = _d.showSubBtn;
		_s.muted = prt._d.autoPlay_bl;
		_s.isShowed_bl = true;
		_s.showNextAndPrevButtons_bl = _d.showNextAndPrevButtons_bl;
		_s.isPlaylistShowed_bl = _d.isPlaylistShowed_bl;
		_s.areYtbQualityButtonsShowed_bl = true;
		_s.repeatBackground_bl = _d.repeatBackground_bl;
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		_s.useVectorIcons_bl = _d.useVectorIcons_bl


		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.setOverflow("visible");
			_s.mainHld = new FWDUVPDisplayObject("div");
			if(_d.useAToB) _s.setupATB();

			if(_s.repeatBackground_bl){
				_s.bk_do = new FWDUVPDisplayObject("div");
				_s.bk_do.getStyle().background = "url('" + _s.controllerBkPath_str +  "')";
			}else{
				_s.bk_do = new FWDUVPDisplayObject("img");
				var img = new Image();
				img.src = _s.controllerBkPath_str;
				_s.bk_do.setScreen(img);	
			}
			_s.mainHld.addChild(_s.bk_do);
			
			_s.mainHld.setOverflow("visible");
			_s.mainHld.getStyle().zIndex = 1;
		
			_s.addChild(_s.mainHld);
			
			if(_s.showYoutubeQualityButton_bl){
				_s.ytbQuality_ar = ["hd4320", "hd2880","hd2160", "hd1440", "highres", "hd1080", "hd720", "large", "medium", "small", "tiny"];
				
				_s.ytbButtons_ar = [];
				_s.ttYtbBtns = _s.ytbQuality_ar.length;
				_s.setupYtbButtons();
			}
			
			if(_s.showNextAndPrevButtonsInController_bl) _s.setupPrevButton();
			_s.setupPlayPauseButton();
			if(_s.showRewindButton_bl) _s.setupRewindButton();
			if(_s.showNextAndPrevButtonsInController_bl) _s.setupNextButton();
			_s.setupMainScrubber();
			if(_s.showTime_bl) _s.setupTime();
			
			if(_s.showVolumeButton_bl) _s.setupVolumeButton();
			
			if(_s.showPlaylistsButtonAndPlaylists_bl) _s.setupCategoriesButton();
			if(_s.showPlaylistButtonAndPlaylist_bl) _s.setupPlaylistButton();

			if(_s.showYoutubeQualityButton_bl) _s.setupYoutubeQualityButton();
			
			if(_s.showShareButton_bl) _s.setupShareButton();
			if(_s.showEmbedButton_bl) _s.setupEmbedButton();
			if(_d.useAToB) _s.setupAtbButton();

			if(_s.showInfoButton_bl) _s.setupInfoButton();
			
			if(_d.showPlaybackRateButton_bl) _s.setupPlaybackRateButton();
			if(_s.showDownloadVideoButton_bl) _s.setupDownloadButton();
			if(_s.showSubBtn) _s.setupSubtitleButton();
			if(_d.showChromecastButton_bl) _s.setupChromecastButton();
			if(_d.showAudioTracksButton_bl) _s.setupAudioTracksButton();
			if(_d.show360DegreeVideoVrButton_bl) _s.setupVrButton();
			if(_s.showFullScreenButton_bl) _s.setupFullscreenButton();
			if(_s.showButtonsToolTip_bl) _s.setupToolTips();
			
			if(_s.showVolumeScrubber_bl){
				_s.setupVolumeScrubber();
				_s.hideVolumeScrubber();
			}
			_s.hide(false);
		};

		
		//###########################################//
		// Resize and position _s...
		//###########################################//
		_s.resizeAndPosition = function(){

			_s.sW = prt.tempVidStageWidth;
			_s.positionButtons();
			_s.setY(prt.tempVidStageHeight - _s.sH);
			_s.hideQualityButtons(false);
			if(_s.ytbButtonsHolder_do){
				FWDAnimation.killTweensOf(_s.ytbButtonsHolder_do);
				_s.ytbButtonsHolder_do.setY(prt.tempStageHeight);
			}
			
			if(_s.subtitlesButtonsHolder_do){
				FWDAnimation.killTweensOf(_s.subtitlesButtonsHolder_do);
				_s.subtitlesButtonsHolder_do.setY(prt.sH);
			}

			if(_s.ATBButtonsHolder_do){
				FWDAnimation.killTweensOf(_s.ATBButtonsHolder_do);
				_s.ATBButtonsHolder_do.setY(prt.sH);
			}
			
			if(_s.playbackRatesButtonsHolder_do){
				FWDAnimation.killTweensOf(_s.playbackRatesButtonsHolder_do);
				_s.playbackRatesButtonsHolder_do.setY(prt.sH);
			}
			
			_s.positionAdsLines();
		};
		
		_s.getButtonIndex = function(button){
			return FWDUVPUtils.indexOfArray(_s.buttons_ar, button);
		}
		
		
		//##############################//
		/* setup background */
		//##############################//
		_s.positionButtons = function(){
			if(!_s.sW) return;
			var button;
			var prevButton;
			var totalButtons = 0;
			var totalButtonsWidth = 0;
			var spaceBetweenButtons = 0;
			var leftWidth = 0;
			var hasTime_bl = _s.showTime_bl;
			var indexToAdd;
			
			if(!_d.playlist_ar || !_d.playlist_ar[prt.id]) return;

			
			if(prt.is360 && _s.vrButton_do){
				_s.addVrButton();
			}else{
				_s.removeVrButton();
			}
			
			// download button
			if(_s.showDownloadVideoButton_bl){
				if(_d.playlist_ar[prt.id]['downloadable']){
					if(_s.getButtonIndex(_s.downloadButton_do) == -1){
						if(_s.ccBtn_do && _s.getButtonIndex(_s.ccBtn_do) != -1){
							indexToAdd = _s.getButtonIndex(_s.ccBtn_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.downloadButton_do);
						}else if(_s.vrButton_do){
							indexToAdd = _s.getButtonIndex(_s.vrButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.downloadButton_do);
						}else if(_s.fullScreenButton_do){
							indexToAdd = _s.getButtonIndex(_s.fullScreenButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.downloadButton_do);
						}else{
							_s.buttons_ar.splice(_s.buttons_ar.length,0, _s.downloadButton_do);
						}
						_s.downloadButton_do.setVisible(true);
					}
				}else{
					var downloadButtonIndex = _s.getButtonIndex(_s.downloadButton_do);
					if(downloadButtonIndex != -1){
						_s.buttons_ar.splice(downloadButtonIndex,1);
						_s.downloadButton_do.setVisible(false);
					}
				}
			};
			
			// info button
			if(_s.showInfoButton_bl){
				if(_d.playlist_ar[prt.id].desc){
					if(_s.getButtonIndex(_s.infoButton_do) == -1){
						if(_s.downloadButton_do && _s.getButtonIndex(_s.downloadButton_do) != -1){
							indexToAdd = _s.getButtonIndex(_s.downloadButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.infoButton_do);
						}else if(_s.ccBtn_do && _s.getButtonIndex(_s.ccBtn_do) != -1){
							indexToAdd = _s.getButtonIndex(_s.ccBtn_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.infoButton_do);
						}else if(_s.vrButton_do){
							indexToAdd = _s.getButtonIndex(_s.vrButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.infoButton_do);
						}else if(_s.fullScreenButton_do){
							indexToAdd = _s.getButtonIndex(_s.fullScreenButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.infoButton_do);
						}else{
							_s.buttons_ar.splice(_s.buttons_ar.length,0, _s.infoButton_do);
						}
						_s.infoButton_do.setVisible(true);
					}
				}else{
					var downloadButtonIndex = _s.getButtonIndex(_s.infoButton_do);
					if(downloadButtonIndex != -1){
						_s.buttons_ar.splice(downloadButtonIndex,1);
						_s.infoButton_do.setVisible(false);
					}
				}
			};
	
			// a to be buttons
			if(_d['useAToB']){
				if(_d.playlist_ar[prt.id]['atb']){
					if(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.atbButton_do) == -1){
						if(_s.infoButton_do && _s.getButtonIndex(_s.infoButton_do) != -1){
							indexToAdd = _s.getButtonIndex(_s.infoButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.atbButton_do);
						}else if(_s.downloadButton_do && _s.getButtonIndex(_s.downloadButton_do) != -1){
							indexToAdd = _s.getButtonIndex(_s.downloadButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.atbButton_do);
						}else if(_s.ccBtn_do && _s.getButtonIndex(_s.ccBtn_do) != -1){
							indexToAdd = _s.getButtonIndex(_s.ccBtn_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.atbButton_do);
						}else if(_s.vrButton_do){
							indexToAdd = _s.getButtonIndex(_s.vrButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.atbButton_do);
						}else if(_s.fullScreenButton_do){
							indexToAdd = _s.getButtonIndex(_s.fullScreenButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.atbButton_do);
						}else{
							_s.buttons_ar.splice(_s.buttons_ar.length,0, _s.atbButton_do);
						}
						_s.atbButton_do.setVisible(true);
					}
				}else{
					var atbButtonIndex = FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.atbButton_do);
					if(atbButtonIndex != -1){
						_s.buttons_ar.splice(atbButtonIndex,1);
						_s.atbButton_do.setVisible(false);
						_s.atb.hide(true);
					}
				}
			};

			// Subtitle button
			if(_s.showSubBtn){
				if(_d.playlist_ar[prt.id].subtitleSource){
					if(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.subtitleButton_do) == -1){
						if(_s.playbackRateButton_do && _s.getButtonIndex(_s.playbackRateButton_do) != -1){
							indexToAdd = _s.getButtonIndex(_s.playbackRateButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.subtitleButton_do);
						}else if(_s.atbButton_do && _s.getButtonIndex(_s.atbButton_do) != -1){
							indexToAdd = _s.getButtonIndex(_s.atbButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.subtitleButton_do);
						}else if(_s.infoButton_do && _s.getButtonIndex(_s.infoButton_do) != -1){
							indexToAdd = _s.getButtonIndex(_s.infoButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.subtitleButton_do);
						}else if(_s.downloadButton_do && _s.getButtonIndex(_s.downloadButton_do) != -1){
							indexToAdd = _s.getButtonIndex(_s.downloadButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.subtitleButton_do);
						}else if(_s.ccBtn_do && _s.getButtonIndex(_s.ccBtn_do) != -1){
							indexToAdd = _s.getButtonIndex(_s.ccBtn_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.subtitleButton_do);
						}else if(_s.vrButton_do){
							indexToAdd = _s.getButtonIndex(_s.vrButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.subtitleButton_do);
						}else if(_s.fullScreenButton_do){
							indexToAdd = _s.getButtonIndex(_s.fullScreenButton_do);
							_s.buttons_ar.splice(indexToAdd, 0, _s.subtitleButton_do);
						}else{
							_s.buttons_ar.splice(_s.buttons_ar.length,0, _s.subtitleButton_do);
						}
						_s.subtitleButton_do.setVisible(true);
					}
				}else{
					var subtitleButtonIndex = FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.subtitleButton_do);
					if(subtitleButtonIndex != -1){
						_s.buttons_ar.splice(subtitleButtonIndex,1);
						_s.subtitleButton_do.setVisible(false);
						_s.subtitleButton_do.setX(-5000);
					}
				}
			};
			

			
			if(prt.videoType_str == FWDUVPlayer.VIMEO && !_d.showDefaultControllerForVimeo_bl){
				
				var playButtonIndex = FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.playPauseButton_do);
				if(playButtonIndex != -1){
					_s.buttons_ar.splice(playButtonIndex, 1);
					_s.playPauseButton_do.setVisible(false);
					_s.playPauseButton_do.setX(-500);
				}
				_s.mainScrubber_do.setVisible(false);
			}else{
				if(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.playPauseButton_do) == -1){
					if(_s.playPauseButton_do){
						indexToAdd = 0;
						_s.buttons_ar.splice(indexToAdd, 0, _s.playPauseButton_do);
						_s.playPauseButton_do.setVisible(true);
					}
				}
				
				if(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.rewindButton_do) == -1){
					if(_s.rewindButton_do){
						indexToAdd = FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.playPauseButton_do);
						_s.buttons_ar.splice(indexToAdd, 0, _s.rewindButton_do);
						_s.rewindButton_do.setVisible(true);
					}
				}
			
				if(_s.showVolumeButton_bl){
					if(_s.showTime_bl){
						if(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.volBtn) == -1){
							indexToAdd = FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.time_do) + 1;
							_s.buttons_ar.splice(indexToAdd, 0, _s.volBtn);
							_s.volBtn.setVisible(true);
						}
					}else{
						if(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.volBtn) == -1){
							indexToAdd = FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.mainScrubber_do) + 1;
							_s.buttons_ar.splice(indexToAdd, 0, _s.volBtn);
							_s.volBtn.setVisible(true);
						}
					}
				}
				
				_s.mainScrubber_do.setVisible(true);
			}
		
			
			var buttonsCopy_ar = [];
			for (var i=0; i < _s.buttons_ar.length; i++) {
				buttonsCopy_ar[i] = _s.buttons_ar[i];
			}
			
			if(prt.tempPlaylistPosition_str == "right" 
				&& _s.showNextAndPrevButtonsInController_bl
				&& !_s.showNP_bl){
				if(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.nextButton_do) != -1){
					buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.nextButton_do), 1);
					buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.prevButton_do), 1);
					_s.nextButton_do.setX(-1000);
					_s.prevButton_do.setX(-1000);
				}
			}
			
			_s.maiScrbW = _s.sW - _s.startSpaceBetweenButtons * 2;
			for (var i=0; i < buttonsCopy_ar.length; i++) {
				button = buttonsCopy_ar[i];
				if(button != _s.mainScrubber_do){
					_s.maiScrbW -= button.w + _s.spaceBetweenButtons;
				}
			};
		
			if(prt.videoType_str == FWDUVPlayer.VIMEO && _s.maiScrbW >= 120 && !_d.showDefaultControllerForVimeo_bl){
				if(_s.mainScrubber_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.mainScrubber_do) != -1){
					buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.mainScrubber_do), 1);
					_s.positionScrollBarOnTopOfTheController();
				}
				
				if(_s.time_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.time_do) != -1){
					buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.time_do), 1);
					_s.time_do.setX(-1000);
				}
				
				totalButtons = buttonsCopy_ar.length;
				for(var i=0; i<totalButtons; i++){
					totalButtonsWidth += buttonsCopy_ar[i].w;
				}
				
				spaceBetweenButtons = _s.spaceBetweenButtons;
				leftWidth = _s.sW - buttonsCopy_ar[totalButtons - 1].w - _s.startSpaceBetweenButtons - 2;
				
				for (var i=totalButtons - 1; i>=0 ; i--) {
					
					button = buttonsCopy_ar[i];
					if(i == totalButtons - 1){
						button.setX(leftWidth);
					}else{
						prevButton = buttonsCopy_ar[i + 1];
						button.setX(prevButton.x - button.w - spaceBetweenButtons);	
					}
				}
			
			}else if(_s.maiScrbW <= 120 || prt.videoType_str == FWDUVPlayer.VIMEO && !_d.showDefaultControllerForVimeo_bl){
				if(_s.mainScrubber_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.mainScrubber_do) != -1){
					buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.mainScrubber_do), 1);
					_s.positionScrollBarOnTopOfTheController();
				}
				
				if(_s.time_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.time_do) != -1){
					buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.time_do), 1);
					_s.time_do.setX(-1000);
				}
				
				totalButtons = buttonsCopy_ar.length;
				for(var i=0; i<totalButtons; i++){
					totalButtonsWidth += buttonsCopy_ar[i].w;
				}
			
					spaceBetweenButtons = parseInt((_s.sW - totalButtonsWidth - _s.startSpaceBetweenButtons * 2)/(totalButtons - 1));
					leftWidth = parseInt((_s.sW - totalButtonsWidth - ((totalButtons - 1) * spaceBetweenButtons))/2);
					
					for (var i=0; i < totalButtons; i++) {
						button = buttonsCopy_ar[i];
						if(i == 0){
							button.setX(leftWidth);
						}else{
							prevButton = buttonsCopy_ar[i - 1];
							button.setX(prevButton.x + prevButton.w + spaceBetweenButtons);	
						}
					}
			}else{
				while(_s.maiScrbW < _s.mainScrbMinW){
					_s.maiScrbW = _s.sW - _s.startSpaceBetweenButtons * 2;
					if(_s.time_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.time_do) != -1){
						buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.time_do), 1);
						_s.time_do.setX(-1000);
						hasTime_bl = false;
					}else if(_s.shareButton_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.shareButton_do) != -1){
						buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.shareButton_do), 1);
						_s.shareButton_do.setX(-1000);
					}else if(_s.downloadButton_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.downloadButton_do) != -1){
						buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.downloadButton_do), 1);
						_s.downloadButton_do.setX(-1000);
					}else if(_s.embedButton_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.embedButton_do) != -1){
						buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.embedButton_do), 1);
						_s.embedButton_do.setX(-1000);
					}else if(_s.volBtn && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.volBtn) != -1){
						buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.volBtn), 1);
						_s.volBtn.setX(-1000);
					}else if(_s.playbackRateButton_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.playbackRateButton_do) != -1){
						buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.playbackRateButton_do), 1);
						_s.playbackRateButton_do.setX(-1000);
					}else if(_s.ytbQualityButton_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.ytbQualityButton_do) != -1){
						buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.ytbQualityButton_do), 1);
						_s.ytbQualityButton_do.setX(-1000);
					}else if(_s.playlistButton_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.playlistButton_do) != -1){
						buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.playlistButton_do), 1);
						_s.playlistButton_do.setX(-1000);
					}else if(_s.infoButton_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.infoButton_do) != -1){
						buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.infoButton_do), 1);
						_s.infoButton_do.setX(-1000);
					}else if(_s.categoriesButton_do && FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.categoriesButton_do) != -1){
						buttonsCopy_ar.splice(FWDUVPUtils.indexOfArray(buttonsCopy_ar, _s.categoriesButton_do), 1);
						_s.categoriesButton_do.setX(-1000);
					}
							
					totalButtons = buttonsCopy_ar.length;
					for (var i=0; i < totalButtons; i++) {
						button = buttonsCopy_ar[i];
						if(button != _s.mainScrubber_do){
							_s.maiScrbW -= button.w + _s.spaceBetweenButtons;
						}
					};
				};
				
				if(_s.showNextAndPrevButtonsInController_bl
					&& _s.maiScrbW > 120){			
				}
				
				if(hasTime_bl) _s.maiScrbW -= _s.timeOffsetLeftWidth * 2;
				totalButtons = buttonsCopy_ar.length;
				
				for (var i=0; i < totalButtons; i++) {
					button = buttonsCopy_ar[i];
					
					if(i == 0){
						button.setX(_s.startSpaceBetweenButtons);
					}else if(button == _s.mainScrubber_do){
						prevButton = buttonsCopy_ar[i - 1];
						FWDAnimation.killTweensOf(_s.mainScrubber_do);
						_s.mainScrubber_do.setX(prevButton.x + prevButton.w + _s.spaceBetweenButtons);
						_s.mainScrubber_do.setY(parseInt((_s.sH - _s.mainScrbH)/2));
						_s.mainScrubber_do.setWidth(_s.maiScrbW + 1);
						_s.mainScrubberBkMiddle_do.setWidth(_s.maiScrbW - _s.scrbsBkLARW * 2);
						_s.mainScrubberBkRight_do.setX(_s.maiScrbW - _s.scrbsBkLARW);
						_s.mainScrubberDragMiddle_do.setWidth(_s.maiScrbW - _s.scrbsBkLARW - _s.scrubbersOffsetWidth);
					}else if(button == _s.time_do){
						prevButton = buttonsCopy_ar[i - 1];
						button.setX(prevButton.x + prevButton.w + _s.spaceBetweenButtons + _s.timeOffsetLeftWidth);
						var timeOffset = 0;
						if(_s.isLive) timeOffset = 1;
						button.setY(parseInt((_s.sH - button.h)/2) + timeOffset);
					}else if(button == _s.volBtn && hasTime_bl){
						prevButton = buttonsCopy_ar[i - 1];
						button.setX(prevButton.x + prevButton.w + _s.spaceBetweenButtons + _s.timeOffsetRightWidth);
					}else{
						prevButton = buttonsCopy_ar[i - 1];
						button.setX(prevButton.x + prevButton.w + _s.spaceBetweenButtons);
					}
				}
				
				if(_s.isShowed_bl){
					_s.isMainScrubberOnTop_bl = false;
				}else{
					_s.isMainScrubberOnTop_bl = true;
					_s.positionScrollBarOnTopOfTheController();
				}
			}
		
			if(_s.bk_do){
				_s.bk_do.setWidth(_s.sW);
				_s.bk_do.setHeight(_s.sH);
			}
			
			if(_s.progressMiddle_do) _s.progressMiddle_do.setWidth(Math.max(_s.maiScrbW - _s.scrbsBkLARW - _s.scrubbersOffsetWidth, 0));
			_s.updateMainScrubber(_s.percentPlayed);
			_s.updatePreloaderBar(_s.percentLoaded);
			
			_s.mainHld.setWidth(_s.sW);
			_s.mainHld.setHeight(_s.sH);
			_s.setWidth(_s.sW);
			_s.setHeight(_s.sH);

			if(_s.atb) _s.atb.resize();
		};
		
		_s.positionScrollBarOnTopOfTheController = function(){
			
			_s.maiScrbW = _s.sW;
			_s.updatePreloaderBar(_s.percentLoaded);
			
			_s.mainScrubber_do.setWidth(_s.maiScrbW + 1);
			_s.mainScrubberBkMiddle_do.setWidth(_s.maiScrbW - _s.scrbsBkLARW * 2);
			_s.mainScrubberBkRight_do.setX(_s.maiScrbW - _s.scrbsBkLARW);
			_s.mainScrubberDragMiddle_do.setWidth(_s.maiScrbW - _s.scrbsBkLARW - _s.scrubbersOffsetWidth);
			
			var offset = 0;
			if(_s.atb && _s.atb.isShowed_bl) offset = _s.sH;
			
			FWDAnimation.killTweensOf(_s.mainScrubber_do);
			_s.mainScrubber_do.setX(0);
			_s.mainScrubber_do.setAlpha(1);
			
			if(_s.isMainScrubberOnTop_bl || _s.isShowed_bl){
				if(_s.atb && _s.atb.isShowed_bl && !_s.isShowed_bl){
				 	offset += _s.mainScrubberOffestTop;
				}else{
					offset = 0;
				}
				
				FWDAnimation.killTweensOf(_s.mainScrubber_do);
				if(_s.isShowed_bl){
					_s.mainScrubber_do.setY(- _s.mainScrubberOffestTop - offset);
				}else{
					FWDAnimation.to(_s.mainScrubber_do, .8, {y:- _s.mainScrubberOffestTop - offset, ease:Expo.easeOut});
				}
			}else if(!_s.isLive){
				
				FWDAnimation.to(_s.mainScrubber_do, .8, {y:- _s.mainScrubberOffestTop - offset, ease:Expo.easeOut});
			}
			
			_s.isMainScrubberOnTop_bl = true;
		};
	
			
		//################################//
		/* Setup tooltips */
		//################################//		
		_s.setupToolTips = function(){
			FWDUVPToolTip.setPrototype();
			_s.playPauseToolTip_do = new FWDUVPToolTip(_s.playPauseButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "play / pause", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
			document.documentElement.appendChild(_s.playPauseToolTip_do.screen);
			
			if(_s.showControllerWhenVideoIsStopped_bl){
				FWDUVPToolTip.setPrototype();
				_s.prevButtonToolTip_do = new FWDUVPToolTip(_s.prevButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "previous video", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.prevButtonToolTip_do.screen);
				
				FWDUVPToolTip.setPrototype();
				_s.nextButtonToolTip_do = new FWDUVPToolTip(_s.nextButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "next video", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.nextButtonToolTip_do.screen);
			}
			
			if(_s.showPlaylistsButtonAndPlaylists_bl){
				FWDUVPToolTip.setPrototype();
				_s.playlistsButtonToolTip_do = new FWDUVPToolTip(_s.categoriesButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "show playlists", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.playlistsButtonToolTip_do.screen);
			}
			
			if(_s.showPlaylistButtonAndPlaylist_bl){
				FWDUVPToolTip.setPrototype();
				_s.playlistButtonToolTip_do = new FWDUVPToolTip(_s.playlistButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "show / hide playlist", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.playlistButtonToolTip_do.screen);
			}
			
			if(_s.showEmbedButton_bl){
				FWDUVPToolTip.setPrototype();
				_s.embedButtonToolTip_do = new FWDUVPToolTip(_s.embedButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "show embed window", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.embedButtonToolTip_do.screen);
			}
			
			if(_s.showShareButton_bl){
				FWDUVPToolTip.setPrototype();
				_s.facebookButtonToolTip_do = new FWDUVPToolTip(_s.shareButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "share", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.facebookButtonToolTip_do.screen);
			}
			
			if(_d.showChromecastButton_bl){
				FWDUVPToolTip.setPrototype();
				_s.castButtonToolTip_do = new FWDUVPToolTip(_s.ccBtn_do, _d.toopTipBk_str, _d.toopTipPointer_str, "chromecast", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.castButtonToolTip_do.screen);
			}

			FWDUVPToolTip.setPrototype();
			_s.atbButtonToolTip_do = new FWDUVPToolTip(_s.atbButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "a to b loop", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
			document.documentElement.appendChild(_s.atbButtonToolTip_do.screen);
			
			if(_s.showSubBtn){
				FWDUVPToolTip.setPrototype();
				_s.subtitleButtonToolTip_do = new FWDUVPToolTip(_s.subtitleButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "show / hide subtitle", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.subtitleButtonToolTip_do.screen);
			}
			
			
			if(_s.showInfoButton_bl){
				FWDUVPToolTip.setPrototype();
				_s.infoButtonToolTip_do = new FWDUVPToolTip(_s.infoButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "more info", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.infoButtonToolTip_do.screen);
			}
			
			if(_s.showDownloadVideoButton_bl){
				FWDUVPToolTip.setPrototype();
				_s.downloadButtonToolTip_do = new FWDUVPToolTip(_s.downloadButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "download video", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.downloadButtonToolTip_do.screen);
			}
			
			if(_s.fullScreenButton_do){
				FWDUVPToolTip.setPrototype();
				_s.fullscreenButtonToolTip_do = new FWDUVPToolTip(_s.fullScreenButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "fullscreen / normalscreen", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.fullscreenButtonToolTip_do.screen);
			}

			if(_s.vrButton_do){
				FWDUVPToolTip.setPrototype();
				_s.vrToolTip_do = new FWDUVPToolTip(_s.vrButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "VR", _s.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.vrToolTip_do.screen);
			}
		};
		
		_s.showToolTip = function(button, toolTip, e){
			if(!_s.showButtonsToolTip_bl) return;
			var ws = FWDUVPUtils.getViewportSize();
			var wc = FWDUVPUtils.getViewportMouseCoordinates(e);
			var localX;
			var localY;
			
			if(button.screen.offsetWidth < 3){
				localX = parseInt(button.getGlobalX() * 100 + button.w/2 - toolTip.w/2);
				localY = parseInt(button.getGlobalY() * 100 - toolTip.h - 8);
			}else{
				localX = parseInt(button.getGlobalX() + button.w/2 - toolTip.w/2);
				localY = parseInt(button.getGlobalY() - toolTip.h - 8);
			}
			
			var offseX = 0;
		
			if(localX < 0){
				offseX = localX;
				localX = 0;
			}else if(localX + toolTip.w > ws.w){
				offseX = (ws.w - (localX + toolTip.w)) * -1;
				localX = localX + (offseX * -1);
			}
			
			toolTip.positionPointer(offseX, false);
			
			toolTip.setX(localX);
			toolTip.setY(localY);
			toolTip.show();
			
		};

		
		//################################################//
		/* Setup main scrubber */
		//################################################//
		_s.setupAdsLines = function(linesAr, id, catId, overwrite){
			if(_s.createdAdsOnce_bl || _s.curLinesId == id && _s.curLinesCat == catId && !overwrite) return;
			
			_s.curLinesId = id;
			_s.curLinesCat = catId;
			
			if(!linesAr) return;
			_s.resetsAdsLines();

			if(!_s.linesHolder_do){
				_s.linesHolder_do = new FWDUVPDisplayObject("div");
				_s.linesHolder_do.setOverflow("visible");
				_s.mainScrubber_do.addChild(_s.linesHolder_do);
			}
			
			_s.createdAdsOnce_bl = true;
			_s.lines_ar = linesAr;
			if(_s.lines_ar){
				var line;
				_s.line_ar = [];
				for(var i=0; i<_s.lines_ar.length; i++){
					line = new FWDUVPDisplayObject("div");
					line.screen.className = 'uvp-ad-line';
					var src = _d.adLinePat_str;
					if(_s.useHEX && window['isWhite']){
						src = _d.sknPth + 'ad-line-dark.png';
					}
					line.getStyle().background = "url('" + src + "') repeat-x";
					line.timeStart = linesAr[i].timeStart;
					line.setWidth(2);
					line.setHeight(_s.mainScrubberDragLeft_img.height);
					line.isUsed_bl = false;
					line.isShowed_bl = false;
					if(_s.lines_ar[i].played_bl) line.setVisible(false);
					line.setAlpha(0);
					_s.line_ar[i] = line;
					_s.linesHolder_do.addChild(line);
				}
			}
			_s.totalDuration = 0;
		};
		
		_s.hideAdsLines = function(){
			if(_s.linesHolder_do) _s.linesHolder_do.setX(-5000);
			if(_s.line_ar){
				for(var i=0; i<_s.line_ar.length; i++){
					_s.line_ar[i].setAlpha(0);
					_s.line_ar[i].isShowed_bl = false;
				}
			}
		}
		
		_s.positionAdsLines = function(totalDuration){
		
			if(!_s.linesHolder_do || !prt.totalDuration || !_s.createdAdsOnce_bl)  return;
		
			_s.totalDuration = prt.totalDuration;
			
			if(prt.isAdd_bl){
				_s.linesHolder_do.setX(-5000);
			}else{
				_s.linesHolder_do.setX(0);
			}
		
			if(_s.line_ar){
				var line;
				for(var i=0; i<_s.line_ar.length; i++){
					line = _s.line_ar[i];
					var x = Math.round((line.timeStart/_s.totalDuration) * _s.maiScrbW) - 1;
					line.setX(x);
					if(line.x < 0) line.setX(0);
					if(!line.isUsed_bl && _s.totalDuration != 0 && !line.isShowed_bl){
						FWDAnimation.to(line, 1, {alpha:1, delay:1, ease:Expo.easeOut});
						line.isShowed_bl = true;
					}
				}
			}
		}
		
		_s.resetsAdsLines = function(){
			if(_s.line_ar){
				for(var i=0; i<_s.line_ar.length; i++){
					FWDAnimation.killTweensOf(_s.line_ar[i]);
					_s.linesHolder_do.removeChild(_s.line_ar[i]);
				}
				_s.createdAdsOnce_bl = false;
				_s.curLinesId = -1;
				_s.line_ar = null;
				_s.hadLInes = false;
			}
		}

		
		//##########################################//
		/* Setup playback rate button */
		//##########################################//
		_s.playbackRatesSource_ar = _d.defaultPlaybackRate_ar;
		_s.playbackRateButtons_ar = [];
		_s.totalPlaybackRateButtons = 6;
		_s.arePlaybackRateButtonsShowed_bl = true;
		if(!_s.showPlaybackRateButton_bl) _s.arePlaybackRateButtonsShowed_bl = false;
		
		_s.setupPlaybackRateButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.playbackRateButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-watch-later'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
				
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.playbackRateButton_do = new FWDUVPSimpleButton(_d.playbackRateNPath_img,
															 _d.playbackRateSPath_str, 
															 undefined, 
															 true,
															 _s.useHEX,
															 _s.nBC,
															 _s.sBC);
			}
			
			_s.playbackRateButton_do.screen.className = 'fwduvp-playback-rate-button';
			_s.playbackRateButton_do.setY(parseInt((_s.sH - _s.playbackRateButton_do.h)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.playbackRateButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.playbackRateButton_do.setY(parseInt((_s.sH - _s.playbackRateButton_do.buttonHeight)/2));
				}
			}, 50);
			_s.playbackRateButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.playbackRateButtonMouseUpHandler);
			_s.mainHld.addChild(_s.playbackRateButton_do);
			_s.playbackRateButton_do.setX(-500);
			
			_s.disablePlaybackRateButton();
			_s.setupPlaybackRateButtons();	
		}
		
		_s.playbackRateButtonMouseUpHandler = function(){
			if(_s.arePlaybackRateButtonsShowed_bl){
				_s.hidePlaybackRateButtons(true);
			}else{
				_s.showPlaybackRateButtons(true);
				_s.hideMainScrubberTop();
			}
		};
		
		_s.disablePlaybackRateButton = function(){
			if(_s.playbackRateButton_do) _s.playbackRateButton_do.disable();
		};
		
		_s.enablePlaybackRateButton = function(){
			if(_s.playbackRateButton_do) _s.playbackRateButton_do.enable();
		};
				
		_s.removePlaybackRateButton = function(){
			if(!_s.playbackRateButton_do) return;
			if(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.playbackRateButton_do) != -1){
				_s.buttons_ar.splice(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.playbackRateButton_do), 1);
				_s.playbackRateButton_do.setX(-300);
				_s.positionButtons();
			}
		};
		
		_s.addPlaybackRateButton = function(rate){
			if(!_s.playbackRateButton_do) return;
			
			if(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.playbackRateButton_do) != -1) return;
			var indexToAdd;

			if(_s.atbButton_do && _s.getButtonIndex(_s.atbButton_do) != -1){
				indexToAdd = _s.getButtonIndex(_s.atbButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.playbackRateButton_do);
			}else if(_s.infoButton_do && _s.getButtonIndex(_s.infoButton_do) != -1){
				indexToAdd = _s.getButtonIndex(_s.infoButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.playbackRateButton_do);
			}else if(_s.downloadButton_do && _s.getButtonIndex(_s.downloadButton_do) != -1){
				indexToAdd = _s.getButtonIndex(_s.downloadButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.playbackRateButton_do);
			}else if(_s.ccBtn_do && _s.getButtonIndex(_s.ccBtn_do) != -1){
				indexToAdd = _s.getButtonIndex(_s.ccBtn_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.playbackRateButton_do);
			}else if(_s.vrButton_do){
				indexToAdd = _s.getButtonIndex(_s.vrButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.playbackRateButton_do);
			}else if(_s.fullScreenButton_do){
				indexToAdd = _s.getButtonIndex(_s.fullScreenButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.playbackRateButton_do);
			}else{
				_s.buttons_ar.splice(_s.buttons_ar.length,0, _s.playbackRateButton_do);
			}
			
			_s.updatePlaybackRateButtons(rate);
		};

		
		//###################################################//
		/* Setup PlaybackRatebuttons */
		//###################################################//
		_s.updatePlaybackRateButtons = function(playbackRateIndex){
			if(!_s.playbackRateButton_do) return;
			setTimeout(function(){
				_s.disablePlaybackRateButtons(playbackRateIndex);
			},65);
			_s.prevplaybackRateIndex = playbackRateIndex;
		};	
		
		_s.setupPlaybackRateButtons = function(){
			
			_s.playbackRatesButtonsHolder_do = new FWDUVPDisplayObject("div");
			_s.playbackRatesButtonsHolder_do.setOverflow("visible");
			
			if(_s.repeatBackground_bl){
				_s.playbackRatesButtonsHolder_do.getStyle().background = "url('" + _s.controllerBkPath_str +  "')";
			}else{
				_s.playbackRatesButtonsBackground_do = new FWDUVPDisplayObject("img");
				var img = new Image();
				img.src = _s.controllerBkPath_str;
				_s.playbackRatesButtonsBackground_do.setScreen(img);
				_s.playbackRatesButtonsHolder_do.addChild(_s.playbackRatesButtonsBackground_do);
			}
			
			_s.playbackRatesButtonsHolder_do.setX(300);
			_s.playbackRatesButtonsHolder_do.setY(-300);
			prt.videoHolder_do.addChild(_s.playbackRatesButtonsHolder_do);
			
			var img = new Image();
			img.src = _s.ytbQualityButtonPointerPath_str;
			_s.playbackRatesPonter_do = new FWDUVPDisplayObject("img");
			_s.playbackRatesPonter_do.setScreen(img);
			_s.playbackRatesPonter_do.setWidth(_s.pointerWidth);
			_s.playbackRatesPonter_do.setHeight(_s.pointerHeight);
			_s.playbackRatesButtonsHolder_do.addChild(_s.playbackRatesPonter_do);
	
			
			var img = new Image();
			img.src = _s.youtubeQualityArrowPath_str;
			_s.playbackRateQualityArrow_do = new FWDUVPDisplayObject("img");
			_s.playbackRateQualityArrow_do.setScreen(img);
			_s.playbackRateQualityArrow_do.setX(7);
			_s.playbackRateQualityArrow_do.setWidth(5);
			_s.playbackRateQualityArrow_do.setHeight(7);
			_s.playbackRatesButtonsHolder_do.addChild(_s.playbackRateQualityArrow_do);
			
			var btn;
			
			for(var i=0; i<_s.totalPlaybackRateButtons; i++){
				FWDUVPYTBQButton.setPrototype();
				btn = new FWDUVPYTBQButton("no source", 
						_s.youtubeQualityButtonNormalColor_str, 
						_s.youtubeQualityButtonSelectedColor_str,
						undefined,
						i);
				
				btn.addListener(FWDUVPYTBQButton.MOUSE_OVER, _s.plbkQualityOver);
				btn.addListener(FWDUVPYTBQButton.MOUSE_OUT, _s.plbkQualityOut);
				btn.addListener(FWDUVPYTBQButton.CLICK, _s.plbkQualityClick);
				_s.playbackRateButtons_ar[i] = btn;
				_s.playbackRatesButtonsHolder_do.addChild(btn);
			}
			_s.positionAndResizePlaybackRateButtons(_s.playbackRatesSource_ar);
			_s.hidePlaybackRateButtons(false);
		};
		
		_s.plbkQualityOver = function(e){
			_s.setPlaybackRateArrowPosition(e.target);
		};
		
		_s.plbkQualityOut = function(e){
			_s.setPlaybackRateArrowPosition(undefined);
		};
		
		_s.plbkQualityClick = function(e){
			_s.startAtPlaybackRate = e.id;
			_s.disablePlaybackRateButtons(_s.startAtPlaybackRate);
			_s.hidePlaybackRateButtons(true);
			_s.dispatchEvent(FWDUVPController.CHANGE_PLAYBACK_RATES, {rate:_s.playbackRatesSource_ar[e.id]});
		};
		
		_s.positionAndResizePlaybackRateButtons = function(ar){
			if(!ar) return;
			
			var totalButtons = ar.length;
			if(_s.prevplaybackRatesQualityButtonsLength == totalButtons) return;
			_s.prevplaybackRatesQualityButtonsLength = totalButtons;
			var btn;
			var startY = 5;
			var totalWidth = 0;
			var totalHeight = 0;
			
			for(var i=0; i<totalButtons; i++){
				btn = _s.playbackRateButtons_ar[i];
				if(ar[i] == 1){
					btn.updateText("normal");
				}else{
					btn.updateText(ar[i]);
				}
				
				btn.setFinalSize();
			}
			
			setTimeout(function(){
				for(var i=0; i<totalButtons; i++){
					btn = _s.playbackRateButtons_ar[i];
					if(i < totalButtons){
						if(btn.x != 0) btn.setX(0);
						if(btn.w > totalWidth) totalWidth = btn.w;
						btn.setY(startY);
						startY += btn.h;
					}else{
						if(btn.x != -3000) btn.setX(-3000);
					}
				}
				
				for(var i=0; i<totalButtons; i++){
					btn = _s.playbackRateButtons_ar[i];
					if(btn.dumy_do.w < totalWidth){
						btn.setWidth(totalWidth);
						btn.dumy_do.setWidth(totalWidth);
					}
				}
				
				totalHeight = startY + 5;
				_s.playbackRatesPonter_do.setX(parseInt((totalWidth - _s.playbackRatesPonter_do.w)/2));
				_s.playbackRatesPonter_do.setY(totalHeight);
				if(_s.playbackRatesButtonsBackground_do){	
					_s.playbackRatesButtonsBackground_do.setWidth(totalWidth);
					_s.playbackRatesButtonsBackground_do.setHeight(totalHeight);
				}
				_s.playbackRatesButtonsHolder_do.setWidth(totalWidth);
				_s.playbackRatesButtonsHolder_do.setHeight(totalHeight);
			}, 60);
		};
		
		_s.disablePlaybackRateButtons = function(index){
			if(index == undefined) return;
			for(var i=0; i<_s.totalPlaybackRateButtons; i++){
				var btn = _s.playbackRateButtons_ar[i];
				if(i == index){
					FWDAnimation.killTweensOf(_s.playbackRateQualityArrow_do);
					_s.playbackRateQualityArrow_do.setY(btn.y + parseInt((btn.h - _s.playbackRateQualityArrow_do.h)/2) - 1);
					btn.disable();
					_s.playbackRateDisabledButton_do = btn;
				}else{
					btn.enable();
				}
			}
		};
		
		_s.setPlaybackRateArrowPosition = function(target){
			var curY = 0;
			if(!target){
				curY = _s.playbackRateDisabledButton_do.y + parseInt((_s.playbackRateDisabledButton_do.h - _s.playbackRateQualityArrow_do.h)/2 - 1);
			}else{
				curY = target.y + parseInt((target.h - _s.playbackRateQualityArrow_do.h)/2 - 1);
			}
			FWDAnimation.killTweensOf(_s.playbackRateQualityArrow_do);
			FWDAnimation.to(_s.playbackRateQualityArrow_do, .6, {y:curY, delay:.1, ease:Expo.easeInOut});
		};
		
		_s.showPlaybackRateButtons = function(animate){
			if(_s.arePlaybackRateButtonsShowed_bl) return;
			_s.hideQualityButtons();
			_s.arePlaybackRateButtonsShowed_bl = true;
			var finalX = parseInt(_s.playbackRateButton_do.x + (parseInt(_s.playbackRateButton_do.w - _s.playbackRatesButtonsHolder_do.w)/2));
			var finalY = parseInt(prt.tempVidStageHeight - _s.sH - _s.playbackRatesButtonsHolder_do.h - 6);
			
			if(_s.hasPointerEvent_bl){
				window.addEventListener("pointerdown", _s.hideplaybackRatesButtonsHandler);
			}else{
				if(!_s.isMbl){
					window.addEventListener("mousedown", _s.hideplaybackRatesButtonsHandler);
				}
				window.addEventListener("touchstart", _s.hideplaybackRatesButtonsHandler);
			}
			
			_s.playbackRatesButtonsHolder_do.setX(finalX);
		
			if(animate){
				FWDAnimation.to(_s.playbackRatesButtonsHolder_do, .6, {y:finalY, ease:Expo.easeInOut});
			}else{
				FWDAnimation.killTweensOf(_s.playbackRatesButtonsHolder_do);
				_s.playbackRatesButtonsHolder_do.setY(finalY);
			}
		};
	
		_s.hidePlaybackRateButtons = function(animate){
			if(!_s.arePlaybackRateButtonsShowed_bl || !_s.playbackRatesButtonsHolder_do) return;
			_s.arePlaybackRateButtonsShowed_bl = false;
			_s.showMainScrubberOnTop();
			
			if(animate){
				FWDAnimation.to(_s.playbackRatesButtonsHolder_do, .6, {y:prt.sH, ease:Expo.easeInOut});
			}else{
				FWDAnimation.killTweensOf(_s.playbackRatesButtonsHolder_do);
				_s.playbackRatesButtonsHolder_do.setY(prt.sH);
			}
			
			if(_s.hasPointerEvent_bl){
				window.removeEventListener("pointerdown", _s.hideplaybackRatesButtonsHandler);
			}else{
				if(!_s.isMbl){
					window.removeEventListener("mousedown", _s.hideplaybackRatesButtonsHandler);
				}
				window.removeEventListener("touchstart", _s.hideplaybackRatesButtonsHandler);
			}
		};
		
		_s.hideplaybackRatesButtonsHandler = function(e){
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			if(FWDUVPUtils.hitTest(_s.playbackRateButton_do.screen, vc.screenX, vc.screenY)
			   || FWDUVPUtils.hitTest(_s.playbackRatesButtonsHolder_do.screen, vc.screenX, vc.screenY)){
				return;
			}
			_s.hidePlaybackRateButtons(true);
		};

		
		//###############################################//
		/* Set is live */
		//###############################################//
		_s.setIsLive = function(isLive){
			_s.isLive = isLive;
			if(isLive){
				if(!_s.mainScrubber_do.contains(_s.live_do)){
					_s.mainScrubber_do.setAlpha(.2);
					_s.mainHld.addChild(_s.live_do);
					setTimeout(function(){
							_s.live_do.setX(4);
							_s.live_do.setY(- _s.live_do.getHeight() - 4);
					}, 100)
					_s.disableMainScrubber();
				}
			}else{
				if(_s.mainHld.contains(_s.live_do)){
					_s.mainHld.removeChild(_s.live_do);
					_s.mainScrubber_do.setAlpha(1);
					
					_s.enableMainScrubber();
				}
			}
		}
		
		//################################################//
		/* Setup main scrubber */
		//################################################//
		_s.setupMainScrubber = function(){
			//setup background bar
			_s.mainScrubber_do = new FWDUVPDisplayObject("div");
			_s.mainScrubber_do.screen.className = 'fwduvp-main-scrubber';
			_s.mainScrubber_do.setY(parseInt((_s.sH - _s.mainScrbH)/2));
			_s.mainScrubber_do.setHeight(_s.mainScrbH);
			
			_s.mainScrubberBkLeft_do = new FWDUVPDisplayObject("img");
			_s.mainScrubberBkLeft_do.setScreen(_s.mainScrubberBkLeft_img);
			
			var rightImage = new Image();
			rightImage.src = _d.mainScrubberBkRightPath_str;
			_s.mainScrubberBkRight_do = new FWDUVPDisplayObject("img");
			_s.mainScrubberBkRight_do.setScreen(rightImage);
			_s.mainScrubberBkRight_do.setWidth(_s.mainScrubberBkLeft_do.w);
			_s.mainScrubberBkRight_do.setHeight(_s.mainScrubberBkLeft_do.h);
		
			var middleImage = new Image();
			middleImage.src = _s.mainScrubberBkMiddlePath_str;
			
			_s.mainScrubberBkMiddle_do = new FWDUVPDisplayObject("div");	
			_s.mainScrubberBkMiddle_do.getStyle().background = "url('" + _s.mainScrubberBkMiddlePath_str + "') repeat-x";
				
			_s.mainScrubberBkMiddle_do.setHeight(_s.mainScrbH);
			_s.mainScrubberBkMiddle_do.setX(_s.scrbsBkLARW);
			
			//setup progress bar
			_s.mainProgress_do = new FWDUVPDisplayObject("div");
			_s.mainProgress_do.setHeight(_s.mainScrbH);
		
			_s.progressLeft_do = new FWDUVPDisplayObject("img");
			_s.progressLeft_do.setScreen(_s.progress);
			
			middleImage = new Image();
			middleImage.src = _s.progressMiddlePath_str;
			
			_s.progressMiddle_do = new FWDUVPDisplayObject("div");	
			_s.progressMiddle_do.getStyle().background = "url('" + _s.progressMiddlePath_str + "') repeat-x";
		
			_s.progressMiddle_do.setHeight(_s.mainScrbH);
			_s.progressMiddle_do.setX(_s.mainScrbDrgLW);
			
			//setup darg bar.
			_s.mainScrubberDrag_do = new FWDUVPDisplayObject("div");
			_s.mainScrubberDrag_do.setHeight(_s.mainScrbH);
		
			if(_s.useHEX){
				_s.mainScrubberDragLeft_do = new FWDUVPDisplayObject("div");
				_s.mainScrubberDragLeft_do.setWidth(_s.mainScrubberDragLeft_img.width);
				_s.mainScrubberDragLeft_do.setHeight(_s.mainScrubberDragLeft_img.height);
				_s.mainScrubberDragLeft_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.mainScrubberDragLeft_img, _s.nBC).canvas;
				_s.mainScrubberDragLeft_do.screen.appendChild(_s.mainScrubberDragLeft_canvas);	
			}else{
				_s.mainScrubberDragLeft_do = new FWDUVPDisplayObject("img");
				_s.mainScrubberDragLeft_do.setScreen(_s.mainScrubberDragLeft_img);
			}
			
			_s.mainScrubberMiddleImage = new Image();
			_s.mainScrubberMiddleImage.src = _s.mainScrubberDragMiddlePath_str;
			_s.volumeScrubberDragMiddle_do = new FWDUVPDisplayObject("div");
			
			if(_s.useHEX){
				_s.mainScrubberDragMiddle_do = new FWDUVPDisplayObject("div");
				_s.mainScrubberMiddleImage.onload = function(){
					var testCanvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.mainScrubberMiddleImage, _s.nBC, true);
					_s.mainSCrubberMiddleCanvas = testCanvas.canvas;
					_s.mainSCrubberDragMiddleImageBackground = testCanvas.image;
					_s.mainScrubberDragMiddle_do.getStyle().background = "url('" + _s.mainSCrubberDragMiddleImageBackground.src + "') repeat-x";
				}
			}else{
				_s.mainScrubberDragMiddle_do = new FWDUVPDisplayObject("div");	
				_s.mainScrubberDragMiddle_do.getStyle().background = "url('" + _s.mainScrubberDragMiddlePath_str + "') repeat-x";
			}
			
			_s.mainScrubberDragMiddle_do.setHeight(_s.mainScrbH);
			_s.mainScrubberDragMiddle_do.setX(_s.mainScrbDrgLW);
			
			_s.mainScrubberBarLine_do = new FWDUVPDisplayObject("img");
			_s.mainScrubberBarLine_do.setScreen(_s.mainScrubberLine_img);
			_s.mainScrubberBarLine_do.setAlpha(0);
			_s.mainScrubberBarLine_do.hasTransform3d_bl = false;
			_s.mainScrubberBarLine_do.hasTransform2d_bl = false;
			
			_s.buttons_ar.push(_s.mainScrubber_do);
			
			_s.live_do = new FWDUVPDisplayObject("div");
			_s.live_do.hasTransform3d_bl = false;
			_s.live_do.hasTransform2d_bl = false;
			_s.live_do.setBackfaceVisibility();
			_s.live_do.getStyle().fontFamily = "Arial";
			_s.live_do.getStyle().fontSize= "12px";
			_s.live_do.getStyle().whiteSpace= "nowrap";
			_s.live_do.getStyle().textAlign = "center";
			_s.live_do.getStyle().padding = "4px";
			_s.live_do.getStyle().paddingLeft = "6px";
			_s.live_do.getStyle().paddingRIght = "6px";
			_s.live_do.getStyle().color = "#FFFFFF";
			_s.live_do.getStyle().fontSmoothing = "antialiased";
			_s.live_do.getStyle().webkitFontSmoothing = "antialiased";
			_s.live_do.getStyle().textRendering = "optimizeLegibility";
			_s.live_do.getStyle().backgroundColor = "rgba(255,0,0,0.8)";
			_s.live_do.setInnerHTML("&#x25C9; LIVE");
			
			//add all children
			_s.mainScrubber_do.addChild(_s.mainScrubberBkLeft_do);
			_s.mainScrubber_do.addChild(_s.mainScrubberBkMiddle_do);
			_s.mainScrubber_do.addChild(_s.mainScrubberBkRight_do);
			_s.mainScrubber_do.addChild(_s.mainScrubberBarLine_do);
			_s.mainScrubberDrag_do.addChild(_s.mainScrubberDragLeft_do);
			_s.mainScrubberDrag_do.addChild(_s.mainScrubberDragMiddle_do);
			_s.mainProgress_do.addChild(_s.progressLeft_do);
			_s.mainProgress_do.addChild(_s.progressMiddle_do);
			_s.mainScrubber_do.addChild(_s.mainProgress_do);
			_s.mainScrubber_do.addChild(_s.mainScrubberDrag_do);
			_s.mainScrubber_do.addChild(_s.mainScrubberBarLine_do);
			_s.mainHld.addChild(_s.mainScrubber_do);
			
			if(!_s.disableVideoScrubber_bl){
				if(_s.hasPointerEvent_bl){
					_s.mainScrubber_do.screen.addEventListener("pointerover", _s.mainScrubberOnOverHandler);
					_s.mainScrubber_do.screen.addEventListener("pointerout", _s.mainScrubberOnOutHandler);
					_s.mainScrubber_do.screen.addEventListener("pointerdown", _s.mainScrubberOnDownHandler);
				}else if(_s.screen.addEventListener){	
					if(!_s.isMbl){
						_s.mainScrubber_do.screen.addEventListener("mouseover", _s.mainScrubberOnOverHandler);
						_s.mainScrubber_do.screen.addEventListener("mousemove", _s.updateTooltipOnMove);
						_s.mainScrubber_do.screen.addEventListener("mouseout", _s.mainScrubberOnOutHandler);
						_s.mainScrubber_do.screen.addEventListener("mousedown", _s.mainScrubberOnDownHandler);
					}
					_s.mainScrubber_do.screen.addEventListener("touchstart", _s.mainScrubberOnDownHandler);
				}
			}
			
			_s.disableMainScrubber();
			_s.updateMainScrubber(0);

			FWDUVPScrubberToolip.setPrototype();
			_s.ttm = new FWDUVPScrubberToolip(_s.mainScrubber_do, _d.scrubbersToolTipLabelBackgroundColor, _d.scrubbersToolTipLabelFontColor);
			_s.addChild(_s.ttm);
		};

		_s.updateToolTip = function(localX, percentScrubbed){
			if(!_d.showMainScrubberToolTipLabel_bl) return;
			if(prt.isCasting){
				_s.ttm.setLabel(FWDUVPUtils.formatTime(Math.round(prt.cc.getDuration() * percentScrubbed)));
			}else{
				_s.ttm.setLabel(FWDUVPUtils.formatTime(Math.round(prt.totalDuration * percentScrubbed)));
			}
			_s.ttm.setX(Math.round(_s.mainScrubber_do.x + localX - _s.ttm.getWidth()/2) + 1);
			 
			_s.ttm.setY(_s.mainScrubber_do.y - _s.ttm.h - 2);
		}
		
		_s.updateThumbnailsPreview = function(localX, percentScrubbed){
			if(!_s.thumbnailsPreview_do || !prt.hasThumbnailsPreview) return;
			var pointerOffsetX = 0;
			
			var x = Math.round(_s.mainScrubber_do.x + localX - _s.thumbnailsPreview_do.getWidth()/2) + 1;
			if(x < 1){
				pointerOffsetX = x;
				x = 1;
			}else if(x > _s.sW - _s.thumbnailsPreview_do.w - 1){
				pointerOffsetX = x - _s.sW + _s.thumbnailsPreview_do.w;
				x = _s.sW - _s.thumbnailsPreview_do.w - 1;
			}
			_s.thumbnailsPreview_do.setLabel(FWDUVPUtils.formatTime(Math.round(prt.totalDuration * percentScrubbed)), Math.round(prt.totalDuration * percentScrubbed), pointerOffsetX);
			_s.thumbnailsPreview_do.setX(x);
			_s.thumbnailsPreview_do.setY(_s.mainScrubber_do.y - _s.thumbnailsPreview_do.h - 2);
		}

		_s.updateTooltipOnMove = function(e){
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			var localX = vc.screenX - _s.mainScrubber_do.getGlobalX();
			
			if(localX < 0){
				localX = 0;
			}else if(localX > _s.maiScrbW - _s.scrubbersOffsetWidth){
				localX = _s.maiScrbW - _s.scrubbersOffsetWidth;
			}
			var percentScrubbed = localX/_s.maiScrbW;

			_s.updateToolTip(localX, percentScrubbed);
			_s.updateThumbnailsPreview(localX, percentScrubbed);
		}

		_s.mainScrubberWMouseMove = function(e){
			var wc = FWDUVPUtils.getViewportMouseCoordinates(e);
			_s.vcX = wc.screenX;
			_s.vcY = wc.screenY;
			if(!FWDUVPUtils.hitTest(_s.mainScrubber_do.screen, _s.vcX, _s.vcY)){
				if(!_s.isMainScrubberScrubbing_bl){
					window.removeEventListener('mousemove', _s.mainScrubberWMouseMove);
					_s.ttm.hide();
				} 
			}
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			var localX = vc.screenX - _s.mainScrubber_do.getGlobalX();
			
			if(localX < 0){
				localX = 0;
			}else if(localX > _s.maiScrbW - _s.scrubbersOffsetWidth){
				localX = _s.maiScrbW - _s.scrubbersOffsetWidth;
			}
			var percentScrubbed = localX/_s.maiScrbW;
			_s.updateThumbnailsPreview(localX, percentScrubbed);
		}
		
		_s.mainScrubberOnOverHandler =  function(e){
			if(_s.isMainScrubberDisabled_bl) return;
			if(_d.showMainScrubberToolTipLabel_bl && !prt.hasThumbnailsPreview) _s.ttm.show();
			if(_s.thumbnailsPreview_do && prt.hasThumbnailsPreview) _s.thumbnailsPreview_do.show();
		
			if(!_s.isMbl && (_s.ttm || _s.thumbnailsPreview_do)){
				window.removeEventListener('mousemove', _s.mainScrubberWMouseMove);
				window.addEventListener('mousemove', _s.mainScrubberWMouseMove);
			}
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			var localX = vc.screenX - _s.mainScrubber_do.getGlobalX();
		
			if(localX < 0){
				localX = 0;
			}else if(localX > _s.maiScrbW - _s.scrubbersOffsetWidth){
				localX = _s.maiScrbW - _s.scrubbersOffsetWidth;
			}
			var percentScrubbed = localX/_s.maiScrbW;

			_s.updateToolTip(localX, percentScrubbed);
			_s.updateThumbnailsPreview(localX, percentScrubbed);
		};
		
		_s.mainScrubberOnOutHandler =  function(e){
			if(!_s.isMainScrubberScrubbing_bl){
				if(_s.ttm) _s.ttm.hide();
				if(_s.thumbnailsPreview_do && prt.hasThumbnailsPreview) _s.thumbnailsPreview_do.hide();
			}
		};
		
		_s.mainScrubberOnDownHandler =  function(e){
			if(_s.isMainScrubberDisabled_bl || e.button == 2) return;
			
			prt.showDisable();
			if(e.preventDefault) e.preventDefault();
			_s.isMainScrubberScrubbing_bl = true;
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			var localX = vc.screenX - _s.mainScrubber_do.getGlobalX();
			
			if(localX < 0){
				localX = 0;
			}else if(localX > _s.maiScrbW - _s.scrubbersOffsetWidth){
				localX = _s.maiScrbW - _s.scrubbersOffsetWidth;
			}
			var percentScrubbed = localX/_s.maiScrbW;
		
			if(_d.showMainScrubberToolTipLabel_bl && !prt.hasThumbnailsPreview) _s.ttm.show();
			if(_s.thumbnailsPreview_do && prt.hasThumbnailsPreview) _s.thumbnailsPreview_do.show();
			_s.updateToolTip(localX, percentScrubbed);
			_s.updateMainScrubber(percentScrubbed);
			_s.updateThumbnailsPreview(localX, percentScrubbed);
			
			_s.dispatchEvent(FWDUVPController.START_TO_SCRUB);
			_s.dispatchEvent(FWDUVPController.SCRUB, {percent:percentScrubbed});
			
			if(_s.hasPointerEvent_bl){
				window.addEventListener("pointermove", _s.mainScrubberMoveHandler);
				window.addEventListener("pointerup", _s.mainScrubberEndHandler);
			}else{
				window.addEventListener("mousemove", _s.mainScrubberMoveHandler);
				window.addEventListener("mouseup", _s.mainScrubberEndHandler);		
				window.addEventListener("touchmove", _s.mainScrubberMoveHandler, {passive:false});
				window.addEventListener("touchend", _s.mainScrubberEndHandler);
			}	
		};
		
		_s.mainScrubberMoveHandler = function(e){
			if(e.preventDefault) e.preventDefault();
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			var localX = vc.screenX - _s.mainScrubber_do.getGlobalX();
			
			if(localX < 0){
				localX = 0;
			}else if(localX > _s.maiScrbW - _s.scrubbersOffsetWidth){
				localX = _s.maiScrbW - _s.scrubbersOffsetWidth;
			}
			
			var percentScrubbed = localX/_s.maiScrbW;
			_s.updateToolTip(localX, percentScrubbed);
			_s.updateMainScrubber(percentScrubbed);
			_s.updateThumbnailsPreview(localX, percentScrubbed);
			_s.dispatchEvent(FWDUVPController.SCRUB, {percent:percentScrubbed});
		};
		
		_s.mainScrubberEndHandler = function(e){
			prt.hideDisable();			
			if(e){
				var wp = FWDUVPUtils.getViewportMouseCoordinates(e);
				if(!FWDUVPUtils.hitTest(_s.mainScrubber_do.screen, wp.screenX, wp.screenY)){
					if(_s.ttm) _s.ttm.hide();
					if(_s.thumbnailsPreview_do && prt.hasThumbnailsPreview) _s.thumbnailsPreview_do.hide();
				}
			}
	
			_s.isMainScrubberScrubbing_bl = false;
			_s.dispatchEvent(FWDUVPController.STOP_TO_SCRUB);
			
			if(_s.hasPointerEvent_bl){
				window.removeEventListener("pointermove", _s.mainScrubberMoveHandler);
				window.removeEventListener("pointerup", _s.mainScrubberEndHandler);
			}else{
				window.removeEventListener("mousemove", _s.mainScrubberMoveHandler);
				window.removeEventListener("mouseup", _s.mainScrubberEndHandler);		
				window.removeEventListener("touchmove", _s.mainScrubberMoveHandler);
				window.removeEventListener("touchend", _s.mainScrubberEndHandler);
			}
		};
		
		_s.disableMainScrubber = function(){
			if(!_s.mainScrubber_do) return;
			_s.isMainScrubberDisabled_bl = true;
			_s.mainScrubber_do.setButtonMode(false);
			_s.mainScrubberEndHandler();
			_s.mainScrubberOnOutHandler();
			_s.updateMainScrubber(0);
			_s.updatePreloaderBar(0);
		};
		
		_s.enableMainScrubber = function(){
			if(!_s.mainScrubber_do || _s.isLive) return;
			_s.isMainScrubberDisabled_bl = false;
			if(!_s.disableVideoScrubber_bl) _s.mainScrubber_do.setButtonMode(true);
		};
		
		_s.updateMainScrubber = function(percent){
			if(!_s.mainScrubber_do) return;
			if(_s.isLive) percent = 0;
			var finalWidth = parseInt(percent * _s.maiScrbW);
			if(isNaN(finalWidth) || finalWidth == undefined) return;
			if(finalWidth < 0) finalWidth = 0;
			
			_s.percentPlayed = percent;
			if(!FWDUVPlayer.hasHTML5Video && finalWidth >= _s.mainProgress_do.w) finalWidth = _s.mainProgress_do.w;
			
			if(finalWidth < 1 && _s.isMainScrubberLineVisible_bl){
				_s.isMainScrubberLineVisible_bl = false;
				FWDAnimation.to(_s.mainScrubberBarLine_do, .5, {alpha:0});
			}else if(finalWidth > 1 && !_s.isMainScrubberLineVisible_bl){
				_s.isMainScrubberLineVisible_bl = true;
				FWDAnimation.to(_s.mainScrubberBarLine_do, .5, {alpha:1});
			}
			
			_s.mainScrubberDrag_do.setWidth(finalWidth);
			if(finalWidth > _s.maiScrbW - _s.scrubbersOffsetWidth) finalWidth = _s.maiScrbW - _s.scrubbersOffsetWidth;
			if(finalWidth < 0) finalWidth = 0;
			FWDAnimation.to(_s.mainScrubberBarLine_do, .8, {x:finalWidth + 1, ease:Expo.easeOut});
		};
		
		_s.updatePreloaderBar = function(percent){
			if(!_s.mainProgress_do) return;
			if(_s.isLive) percent = 0;
			_s.percentLoaded = percent;
			var finalWidth = parseInt(_s.percentLoaded * _s.maiScrbW); 
			if(isNaN(finalWidth) || finalWidth == undefined) return;
			if(finalWidth < 0) finalWidth = 0;
			
			if(_s.percentLoaded >= 0.98){
				_s.percentLoaded = 1;
				_s.mainProgress_do.setY(-30);
			}else if(_s.mainProgress_do.y != 0 && _s.percentLoaded!= 1){
				_s.mainProgress_do.setY(0);
			}
			if(finalWidth > _s.maiScrbW - _s.scrubbersOffsetWidth) finalWidth = _s.maiScrbW - _s.scrubbersOffsetWidth;
			if(finalWidth < 0) finalWidth = 0;
			_s.mainProgress_do.setWidth(finalWidth);
		};
		

		//################################################//
		/* Setup prev button */
		//################################################//
		_s.setupPrevButton = function(){
			
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.prevButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-FF-left'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.prevButton_do = new FWDUVPSimpleButton(_d.prev2N_img, _d.prevSPath_str, undefined, true, _s.useHEX,
						_s.nBC,
						_s.sBC);
			}
			
			_s.prevButton_do.screen.className = 'fwduvp-prev-button';
			_s.prevButton_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.prevButtonShowTooltipHandler);
			_s.prevButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.prevButtonOnMouseUpHandler);
			_s.prevButton_do.setY(parseInt((_s.sH - _s.prevButton_do.h)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.prevButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.prevButton_do.setY(parseInt((_s.sH - _s.prevButton_do.buttonHeight)/2));
				}
			}, 50);
		
			_s.buttons_ar.push(_s.prevButton_do);
			_s.mainHld.addChild(_s.prevButton_do); 
		};
		
		_s.prevButtonShowTooltipHandler = function(e){
			
			_s.showToolTip(_s.prevButton_do, _s.prevButtonToolTip_do, e.e);
		};
		
		_s.prevButtonOnMouseUpHandler = function(){
			_s.dispatchEvent(FWDUVPPlaylist.PLAY_PREV_VIDEO);
		};

		
		//################################################//
		/* Setup next button */
		//################################################//
		_s.setupNextButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.nextButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-FF-right'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.nextButton_do = new FWDUVPSimpleButton(_d.next2N_img, _d.nextSPath_str, undefined, true, _s.useHEX,
						_s.nBC,
						_s.sBC);
			}

			_s.nextButton_do.screen.className = 'fwduvp-next-button';
			_s.nextButton_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.nextButtonShowTooltipHandler);
			_s.nextButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.nextButtonOnMouseUpHandler);
			_s.nextButton_do.setY(parseInt((_s.sH - _s.nextButton_do.h)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.nextButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.nextButton_do.setY(parseInt((_s.sH - _s.nextButton_do.buttonHeight)/2));
				}
			}, 50);
			_s.buttons_ar.push(_s.nextButton_do);
			_s.mainHld.addChild(_s.nextButton_do);
		};
		
		_s.nextButtonShowTooltipHandler = function(e){
			_s.showToolTip(_s.nextButton_do, _s.nextButtonToolTip_do, e.e);
		};
		
		_s.nextButtonOnMouseUpHandler = function(){
			_s.dispatchEvent(FWDUVPPlaylist.PLAY_NEXT_VIDEO);
		};

	
		//################################################//
		/* Setup play button */
		//################################################//
		_s.setupPlayPauseButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPComplexButton.setPrototype();
				_s.playPauseButton_do = new FWDUVPComplexButton(undefined, undefined, undefined, undefined, true, undefined, undefined, undefined,
					"<span class='fwdicon fwdicon-play'></span>",
					"<span class='fwdicon fwdicon-pause'></span>",
					"UVPMainButtonsNormalState play",
					"UVPMainButtonsSelectedState play"
				);
			}else{
				FWDUVPComplexButton.setPrototype();
				_s.playPauseButton_do = new FWDUVPComplexButton(
						_s.playN_img,
						_d.playSPath_str,
						_s.pauseN_img,
						_d.pauseSPath_str,
						true,
						_s.useHEX,
						_s.nBC,
						_s.sBC
				);
			}
			
			_s.buttons_ar.push(_s.playPauseButton_do);
			_s.playPauseButton_do.setY(parseInt((_s.sH - _s.playPauseButton_do.buttonHeight)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.playPauseButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.playPauseButton_do.setY(parseInt((_s.sH - _s.playPauseButton_do.buttonHeight)/2));
				}
			}, 50);

			_s.playPauseButton_do.screen.className = 'fwduvp-play-button';
			_s.playPauseButton_do.addListener(FWDUVPComplexButton.SHOW_TOOLTIP, _s.playButtonShowTooltipHandler);
			_s.playPauseButton_do.addListener(FWDUVPComplexButton.MOUSE_UP, _s.playButtonMouseUpHandler);
			_s.mainHld.addChild(_s.playPauseButton_do);
		};
		
		
		_s.playButtonShowTooltipHandler = function(e){
			_s.showToolTip(_s.playPauseButton_do, _s.playPauseToolTip_do, e.e);
		};
		
		_s.showPlayButton = function(){
			if(!_s.playPauseButton_do) return;
			_s.playPauseButton_do.setButtonState(1);
		};
		
		_s.showPauseButton = function(){
			if(!_s.playPauseButton_do) return;
			_s.playPauseButton_do.setButtonState(0);
		};
		
		_s.playButtonMouseUpHandler = function(){
			if(_s.playPauseButton_do.currentState == 0){
				_s.dispatchEvent(FWDUVPController.PAUSE);
			}else{
				_s.dispatchEvent(FWDUVPController.PLAY);
			}
		};
		
		_s.disablePlayButton = function(){
			_s.playPauseButton_do.disable();
			_s.playPauseButton_do.setNormalState();
			_s.showPlayButton();
		};
		
		_s.enablePlayButton = function(){
			_s.playPauseButton_do.enable();
		};
		

		//##########################################//
		/* Setup categories buttons */
		//##########################################//
		_s.setupCategoriesButton = function(){
			if(_s.useVectorIcons_bl){				
				FWDUVPSimpleButton.setPrototype();
				_s.categoriesButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-playlist'></span>",
						undefined,
						"UVPMainButtonsNormalState cats",
						"UVPMainButtonsSelectedState cats"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.categoriesButton_do = new FWDUVPSimpleButton(_s.categoriesN_img, _d.categoriesSPath_str, undefined, true, _s.useHEX,
						_s.nBC,
						_s.sBC);
			}

			_s.categoriesButton_do.screen.className = 'fwduvp-categories-button';
			_s.categoriesButton_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.categoriesButtonShowTooltipHandler);
			_s.categoriesButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.categoriesButtonOnMouseUpHandler);
			_s.categoriesButton_do.setY(parseInt((_s.sH - _s.categoriesButton_do.h)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.categoriesButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.categoriesButton_do.setY(parseInt((_s.sH - _s.categoriesButton_do.buttonHeight)/2));
				}
			}, 50);
			_s.buttons_ar.push(_s.categoriesButton_do);
			_s.mainHld.addChild(_s.categoriesButton_do); 
		};
		
		_s.categoriesButtonShowTooltipHandler = function(e){
			_s.showToolTip(_s.categoriesButton_do, _s.playlistsButtonToolTip_do, e.e);
		};
		
		_s.categoriesButtonOnMouseUpHandler = function(){
			_s.dispatchEvent(FWDUVPController.SHOW_CATEGORIES);
		};
		
		_s.setCategoriesButtonState = function(state){	
			if(!_s.categoriesButton_do) return;
			if(state == "selected"){
				_s.categoriesButton_do.setSelected();
			}else if(state == "unselected"){
				_s.categoriesButton_do.setUnselected();
			}
		};
		

		//##########################################//
		/* Setup playlist button */
		//##########################################//
		_s.setupPlaylistButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPComplexButton.setPrototype();
				_s.playlistButton_do = new FWDUVPComplexButton(undefined, undefined, undefined, undefined, true, undefined, undefined, undefined,
					"<span class='fwdicon fwdicon-playlist-sidebar'></span>",
					"<span class='fwdicon fwdicon-playlist-close-sidebar'></span>",
					"UVPMainButtonsNormalState playlist",
					"UVPMainButtonsSelectedState playlist"
				);
			}else{
				FWDUVPComplexButton.setPrototype();
				_s.playlistButton_do = new FWDUVPComplexButton(
						_s.hidePlaylistN_img,
						_d.hidePlaylistSPath_str,
						_s.showPlaylistN_img,
						_d.showPlaylistSPath_str,
						true,
						_s.useHEX,
						_s.nBC,
						_s.sBC
				);
			}
			
			_s.buttons_ar.push(_s.playlistButton_do);
			_s.playlistButton_do.setY(parseInt((_s.sH - _s.playlistButton_do.buttonHeight)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.playlistButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.playlistButton_do.setY(parseInt((_s.sH - _s.playlistButton_do.buttonHeight)/2));
				}
			}, 50);

			_s.playlistButton_do.screen.className = 'fwduvp-playlist-button';
			_s.playlistButton_do.addListener(FWDUVPComplexButton.SHOW_TOOLTIP, _s.playlistButtonShowToolTipHandler);
			_s.playlistButton_do.addListener(FWDUVPComplexButton.MOUSE_UP, _s.playlistButtonMouseUpHandler);
			if(!_s.showPlaylistByDefault_bl) _s.playlistButton_do.setButtonState(0);
			_s.mainHld.addChild(_s.playlistButton_do);
			
		};
		
		_s.playlistButtonShowToolTipHandler = function(e){
			_s.showToolTip(_s.playlistButton_do, _s.playlistButtonToolTip_do, e.e);
		};
		
		_s.showShowPlaylistButton = function(){
			if(!_s.playlistButton_do) return;
			_s.playlistButton_do.setButtonState(1);
		};
		
		_s.showHidePlaylistButton = function(){
			if(!_s.playlistButton_do) return;
			_s.playlistButton_do.setButtonState(0);
		};
		
		_s.playlistButtonMouseUpHandler = function(){
			if(_s.playlistButton_do.currentState == 1){
				_s.dispatchEvent(FWDUVPController.SHOW_PLAYLIST);
			}else{
				_s.dispatchEvent(FWDUVPController.HIDE_PLAYLIST);
			}
			_s.playlistButton_do.setNormalState(true);
			if(_s.playlistButtonToolTip_do) _s.playlistButtonToolTip_do.hide();
		};
		
		_s.disablePlaylistButton = function(){
			if(_s.playlistButton_do){
				_s.playlistButton_do.disable();
				_s.playlistButton_do.setAlpha(.4);
			}
		};
		
		_s.enablePlaylistButton = function(){
			if(_s.playlistButton_do){
				_s.playlistButton_do.enable();
				_s.playlistButton_do.setAlpha(1);
			}
		};
		

		//##########################################//
		/* Setup embed button */
		//#########################################//
		_s.setupEmbedButton = function(){
			if(_s.useVectorIcons_bl){			
				FWDUVPSimpleButton.setPrototype();
				_s.embedButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-embed'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.embedButton_do = new FWDUVPSimpleButton(_s.embedN_img, _d.embedPathS_str, undefined, true, _s.useHEX,
						_s.nBC,
						_s.sBC);
			}

			_s.embedButton_do.screen.className = 'fwduvp-embed-button';
			_s.embedButton_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.embedButtonShowToolTipHandler);
			_s.embedButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.embedButtonOnMouseUpHandler);
			_s.embedButton_do.setY(parseInt((_s.sH - _s.embedButton_do.h)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.embedButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.embedButton_do.setY(parseInt((_s.sH - _s.embedButton_do.buttonHeight)/2));
				}
			}, 50);
			_s.buttons_ar.push(_s.embedButton_do);
			_s.mainHld.addChild(_s.embedButton_do);
		};
		
		_s.embedButtonShowToolTipHandler = function(e){
			_s.showToolTip(_s.embedButton_do, _s.embedButtonToolTip_do, e.e);
		};
		
		_s.embedButtonOnMouseUpHandler = function(){
			_s.dispatchEvent(FWDUVPController.SHOW_EMBED_WINDOW);
			if(_s.embedButtonToolTip_do) _s.embedButtonToolTip_do.hide();
		};

		
		//###################################################//
		/* Setup youtube quality buttons */
		//###################################################//
		_s.setupYtbButtons = function(){
			_s.ytbButtonsHolder_do = new FWDUVPDisplayObject("div");
			_s.ytbButtonsHolder_do.setOverflow("visible");
			if(_s.repeatBackground_bl){
				_s.ytbButtonsHolder_do.getStyle().background = "url('" + _s.controllerBkPath_str +  "')";
			}else{
				_s.ytbButtonBackground_do = new FWDUVPDisplayObject("img");
				var img = new Image();
				img.src = _s.controllerBkPath_str;
				_s.ytbButtonBackground_do.setScreen(img);
				_s.ytbButtonsHolder_do.addChild(_s.ytbButtonBackground_do);
			}
			
			_s.ytbButtonsHolder_do.setX(300);
			_s.ytbButtonsHolder_do.setY(-300);
			prt.videoHolder_do.addChild(_s.ytbButtonsHolder_do, 0);
			
			var img = new Image();
			img.src = _s.ytbQualityButtonPointerPath_str;
			_s.pointer_do = new FWDUVPDisplayObject("img");
			_s.pointer_do.setScreen(img);
			_s.pointer_do.setWidth(_s.pointerWidth);
			_s.pointer_do.setHeight(_s.pointerHeight);
			_s.ytbButtonsHolder_do.addChild(_s.pointer_do);
			
			var img = new Image();
			img.src = _s.youtubeQualityArrowPath_str;
			_s.ytbQualityArrow_do = new FWDUVPDisplayObject("img");
			_s.ytbQualityArrow_do.setScreen(img);
			_s.ytbQualityArrow_do.setX(7);
			_s.ytbQualityArrow_do.setWidth(5);
			_s.ytbQualityArrow_do.setHeight(7);
			_s.ytbButtonsHolder_do.addChild(_s.ytbQualityArrow_do);
			
			var btn;
			for(var i=0; i<_s.ttYtbBtns; i++){
				FWDUVPYTBQButton.setPrototype();
				var btn = new FWDUVPYTBQButton(_s.ytbQuality_ar[i], 
						_s.youtubeQualityButtonNormalColor_str, 
						_s.youtubeQualityButtonSelectedColor_str,
						_d.hdPath_str,
						i);
				
				btn.addListener(FWDUVPYTBQButton.MOUSE_OVER, _s.ytbQualityOver);
				btn.addListener(FWDUVPYTBQButton.MOUSE_OUT, _s.ytbQualityOut);
				btn.addListener(FWDUVPYTBQButton.CLICK, _s.ytbQualityClick);
				_s.ytbButtons_ar[i] = btn;
				_s.ytbButtonsHolder_do.addChild(btn);
			}
			_s.hideQualityButtons(false);
		};
		
		_s.ytbQualityOver = function(e){
			_s.setYtbQualityArrowPosition(e.target);
		};
		
		_s.ytbQualityOut = function(e){
			_s.setYtbQualityArrowPosition(undefined);
		};
		
		_s.ytbQualityClick = function(e){
			_s.hideQualityButtons(true);
			_s.dispatchEvent(FWDUVPController.CHANGE_YOUTUBE_QUALITY, {quality:e.target.label_str, id:e.id});
		};
		
		_s.positionAndResizeYtbQualityButtons = function(ar){
			if(!ar) return;
			var totalButtons = ar.length;
			if(_s.prevYtbQualityButtonsLength == totalButtons) return;
			_s.prevYtbQualityButtonsLength = totalButtons;
			var btn;
			var startY = 5;
			var totalWidth = 0;
			var totalHeight = 0;
			
			for(var i=0; i<totalButtons; i++){
				btn = _s.ytbButtons_ar[i];
				if(btn){
					btn.updateText(ar[i]);	
				}
			}
			
			setTimeout(function(){
				for(var i=0; i<_s.ttYtbBtns; i++){
					btn = _s.ytbButtons_ar[i];

					btn.setFinalSize();
					if(i < totalButtons){
						if(btn.x != 0) btn.setX(0);
						if(btn.w > totalWidth) totalWidth = btn.w;
						btn.setY(startY);
						startY += btn.h;
					}else{
						if(btn.x != -3000) btn.setX(-3000);
					}
				}
				
				for(var i=0; i<_s.ttYtbBtns; i++){
					btn = _s.ytbButtons_ar[i];
					if(btn.dumy_do.w < totalWidth){
						btn.setWidth(totalWidth);
						btn.dumy_do.setWidth(totalWidth);
					}
				}
				
				totalHeight = startY + 5;
				_s.pointer_do.setX(parseInt((totalWidth - _s.pointer_do.w)/2));
				_s.pointer_do.setY(totalHeight);
				if(_s.ytbButtonBackground_do){
					_s.ytbButtonBackground_do.setWidth(totalWidth);
					_s.ytbButtonBackground_do.setHeight(totalHeight);
				}
				_s.ytbButtonsHolder_do.setWidth(totalWidth);
				_s.ytbButtonsHolder_do.setHeight(totalHeight);
			}, 300);
		};
		
		_s.disableQualityButtons = function(curQualityLevel, btnId){
			_s.showHDIcon(curQualityLevel);

			for(var i=0; i<_s.ttYtbBtns; i++){
				var btn = _s.ytbButtons_ar[i];
				
				if(btn.label_str == curQualityLevel
					|| btn.id === btnId){
					FWDAnimation.killTweensOf(_s.ytbQualityArrow_do);

					if(btnId !== undefined){
						if(btn.id === btnId){
							_s.showHDIcon(_s.ytbButtons_ar[btnId].label_str)
						}
					}

					if(btn.y != 0){
						_s.ytbQualityArrow_do.setY(btn.y + Math.round((btn.h - _s.ytbQualityArrow_do.h)/2));
						_s.ytbDisabledButton_do = btn;
					}
					
					btn.disable();
				}else{
					btn.enable();
				}
			}
		};

		_s.showHDIcon = function(curQualityLevel){
			if(curQualityLevel == "highres"
				|| curQualityLevel == "hd720" 
			    || curQualityLevel == "hd1080"
			 	|| curQualityLevel == "hd1440" 
			 	|| curQualityLevel == "hd2160"
			 	|| curQualityLevel == "hd2880"
			){
				_s.ytbQualityButton_do.showDisabledState();
			}else{
				_s.ytbQualityButton_do.hideDisabledState();
			}
			
		}
		
		_s.setYtbQualityArrowPosition = function(target){
			var curY = 0;
			if(!target){
				curY = _s.ytbDisabledButton_do.y + parseInt((_s.ytbDisabledButton_do.h - _s.ytbQualityArrow_do.h)/2);
			}else{
				curY = target.y + parseInt((target.h - _s.ytbQualityArrow_do.h)/2);
			}
			FWDAnimation.killTweensOf(_s.ytbQualityArrow_do);
			FWDAnimation.to(_s.ytbQualityArrow_do, .6, {y:curY, delay:.1, ease:Expo.easeInOut});
		};
		
		_s.showQualityButtons = function(animate){
			if(_s.areYtbQualityButtonsShowed_bl || !_s.showYoutubeQualityButton_bl) return;
			_s.hideSubtitleButtons();
			_s.hideMainScrubberTop();
			_s.areYtbQualityButtonsShowed_bl = true;
			var finalX = parseInt(_s.ytbQualityButton_do.x + (parseInt(_s.ytbQualityButton_do.w - _s.ytbButtonsHolder_do.w)/2));
			var finalY = parseInt(prt.tempVidStageHeight - _s.sH - _s.ytbButtonsHolder_do.h - 6);
			
			if(window.hasPointerEvent_bl){
				window.addEventListener("pointerdown", _s.hideQualityButtonsHandler);
			}else{
				if(!_s.isMbl){
					window.addEventListener("mousedown", _s.hideQualityButtonsHandler);
				}
				window.addEventListener("touchstart", _s.hideQualityButtonsHandler);
			}
			
			_s.ytbButtonsHolder_do.setX(finalX);
		
			if(animate){
				FWDAnimation.to(_s.ytbButtonsHolder_do, .6, {y:finalY, ease:Expo.easeInOut});
			}else{
				FWDAnimation.killTweensOf(_s.ytbButtonsHolder_do);
				_s.ytbButtonsHolder_do.setY(finalY);
			}
		};
	
		_s.hideQualityButtons = function(animate){
			if(!_s.areYtbQualityButtonsShowed_bl || !_s.showYoutubeQualityButton_bl) return;
			_s.hideSubtitleButtons();
			_s.areYtbQualityButtonsShowed_bl = false;
			if(animate){
				FWDAnimation.to(_s.ytbButtonsHolder_do, .6, {y:prt.sH, ease:Expo.easeInOut});
			}else{
				FWDAnimation.killTweensOf(_s.ytbButtonsHolder_do);
				_s.ytbButtonsHolder_do.setY(prt.sH);
			}
			
			if(window.hasPointerEvent_bl){
				window.removeEventListener("pointerdown", _s.hideQualityButtonsHandler);
			}else{
				if(!_s.isMbl){
					window.removeEventListener("mousedown", _s.hideQualityButtonsHandler);
				}
				window.removeEventListener("touchstart", _s.hideQualityButtonsHandler);
			}
		};
		

		//##########################################//
		/* Setup subtitle button */
		//##########################################//
		_s.subtitlesSource_ar = _d.subtitles_ar;
		_s.subtitleButtons_ar = [];
		_s.totalSubttleButtons = 10;
		
		_s.setupSubtitleButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPComplexButton.setPrototype();
				_s.subtitleButton_do = new FWDUVPComplexButton(undefined, undefined, undefined, undefined, true, undefined, undefined, undefined,
					"<span class='fwdicon fwdicon-CC'></span>",
					"<span class='fwdicon fwdicon-CC-off'></span>",
					"UVPMainButtonsNormalState",
					"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPComplexButton.setPrototype();
				_s.subtitleButton_do = new FWDUVPComplexButton(
						_d.showSubtitleNPath_img,
						_d.showSubtitleSPath_str,
						_d.hideSubtitleNPath_img,
						_d.hideSubtitleSPath_str,
						true,
						_s.useHEX,
						_s.nBC,
						_s.sBC
				);
			}
			
			var checkIconInterval = setInterval(function(){
				if(_s.subtitleButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.subtitleButton_do.setY(parseInt((_s.sH - _s.subtitleButton_do.buttonHeight)/2));
				}
			}, 50);
			
			_s.subtitleButton_do.screen.className = 'fwduvp-subtitle-button';
			_s.buttons_ar.push(_s.subtitleButton_do);
			_s.subtitleButton_do.setY(parseInt((_s.sH - _s.subtitleButton_do.h)/2));
			_s.subtitleButton_do.addListener(FWDUVPComplexButton.MOUSE_UP, _s.subtitleButtonMouseUpHandler);
			_s.mainHld.addChild(_s.subtitleButton_do);
			
			_s.setupSubtitleButtons();
			
			if(location.protocol.indexOf("file:") != -1) _s.disableSubtitleButton();
			
			if(prt.subtitle_do.showSubtitileByDefault_bl) _s.subtitleButton_do.setButtonState(0);
		}
		
		_s.subtitleButtonMouseUpHandler = function(){
			if(_s.areSubtitleButtonsShowed_bl){
				_s.hideSubtitleButtons(true);
			}else{
				_s.showSubtitleButtons(true);
			}
		};
		
		_s.disableSubtitleButton = function(){
			if(_s.subtitleButton_do) _s.subtitleButton_do.disable();
		};
		
		_s.enableSubtitleButton = function(){
			if(_s.subtitleButton_do) _s.subtitleButton_do.enable();
		};




			
		//###################################################//
		/* Setup subtitlebuttons */
		//###################################################//
		_s.updateSubtitleButtons = function(subtitles, subtitleIndex){
			if(!_s.subtitleButton_do) return;
			
			_s.subtitlesSource_ar = subtitles;
			_s.positionAndResizeSubtitleButtons(subtitles);
			setTimeout(function(){
				subtitleIndex = _s.subtitlesSource_ar.length - 1 - subtitleIndex;
				_s.disableSubtitleButtons(subtitleIndex);
			},65);
			_s.prevSubtitleIndex = subtitleIndex;
		};	
		
		_s.setupSubtitleButtons = function(){
			_s.subtitlesButtonsHolder_do = new FWDUVPDisplayObject("div");
			_s.subtitlesButtonsHolder_do.setOverflow("visible");
			if(_s.repeatBackground_bl){
				_s.subtitlesButtonsHolder_do.getStyle().background = "url('" + _s.controllerBkPath_str +  "')";
			}else{
				_s.subtitlesButtonsBackground_do = new FWDUVPDisplayObject("img");
				var img = new Image();
				img.src = _s.controllerBkPath_str;
				_s.subtitlesButtonsBackground_do.setScreen(img);
				_s.subtitlesButtonsHolder_do.addChild(_s.subtitlesButtonsBackground_do);
			}
			
			_s.subtitlesButtonsHolder_do.setX(300);
			_s.subtitlesButtonsHolder_do.setY(-300);
			prt.videoHolder_do.addChild(_s.subtitlesButtonsHolder_do, 0);
			
			var img = new Image();
			img.src = _s.ytbQualityButtonPointerPath_str;
			_s.subtitlesPonter_do = new FWDUVPDisplayObject("img");
			_s.subtitlesPonter_do.setScreen(img);
			_s.subtitlesPonter_do.setWidth(_s.pointerWidth);
			_s.subtitlesPonter_do.setHeight(_s.pointerHeight);
			_s.subtitlesButtonsHolder_do.addChild(_s.subtitlesPonter_do);
	
			
			var img = new Image();
			img.src = _s.youtubeQualityArrowPath_str;
			_s.subtitleQualityArrow_do = new FWDUVPDisplayObject("img");
			_s.subtitleQualityArrow_do.setScreen(img);
			_s.subtitleQualityArrow_do.setX(7);
			_s.subtitleQualityArrow_do.setWidth(5);
			_s.subtitleQualityArrow_do.setHeight(7);
			_s.subtitlesButtonsHolder_do.addChild(_s.subtitleQualityArrow_do);
					
			for(var i=0; i<_s.totalSubttleButtons; i++){
				FWDUVPYTBQButton.setPrototype();
				var btn = new FWDUVPYTBQButton("no source", 
						_s.youtubeQualityButtonNormalColor_str, 
						_s.youtubeQualityButtonSelectedColor_str,
						_d.hdPath_str,
						i);
				
				btn.addListener(FWDUVPYTBQButton.MOUSE_OVER, _s.sbtQualityOver);
				btn.addListener(FWDUVPYTBQButton.MOUSE_OUT, _s.sbtQualityOut);
				btn.addListener(FWDUVPYTBQButton.CLICK, _s.sbtQualityClick);
				_s.subtitleButtons_ar[i] = btn;
				_s.subtitlesButtonsHolder_do.addChild(btn);
			}
			_s.hideSubtitleButtons(false);
		};
		
		_s.sbtQualityOver = function(e){
			_s.setSubtitleArrowPosition(e.target);
		};
		
		_s.sbtQualityOut = function(e){
			_s.setSubtitleArrowPosition(undefined);
		};
		
		_s.sbtQualityClick = function(e){
			_s.startAtSubtitle = e.id;
			_s.disableSubtitleButtons(_s.startAtSubtitle);
			_s.hideSubtitleButtons(true);
			
			_s.dispatchEvent(FWDUVPController.CHANGE_SUBTITLE, {id:_s.subtitlesSource_ar.length -1 - e.id});
		};
		
		_s.positionAndResizeSubtitleButtons = function(ar){
			if(!ar) return;
			
			var totalButtons = ar.length;
			if(_s.prevSubtitlesQualityButtonsLength == totalButtons) return;
			_s.prevSubtitlesQualityButtonsLength = totalButtons;
			var btn;
			var startY = 5;
			var totalWidth = 0;
			var totalHeight = 0;

			for(var i=0; i<totalButtons; i++){
				btn = _s.subtitleButtons_ar[i];
				btn.updateText(ar[i]["label"]);
				btn.setFinalSize();
			}
			
			setTimeout(function(){
				for(var i=0; i<_s.totalSubttleButtons; i++){
					btn = _s.subtitleButtons_ar[i];
					if(i < totalButtons){
						if(btn.x != 0) btn.setX(0);
						if(btn.w > totalWidth) totalWidth = btn.w;
						btn.setY(startY);
						startY += btn.h;
					}else{
						if(btn.x != -3000) btn.setX(-3000);
					}
				}
				
				for(var i=0; i<_s.totalSubttleButtons; i++){
					btn = _s.subtitleButtons_ar[i];
					if(btn.dumy_do.w < totalWidth){
						btn.setWidth(totalWidth);
						btn.dumy_do.setWidth(totalWidth);
					}
				}
				
				totalHeight = startY + 5;
				_s.subtitlesPonter_do.setX(parseInt((totalWidth - _s.subtitlesPonter_do.w)/2));
				_s.subtitlesPonter_do.setY(totalHeight);
				if(_s.subtitlesButtonsBackground_do){	
					_s.subtitlesButtonsBackground_do.setWidth(totalWidth);
					_s.subtitlesButtonsBackground_do.setHeight(totalHeight);
				}
				_s.subtitlesButtonsHolder_do.setWidth(totalWidth);
				_s.subtitlesButtonsHolder_do.setHeight(totalHeight);
			}, 60);
		};
		
		_s.disableSubtitleButtons = function(index){
			for(var i=0; i<_s.totalSubttleButtons; i++){
				var btn = _s.subtitleButtons_ar[i];
				if(i == index){
					FWDAnimation.killTweensOf(_s.subtitleQualityArrow_do);
					_s.subtitleQualityArrow_do.setY(btn.y + parseInt((btn.h - _s.subtitleQualityArrow_do.h)/2) + 1);
					btn.disable();
					_s.subtitleDisabledButton_do = btn;
				}else{
					btn.enable();
				}
			}
			
			if(_s.subtitlesSource_ar.length -1 - index == 0){
				_s.subtitleButton_do.setButtonState(0);
			}else{
				_s.subtitleButton_do.setButtonState(1);
			}
		};
		
		_s.setSubtitleArrowPosition = function(target){
			var curY = 0;
			if(!target){
				curY = _s.subtitleDisabledButton_do.y + parseInt((_s.subtitleDisabledButton_do.h - _s.subtitleQualityArrow_do.h)/2);
			}else{
				curY = target.y + parseInt((target.h - _s.subtitleQualityArrow_do.h)/2);
			}
			FWDAnimation.killTweensOf(_s.subtitleQualityArrow_do);
			FWDAnimation.to(_s.subtitleQualityArrow_do, .6, {y:curY, delay:.1, ease:Expo.easeInOut});
		};
		
		_s.showSubtitleButtons = function(animate){
			if(_s.areSubtitleButtonsShowed_bl) return;
			_s.hideQualityButtons();
			_s.hideMainScrubberTop();
			_s.areSubtitleButtonsShowed_bl = true;
			var finalX = parseInt(_s.subtitleButton_do.x + (parseInt(_s.subtitleButton_do.w - _s.subtitlesButtonsHolder_do.w)/2));
			var finalY = parseInt(prt.tempVidStageHeight - _s.sH - _s.subtitlesButtonsHolder_do.h - 6);
			
			if(_s.hasPointerEvent_bl){
				window.addEventListener("pointerdown", _s.hideSubtitlesButtonsHandler);
			}else{
				if(!_s.isMbl){
					window.addEventListener("mousedown", _s.hideSubtitlesButtonsHandler);
				}
				window.addEventListener("touchstart", _s.hideSubtitlesButtonsHandler);
			}
			
			_s.subtitlesButtonsHolder_do.setX(finalX);
		
			if(animate){
				FWDAnimation.to(_s.subtitlesButtonsHolder_do, .6, {y:finalY, ease:Expo.easeInOut});
			}else{
				FWDAnimation.killTweensOf(_s.subtitlesButtonsHolder_do);
				_s.subtitlesButtonsHolder_do.setY(finalY);
			}
		};
	
		_s.hideSubtitleButtons = function(animate){
			if(!_s.areSubtitleButtonsShowed_bl || !_s.subtitlesButtonsHolder_do) return;
			_s.areSubtitleButtonsShowed_bl = false;
			if(animate){
				FWDAnimation.to(_s.subtitlesButtonsHolder_do, .6, {y:prt.sH, ease:Expo.easeInOut});
			}else{
				FWDAnimation.killTweensOf(_s.subtitlesButtonsHolder_do);
				_s.subtitlesButtonsHolder_do.setY(prt.sH);
			}
			
			if(_s.hasPointerEvent_bl){
				window.removeEventListener("pointerdown", _s.hideSubtitlesButtonsHandler);
			}else{
				if(!_s.isMbl){
					window.removeEventListener("mousedown", _s.hideSubtitlesButtonsHandler);
				}
				window.removeEventListener("touchstart", _s.hideSubtitlesButtonsHandler);
			}
			_s.showMainScrubberOnTop();
		};
		
		_s.hideSubtitlesButtonsHandler = function(e){
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			if(FWDUVPUtils.hitTest(_s.subtitleButton_do.screen, vc.screenX, vc.screenY)
			   || FWDUVPUtils.hitTest(_s.subtitlesButtonsHolder_do.screen, vc.screenX, vc.screenY)){
				return;
			}
			_s.hideSubtitleButtons(true);
		};
		
		
		//##########################################//
		/* Setup youtube quality button */
		//##########################################//
		_s.setupYoutubeQualityButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.ytbQualityButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-settings'></span>",
						_d.hdIcn,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.ytbQualityButton_do = new FWDUVPSimpleButton(
						_s.ytbQualityN_img,
						_d.ytbQualitySPath_str,
						_d.ytbQualityDPath_str,
						true,
						_s.useHEX,
						_s.nBC,
						_s.sBC
				);
			}
			
			_s.ytbQualityButton_do.screen.className = 'fwduvp-quality-button';
			_s.ytbQualityButton_do.setX(-300);
			_s.ytbQualityButton_do.setY(parseInt((_s.sH - _s.ytbQualityButton_do.h)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.ytbQualityButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.ytbQualityButton_do.setY(parseInt((_s.sH - _s.ytbQualityButton_do.buttonHeight)/2));
				}
			}, 50);
			_s.ytbQualityButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.ytbQualityMouseUpHandler);
			_s.mainHld.addChild(_s.ytbQualityButton_do);
		};
		
		_s.ytbQualityMouseUpHandler = function(){
			
			if(_s.areYtbQualityButtonsShowed_bl){
				_s.hideQualityButtons(true);
				if(_s.isMainScrubberOnTop_bl){
					_s.mainScrubber_do.setX(0);
					FWDAnimation.to(_s.mainScrubber_do, .6, {alpha:1});
				}
			}else{
				_s.showQualityButtons(true);
			}
		};
		
		_s.hideQualityButtonsHandler = function(e){
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			if(FWDUVPUtils.hitTest(_s.ytbQualityButton_do.screen, vc.screenX, vc.screenY)
			   || FWDUVPUtils.hitTest(_s.ytbButtonsHolder_do.screen, vc.screenX, vc.screenY)){
				return;
			}
			_s.hideQualityButtons(true);
			_s.showMainScrubberOnTop();
		};
		
		_s.addYtbQualityButton = function(){
			if(_s.hasYtbButton_bl || !_s.showYoutubeQualityButton_bl) return;
			_s.hasYtbButton_bl = true;
			var indexToAdd;
			if(_s.subtitleButton_do && _s.getButtonIndex(_s.subtitleButton_do) != -1){
				indexToAdd = _s.getButtonIndex(_s.subtitleButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.ytbQualityButton_do);
			}else if(_s.playbackRateButton_do && _s.getButtonIndex(_s.playbackRateButton_do) != -1){
				indexToAdd = _s.getButtonIndex(_s.playbackRateButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.ytbQualityButton_do);
			}else if(_s.atbButton_do && _s.getButtonIndex(_s.atbButton_do) != -1){
				indexToAdd = _s.getButtonIndex(_s.atbButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.ytbQualityButton_do);
			}else if(_s.infoButton_do && _s.getButtonIndex(_s.infoButton_do) != -1){
				indexToAdd = _s.getButtonIndex(_s.infoButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.ytbQualityButton_do);
			}else if(_s.downloadButton_do && _s.getButtonIndex(_s.downloadButton_do) != -1){
				indexToAdd = _s.getButtonIndex(_s.ytbQualityButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.ytbQualityButton_do);
			}else if(_s.ccBtn_do && _s.getButtonIndex(_s.ccBtn_do) != -1){
				indexToAdd = _s.getButtonIndex(_s.ccBtn_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.ytbQualityButton_do);
			}else if(_s.vrButton_do){
				indexToAdd = _s.getButtonIndex(_s.vrButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.ytbQualityButton_do);
			}else if(_s.fullScreenButton_do){
				indexToAdd = _s.getButtonIndex(_s.fullScreenButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.ytbQualityButton_do);
			}else{
				_s.buttons_ar.splice(_s.buttons_ar.length,0, _s.ytbQualityButton_do);
			}
			
			_s.ytbQualityButton_do.disable();
			_s.ytbQualityButton_do.rotation = 0;
			_s.ytbQualityButton_do.setRotation(_s.ytbQualityButton_do.rotation);
			_s.ytbQualityButton_do.hideDisabledState();
			_s.hideQualityButtons(false);
			
			_s.positionButtons();
		};
		
		_s.removeYtbQualityButton = function(){
			if(!_s.hasYtbButton_bl || !_s.showYoutubeQualityButton_bl) return;
			_s.hasYtbButton_bl = false;
			_s.buttons_ar.splice(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.ytbQualityButton_do), 1);
			
			_s.ytbQualityButton_do.setX(-300);
			_s.ytbQualityButton_do.hideDisabledState();
			_s.hideQualityButtons(false);
			_s.positionButtons();
		};
		
		_s.updateQuality = function(qualityLevels, curQualityLevel, id){
			if(!_s.hasYtbButton_bl || !_s.showYoutubeQualityButton_bl) return;

			_s.positionAndResizeYtbQualityButtons(qualityLevels);
			
			setTimeout(function(){
				_s.disableQualityButtons(curQualityLevel, id);
			},300);
		};	

		
		//##########################################//
		/* Setup info  button */
		//#########################################//
		_s.setupInfoButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.infoButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-info'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.infoButton_do = new FWDUVPSimpleButton(_s.infoN_img, _d.infoSPath_str, undefined, true, _s.useHEX,
						_s.nBC,
						_s.sBC);
			}

			_s.infoButton_do.screen.className = 'fwduvp-ifon-button';
			var checkIconInterval = setInterval(function(){
				if(_s.infoButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.infoButton_do.setY(parseInt((_s.sH - _s.infoButton_do.buttonHeight)/2));
				}
			}, 50);
			_s.infoButton_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.infoButtonShowToolTipHandler);
			_s.infoButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.infoButtonOnMouseUpHandler);
			_s.infoButton_do.setX(-300);
			_s.infoButton_do.setY(parseInt((_s.sH - _s.infoButton_do.h)/2));
			_s.mainHld.addChild(_s.infoButton_do);
		};
		
		_s.infoButtonShowToolTipHandler = function(e){
			_s.showToolTip(_s.infoButton_do, _s.infoButtonToolTip_do, e.e);
		};
		
		_s.infoButtonOnMouseUpHandler = function(){
			_s.dispatchEvent(FWDUVPController.SHOW_INFO_WINDOW);
		};
		
		_s.enableQualtyButton = function(){
			if(_s.ytbQualityButton_do) _s.ytbQualityButton_do.enable();
		}
		
		_s.disableQualtyButton = function(){
			if(_s.ytbQualityButton_do) _s.ytbQualityButton_do.disable();
		}
		

		//##########################################//
		/* Setup download button */
		//#########################################//
		_s.setupDownloadButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.downloadButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-download'></span>",
						undefined,
						"UVPMainButtonsNormalState dw",
						"UVPMainButtonsSelectedState dw"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.downloadButton_do = new FWDUVPSimpleButton(_s.downloadN_img, _d.downloadSPath_str, undefined, true, _s.useHEX,
						_s.nBC,
						_s.sBC);
			}

			_s.downloadButton_do.screen.className = 'fwduvp-download-button';
			_s.downloadButton_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.downloadButtonShowToolTipHandler);
			_s.downloadButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.downloadButtonOnMouseUpHandler);
			_s.downloadButton_do.setX(-300);
			_s.downloadButton_do.setY(parseInt((_s.sH - _s.downloadButton_do.h)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.downloadButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.downloadButton_do.setY(parseInt((_s.sH - _s.downloadButton_do.buttonHeight)/2));
				}
			}, 50);
			_s.mainHld.addChild(_s.downloadButton_do); 
		};
		
		_s.downloadButtonShowToolTipHandler = function(e){
			_s.showToolTip(_s.downloadButton_do, _s.downloadButtonToolTip_do, e.e);
		};
		
		_s.downloadButtonOnMouseUpHandler = function(){
			_s.dispatchEvent(FWDUVPController.DOWNLOAD_VIDEO);
		};
		
		
		//##########################################//
		/* Setup thumbnails preview */
		//##########################################//
		_s.setupThumbnailsPreview =  function(){
			if(_s.thumbnailsPreview_do || !window['FWDUVPThumbnailsPreview']) return;
			FWDUVPThumbnailsPreview.setPrototype();
			_s.thumbnailsPreview_do = new FWDUVPThumbnailsPreview(_s);
			_s.thumbnailsPreview_do.addListener(FWDUVPData.LOAD_ERROR, function(e){
				
				_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:e.text});
			});
		}

		//##########################################//
		/* Setup a to b button */
		//##########################################//
		_s.setupATB = function(){
			FWDUVPATB.setPrototype();
			_s.atb = new FWDUVPATB(_s);
			_s.mainHld.addChild(_s.atb);
			_s.atb.addListener(FWDUVPATB.START_TO_SCRUB, _s.atbStartToScrub);
			_s.atb.addListener(FWDUVPATB.STOP_TO_SCRUB, _s.atbStopToScrub);
		}

		_s.atbStartToScrub = function(){
			prt.showDisable();
		}

		_s.atbStopToScrub = function(){
			prt.hideDisable();
		}

		_s.setupAtbButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.atbButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-AB'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.atbButton_do = new FWDUVPSimpleButton(
						_d.atbNPath_img,
						_d.atbSPath_str,
						undefined,
						true,
						_s.useHEX,
						_s.nBC,
						_s.sBC
				);
			}
			
			_s.atbButton_do.screen.className = 'fwduvp-a-to-b-button';
			_s.atbButton_do.setX(-5000);
			_s.atbButton_do.setY(parseInt((_s.sH - _s.atbButton_do.h)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.atbButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.atbButton_do.setY(parseInt((_s.sH - _s.atbButton_do.buttonHeight)/2));
				}
			}, 50);
			_s.atbButton_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.atbButtonShowTooltipHandler);
			_s.atbButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.atbButtonMouseUpHandler);
			_s.mainHld.addChild(_s.atbButton_do);
		};
		
		_s.atbButtonShowTooltipHandler = function(e){
			_s.showToolTip(_s.atbButton_do, _s.atbButtonToolTip_do, e.e);
		};
		
	
		_s.atbButtonMouseUpHandler = function(){
			if(_s.atbButton_do.isSelected){
				_s.atbButton_do.doNotallowToSetNormal = false;
				_s.atbButton_do.isSelected = false;
				_s.atb.hide(true);
				if(_s.isMbl) _s.atbButton_do.setNormalState();
			}else{
				_s.atbButton_do.isSelected = true;
				_s.atbButton_do.doNotallowToSetNormal = true;
				_s.atbButton_do.setSelectedState();
				_s.atb.show(true);
			}
			
		};

		_s.disableAtbButton = function(){
			if(_s.atbButton_do) _s.atbButton_do.disable();
		};
		
		_s.enableAtbButton = function(){
			if(_s.atbButton_do) _s.atbButton_do.enable();
		};

		
		//##########################################//
		/* Setup facebook button */
		//##########################################//
		_s.setupShareButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.shareButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-share'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.shareButton_do = new FWDUVPSimpleButton(
						_d.shareN_img,
						_d.shareSPath_str,
						undefined,
						true,
						_s.useHEX,
						_s.nBC,
						_s.sBC
				);
			}
			
			_s.shareButton_do.screen.className = 'fwduvp-share-button';
			_s.buttons_ar.push(_s.shareButton_do);
			_s.shareButton_do.setY(parseInt((_s.sH - _s.shareButton_do.h)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.shareButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.shareButton_do.setY(parseInt((_s.sH - _s.shareButton_do.buttonHeight)/2));
				}
			}, 50);
			_s.shareButton_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.facebookButtonShowTooltipHandler);
			_s.shareButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.facebookButtonMouseUpHandler);
			_s.mainHld.addChild(_s.shareButton_do);
		};
		
		_s.facebookButtonShowTooltipHandler = function(e){
			_s.showToolTip(_s.shareButton_do, _s.facebookButtonToolTip_do, e.e);
		};
		
	
		_s.facebookButtonMouseUpHandler = function(){
			_s.dispatchEvent(FWDUVPController.SHOW_SHARE_WINDOW);
		};

		
		//##########################################//
		/* Setup chromecast button */
		//##########################################//
		_s.setupChromecastButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPComplexButton.setPrototype();
				_s.ccBtn_do = new FWDUVPComplexButton(undefined, undefined, undefined, undefined, true, undefined, undefined, undefined,
					"<span class='fwdicon fwdicon-cast'></span>",
					"<span class='fwdicon fwdicon-uncast'></span>",
					"UVPMainButtonsNormalState",
					"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPComplexButton.setPrototype();
				_s.ccBtn_do = new FWDUVPComplexButton(
					_d.castN_img,
					_d.castSPath_str,
					_d.uncastN_img,
					_d.uncastSPath_str,
					true,
					_s.useHEX,
					_s.nBC,
					_s.sBC
				);
			}
				
			var checkIconInterval = setInterval(function(){
				if(_s.ccBtn_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.ccBtn_do.setY(parseInt((_s.sH - _s.ccBtn_do.buttonHeight)/2));
				}
			}, 50);

			_s.ccBtn_do.screen.className = 'fwduvp-chromecast-button';
			_s.ccBtn_do.setY(parseInt((_s.sH - _s.ccBtn_do.buttonHeight)/2));
			_s.ccBtn_do.addListener(FWDUVPComplexButton.MOUSE_UP, _s.chormecastMouseUpHandler);
			_s.ccBtn_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.castTooltipHandler);
			_s.ccBtn_do.setX(-500);
			_s.mainHld.addChild(_s.ccBtn_do);
		}
		
		_s.castTooltipHandler = function(e){
			_s.showToolTip(_s.ccBtn_do, _s.castButtonToolTip_do, e.e);
		};

		_s.chormecastMouseUpHandler = function(){
			if(_s.ccBtn_do.currentState == 0){
				_s.dispatchEvent(FWDUVPController.UNCAST);
			}else{
				_s.dispatchEvent(FWDUVPController.CAST);
			}
		}
		
		_s.removeCCButton = function(){
			if(!_s.ccBtn_do) return;
			if(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.ccBtn_do) != -1){
				_s.buttons_ar.splice(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.ccBtn_do), 1);
				_s.ccBtn_do.setX(-300);
				_s.positionButtons();
			}
		};
		
		_s.addCCButton = function(){
			
			if(!_s.ccBtn_do) return;
			
			if(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.ccBtn_do) == -1){
				if(_s.vrButton_do){
					var indexToAdd = _s.getButtonIndex(_s.vrButton_do);
					_s.buttons_ar.splice(indexToAdd, 0, _s.ccBtn_do);
				}else if(_s.fullScreenButton_do && FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.fullScreenButton_do) != -1){
					_s.buttons_ar.splice(FWDUVPUtils.indexOfArray(_s.buttons_ar, _s.fullScreenButton_do), 0, _s.ccBtn_do);
				}else{
					_s.buttons_ar.splice(_s.buttons_ar.length, 0, _s.ccBtn_do);
				}
				_s.positionButtons();
			}
		};


		//###################################################//
		/* Setup audio traks button */
		//###################################################//
		_s.setupAudioTracksButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.atButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-headephone'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
				_s.atButton_do.screen.className = "fwduvp-audio-tracks-button vector";
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.atButton_do = new FWDUVPSimpleButton(_d.at_img,
															 _d.atSPath_img, 
															 undefined, 
															 true,
															 _s.useHEX,
															 _s.nBC,
															 _s.sBC);
				_s.atButton_do.screen.className = "fwduvp-audio-tracks-button";
			}

			var checkIconInterval = setInterval(function(){
				if(_s.atButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.atButton_do.setY(parseInt((_s.sH - _s.atButton_do.buttonHeight)/2));
				}
			}, 50);
			
			_s.atButton_do.screen.className = 'fwduvp-audio-tracks-button';
			_s.atButton_do.setY(parseInt((_s.sH - _s.atButton_do.h)/2));
			_s.atButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.atButtonMouseUpHandler);
			_s.atButton_do.setX(-300);
			_s.mainHld.addChild(_s.atButton_do);

			_s.setupATBButtons();
			
			_s.disableAtButton();
		}
		
		_s.atButtonMouseUpHandler = function(){
			_s.showATBButtons(true);
		};
		
		_s.disableAtButton = function(){
			if(_s.atButton_do) _s.atButton_do.disable();
		};
		
		_s.enableAtButton = function(){
			if(_s.atButton_do) _s.atButton_do.enable();
		};
		
		_s.removeAtButton = function(){
			if(!_s.atButton_do) return;
			if(_s.getButtonIndex(_s.atButton_do) != -1){
				_s.buttons_ar.splice(_s.getButtonIndex(_s.atButton_do), 1);
				_s.atButton_do.setX(-300);
			}
		};
		
		_s.addAtButton = function(){
			if(!_s.atButton_do) return;
			if(_s.getButtonIndex(_s.atButton_do) != -1) return;
			
			_s.disableAtButton();
			if(_s.ytbQualityButton_do && _s.getButtonIndex(_s.ytbQualityButton_do) != -1){
				var indexToAdd = _s.getButtonIndex(_s.ytbQualityButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.atButton_do);
			}else if(_s.fullScreenButton_do && _s.getButtonIndex(_s.fullScreenButton_do) != -1){
				var indexToAdd = _s.getButtonIndex(_s.fullScreenButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.atButton_do);
			}else{
				_s.buttons_ar.splice(_s.buttons_ar.length,0, _s.atButton_do);
			}
			_s.positionButtons();
		};


		//###################################################//
		/* Setup audio tracks buttons. */
		//###################################################//
		_s.totalATBButtons = 10;
		_s.areATBButtonsShowed_bl = false;
		_s.updateATBButtons = function(ATB, ATBIndex){
			if(!_s.atButton_do) return;
		
			_s.ATBSource_ar = ATB;

			_s.positionAndResizeATBButtons(ATB);
			
			setTimeout(function(){
				ATBIndex = _s.ATBSource_ar.length - 1 - ATBIndex;
				_s.disableATBButtons(ATBIndex);
			},65);
			_s.prevATBIndex = ATBIndex;
		};	
		
		_s.setupATBButtons = function(){

			_s.ATBButtons_ar = [];
			_s.ATBButtonsHolder_do = new FWDUVPDisplayObject("div");
			_s.ATBButtonsHolder_do.setOverflow("visible");
			if(_s.repeatBackground_bl){
				_s.ATBButtonsHolder_do.getStyle().background = "url('" + _s.controllerBkPath_str +  "')";
			}else{
				_s.ATBButtonsBackground_do = new FWDUVPDisplayObject("img");
				var img = new Image();
				img.src = _s.controllerBkPath_str;
				_s.ATBButtonsBackground_do.setScreen(img);
				_s.ATBButtonsHolder_do.addChild(_s.ATBButtonsBackground_do);
			}
			
			_s.ATBButtonsHolder_do.setX(300);
			_s.ATBButtonsHolder_do.setY(-300);
			prt.videoHolder_do.addChild(_s.ATBButtonsHolder_do, 0);
			
			var img = new Image();
			img.src = _s.ytbQualityButtonPointerPath_str;
			_s.ATBPonter_do = new FWDUVPDisplayObject("img");
			_s.ATBPonter_do.setScreen(img);
			_s.ATBPonter_do.setWidth(_s.pointerWidth);
			_s.ATBPonter_do.setHeight(_s.pointerHeight);
			_s.ATBButtonsHolder_do.addChild(_s.ATBPonter_do);
	
			var img = new Image();
			img.src = _s.youtubeQualityArrowPath_str;
			_s.ABTQualityArrow_do = new FWDUVPDisplayObject("img");
			_s.ABTQualityArrow_do.setScreen(img);
			_s.ABTQualityArrow_do.setX(7);
			_s.ABTQualityArrow_do.setWidth(5);
			_s.ABTQualityArrow_do.setHeight(7);
			_s.ATBButtonsHolder_do.addChild(_s.ABTQualityArrow_do);
					
			for(var i=0; i<_s.totalATBButtons; i++){
				FWDUVPYTBQButton.setPrototype();
				var btn = new FWDUVPYTBQButton("no source", 
						_s.youtubeQualityButtonNormalColor_str, 
						_s.youtubeQualityButtonSelectedColor_str,
						_d.hdPath_str,
						i);
				
				btn.addListener(FWDUVPYTBQButton.MOUSE_OVER, _s.ATBQualityOver);
				btn.addListener(FWDUVPYTBQButton.MOUSE_OUT, _s.ATBQualityOut);
				btn.addListener(FWDUVPYTBQButton.CLICK, _s.ATBQualityClick);
				_s.ATBButtons_ar[i] = btn;
				_s.ATBButtonsHolder_do.addChild(btn);
			}
			_s.hideATBButtons(false);
		};
		
		_s.ATBQualityOver = function(e){
			_s.setATBArrowPosition(e.target);
		};
		
		_s.ATBQualityOut = function(e){
			_s.setATBArrowPosition(undefined);
		};
		
		_s.ATBQualityClick = function(e){
			_s.startAtATB = e.id;
			
			_s.disableATBButtons(_s.startAtATB);
			_s.hideATBButtons(true);
			
			_s.dispatchEvent(FWDUVPController.CHANGE_AUDIO_TRACKS, {id:_s.ATBSource_ar.length -1 - e.id});
		};
		
		_s.positionAndResizeATBButtons = function(ar){
			if(!ar) return;
			
			var totalButtons = ar.length;

			if(_s.prevATBButtonsLength == totalButtons) return;
			_s.prevATBButtonsLength = totalButtons;

			var btn;
			var startY = 5;
			var totalWidth = 0;
			var totalHeight = 0;

			for(var i=0; i<totalButtons; i++){
				btn = _s.ATBButtons_ar[i];
				btn.updateText(ar[i]["label"]);
				btn.setFinalSize();
			}

			setTimeout(function(){
				for(var i=0; i<_s.totalATBButtons; i++){
					btn = _s.ATBButtons_ar[i];
					if(i < totalButtons){
						if(btn.x != 0) btn.setX(0);
						if(btn.w > totalWidth) totalWidth = btn.w;
						btn.setY(startY);
						startY += btn.h;
					}else{
						if(btn.x != -3000) btn.setX(-3000);
					}
				}
				
				for(var i=0; i<_s.totalATBButtons; i++){
					btn = _s.ATBButtons_ar[i];
					if(btn.dumy_do.w < totalWidth){
						btn.setWidth(totalWidth);
						btn.dumy_do.setWidth(totalWidth);
					}
				}
				
				totalHeight = startY + 5;

				_s.ATBPonter_do.setX(parseInt((totalWidth - _s.ATBPonter_do.w)/2));
				_s.ATBPonter_do.setY(totalHeight);
				if(_s.ATBButtonsBackground_do){	
					_s.ATBButtonsBackground_do.setWidth(totalWidth);
					_s.ATBButtonsBackground_do.setHeight(totalHeight);
				}
				_s.ATBButtonsHolder_do.setWidth(totalWidth);
				_s.ATBButtonsHolder_do.setHeight(totalHeight);
			}, 60);
		};
		
		_s.disableATBButtons = function(index){
			for(var i=0; i<_s.totalATBButtons; i++){
				var btn = _s.ATBButtons_ar[i];
				if(i == index){
					FWDAnimation.killTweensOf(_s.ABTQualityArrow_do);
					_s.ABTQualityArrow_do.setY(btn.y + parseInt((btn.h - _s.ABTQualityArrow_do.h)/2) + 1);
					btn.disable();
					_s.ABTDisabledButton_do = btn;
				}else{
					btn.enable();
				}
			}
		};
		
		_s.setATBArrowPosition = function(target){
			var curY = 0;
			if(!target){
				curY = _s.ABTDisabledButton_do.y + parseInt((_s.ABTDisabledButton_do.h - _s.ABTQualityArrow_do.h)/2);
			}else{
				curY = target.y + parseInt((target.h - _s.ABTQualityArrow_do.h)/2);
			}
			FWDAnimation.killTweensOf(_s.ABTQualityArrow_do);
			FWDAnimation.to(_s.ABTQualityArrow_do, .6, {y:curY, delay:.1, ease:Expo.easeInOut});
		};
		
		_s.showATBButtons = function(animate){
			_s.hideATBButtons();
			_s.hideMainScrubberTop();
			_s.areATBButtonsShowed_bl = true;
			var finalX = parseInt(_s.atButton_do.x + (parseInt(_s.atButton_do.w - _s.ATBButtonsHolder_do.w)/2));
			var finalY = parseInt(prt.tempVidStageHeight - _s.sH - _s.ATBButtonsHolder_do.h - 6);
			
			if(_s.hasPointerEvent_bl){
				window.addEventListener("pointerdown", _s.hideATBsButtonsHandler);
			}else{
				if(!_s.isMbl){
					window.addEventListener("mousedown", _s.hideATBsButtonsHandler);
				}
				window.addEventListener("touchstart", _s.hideATBsButtonsHandler);
			}
			
			_s.ATBButtonsHolder_do.setX(finalX);
		
			if(animate){
				FWDAnimation.to(_s.ATBButtonsHolder_do, .6, {y:finalY, ease:Expo.easeInOut});
			}else{
				FWDAnimation.killTweensOf(_s.ATBButtonsHolder_do);
				_s.ATBButtonsHolder_do.setY(finalY);
			}
		};
	
		_s.hideATBButtons = function(animate){
			if(!_s.ATBButtonsHolder_do) return;
			
			_s.areATBButtonsShowed_bl = false;
			if(animate){
				FWDAnimation.to(_s.ATBButtonsHolder_do, .6, {y:prt.sH, ease:Expo.easeInOut});
			}else{
				FWDAnimation.killTweensOf(_s.ATBButtonsHolder_do);
				_s.ATBButtonsHolder_do.setY(prt.sH);
			}

			if(_s.hasPointerEvent_bl){
				window.removeEventListener("pointerdown", _s.hideATBsButtonsHandler);
			}else{
				if(!_s.isMbl){
					window.removeEventListener("mousedown", _s.hideATBsButtonsHandler);
				}
				window.removeEventListener("touchstart", _s.hideATBsButtonsHandler);
			}
			_s.showMainScrubberOnTop();
		};
		
		_s.hideATBsButtonsHandler = function(e){
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			if(FWDUVPUtils.hitTest(_s.atButton_do.screen, vc.screenX, vc.screenY)
			   || FWDUVPUtils.hitTest(_s.ATBButtonsHolder_do.screen, vc.screenX, vc.screenY)){
				return;
			}
			_s.hideATBButtons(true);
		};


		//###################################################//
		/* Setup VR button */
		//###################################################//
		_s.setupVrButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.vrButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-vr'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
				setTimeout(() => {
					_s.vrButton_do.setY(parseInt((_s.sH - _s.vrButton_do.h)/2) + 1);
				}, 300);
				_s.vrButton_do.screen.className = "FWDUVP-vr-button vector";
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.vrButton_do = new FWDUVPSimpleButton(_d.vr_img,
															 _d.vrSPath_img, 
															 undefined, 
															 true,
															 _s.useHEX,
															 _s.nBC,
															 _s.sBC);
					_s.vrButton_do.screen.className = "FWDUVP-vr-button";
			}
			
			_s.vrButton_do.screen.className = 'fwduvp-vr-button';
			_s.vrButton_do.setY(parseInt((_s.sH - _s.vrButton_do.h)/2));
			_s.vrButton_do.addListener(FWDUVPComplexButton.SHOW_TOOLTIP, _s.vrButtonShowToolTipHandler);
			_s.vrButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.vrButtonMouseUpHandler);
			_s.mainHld.addChild(_s.vrButton_do);
			_s.vrButton_do.setX(-300);
			_s.disableVrButton();
		}

		_s.vrButtonShowToolTipHandler =  function(e){
			_s.showToolTip(_s.vrButton_do, _s.vrToolTip_do, e.e);
		}
		
		_s.vrButtonMouseUpHandler = function(){
			_s.dispatchEvent(FWDUVPController.VR);
		};
		
		_s.disableVrButton = function(){
			if(_s.vrButton_do) _s.vrButton_do.disable();
		};
		
		_s.enableVrButton = function(){
			if(_s.vrButton_do) _s.vrButton_do.enable();
		};
		
		_s.removeVrButton = function(){
			if(!_s.vrButton_do) return;
			if(_s.getButtonIndex(_s.vrButton_do) != -1){
				_s.buttons_ar.splice(_s.getButtonIndex(_s.vrButton_do), 1);
				_s.vrButton_do.setX(-300);
			}
		};
		
		_s.addVrButton = function(){
			if(!_s.vrButton_do) return;
			if(_s.getButtonIndex(_s.vrButton_do) != -1) return;
			
			_s.disableVrButton();
			if(_s.fullScreenButton_do && _s.getButtonIndex(_s.fullScreenButton_do) != -1){
				var indexToAdd = _s.getButtonIndex(_s.fullScreenButton_do);
				_s.buttons_ar.splice(indexToAdd, 0, _s.vrButton_do);
			}else{
				_s.buttons_ar.splice(_s.buttons_ar.length,0, _s.infoButton_do);
			}
		};



		//##########################################//
		/* Setup fullscreen button */
		//##########################################//
		_s.setupFullscreenButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPComplexButton.setPrototype();
				_s.fullScreenButton_do = new FWDUVPComplexButton(undefined, undefined, undefined, undefined, true, undefined, undefined, undefined,
					"<span class='fwdicon fwdicon-fullscreen'></span>",
					"<span class='fwdicon fwdicon-normalscreen'></span>",
					"UVPMainButtonsNormalState",
					"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPComplexButton.setPrototype();
				_s.fullScreenButton_do = new FWDUVPComplexButton(
						_s.fullScreenN_img,
						_d.fullScreenSPath_str,
						_s.normalScreenN_img,
						_d.normalScreenSPath_str,
						true,
						_s.useHEX,
						_s.nBC,
						_s.sBC
				);
			}
			
			_s.buttons_ar.push(_s.fullScreenButton_do);
			_s.fullScreenButton_do.setY(parseInt((_s.sH - _s.fullScreenButton_do.buttonHeight)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.fullScreenButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.fullScreenButton_do.setY(parseInt((_s.sH - _s.fullScreenButton_do.buttonHeight)/2));
				}
			}, 50);

			_s.fullScreenButton_do.screen.className = 'fwduvp-fullscreen-button';
			_s.fullScreenButton_do.addListener(FWDUVPComplexButton.SHOW_TOOLTIP, _s.fullscreenButtonShowToolTipHandler);
			_s.fullScreenButton_do.addListener(FWDUVPComplexButton.MOUSE_UP, _s.fullScreenButtonMouseUpHandler);
			_s.mainHld.addChild(_s.fullScreenButton_do);
		};
		
		_s.fullscreenButtonShowToolTipHandler = function(e){
			_s.showToolTip(_s.fullScreenButton_do, _s.fullscreenButtonToolTip_do, e.e);
		};
		
		_s.showFullScreenButton = function(){
			if(!_s.fullScreenButton_do) return;
			_s.fullScreenButton_do.setButtonState(1);
		};
		
		_s.showNormalScreenButton = function(){
			if(!_s.fullScreenButton_do) return;
			_s.fullScreenButton_do.setButtonState(0);
		};
		
		_s.setNormalStateToFullScreenButton = function(){
			if(!_s.fullScreenButton_do) return;
			_s.fullScreenButton_do.setNormalState(true);
			_s.hideQualityButtons(false);
		};
		
		_s.fullScreenButtonMouseUpHandler = function(){
			if(_s.fullscreenButtonToolTip_do) _s.fullscreenButtonToolTip_do.hide();
			if(_s.fullScreenButton_do.currentState == 1){
				_s.dispatchEvent(FWDUVPController.FULL_SCREEN);
			}else{
				_s.dispatchEvent(FWDUVPController.NORMAL_SCREEN);
			}
		};

		
		//########################################//
		/* Setup time*/
		//########################################//
		_s.setupTime = function(){
			_s.time_do = new FWDUVPDisplayObject("div");
			_s.time_do.screen.className = 'fwduvp-time';
			_s.time_do.hasTransform3d_bl = false;
			_s.time_do.hasTransform2d_bl = false;
			_s.time_do.setBackfaceVisibility();
			_s.time_do.getStyle().fontFamily = "Arial";
			_s.time_do.getStyle().fontSize= "12px";
			_s.time_do.getStyle().whiteSpace= "nowrap";
			_s.time_do.getStyle().textAlign = "center";
			_s.time_do.getStyle().color = _s.timeColor_str;
			_s.time_do.getStyle().fontSmoothing = "antialiased";
			_s.time_do.getStyle().webkitFontSmoothing = "antialiased";
			_s.time_do.getStyle().textRendering = "optimizeLegibility";	
			_s.mainHld.addChild(_s.time_do);
			_s.updateTime("00:00/00:00");
			_s.buttons_ar.push(_s.time_do);
		};
		
		_s.updateTime = function(time){
			if(!_s.time_do) return;
			if(_s.isLive) time = time.substr(0, time.indexOf("/"));
			_s.time_do.setInnerHTML(time);
			
			if(_s.lastTimeLength != time.length){
				_s.time_do.w = _s.time_do.getWidth();
				_s.positionButtons();
				
				setTimeout(function(){
					_s.time_do.w = _s.time_do.getWidth();
					_s.time_do.h = _s.time_do.getHeight();
					_s.time_do.setY(parseInt((_s.sH - _s.time_do.h)/2) + 1 + _s.timeOffsetTop);
					_s.positionButtons();
				}, 50);
				_s.lastTimeLength = time.length;
			}
		};

		
		//##########################################//
		/* Setup facebook button */
		//##########################################//
		_s.setupRewindButton = function(){
			
			if(_s.useVectorIcons_bl){				
				FWDUVPSimpleButton.setPrototype();
				_s.rewindButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-10'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.rewindButton_do = new FWDUVPSimpleButton(
						_d.rewindN_img,
						_d.rewindSPath_str,
						undefined,
						true,
						_s.useHEX,
						_s.nBC,
						_s.sBC
				);
			}
			
			_s.rewindButton_do.screen.className = 'fwduvp-rewind-button';
			_s.buttons_ar.push(_s.rewindButton_do);
			_s.rewindButton_do.setY(parseInt((_s.sH - _s.rewindButton_do.h)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.rewindButton_do.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.rewindButton_do.setY(parseInt((_s.sH - _s.rewindButton_do.buttonHeight)/2));
				}
			}, 50);
			_s.rewindButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.rewindButtonMouseUpHandler);
			_s.mainHld.addChild(_s.rewindButton_do);
		};
	
		_s.rewindButtonMouseUpHandler = function(){
			_s.dispatchEvent(FWDUVPController.REWIND);
		};
		
		_s.disableRewindButton = function(){
			if(_s.rewindButton_do) _s.rewindButton_do.disable();
		}
		
		_s.enableRewindButton = function(){
			if(_s.rewindButton_do) _s.rewindButton_do.enable();
		}
		

		//##########################################//
		/* Setup volume button */
		//#########################################//
		_s.setupVolumeButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPVolumeButton.setPrototype();
				_s.volBtn = new FWDUVPVolumeButton(undefined, undefined, undefined, undefined, undefined, undefined,
					"<span class='fwdicon fwdicon-sound'></span>",
					"<span class='fwdicon fwdicon-sound-off'></span>",
					"UVPMainButtonsNormalState volume",
					"UVPMainButtonsSelectedState volume"
				);
			}else{
				FWDUVPVolumeButton.setPrototype();
				_s.volBtn = new FWDUVPVolumeButton(_s.volumeN_img, _d.volumeSPath_str, _d.volumeDPath_str, _s.useHEX,
						_s.nBC,
						_s.sBC);
			}
			_s.volBtn.addListener(FWDUVPVolumeButton.SHOW_TOOLTIP, _s.volumeButtonShowTooltipHandler);
			_s.volBtn.addListener(FWDUVPVolumeButton.MOUSE_OVER, _s.volumeOnMouseOverHandler);;
			_s.volBtn.addListener(FWDUVPVolumeButton.MOUSE_UP, _s.volumeOnMouseUpHandler);
			_s.volBtn.setY(parseInt((_s.sH - _s.volBtn.h)/2));
			var checkIconInterval = setInterval(function(){
				if(_s.volBtn.buttonHeight > 0){
					clearInterval(checkIconInterval);
					_s.volBtn.setY(parseInt((_s.sH - _s.volBtn.buttonHeight)/2));
				}
			}, 50);
			_s.buttons_ar.push(_s.volBtn);
			_s.mainHld.addChild(_s.volBtn); 
			if(_s.volume == 0) _s.volBtn.setDisabledState();
		};
		
		_s.volumeButtonShowTooltipHandler = function(e){};
		
		_s.hideMainScrubberTop = function(){
			if(_s.isMainScrubberOnTop_bl){
				FWDAnimation.to(_s.mainScrubber_do, .4, {alpha:0, onComplete:function(){_s.mainScrubber_do.setX(-5000);}});
			}
		}
		
		_s.showMainScrubberOnTop = function(){
			if(_s.isMainScrubberOnTop_bl){
				_s.mainScrubber_do.setX(0);
				FWDAnimation.to(_s.mainScrubber_do, .6, {alpha:1});
			}
		}
		
		_s.volumeOnMouseOverHandler = function(){
			_s.showVolumeScrubber(true);
			_s.hideQualityButtons(true);
			_s.hideSubtitleButtons(true);
			_s.hideATBButtons(true);
			_s.hidePlaybackRateButtons(true);
			_s.hideMainScrubberTop();
		};
		
		_s.volumeOnMouseUpHandler = function(){
			var vol = _s.lastVolume;
			if(_s.isMbl){
				if(!_s.isVolumeScrubberShowed_bl){
					_s.volumeOnMouseOverHandler();
				}
				return;
			}

			if(_s.muted){
				vol = _s.lastVolume;
				_s.muted = false;
			}else{
				vol = 0.000001;
				_s.muted = true;
			};
			_s.updateVolume(vol);
		};
		

		//################################################//
		/* Setup volume scrubber */
		//################################################//
		_s.setupVolumeScrubber = function(){
			
			//setup background bar
			_s.volumeScrubberHolder_do = new FWDUVPDisplayObject("div");
			
			if(_s.repeatBackground_bl){
				_s.volumeBk_do = new FWDUVPDisplayObject("div");
				_s.volumeBk_do.getStyle().background = "url('" + _s.controllerBkPath_str +  "')";
			}else{
				_s.volumeBk_do = new FWDUVPDisplayObject("img");
				var volumeBk_img = new Image();
				volumeBk_img.src = _s.controllerBkPath_str;
				_s.volumeBk_do.setScreen(volumeBk_img);
			}
			_s.volumeScrubberHolder_do.addChild(_s.volumeBk_do);

			_s.volumeScrubber_do = new FWDUVPDisplayObject("div");
			_s.volumeScrubber_do.setHeight(_s.mainScrbH);
			_s.volumeScrubber_do.setY(parseInt(_s.volumeScrubberOfsetHeight/2));
			
			var volumeScrubberBkBottom_img = new Image();
			volumeScrubberBkBottom_img.src = _d.volumeScrubberBkBottomPath_str;
			_s.volumeScrubberBkBottom_do = new FWDUVPDisplayObject("img");
			_s.volumeScrubberBkBottom_do.setScreen(volumeScrubberBkBottom_img);
			_s.volumeScrubberBkBottom_do.setWidth(_s.mainScrubberBkLeft_img.height);
			_s.volumeScrubberBkBottom_do.setHeight(_s.mainScrubberBkLeft_img.width);
			_s.volumeScrubberBkBottom_do.setY(_s.volumeScrubberHeight - _s.volumeScrubberOfsetHeight - _s.volumeScrubberBkBottom_do.h);
		
			var volumeScrubberBkTop_img = new Image();
			volumeScrubberBkTop_img.src = _d.volumeScrubberBkTopPath_str;
			_s.volumeScrubberBkTop_do = new FWDUVPDisplayObject("img");
			
			_s.volumeScrubberBkTop_do.setScreen(volumeScrubberBkTop_img);
			_s.volumeScrubberBkTop_do.setWidth(_s.volumeScrubberBkBottom_do.w);
			_s.volumeScrubberBkTop_do.setHeight(_s.volumeScrubberBkBottom_do.h);
			
			var middleImage = new Image();
			middleImage.src = _d.volumeScrubberBkMiddlePath_str;
			
			if(_s.isMbl){
				_s.volumeScrubberBkMiddle_do = new FWDUVPDisplayObject("div");	
				_s.volumeScrubberBkMiddle_do.getStyle().background = "url('" + _s.volumeScrubberBkMiddlePath_str + "') repeat-y";
			}else{
				_s.volumeScrubberBkMiddle_do = new FWDUVPDisplayObject("img");
				_s.volumeScrubberBkMiddle_do.setScreen(middleImage);
			}
			
			_s.volumeScrubberBkMiddle_do.setWidth(_s.volumeScrubberBkBottom_do.w);
			_s.volumeScrubberBkMiddle_do.setHeight((_s.volumeScrubberHeight - _s.volumeScrubberOfsetHeight) - _s.volumeScrubberBkTop_do.h * 2);
			_s.volumeScrubberBkMiddle_do.setY(_s.volumeScrubberBkTop_do.h);
			
			//setup darg bar.
			_s.volumeScrubberDrag_do = new FWDUVPDisplayObject("div");
			_s.volumeScrubberDrag_do.setWidth(_s.volumeScrubberBkBottom_do.w);
			
			if(_s.useHEX){
				_s.volumeScrubberDragBottom_do = new FWDUVPDisplayObject("div");
				_s.volumeScrubberDragBottom_do.setWidth(_s.volumeScrubberDragBottom_img.width);
				_s.volumeScrubberDragBottom_do.setHeight(_s.volumeScrubberDragBottom_img.height);
				_s.volumeScrubberDragBottom_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.volumeScrubberDragBottom_img, _s.nBC).canvas;
				_s.volumeScrubberDragBottom_do.screen.appendChild(_s.volumeScrubberDragBottom_canvas);	
			}else{
				_s.volumeScrubberDragBottom_do = new FWDUVPDisplayObject("img");
				_s.volumeScrubberDragBottom_do.setScreen(_s.volumeScrubberDragBottom_img);
			}
		
			_s.volumeScrubberDragBottom_do.setWidth(_s.mainScrubberDragLeft_img.height);
			_s.volumeScrubberDragBottom_do.setHeight(_s.mainScrubberDragLeft_img.width);
			_s.volumeScrubberDragBottom_do.setY(_s.volumeScrubberHeight - _s.volumeScrubberOfsetHeight - _s.volumeScrubberDragBottom_do.h);
			
			
			_s.middleImage = new Image();
			_s.middleImage.src = _s.volumeScrubberDragMiddlePath_str;
			
			if(_s.useHEX){
				_s.volumeScrubberDragMiddle_do = new FWDUVPDisplayObject("div");
				_s.middleImage.onload = function(){
					_s.volumeScrubberDragMiddle_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.middleImage, _s.nBC, true);
					_s.volumeScrubberDragImage_img = _s.volumeScrubberDragMiddle_canvas.image;
					_s.volumeScrubberDragMiddle_do.getStyle().background = "url('" + _s.volumeScrubberDragImage_img.src + "') repeat-y";
				}
			}else{
				_s.volumeScrubberDragMiddle_do = new FWDUVPDisplayObject("img");
				_s.volumeScrubberDragMiddle_do.setScreen(_s.middleImage);
			}
			
			_s.volumeScrubberDragMiddle_do.setWidth(_s.volumeScrubberDragBottom_do.w);
			_s.volumeScrubberDragMiddle_do.setHeight(_s.volumeScrubberHeight);
			
			var volumeScrubberBarLine_img = new Image();
			volumeScrubberBarLine_img.src = _d.volumeScrubberLinePath_str;
			_s.volumeScrubberBarLine_do = new FWDUVPDisplayObject("img");
			_s.volumeScrubberBarLine_do.setScreen(volumeScrubberBarLine_img);
			_s.volumeScrubberBarLine_do.setWidth(_s.mainScrubberLine_img.height);
			_s.volumeScrubberBarLine_do.setHeight(_s.mainScrubberLine_img.width);
			_s.volumeScrubberBarLine_do.setAlpha(0);
			_s.volumeScrubberBarLine_do.hasTransform3d_bl = false;
			_s.volumeScrubberBarLine_do.hasTransform2d_bl = false;
			_s.volumeScrubberHolder_do.setWidth(_s.volScrbW);
			_s.volumeScrubberHolder_do.setHeight(_s.volumeScrubberHeight + _s.sH);
			_s.volumeBk_do.setWidth(_s.volScrbW);
			_s.volumeBk_do.setHeight(_s.volumeScrubberHeight + _s.sH);
			_s.volumeScrubber_do.setWidth(_s.volScrbW);
			_s.volumeScrubber_do.setHeight(_s.volumeScrubberHeight - _s.volumeScrubberOfsetHeight);
			
			//add all children
			_s.volumeScrubber_do.addChild(_s.volumeScrubberBkBottom_do);
			_s.volumeScrubber_do.addChild(_s.volumeScrubberBkMiddle_do);
			_s.volumeScrubber_do.addChild(_s.volumeScrubberBkTop_do);
			_s.volumeScrubber_do.addChild(_s.volumeScrubberBarLine_do);
			_s.volumeScrubber_do.addChild(_s.volumeScrubberDragBottom_do);
			_s.volumeScrubberDrag_do.addChild(_s.volumeScrubberDragMiddle_do);
			_s.volumeScrubber_do.addChild(_s.volumeScrubberDrag_do);
			_s.volumeScrubber_do.addChild(_s.volumeScrubberBarLine_do);
			_s.volumeScrubberHolder_do.addChild(_s.volumeScrubber_do);
		
			_s.addChild(_s.volumeScrubberHolder_do);
			
			if(_s.isMbl){
				if(_s.hasPointerEvent_bl){
					_s.volumeScrubber_do.screen.addEventListener("pointerover", _s.volumeScrubberOnOverHandler);
					_s.volumeScrubber_do.screen.addEventListener("pointerout", _s.volumeScrubberOnOutHandler);
					_s.volumeScrubber_do.screen.addEventListener("pointerdown", _s.volumeScrubberOnDownHandler);
				}else{
					_s.volumeScrubber_do.screen.addEventListener("touchstart", _s.volumeScrubberOnDownHandler);
				}
			}else if(_s.screen.addEventListener){	
				_s.volumeScrubber_do.screen.addEventListener("mouseover", _s.volumeScrubberOnOverHandler);
				_s.volumeScrubber_do.screen.addEventListener("mouseout", _s.volumeScrubberOnOutHandler);
				_s.volumeScrubber_do.screen.addEventListener("mousedown", _s.volumeScrubberOnDownHandler);
			}
			
			_s.enableVolumeScrubber();
			_s.updateVolumeScrubber(_s.volume);
		};
		
		_s.volumeScrubberOnOverHandler =  function(e){
			if(_s.isVolumeScrubberDisabled_bl) return;
		};
		
		_s.volumeScrubberOnOutHandler =  function(e){
			if(_s.isVolumeScrubberDisabled_bl) return;
		};
		
		_s.volumeScrubberOnDownHandler =  function(e){
			if(_s.isVolumeScrubberDisabled_bl || e.button == 2) return;
			if(e.preventDefault) e.preventDefault();
			_s.volumeScrubberIsDragging_bl = true;
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			var localY = vc.screenY - _s.volumeScrubber_do.getGlobalY();
			prt.showDisable();
			if(localY < 0){
				localY = 0;
			}else if(localY > _s.volumeScrubber_do.h - _s.scrubbersOffsetWidth){
				localY = _s.volumeScrubber_do.h - _s.scrubbersOffsetWidth;
			}
			var percentScrubbed = 1 - localY/_s.volumeScrubber_do.h;

			_s.lastVolume = percentScrubbed;
			_s.updateVolume(percentScrubbed);
			
			if(_s.isMbl){
				if(_s.hasPointerEvent_bl){
					window.addEventListener("MSPointerMove", _s.volumeScrubberMoveHandler);
					window.addEventListener("pointerup", _s.volumeScrubberEndHandler);
				}else{
					window.addEventListener("touchmove", _s.volumeScrubberMoveHandler, {passive:false});
					window.addEventListener("touchend", _s.volumeScrubberEndHandler);
				}
			}else{
				window.addEventListener("mousemove", _s.volumeScrubberMoveHandler);
				window.addEventListener("mouseup", _s.volumeScrubberEndHandler);		
			}
		};
		
		_s.volumeScrubberMoveHandler = function(e){
			if(_s.isVolumeScrubberDisabled_bl) return;
			if(e.preventDefault) e.preventDefault();
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			var localY = vc.screenY - _s.volumeScrubber_do.getGlobalY();
			
			if(localY < _s.scrubbersOffsetWidth){
				localY = _s.scrubbersOffsetWidth;
			}else if(localY > _s.volumeScrubber_do.h){
				localY = _s.volumeScrubber_do.h;
			}
			var percentScrubbed = 1 - localY/_s.volumeScrubber_do.h;
		
			_s.lastVolume = percentScrubbed;
			_s.updateVolume(percentScrubbed);
		};
		
		_s.volumeScrubberEndHandler = function(){
			prt.hideDisable();
			_s.volumeScrubberIsDragging_bl = false;
			if(_s.isMbl){
				if(_s.hasPointerEvent_bl){
					window.removeEventListener("MSPointerMove", _s.volumeScrubberMoveHandler);
					window.removeEventListener("pointerup", _s.volumeScrubberEndHandler);
				}else{
					window.removeEventListener("touchmove", _s.volumeScrubberMoveHandler);
					window.removeEventListener("touchend", _s.volumeScrubberEndHandler);
				}
			}else{
				window.removeEventListener("mousemove", _s.volumeScrubberMoveHandler);
				window.removeEventListener("mouseup", _s.volumeScrubberEndHandler);		
			}
		};
		
		_s.disableVolumeScrubber = function(){
			_s.isVolumeScrubberDisabled_bl = true;
			_s.volumeScrubber_do.setButtonMode(false);
			_s.volumeScrubberEndHandler();
		};
		
		_s.enableVolumeScrubber = function(){
			_s.isVolumeScrubberDisabled_bl = false;
			_s.volumeScrubber_do.setButtonMode(true);
		};
		
		_s.updateVolumeScrubber = function(percent){
			var totalHeight = _s.volumeScrubberHeight - _s.volumeScrubberOfsetHeight;
			var finalHeight = Math.round(percent * totalHeight); 
			
			_s.volumeScrubberDrag_do.setHeight(Math.max(0,finalHeight - _s.volumeScrubberDragBottom_do.h));
			_s.volumeScrubberDrag_do.setY(totalHeight - finalHeight);
		
			if(finalHeight < 1 && _s.isVolumeScrubberLineVisible_bl){
				_s.isVolumeScrubberLineVisible_bl = false;
				FWDAnimation.to(_s.volumeScrubberBarLine_do, .5, {alpha:0});
				FWDAnimation.to(_s.volumeScrubberDragBottom_do, .5, {alpha:0});
			}else if(finalHeight > 1 && !_s.isVolumeScrubberLineVisible_bl){
				_s.isVolumeScrubberLineVisible_bl = true;
				FWDAnimation.to(_s.volumeScrubberBarLine_do, .5, {alpha:1});
				FWDAnimation.to(_s.volumeScrubberDragBottom_do, .5, {alpha:1});
			}
			
			if(finalHeight > totalHeight) finalHeight = totalHeight;
			
			FWDAnimation.to(_s.volumeScrubberBarLine_do, .8, {y:totalHeight - finalHeight - 2, ease:Expo.easeOut});
		};
		
		_s.updateVolume = function(volume, preventEvent){
			if(!_s.showVolumeScrubber_bl) return;
			_s.volume = volume;
			if(_s.volume <= 0.000001){
				_s.muted = true;
				_s.volume = 0;
			}else if(_s.voume >= 1){
				_s.muted = false;
				_s.volume = 1;
				prt.removeAPT();
			}else{
				_s.muted = false;
				prt.removeAPT();
			}
			
			if(_s.volume == 0){
				if(_s.volBtn) _s.volBtn.setDisabledState();
			}else{
				if(_s.volBtn) _s.volBtn.setEnabledState();
			}
			
			if(_s.volumeScrubberBarLine_do) _s.updateVolumeScrubber(_s.volume);
			if(!preventEvent) _s.dispatchEvent(FWDUVPController.CHANGE_VOLUME, {percent:_s.volume});
		};
		
		_s.showVolumeScrubber = function(animate){
			if(_s.isVolumeScrubberShowed_bl) return;
			_s.isVolumeScrubberShowed_bl = true;
			var finalY = - _s.volumeScrubberHolder_do.h + _s.h;
			_s.volumeScrubberHolder_do.setVisible(true);
			
			if(_s.isMbl){
				setTimeout(function(){
					window.addEventListener("touchstart", _s.hideVolumeSchubberOnMoveHandler);
				},50);
			}else{
				window.addEventListener("mousemove", _s.hideVolumeSchubberOnMoveHandler);
			}
			
			_s.volumeScrubberHolder_do.setX(parseInt(_s.volBtn.x + (_s.volBtn.w - _s.volumeScrubberHolder_do.w)/2));
			
			if(animate){
				FWDAnimation.to(_s.volumeScrubberHolder_do, .6, {y:finalY, ease:Expo.easeInOut});
			}else{
				FWDAnimation.killTweensOf(_s.volumeScrubberHolder_do);
				_s.volumeScrubberHolder_do.setY(finalY);
			}
		};
		
		_s.hideVolumeSchubberOnMoveHandler = function(e){
			
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			
			if((FWDUVPUtils.hitTest(_s.volumeScrubberHolder_do.screen, vc.screenX, vc.screenY)
			   || FWDUVPUtils.hitTest(_s.volBtn.screen, vc.screenX, vc.screenY)
			 ) && !_s.isMbl){
				return;
			}
			
			if(FWDUVPUtils.hitTest(_s.volumeScrubber_do.screen, vc.screenX, vc.screenY) && _s.isMbl){
				return;
			}
			
			if(_s.volumeScrubberIsDragging_bl) return;
		
			_s.hideVolumeScrubber(true);
			if(_s.isMainScrubberOnTop_bl){
				_s.mainScrubber_do.setX(0);
				FWDAnimation.to(_s.mainScrubber_do, .6, {alpha:1});
			}
		};
	
		_s.hideVolumeScrubber = function(animate){
			if(!_s.isVolumeScrubberShowed_bl) return;
			_s.isVolumeScrubberShowed_bl = false;
			
			_s.volBtn.setNormalState(true);
			if(animate){
				FWDAnimation.to(_s.volumeScrubberHolder_do, .6, {y:prt.sH, ease:Expo.easeInOut, onComplete:function(){_s.volumeScrubberHolder_do.setVisible(false);}});
			}else{
				FWDAnimation.killTweensOf(_s.ytbButtonsHolder_do);
				_s.volumeScrubberHolder_do.setY(prt.sH);
				_s.volumeScrubberHolder_do.setVisible(false);
			}
			
			if(_s.isMbl){
				window.removeEventListener("touchstart", _s.hideVolumeSchubberOnMoveHandler);
			}else{
				window.removeEventListener("mousemove", _s.hideVolumeSchubberOnMoveHandler);
			}
		};

		
		//###################################//
		/* show / hide */
		//###################################//
		_s.show = function(animate){
			if(_s.isShowed_bl) return;
			_s.isShowed_bl = true;

			_s.setX(0);
			if(animate){
				FWDAnimation.to(_s.mainHld, .8, {y:0, ease:Expo.easeInOut});
			}else{
				FWDAnimation.killTweensOf(_s.mainHld);
				_s.mainHld.setY(0);
			}

			_s.disableCtrl_to = setTimeout(function(){
				_s.positionButtons();
				_s.getStyle().pointerEvents = 'auto';
			}, 200);

		};
		
		_s.hide = function(animate, offset){

			if(!_s.isShowed_bl) return;
			if(!offset) offset = 0;
			if(_s.atb && _s.atb.isShowed_bl) offset += _s.h + 1;
			if(_s.isMainScrubberOnTop_bl  && _s.atb && _s.atb.isShowed_bl) offset += _s.mainScrubberOffestTop;
			if(!_d.showScrubberWhenControllerIsHidden_bl) offset +=_s.mainScrubber_do.h - 14;
			_s.isShowed_bl = false;
			clearTimeout(_s.disableCtrl_to);
			_s.getStyle().pointerEvents = 'none';
			
			if(animate){
				FWDAnimation.to(_s.mainHld, .8, {y:_s.sH + offset, ease:Expo.easeInOut});
			}else{
				FWDAnimation.killTweensOf(_s.mainHld);
				_s.mainHld.setY(_s.sH + offset);
			}

			_s.hideQualityButtons(true);
			_s.hideSubtitleButtons(true);
			_s.hideATBButtons(true);
			_s.hidePlaybackRateButtons(true);
		};
		
		_s.mainScrubberDragMiddleAddPath_str = _d.mainScrubberDragMiddleAddPath_str;
		_s.updateHexColorForScrubber = function(isAdd){
			if(isAdd){
				_s.mainScrubberDragMiddle_do.getStyle().background = "url('" + _s.mainScrubberDragMiddleAddPath_str + "') repeat-x";
				_s.mainScrubberDragLeft_do.screen.src = _d.mainScrubberDragLeftAddPath_str;
			}else{
				if(_s.useHEX && _s.mainSCrubberMiddleCanvas){
					var newCenterImage = FWDUVPUtils.changeCanvasHEXColor(_s.mainScrubberMiddleImage, _s.mainSCrubberMiddleCanvas, _s.nBC, true);
					_s.mainScrubberDragMiddle_do.getStyle().background = "url('" + newCenterImage.src + "') repeat-x";
				}else{
					_s.mainScrubberDragMiddle_do.getStyle().background = "url('" + _s.mainScrubberDragMiddlePath_str + "') repeat-x";
					_s.mainScrubberDragLeft_do.screen.src = _s.mainScrubberDragLeftSource;
				}
			}
		}

		_s.updateHEXColors = function(nBC, sBC){
		 	_s.nBC = nBC;
            _s.sBC = sBC;
		}
	
		_s.init();
	};

	
	/* set prototype */
	FWDUVPController.setPrototype = function(){
		FWDUVPController.prototype = new FWDUVPDisplayObject("div");
	};
	

	FWDUVPController.VR = 'vr';
	FWDUVPController.UNCAST = 'uncast';
	FWDUVPController.CAST = 'cast';	
	FWDUVPController.SHOW_SHARE_WINDOW = "showShareWindow";
	FWDUVPController.SHOW_SUBTITLE = "showSubtitle";
	FWDUVPController.HIDE_SUBTITLE = "hideSubtitle";
	FWDUVPController.SHOW_PLAYLIST = "showPlaylist";
	FWDUVPController.HIDE_PLAYLIST = "hidePlaylist";
	FWDUVPController.SHOW_CATEGORIES = "showCategories";
	FWDUVPController.DOWNLOAD_VIDEO = "downloadVideo";
	FWDUVPController.UNCAST = 'uncast';
	FWDUVPController.REWIND = "rewind";
	FWDUVPController.FULL_SCREEN = "fullScreen";
	FWDUVPController.NORMAL_SCREEN = "normalScreen";
	FWDUVPController.PLAY = "play";
	FWDUVPController.PAUSE = "pause";
	FWDUVPController.START_TO_SCRUB = "startToScrub";
	FWDUVPController.SCRUB = "scrub";
	FWDUVPController.STOP_TO_SCRUB = "stopToScrub";
	FWDUVPController.CHANGE_VOLUME = "changeVolume";
	FWDUVPController.CHANGE_YOUTUBE_QUALITY = "changeYoutubeQuality";
	FWDUVPController.SHOW_EMBED_WINDOW = "showEmbedWindow";
	FWDUVPController.SHOW_INFO_WINDOW = "showInfoWindow";
	FWDUVPController.CHANGE_SUBTITLE = "changeSubtitle";
	FWDUVPController.CHANGE_PLAYBACK_RATES = "changePlaybackRate";
	FWDUVPController.CHANGE_AUDIO_TRACKS = 'changeAudioTracks';
	
	FWDUVPController.prototype = null;
	window.FWDUVPController = FWDUVPController;
	
}());/**
 * Easy Video Player PACKAGED v8.4
 * Data.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function(window){
	
	var FWDUVPData = function(props, playListElement, prt){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPData.prototype;

		_s.props = props;
		_s.skinPaths_ar = [];
		_s.images_ar = [];
		_s.cats_ar = [];
		_s.catsRef_ar = [];
	
		_s.controllerHeight = 0;
		_s.countLoadedSkinImages = 0;
		_s.volume = 1;
		_s.controllerHideDelay = 0;
		_s.startSpaceBetweenButtons = 0;
		_s.spaceBetweenButtons = 0;
		_s.scrubbersOffsetWidth = 0;
		_s.volumeScrubberOffsetTopWidth = 0;
		_s.timeOffsetLeftWidth = 0;
		_s.timeOffsetTop = 0;
		_s.logoMargins = 0;
		_s.startAtPlaylist = 0;
		_s.startAtVideo = 0;
		_s.playlistBottomHeight = 0;
		_s.maxPlaylistItems = 0;
		_s.totalPlaylists = 0;
		_s.thumbnailMaxWidth = 0; 
		_s.buttonsMargins = 0;
		_s.nextAndPrevSetButtonsMargins = 0;
		_s.thumbnailMaxHeight = 0;
		_s.horizontalSpaceBetweenThumbnails = 0;
		_s.verticalSpaceBetweenThumbnails = 0;
		_s.buttonsToolTipHideDelay = 0;
		_s.thumbnailWidth = 0;
		_s.thumbnailHeight = 0;
		_s.timeOffsetTop = 0;
		_s.embedWindowCloseButtonMargins = 0;
		_s.plsCache_ar = [];
		
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
	

		//###################################//
		/*init*/
		//###################################//
		_s.init = function(){
			_s.parseProperties();
		};
		

		//#############################################//
		// parse properties.
		//#############################################//
		_s.parseProperties = function(){
			
			_s.useHEX = _s.props.useHEXColorsForSkin; 
			_s.useHEX = _s.useHEX == "yes" ? true : false;
			if(location.protocol.indexOf("file:") != -1) _s.useHEX = false;
			
			_s.categoriesId_str = _s.props.playlistsId;
			if(!_s.categoriesId_str){
				setTimeout(function(){
					if(_s == null) return;
					var errorMessage_str = "The <font color='#ff0000'>playlistsId</font> property is not defined in the constructor function!";
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:errorMessage_str});
				}, 50);
				return;
			}
				
			_s.mainFolderPath_str = _s.props.mainFolderPath;
			if(!_s.mainFolderPath_str){
				setTimeout(function(){
					if(_s == null) return;
					var errorMessage_str = "The <font color='#ff0000'>mainFolderPath</font> property is not defined in the constructor function!";
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:errorMessage_str});
				}, 50);
				return;
			}
			
			if((_s.mainFolderPath_str.lastIndexOf("/") + 1) != _s.mainFolderPath_str.length){
				_s.mainFolderPath_str += "/";
			}
			
			_s.sknPth = _s.props.skinPath;
			if(!_s.sknPth){
				setTimeout(function(){
					if(_s == null) return;
					var errorMessage_str = "The <font color='#ff0000'>skinPath</font> property is not defined in the constructor function!";
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:errorMessage_str});
				}, 50);
				return;
			}
			
			if((_s.sknPth.lastIndexOf("/") + 1) != _s.sknPth.length){
				_s.sknPth += "/";
			}
		
			_s.sknPth = _s.mainFolderPath_str + _s.sknPth;
			_s.flashPath_str = _s.mainFolderPath_str + "flashlsChromeless.swf";
			_s.flashCopyToCBPath_str = _s.mainFolderPath_str + "cb.swf";
			_s.proxyPath_str =  _s.mainFolderPath_str + "proxy.php";
			_s.proxyFolderPath_str = _s.mainFolderPath_str  + "proxyFolder.php";
			_s.mailPath_str = _s.mainFolderPath_str  + "sendMail.php";
			_s.sendToAFriendPath_str = _s.mainFolderPath_str  + "sendMailToAFriend.php";
			_s.videoDownloaderPath_str = _s.mainFolderPath_str  + "downloader.php";
			window.fwduvpSendMailNonce = _s.props.sendMailNonce || window.fwduvpSendMailNonce || "";
			window.fwduvpDownloadNonce = _s.props.downloadNonce || window.fwduvpDownloadNonce || "";
			window.fwduvpVimeoNonce = _s.props.vimeoNonce || window.fwduvpVimeoNonce || "";
			if(window.fwduvpSendMailNonce){
				_s.sendToAFriendPath_str += "?fwduvp_nonce=" + encodeURIComponent(window.fwduvpSendMailNonce);
			}
			
			_s.handPath_str = _s.sknPth + "hand.cur";
			_s.grabPath_str = _s.sknPth + "grab.cur";
			if(_s.sknPth.indexOf('white') != -1){
				_s.isWhite = true;
			}
			
			_s.categories_el = document.getElementById(_s.categoriesId_str);
			
			if(!_s.categories_el){
				setTimeout(function(){
					if(_s == null) return;
					var errorMessage_str = "The playlist with the id <font color='#ff0000'>" + _s.categoriesId_str + "</font> is not found!";
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:errorMessage_str});
				}, 50);
				return;
			}
			
			var catsChildren_ar = FWDUVPUtils.getChildren(_s.categories_el);
			_s.totalCats = catsChildren_ar.length;	
			
			if(_s.totalCats == 0){
				setTimeout(function(){
					if(_s == null) return;
					var errorMessage_str = "At least one playlist is required!";
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:errorMessage_str});
				}, 50);
				return;
			}
			
			
			for(var i=0; i<_s.totalCats; i++){
				var obj = {};
				
				var cat_el = null;
				var child = catsChildren_ar[i];
				
				if(!FWDUVPUtils.hasAttribute(child, "data-source")){
					setTimeout(function(){
						if(_s == null) return;
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Attribute <font color='#ff0000'>data-source</font> is required in the plalists html element at position <font color='#ff0000'>" + (i + 1)});
					}, 50);
					return;
				}
				
				if(!FWDUVPUtils.hasAttribute(child, "data-thumbnail-path")){
					setTimeout(function(){
						if(_s == null) return;
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Attribute <font color='#ff0000'>data-thumbnail-path</font> is required in the playlists html element at position <font color='#ff0000'>" + (i + 1)});
					}, 50);
					return;
				}
				
				obj.source = FWDUVPUtils.getAttributeValue(child, "data-source");
				if(obj.source.indexOf("=") == -1 && obj.source.indexOf(".xml") == -1 && obj.source.indexOf("vimeo.com") == -1 && obj.source.indexOf("youtube.") == -1){
					cat_el = document.getElementById(obj.source);
				}else{
					cat_el = obj.source;
				}

				_s.catsRef_ar.push(cat_el);
				
				obj.thumbnailPath = FWDUVPUtils.getAttributeValue(child, "data-thumbnail-path");
			
				obj.htmlContent = child.innerHTML;
				obj.htmlText_str = child.innerText;
				obj.vimeoUserId = FWDUVPUtils.getAttributeValue(child, "data-user-id");
				
				obj.clientId = FWDUVPUtils.getAttributeValue(child, "data-client-id");
				obj.vimeoSecret = FWDUVPUtils.getAttributeValue(child, "data-vimeo-secret");
				obj.vimeoToken = FWDUVPUtils.getAttributeValue(child, "data-vimeo-token");

				if(FWDUVPUtils.hasAttribute(child, "data-playlist-name")){
					obj.playlistName =  FWDUVPUtils.getAttributeValue(child, "data-playlist-name");
				}else{
					obj.playlistName = "not defined!";
				};

				obj.pass =  FWDUVPUtils.getAttributeValue(child, "data-password");	

				_s.cats_ar[i] = obj;
			}
			
			for(var i=0; i<_s.totalCats; i++){
				var obj = {};
				var cat_el = null;
				child = catsChildren_ar[i];	
				cat_el = document.getElementById(FWDUVPUtils.getAttributeValue(child, "data-source"));
			}
		
			_s.startAtPlaylist = _s.props.startAtPlaylist || 0;
			if(isNaN(_s.startAtPlaylist)) _s.startAtPlaylist = 0;
			if(_s.startAtPlaylist < 0){
				_s.startAtPlaylist = 0;
			}else if(_s.startAtPlaylist > _s.totalCats - 1){
				_s.startAtPlaylist = _s.totalCats - 1;
			}
			
			_s.playlistBottomHeight = _s.props.playlistBottomHeight || 0;
			_s.playlistBottomHeight = Math.min(800, _s.playlistBottomHeight);
			
			_s.subtitlesOffLabel_str = _s.props.subtitlesOffLabel || "Subtitle off";
		
			_s.videoSourcePath_str = _s.props.videoSourcePath || undefined;
			_s.timeColor_str = _s.props.timeColor || "#FF0000";
			
			_s.youtubeQualityButtonNormalColor_str = _s.props.youtubeQualityButtonNormalColor || "#FF0000";
			_s.youtubeQualityButtonSelectedColor_str = _s.props.youtubeQualityButtonSelectedColor || "#FF0000";
			_s.posterBackgroundColor_str = _s.props.posterBackgroundColor || "transparent";
		
			_s.showPlaylistButtonAndPlaylist_bl = _s.props.showPlaylistButtonAndPlaylist;
			_s.showPlaylistButtonAndPlaylist_bl = _s.showPlaylistButtonAndPlaylist_bl == "no" ? false : true;

			_s.showYoutubeRelAndInfo_bl = _s.props.showYoutubeRelAndInfo;
			_s.showYoutubeRelAndInfo_bl = _s.showYoutubeRelAndInfo_bl == "no" ? false : true;	

			_s.useResumeOnPlay_bl = _s.props.useResumeOnPlay;
			_s.useResumeOnPlay_bl = _s.useResumeOnPlay_bl == "yes" ? true : false;

			_s.useResumeOnPlay_bl = _s.props.useResumeOnPlay;
			_s.useResumeOnPlay_bl = _s.useResumeOnPlay_bl == "yes" ? true : false;

			_s.showOnlyThumbnail = _s.props.showOnlyThumbnail;
			_s.showOnlyThumbnail = _s.showOnlyThumbnail == "yes" ? true : false;

			_s.showThumbnail_bl = _s.props.showThumbnail;
			_s.showThumbnail_bl = _s.showThumbnail_bl == "no" ? false : true;
			if(_s.showOnlyThumbnail) _s.showThumbnail_bl = true;
	
			_s.showPlaylistOnFullScreen = _s.props.showPlaylistOnFullScreen;
			_s.showPlaylistOnFullScreen = _s.showPlaylistOnFullScreen == "yes" ? true : false;
			
			_s.stopAfterLastVideoHasPlayed_bl = _s.props.stopAfterLastVideoHasPlayed;
			_s.stopAfterLastVideoHasPlayed_bl = _s.stopAfterLastVideoHasPlayed_bl == "yes" ? true : false;
			
	
			_s.usePlaylistsSelectBox_bl = _s.props.usePlaylistsSelectBox;
			_s.usePlaylistsSelectBox_bl = _s.usePlaylistsSelectBox_bl == "yes" ? true : false;
			
			_s.executeCuepointsOnlyOnce_bl = _s.props.executeCuepointsOnlyOnce; 
			_s.executeCuepointsOnlyOnce_bl = _s.executeCuepointsOnlyOnce_bl == "yes" ? true : false;
			
			_s.showPlaylistByDefault_bl = _s.props.showPlaylistByDefault;
			_s.showPlaylistByDefault_bl = _s.showPlaylistByDefault_bl == "no" ? false : true;
		
			_s.playAfterVideoStop_bl = _s.props.playAfterVideoStop;
			_s.playAfterVideoStop_bl = _s.playAfterVideoStop_bl == "no" ? false : true;
			
			_s.openerAlignment_str = _s.props.openerAlignment;
			_s.openerEqulizerOffsetTop = _s.props.openerEqulizerOffsetTop || 0;
			_s.openerEqulizerOffsetLeft = _s.props.openerEqulizerOffsetLeft || 0;
			
			_s.showOpener_bl = _s.props.showOpener; 
			_s.showOpener_bl = _s.showOpener_bl == "yes" ? true : false;

			_s.stickyOnScrollShowOpener_bl = _s.props.stickyOnScrollShowOpener; 
			_s.stickyOnScrollShowOpener_bl = _s.stickyOnScrollShowOpener_bl == "yes" ? true : false;
			
			_s.showOpenerPlayPauseButton_bl = _s.props.showOpenerPlayPauseButton;
			_s.showOpenerPlayPauseButton_bl = _s.showOpenerPlayPauseButton_bl == "yes" ? true : false;
			
			_s.animate_bl = _s.props.animatePlayer; 
			_s.animate_bl = _s.animate_bl == "yes" ? true : false;
			
			_s.showChromecastButton_bl = _s.props.showChromecastButton; 
			_s.showChromecastButton_bl = _s.showChromecastButton_bl == "yes" ? true : false;
			if(!FWDUVPUtils.isChrome || FWDUVPUtils.isLocal || location.href.indexOf("https:") == -1) _s.showChromecastButton_bl = false;

			_s.show360DegreeVideoVrButton_bl = _s.props.show360DegreeVideoVrButton; 
			_s.show360DegreeVideoVrButton_bl = _s.show360DegreeVideoVrButton_bl == "yes" ? true : false;
		
			_s.showAnnotationsPositionTool_bl =  _s.props.showAnnotationsPositionTool;
			_s.showAnnotationsPositionTool_bl = _s.showAnnotationsPositionTool_bl == "yes" ? true : false;
			if(_s.showAnnotationsPositionTool_bl) _s.showPlaylistByDefault_bl = false;
			
			_s.showPlaylistName_bl = _s.props.showPlaylistName;
			_s.showPlaylistName_bl = _s.showPlaylistName_bl == "no" ? false : true;
			
			_s.showSearchInpt = _s.props.showSearchInput;
			_s.showSearchInpt = _s.showSearchInpt == "no" ? false : true;
			
			_s.showSubByDflt = _s.props.showSubtitleByDefault;
			_s.showSubByDflt = _s.showSubByDflt == "no" ? false : true;
				 
			_s.showSubBtn = _s.props.showSubtitleButton;
			_s.showSubBtn = _s.showSubBtn == "no" ? false : true;
			
			_s.forceDisableDownloadButtonForFolder_bl = _s.props.forceDisableDownloadButtonForFolder; 
			_s.forceDisableDownloadButtonForFolder_bl = _s.forceDisableDownloadButtonForFolder_bl == "yes" ? true : false;
			
			_s.nBC = _s.props.normalHEXButtonsColor || "#FFFFFF";

			if(_s.sknPth.indexOf('dark') != -1){
				_s.sBC = '#FFFFFF';
			}else{
				_s.sBC = '#000000';
			}

			_s.playlistPosition_str = _s.props.playlistPosition || "bottom";
			var test = _s.playlistPosition_str == "bottom" || _s.playlistPosition_str == "right";		   
			if(!test) _s.playlistPosition_str = "right";		
			
			_s.folderVideoLabel_str = _s.props.folderVideoLabel || "Video ";
			
			_s.logoPosition_str = _s.props.logoPosition || "topleft";
			_s.logoPosition_str = String(_s.logoPosition_str).toLowerCase();
			test = _s.logoPosition_str == "topleft" 
					   || _s.logoPosition_str == "topright"
					   || _s.logoPosition_str == "bottomleft"
					   || _s.logoPosition_str == "bottomright"; 
			if(!test) _s.logoPosition_str = "topleft";
			
			_s.thumbnailSelectedType_str = _s.props.thumbnailSelectedType || "opacity";
			if(_s.thumbnailSelectedType_str != "blackAndWhite"  
				&& _s.thumbnailSelectedType_str != "threshold" 
				&& _s.thumbnailSelectedType_str != "opacity"){
				_s.thumbnailSelectedType_str = "opacity";
			}
			if(_s.isMbl || FWDUVPUtils.isIEAndLessThen9)  _s.thumbnailSelectedType_str = "opacity";
			if(document.location.protocol == "file:") _s.thumbnailSelectedType_str = "opacity";
			
			_s.adsButtonsPosition_str = _s.props.adsButtonsPosition || "left";
			_s.adsButtonsPosition_str = String(_s.adsButtonsPosition_str).toLowerCase();
			test = _s.adsButtonsPosition_str == "left" 
					   || _s.adsButtonsPosition_str == "right";
					 	   
			if(!test) _s.adsButtonsPosition_str = "left";
			
			_s.skipToVideoButtonText_str = _s.props.skipToVideoButtonText || "not defined";
			_s.skipToVideoText_str = _s.props.skipToVideoText;
			
			_s.adsTextNormalColor = _s.props.adsTextNormalColor || "#FF0000";
			_s.adsTextSelectedColor = _s.props.adsTextSelectedColor || "#FF0000";
			_s.adsBorderNormalColor_str = _s.props.adsBorderNormalColor || "#FF0000";
			_s.adsBorderSelectedColor_str = _s.props.adsBorderSelectedColor || "#FF0000";
				
			_s.volume = _s.props.volume;
			if(_s.volume == undefined || isNaN(_s.volume)) _s.volume = 1;
			
			if(_s.volume > 1){
				_s.volume = 1;
			}else if(_s.volume <=0){
				_s.volume = 0;
			}

			_s.rewTm = _s.props.rewindTime;
			if(_s.rewTm == undefined || isNaN(_s.rewTm)) _s.rewTm = 10;
			if(_s.rewTm <=1){
				_s.rewTm = 1;
			}
		
			_s.buttonsToolTipFontColor_str = _s.props.buttonsToolTipFontColor || "#FF0000";
			_s.toolTipsButtonFontColor_str = _s.props.toolTipsButtonFontColor || "#FF0000";
			_s.shareAndEmbedTextColor_str = _s.props.shareAndEmbedTextColor || "#FF0000";
			_s.inputBackgroundColor_str = _s.props.inputBackgroundColor || "#FF0000";
			_s.inputColor_str = _s.props.inputColor || "#FF0000";
			_s.searchInputBackgroundColor_str = _s.props.searchInputBackgroundColor || "#FF0000";
			_s.borderColor_str = _s.props.borderColor || "#FF0000";
			_s.searchInputColor_str = _s.props.searchInputColor || "#FF0000";
			_s.youtubeAndFolderVideoTitleColor_str = _s.props.youtubeAndFolderVideoTitleColor || "#FF0000";
			_s.folderAudioSecondTitleColor_str = _s.props.folderAudioSecondTitleColor || "#666666";
			_s.youtubeDescriptionColor_str = _s.props.youtubeDescriptionColor || "#FF0000"; 
			_s.youtubeOwnerColor_str = _s.props.youtubeOwnerColor || "#FF0000";
			_s.secondaryLabelsColor_str = _s.props.secondaryLabelsColor || "#FF0000"; 
			_s.mainLabelsColor_str = _s.props.mainLabelsColor || "#FF0000"; 
			_s.playlistBackgroundColor_str = _s.props.playlistBackgroundColor || "#FF0000"; 
			_s.thumbnailNormalBackgroundColor_str = _s.props.thumbnailNormalBackgroundColor || "#FF0000"; 
			_s.playlistNameColor_str = _s.props.playlistNameColor || "#FF0000"; 
			_s.thumbnailHoverBackgroundColor_str = _s.props.thumbnailHoverBackgroundColor || "#FF0000"; 
			_s.thumbnailDisabledBackgroundColor_str = _s.props.thumbnailDisabledBackgroundColor || "#FF0000"; 
			_s.mainSelectorBackgroundSelectedColor = _s.props.mainSelectorBackgroundSelectedColor || "#FFFFFF";
			_s.mainSelectorTextNormalColor = _s.props.mainSelectorTextNormalColor || "#FFFFFF";
			_s.mainSelectorTextSelectedColor = _s.props.mainSelectorTextSelectedColor || "#000000";
			_s.mainButtonBackgroundNormalColor = _s.props.mainButtonBackgroundNormalColor || "#212021";
			_s.mainButtonBackgroundSelectedColor = _s.props.mainButtonBackgroundSelectedColor || "#FFFFFF"; 
			_s.mainButtonTextNormalColor = _s.props.mainButtonTextNormalColor || "#FFFFFF";
			_s.mainButtonTextSelectedColor = _s.props.mainButtonTextSelectedColor || "#000000";
			_s.logoLink_str = _s.props.logoLink || "none"; 
			_s.logoTarget = _s.props.logoTarget || "_self"; 

			_s.startAtVideo = parseInt(_s.props.startAtVideo) || 0;
			_s.audioVisualizerLinesColor_str = _s.props.audioVisualizerLinesColor || "#0099FF";
			_s.audioVisualizerCircleColor_str = _s.props.audioVisualizerCircleColor || "#FFFFFF";
			_s.privateVideoPassword_str = _s.props.privateVideoPassword;
			_s.youtubeAPIKey = _s.props.youtubeAPIKey || 'AIzaSyCgbixU3aIWCkiZ76h_E-XpEGig5mFhnVY'; 

			_s.contextMenuBackgroundColor_str = _s.props.contextMenuBackgroundColor || "#000000";
			_s.contextMenuBorderColor_str = _s.props.contextMenuBorderColor || "#FF0000";
			_s.contextMenuSpacerColor_str = _s.props.contextMenuSpacerColor || "#FF0000";
			_s.contextMenuItemNormalColor_str = _s.props.contextMenuItemNormalColor || "#FF0000";
			_s.contextMenuItemSelectedColor_str = _s.props.contextMenuItemSelectedColor || "#FF0000";
			_s.contextMenuItemDisabledColor_str = _s.props.contextMenuItemDisabledColor || "#FF0000";

			_s.showScriptDeveloper_bl = _s.props.showScriptDeveloper;
			_s.showScriptDeveloper_bl = _s.showScriptDeveloper_bl == "yes" ? true : false;

			_s.showContextmenu_bl = _s.props.showContextmenu;
			_s.showContextmenu_bl = _s.showContextmenu_bl == "no" ? false : true;

			_s.useFingerPrintStamp = _s.props.useFingerPrintStamp;
			_s.useFingerPrintStamp = _s.useFingerPrintStamp == "yes" ? true : false;
			if(!window['fwduvpFingerPrintStamp']) _s.useFingerPrintStamp = false;
			_s.frequencyOfFingerPrintStamp = _s.props.frequencyOfFingerPrintStamp || 5000;
			_s.durationOfFingerPrintStamp = _s.props.durationOfFingerPrintStamp || 400;

			_s.nextAndPrevSetButtonsMargins = _s.props.nextAndPrevSetButtonsMargins || 0;
			_s.buttonsMargins = _s.props.buttonsMargins || 0; 
			_s.thumbnailMaxWidth = _s.props.thumbnailMaxWidth || 330; 
			_s.thumbnailMaxHeight = _s.props.thumbnailMaxHeight || 330;
			_s.horizontalSpaceBetweenThumbnails = _s.props.horizontalSpaceBetweenThumbnails;
			_s.verticalSpaceBetweenThumbnails = _s.props.verticalSpaceBetweenThumbnails;
			_s.totalPlaylists = _s.cats_ar.length;
			_s.controllerHeight = _s.props.controllerHeight || 50;
			_s.startSpaceBetweenButtons = _s.props.startSpaceBetweenButtons || 0;
			_s.controllerHideDelay = _s.props.controllerHideDelay || 2;
			_s.controllerHideDelay *= 1000;
			_s.spaceBetweenButtons = _s.props.spaceBetweenButtons || 0;
			_s.scrubbersOffsetWidth = _s.props.scrubbersOffsetWidth || 0;
			_s.mainScrubberOffestTop = _s.props.mainScrubberOffestTop || 0;
			_s.volumeScrubberOffsetTopWidth = _s.props.volumeScrubberOffsetTopWidth || 0;
			_s.timeOffsetLeftWidth = _s.props.timeOffsetLeftWidth || 0;
			_s.timeOffsetRightWidth = _s.props.timeOffsetRightWidth || 0;
			_s.timeOffsetTop = _s.props.timeOffsetTop || 0;
			_s.embedWindowCloseButtonMargins = _s.props.embedAndInfoWindowCloseButtonMargins || 0;
			_s.logoMargins = _s.props.logoMargins || 0;
			_s.maxPlaylistItems = _s.props.maxPlaylistItems || 50;
			_s.volumeScrubberHeight = _s.props.volumeScrubberHeight || 10;
			_s.volumeScrubberOfsetHeight = _s.props.volumeScrubberOfsetHeight || 0;
			if(_s.volumeScrubberHeight > 200) _s.volumeScrubberHeight = 200;
			_s.buttonsToolTipHideDelay = _s.props.buttonsToolTipHideDelay || 1.5;
			_s.thumbnailWidth = _s.props.thumbnailWidth || 80;
			_s.thumbnailHeight = _s.props.thumbnailHeight || 80;

			_s.spaceBetweenThumbnails = _s.props.spaceBetweenThumbnails || 0;
			_s.timeOffsetTop = _s.props.timeOffsetTop || 0;
			_s.scrollbarOffestWidth = _s.props.scrollbarOffestWidth || 0;
			_s.scollbarSpeedSensitivity = _s.props.scollbarSpeedSensitivity || .5;
			_s.facebookAppId_str = _s.props.facebookAppId;
			
			_s.aopwBorderSize = _s.props.aopwBorderSize || 0; 
			_s.aopwTitle = _s.props.aopwTitle || "Advertisement";
			_s.aopwTitleColor_str = _s.props.aopwTitleColor || "#FFFFFF"; 
			_s.aopwWidth = _s.props.aopwWidth || 200; 
			_s.aopwHeight = _s.props.aopwHeight || 200; 
			
			_s.fillEntireVideoScreen_bl = _s.props.fillEntireVideoScreen; 
			_s.fillEntireVideoScreen_bl = _s.fillEntireVideoScreen_bl == "yes" ? true : false;

			_s.fillEntireposterScreen_bl = _s.props.fillEntireposterScreen; 
			_s.fillEntireposterScreen_bl = _s.fillEntireposterScreen_bl == "yes" ? true : false;

			_s.goFullScreenOnPlay_bl = _s.props.goFullScreenOnButtonPlay; 
			_s.goFullScreenOnPlay_bl = _s.goFullScreenOnPlay_bl == "yes" ? true : false;
			
			_s.showContextMenu_bl = _s.props.showContextMenu; 
			_s.showContextMenu_bl = _s.showContextMenu_bl == "no" ? false : true;
			
			_s.showController_bl = _s.props.showController; 
			_s.showController_bl = _s.showController_bl == "no" ? false : true;
			
			_s.showButtonsToolTip_bl = _s.props.showButtonsToolTips; 
			_s.showButtonsToolTip_bl = _s.showButtonsToolTip_bl == "no" ? false : true;
			if(_s.isMbl) _s.showButtonsToolTip_bl = false;
			
			_s.addKeyboardSupport_bl = _s.props.addKeyboardSupport; 
			_s.addKeyboardSupport_bl = _s.addKeyboardSupport_bl == "no" ? false : true;

			_s.playsinline = _s.props.playsinline == "yes" ? true : false;

			_s.useAToB = _s.props.useAToB == "yes" ? true : false;
			_s.atbTimeBackgroundColor = _s.props.atbTimeBackgroundColor || "transparent";
			_s.atbTimeTextColorNormal = _s.props.atbTimeTextColorNormal ||  "#888888";
			_s.atbTimeTextColorSelected = _s.props.atbTimeTextColorSelected || "#FFFFFF";
			_s.atbButtonTextNormalColor = _s.props.atbButtonTextNormalColor || "#888888";
			_s.atbButtonTextSelectedColor = _s.props.atbButtonTextSelectedColor || "#FFFFFF";
			_s.atbButtonBackgroundNormalColor = _s.props.atbButtonBackgroundNormalColor || "#FFFFFF";
			_s.atbButtonBackgroundSelectedColor = _s.props.atbButtonBackgroundSelectedColor || "#000000";
			
			_s.addMouseWheelSupport_bl = _s.props.addMouseWheelSupport; 
			_s.addMouseWheelSupport_bl = _s.addMouseWheelSupport_bl == "no" ? false : true;

			_s.addScrOnMM_bl = _s.props.addScrollOnMouseMove; 
			_s.addScrOnMM_bl = _s.addScrOnMM_bl == "yes" ? true : false;
			
			_s.showPlaylistsSearchInput_bl = _s.props.showPlaylistsSearchInput; 
			_s.showPlaylistsSearchInput_bl = _s.showPlaylistsSearchInput_bl == "yes" ? true : false;
		
			_s.scrubbersToolTipLabelBackgroundColor = _s.props.scrubbersToolTipLabelBackgroundColor || "#FFFFFF";
			_s.scrubbersToolTipLabelFontColor  = _s.props.scrubbersToolTipLabelFontColor || "#000000";
		
			_s.autoPlay_bl = _s.props.autoPlay; 
			_s.autoPlay_bl = _s.autoPlay_bl == "yes" ? true : false;
			_s.autoPlayText = _s.props.autoPlayText || '';
			
			_s.showNextAndPrevButtons_bl = _s.props.showNextAndPrevButtons; 
			_s.showNextAndPrevButtons_bl = _s.showNextAndPrevButtons_bl == "no" ? false : true;
			
			_s.showPlaylistsButtonAndPlaylists_bl = _s.props.showPlaylistsButtonAndPlaylists;
			_s.showPlaylistsButtonAndPlaylists_bl = _s.showPlaylistsButtonAndPlaylists_bl == "no" ? false : true;
			
			_s.showEmbedButton_bl = _s.props.showEmbedButton;
			_s.showEmbedButton_bl = _s.showEmbedButton_bl == "no" ? false : true;

			_s.showScrubberWhenControllerIsHidden_bl = _s.props.showScrubberWhenControllerIsHidden; 
			_s.showScrubberWhenControllerIsHidden_bl = _s.showScrubberWhenControllerIsHidden_bl == "no" ? false : true;

			_s.showMainScrubberToolTipLabel_bl = _s.props.showMainScrubberToolTipLabel;
			_s.showMainScrubberToolTipLabel_bl = _s.showMainScrubberToolTipLabel_bl == "yes" ? true : false;
			
			_s.showPlaylistsByDefault_bl = _s.props.showPlaylistsByDefault; 
			_s.showPlaylistsByDefault_bl = _s.showPlaylistsByDefault_bl == "yes" ? true : false;
			
			_s.loop_bl = _s.props.loop; 
			_s.loop_bl = _s.loop_bl == "yes" ? true : false;
			
			_s.shuffle_bl = _s.props.shuffle; 
			_s.shuffle_bl = _s.shuffle_bl == "yes" ? true : false;
			
			_s.showLoopButton_bl = _s.props.showLoopButton; 
			_s.showLoopButton_bl = _s.props.showLoopButton == "no" ? false : true;
			
			_s.showShuffleButton_bl = _s.props.showShuffleButton; 
			_s.showShuffleButton_bl = _s.props.showShuffleButton == "no" ? false : true;
			
			_s.showDownloadVideoButton_bl = _s.props.showDownloadButton; 
			_s.showDownloadVideoButton_bl = _s.showDownloadVideoButton_bl == "no" ? false : true;

			_s.randomizePlaylist_bl = _s.props.randomizePlaylist; 
			_s.randomizePlaylist_bl = _s.randomizePlaylist_bl == "yes" ? true : false;
			
			_s.showDefaultControllerForVimeo_bl = _s.props.showDefaultControllerForVimeo; 
			_s.showDefaultControllerForVimeo_bl = _s.showDefaultControllerForVimeo_bl == "yes" ? true : false;
			
			_s.showInfoButton_bl = _s.props.showInfoButton; 
			_s.showInfoButton_bl = _s.showInfoButton_bl == "no" ? false : true;
		
			_s.showLogo_bl = _s.props.showLogo; 
			_s.showLogo_bl = _s.showLogo_bl == "yes" ? true : false;
			
			_s.hideLogoWithController_bl = _s.props.hideLogoWithController;
			_s.hideLogoWithController_bl = _s.hideLogoWithController_bl == "yes" ? true : false;
			
			_s.showPoster_bl = _s.props.showPoster; 
			_s.showPoster_bl = _s.showPoster_bl == "yes" ? true : false;
			
			_s.useVectorIcons_bl = _s.props.useVectorIcons; 
			_s.useVectorIcons_bl = _s.useVectorIcons_bl == "yes" ? true : false;
			
			_s.showVolumeButton_bl = _s.props.showVolumeButton; 
			_s.showVolumeButton_bl = _s.showVolumeButton_bl == "no" ? false : true;
			
			_s.showVolumeScrubber_bl = _s.showVolumeButton_bl;
			
			_s.showControllerWhenVideoIsStopped_bl = _s.props.showControllerWhenVideoIsStopped; 
			_s.showControllerWhenVideoIsStopped_bl = _s.showControllerWhenVideoIsStopped_bl == "yes" ? true : false;
			
			_s.showNextAndPrevButtonsInController_bl = _s.props.showNextAndPrevButtonsInController; 
			_s.showNextAndPrevButtonsInController_bl = _s.showNextAndPrevButtonsInController_bl == "yes" ? true : false;
			
			_s.showTime_bl = _s.props.showTime; 
			_s.showTime_bl = _s.showTime_bl == "no" ? false : true;
			
			_s.shwPpoppAdClsBtn = _s.props.showPopupAdsCloseButton; 
			_s.shwPpoppAdClsBtn = _s.shwPpoppAdClsBtn == "no" ? false : true
			
			_s.showRewindButton_bl = _s.props.showRewindButton; 
			_s.showRewindButton_bl = _s.showRewindButton_bl == "no" ? false : true;
			
			_s.disableVideoScrubber_bl = _s.props.disableVideoScrubber; 
			_s.disableVideoScrubber_bl = _s.disableVideoScrubber_bl == "yes" ? true : false;
			
			_s.showPlaybackRateButton_bl = _s.props.showPlaybackRateButton;
			_s.showPlaybackRateButton_bl = _s.showPlaybackRateButton_bl == "yes" ? true : false;
			
			_s.defaultPlaybackRate_str = _s.props.defaultPlaybackRate;
			if(_s.defaultPlaybackRate_str ==  undefined) _s.defaultPlaybackRate_str = 1;
			_s.defaultPlaybackRate_ar = ["0.25", "0.5", "1", "1.25", "1.5", "2"];
			
			_s.defaultPlaybackRate_ar.reverse();
			var found_bl = false;
			for(var i=0; i<_s.defaultPlaybackRate_ar.length; i++){
				if(_s.defaultPlaybackRate_ar[i] == _s.defaultPlaybackRate_str){
					found_bl = true;
					_s.startAtPlaybackIndex = i;
				}
			}
			
			if(!found_bl){
				_s.startAtPlaybackIndex = 3;
				_s.defaultPlaybackRate_str = _s.defaultPlaybackRate_ar[_s.startAtPlaybackIndex];
			}
			
			_s.showFullScreenButton_bl = _s.props.showFullScreenButton; 
			_s.showFullScreenButton_bl = _s.showFullScreenButton_bl == "no" ? false : true;
			
			_s.repeatBackground_bl = _s.props.repeatBackground; 
			_s.repeatBackground_bl = _s.repeatBackground_bl == "no" ? false : true;
			
			//loggin
			_s.playVideoOnlyWhenLoggedIn_bl = _s.props.playVideoOnlyWhenLoggedIn; 
			_s.playVideoOnlyWhenLoggedIn_bl = _s.playVideoOnlyWhenLoggedIn_bl == "yes" ? true : false;
			
			_s.playIfLoggedIn = _s.props.playIfLoggedIn; 
			_s.playIfLoggedIn = _s.playIfLoggedIn == "yes" ? true : false;
			_s.playIfLoggedInMessage = _s.props.playIfLoggedInMessage || 'Please loggin';
			
			_s.showShareButton_bl = _s.props.showShareButton; 
			_s.showShareButton_bl = _s.showShareButton_bl == "no" ? false : true;
			
			_s.openNewPageAtTheEndOfTheAds_bl =  _s.props.openNewPageAtTheEndOfTheAds;
			_s.openNewPageAtTheEndOfTheAds_bl = _s.openNewPageAtTheEndOfTheAds_bl == "yes" ? true : false;
			
			_s.playAdsOnlyOnce_bl =  _s.props.playAdsOnlyOnce;
			_s.playAdsOnlyOnce_bl = _s.playAdsOnlyOnce_bl == "yes" ? true : false;
			
			_s.startAtRandomVideo_bl =  _s.props.startAtRandomVideo;
			_s.startAtRandomVideo_bl = _s.startAtRandomVideo_bl == "yes" ? true : false;
			
			_s.stopVideoWhenPlayComplete_bl =  _s.props.stopVideoWhenPlayComplete;
			_s.stopVideoWhenPlayComplete_bl = _s.stopVideoWhenPlayComplete_bl == "yes" ? true : false;

			_s.closeLightBoxWhenPlayComplete =  _s.props.closeLightBoxWhenPlayComplete;
			_s.closeLightBoxWhenPlayComplete = _s.closeLightBoxWhenPlayComplete == "yes" ? true : false;

			_s.showYoutubeQualityButton_bl = _s.props.showQualityButton; 
			_s.showYoutubeQualityButton_bl = _s.showYoutubeQualityButton_bl == "no" ? false : true;

			_s.showAudioTracksButton_bl = _s.props.showAudioTracksButton; 
			_s.showAudioTracksButton_bl = _s.showAudioTracksButton_bl == "no" ? false : true;
			
			_s.thumbnailsPreviewWidth = _s.props.thumbnailsPreviewWidth || 300
			_s.thumbnailsPreviewHeight = _s.props.thumbnailsPreviewHeight || 168
			_s.thumbnailsPreviewBackgroundColor =  _s.props.thumbnailsPreviewBackgroundColor || "#000";
			_s.thumbnailsPreviewBorderColor =	_s.props.thumbnailsPreviewBorderColor || "#333";
			_s.thumbnailsPreviewLabelBackgroundColor =	_s.props.thumbnailsPreviewLabelBackgroundColor || "#FFF";
			_s.thumbnailsPreviewLabelFontColor =	_s.props.thumbnailsPreviewLabelFontColor || "#000";
			
			_s.arrowN_str = _s.sknPth + "combobox-arrow-normal.png";
			_s.arrowS_str = _s.sknPth + "combobox-arrow-selected.png";
			
			_s.hlsPath_str = _s.mainFolderPath_str  + "java/hls.js";
			_s.dashPath_str = _s.mainFolderPath_str  + "java/dash.all.min.js";
			_s.threeJsPath_str = _s.mainFolderPath_str  + "java/three.js";
			_s.threeJsControlsPath_str = _s.mainFolderPath_str  + "java/threeControled.js";

			_s.isDark = true;
			if(_s.sknPth.indexOf('dark') == -1){
				_s.isDark = false;
			}
			
			_s.logoPath_str = _s.sknPth + "logo.png";
			_s.adLinePat_str = _s.sknPth + "ad-line.png";
			if(_s.props.logoPath) _s.logoPath_str = _s.props.logoPath;
			
			_s.mainScrubberDragLeftAddPath_str = _s.sknPth + "scrubber-left-drag-add.png";
			_s.mainScrubberDragMiddleAddPath_str = _s.sknPth + "scrubber-middle-drag-add.png";
		
			_s.mainPreloader_img = new Image();
			_s.mainPreloader_img.onerror = _s.onSkinLoadErrorHandler;
			_s.mainPreloader_img.onload = _s.onPreloaderLoadHandler;
			_s.mainPreloader_img.src = _s.sknPth + "preloader.jpg";
			
			_s.hdIcn = _s.sknPth + 'hd.png';

			_s.skinPaths_ar = [
				 {img:_s.skipIconPath_img = new Image(), src:_s.sknPth + "skip-icon.png"},
                 {img:_s.mainScrubberBkLeft_img = new Image(), src:_s.sknPth + "scrubber-left-background.png"},
                 {img:_s.mainScrubberDragLeft_img = new Image(), src:_s.sknPth + "scrubber-left-drag.png"},
                 {img:_s.mainScrubberLine_img = new Image(), src:_s.sknPth + "scrubber-line.png"},
                 {img:_s.progressLeft_img = new Image(), src:_s.sknPth + "progress-left.png"},
				 {img:_s.volumeScrubberDragBottom_img = new Image(), src:_s.sknPth + "volume-scrubber-bottom-drag.png"},
				 {img:_s.popwColseN_img = new Image(), src:_s.sknPth + "popw-close-button.png"},
				 {img:_s.embedColoseN_img = new Image(), src:_s.sknPth + "embed-close-button.png"}

			];
			
			if(!_s.useVectorIcons_bl){
				_s.skinPaths_ar.push(
					 {img:_s.prevN_img = new Image(), src:_s.sknPth + "prev-video.png"},
					 {img:_s.nextN_img = new Image(), src:_s.sknPth + "next-video.png"},
					 {img:_s.playN_img = new Image(), src:_s.sknPth + "play.png"},
					 {img:_s.pauseN_img = new Image(), src:_s.sknPth + "pause.png"},
				     {img:_s.volumeN_img = new Image(), src:_s.sknPth + "volume.png"},
					 {img:_s.largePlayN_img = new Image(), src:_s.sknPth + "large-play.png"},
					 {img:_s.categoriesN_img = new Image(), src:_s.sknPth + "categories-button.png"},
					 {img:_s.replayN_img = new Image(), src:_s.sknPth + "replay-button.png"},
					 {img:_s.shuffleN_img = new Image(), src:_s.sknPth + "shuffle-button.png"},
					 {img:_s.fullScreenN_img = new Image(), src:_s.sknPth + "full-screen.png"},
					 {img:_s.ytbQualityN_img = new Image(), src:_s.sknPth + "youtube-quality.png"},
					 {img:_s.shareN_img = new Image(), src:_s.sknPth + "share.png"},
					 {img:_s.facebookN_img = new Image(), src:_s.sknPth + "facebook.png"},
					 {img:_s.infoN_img = new Image(), src:_s.sknPth + "info-button.png"},
					 {img:_s.downloadN_img = new Image(), src:_s.sknPth + "download-button.png"},
					 {img:_s.normalScreenN_img = new Image(), src:_s.sknPth + "normal-screen.png"},
					 {img:_s.embedN_img = new Image(), src:_s.sknPth + "embed.png"},
					 {img:_s.passColoseN_img = new Image(), src:_s.sknPth + "embed-close-button.png"},
					 {img:_s.showSubtitleNPath_img = new Image(), src:_s.sknPth + "show-subtitle-icon.png"},
					 {img:_s.hideSubtitleNPath_img = new Image(), src:_s.sknPth + "hide-subtitle-icon.png"},
					 {img:_s.playbackRateNPath_img = new Image(), src:_s.sknPth + "playback-rate-normal.png"}
				)

				if(_s.useAToB){
					_s.skinPaths_ar.push(
						{img:_s.atbNPath_img = new Image(), src:_s.sknPth + "a-to-b-button.png"}
					)
				}
			}
			
			if((_s.showOpener_bl && prt.displayType == FWDUVPlayer.STICKY) 
				|| (_s.stickyOnScrollShowOpener_bl && prt.stickyOnScroll)){
				_s.skinPaths_ar.push(
					 {img:_s.openerPauseN_img = new Image(), src:_s.sknPth + "open-pause-button-normal.png"},
					 {img:_s.openerPlayN_img = new Image(), src:_s.sknPth + "open-play-button-normal.png"},
					 {img:_s.animationPath_img = new Image(), src:_s.sknPth + "equalizer.png"},
					 {img:_s.closeN_img = new Image(), src:_s.sknPth + "opener-close.png"},
					 {img:_s.openTopN_img = new Image(), src:_s.sknPth + "open-button-normal-top.png"},
					 {img:_s.openBottomN_img = new Image(), src:_s.sknPth + "open-button-normal-bottom.png"}
					 
				)
				_s.openerPauseS_str = _s.sknPth + "open-pause-button-selected.png";
				_s.openerPlayS_str = _s.sknPth + "open-play-button-selected.png";
				_s.openerAnimationPath_str = _s.sknPth + "equalizer.png";	
				_s.openTopSPath_str = _s.sknPth + "open-button-selected-top.png";	
				_s.openBottomSPath_str = _s.sknPth + "open-button-selected-bottom.png";	
				_s.openTopSPath_str = _s.sknPth + "open-button-selected-top.png";
				_s.openBottomSPath_str = _s.sknPth + "open-button-selected-bottom.png";
				
				_s.closeSPath_str = _s.sknPth + "opener-close-over.png"
			}
			
			if(_s.showRewindButton_bl){
				_s.skinPaths_ar.push(
					 {img:_s.rewindN_img = new Image(), src:_s.sknPth + "rewind.png"}
				)
				_s.rewindSPath_str = _s.sknPth + "rewind-over.png";
			}

			if(_s.showInfoButton_bl){
				_s.skinPaths_ar.push(
					{img:_s.infoWindowClooseN_img = new Image(), src:_s.sknPth + "embed-close-button.png"}
				)
			}
			
			if(_s.showNextAndPrevButtonsInController_bl && !_s.useVectorIcons_bl){
				_s.skinPaths_ar.push(
					{img:_s.next2N_img = new Image(), src:_s.sknPth + "next-video.png"},
					{img:_s.prev2N_img = new Image(), src:_s.sknPth + "prev-video.png"}
				)
			}

			if(_s.show360DegreeVideoVrButton_bl){
				_s.skinPaths_ar.push(
					{img:_s.vr_img = new Image(), src:_s.sknPth + "vr.png"}
				)
				_s.vrSPath_img = _s.sknPth + "vr-over.png";
			}	

			if(_s.showAudioTracksButton_bl){
				_s.skinPaths_ar.push(
					{img:_s.at_img = new Image(), src:_s.sknPth + "at.png"}
				)
				_s.atSPath_img = _s.sknPth + "at-over.png";
			}	
			
			
			if(_s.showShareButton_bl && !_s.useVectorIcons_bl){
				_s.skinPaths_ar.push(
					{img:_s.shareClooseN_img = new Image(), src:_s.sknPth + "embed-close-button.png"},
					{img:_s.facebookN_img = new Image(), src:_s.sknPth + "facebook.png"},
					{img:_s.googleN_img = new Image(), src:_s.sknPth + "google-plus.png"},
					{img:_s.twitterN_img = new Image(), src:_s.sknPth + "twitter.png"},
					{img:_s.likedInkN_img = new Image(), src:_s.sknPth + "likedin.png"},
					{img:_s.bufferkN_img = new Image(), src:_s.sknPth + "buffer.png"},
					{img:_s.diggN_img = new Image(), src:_s.sknPth + "digg.png"},
					{img:_s.redditN_img = new Image(), src:_s.sknPth + "reddit.png"},
					{img:_s.thumbrlN_img = new Image(), src:_s.sknPth + "thumbrl.png"}
				)
				
				_s.facebookSPath_str = _s.sknPth + "facebook-over.png";
				_s.googleSPath_str = _s.sknPth + "google-plus-over.png";
				_s.twitterSPath_str = _s.sknPth + "twitter-over.png";
				_s.likedInSPath_str = _s.sknPth + "likedin-over.png";
				_s.bufferSPath_str = _s.sknPth + "buffer-over.png";
				_s.diggSPath_str = _s.sknPth + "digg-over.png";
				_s.redditSPath_str = _s.sknPth + "reddit-over.png";
				_s.thumbrlSPath_str = _s.sknPth + "thumbrl-over.png";
			}
			
			//setup skin paths
			_s.atbSPath_str = _s.sknPth + "a-to-b-button-over.png";
			_s.popwColseSPath_str = _s.sknPth + "popw-close-button-over.png";
			_s.popwWindowBackgroundPath_str = _s.sknPth + "popw-window-background.png";
			_s.popwBarBackgroundPath_str = _s.sknPth + "popw-bar-background.png";
			_s.playbackRateSPath_str = _s.sknPth + "playback-rate-selected.png";
			_s.prevSPath_str = _s.sknPth + "prev-video-over.png"; 
			_s.nextSPath_str = _s.sknPth + "next-video-over.png"; 
			_s.playSPath_str = _s.sknPth + "play-over.png"; 
			_s.pauseSPath_str = _s.sknPth + "pause-over.png";
			_s.bkMiddlePath_str = _s.sknPth + "controller-middle.png";
			_s.hdPath_str = _s.sknPth + "hd.png";
			_s.youtubeQualityArrowPath_str = _s.sknPth + "youtube-quality-arrow.png";
			_s.ytbQualityButtonPointerPath_str = _s.sknPth + "youtube-quality-pointer.png";
			_s.controllerBkPath_str = _s.sknPth + "controller-background.png";
			_s.skipIconSPath_str = _s.sknPth + "skip-icon-over.png";
			_s.adsBackgroundPath_str = _s.sknPth + "ads-background.png";
			_s.shareSPath_str = _s.sknPth + "share-over.png";

			_s.mainScrubberBkRightPath_str = _s.sknPth + "scrubber-right-background.png";
			_s.mainScrubberBkMiddlePath_str = _s.sknPth + "scrubber-middle-background.png";
			_s.mainScrubberDragMiddlePath_str = _s.sknPth + "scrubber-middle-drag.png";
		
			_s.volumeScrubberBkBottomPath_str = _s.sknPth + "volume-scrubber-bottom-background.png"; 
			_s.volumeScrubberBkMiddlePath_str = _s.sknPth + "volume-scrubber-middle-background.png";
			_s.volumeScrubberBkTopPath_str = _s.sknPth + "volume-scrubber-top-background.png";
			_s.volumeScrubberDragBottomPath_str = _s.sknPth + "volume-scrubber-bottom-drag.png";
			_s.volumeScrubberLinePath_str = _s.sknPth + "volume-scrubber-line.png";
			_s.volumeScrubberDragMiddlePath_str = _s.sknPth + "volume-scrubber-middle-drag.png";	
		
			_s.volumeSPath_str = _s.sknPth + "volume-over.png";
			_s.volumeDPath_str = _s.sknPth + "volume-disabled.png";
			_s.categoriesSPath_str = _s.sknPth + "categories-button-over.png";
			_s.replaySPath_str = _s.sknPth + "replay-button-over.png";
			_s.toopTipBk_str = _s.sknPth + "tooltip-background.png"; 
			_s.toopTipPointer_str = _s.sknPth + "tooltip-pointer.png"; 
			_s.shufflePathS_str = _s.sknPth + "shuffle-button-over.png";
			_s.passButtonNPath_str = _s.sknPth + "pass-button.png";
			_s.passButtonSPath_str = _s.sknPth + "pass-button-over.png";
			
			_s.largePlayS_str = _s.sknPth + "large-play-over.png";
			_s.fullScreenSPath_str = _s.sknPth + "full-screen-over.png";
			_s.ytbQualitySPath_str = _s.sknPth + "youtube-quality-over.png";
			_s.ytbQualityDPath_str = _s.sknPth + "youtube-quality-hd.png";
			_s.facebookSPath_str = _s.sknPth + "facebook-over.png";
			_s.infoSPath_str = _s.sknPth + "info-button-over.png";
			_s.downloadSPath_str = _s.sknPth + "download-button-over.png";
			_s.normalScreenSPath_str = _s.sknPth + "normal-screen-over.png";
			_s.progressMiddlePath_str = _s.sknPth + "progress-middle.png";
			_s.embedPathS_str = _s.sknPth + "embed-over.png";
			_s.embedWindowClosePathS_str = _s.sknPth + "embed-close-button-over.png"; 
			_s.embedWindowInputBackgroundPath_str = _s.sknPth + "embed-window-input-background.png";
			_s.embedCopyButtonNPath_str = _s.sknPth + "embed-copy-button.png";
			_s.embedCopyButtonSPath_str = _s.sknPth + "embed-copy-button-over.png";
			_s.sendButtonNPath_str = _s.sknPth + "send-button.png";
			_s.sendButtonSPath_str = _s.sknPth + "send-button-over.png";
			_s.embedWindowBackground_str = _s.sknPth + "embed-window-background.png";
			_s.showSubtitleSPath_str = _s.sknPth + "show-subtitle-icon-over.png";
			_s.hideSubtitleSPath_str = _s.sknPth + "hide-subtitle-icon-over.png";
			_s.inputArrowPath_str = _s.sknPth + "input-arrow.png"; 
			
			if(_s.showPlaylistsButtonAndPlaylists_bl){
				_s.skinPaths_ar.push(
				    {img:new Image(), src:_s.sknPth + "categories-background.png"}
				);
				
				if(!_s.useVectorIcons_bl){
					_s.skinPaths_ar.push(
						{img:_s.catNextN_img = new Image(), src:_s.sknPth + "categories-next-button.png"},
						{img:_s.catPrevN_img = new Image(), src:_s.sknPth + "categories-prev-button.png"},
						{img:_s.catCloseN_img = new Image(), src:_s.sknPth + "categories-close-button.png"}
					)
				}
				_s.catBkPath_str = _s.sknPth + "categories-background.png"; 
				_s.catThumbBkPath_str = _s.sknPth + "categories-thumbnail-background.png"; 
				_s.catThumbBkTextPath_str = _s.sknPth + "categories-thumbnail-text-backgorund.png"; 
				_s.catNextSPath_str = _s.sknPth + "categories-next-button-over.png"; 
				_s.catPrevSPath_str = _s.sknPth + "categories-prev-button-over.png"; 
				_s.catCloseSPath_str = _s.sknPth + "categories-close-button-over.png"; 
			}
			
			_s.poppAdClsNPth = _s.sknPth + "close-button-normal.png"; 
			_s.poppAdClsSPth = _s.sknPth + "close-button-selected.png"; 
			
			_s.annotationAddCloseNPath_str = _s.sknPth + "annotation-close-button-normal.png"; 
			_s.annotationAddCloseSPath_str = _s.sknPth + "annotation-close-button-selected.png";
			
			if(_s.showPlaylistButtonAndPlaylist_bl){
				var prevThumbsSetNPath_str;
				
				_s.playlistThumbnailsBkPath_str = _s.sknPth + "playlist-thumbnail-background.png";
				_s.playlistBkPath_str = _s.sknPth + "playlist-background.png";
				
				if(_s.playlistPosition_str == "bottom"){
					_s.skinPaths_ar.push(
					    {img:_s.hidePlaylistN_img = new Image(), src:_s.sknPth + "hide-horizontal-playlist.png"},
					    {img:_s.showPlaylistN_img = new Image(), src:_s.sknPth + "show-horizontal-playlist.png"}
					);
					_s.hidePlaylistSPath_str = _s.sknPth + "hide-horizontal-playlist-over.png"; 
					_s.showPlaylistSPath_str = _s.sknPth + "show-horizontal-playlist-over.png"; 
				}else{
					_s.skinPaths_ar.push(
					    {img:_s.hidePlaylistN_img = new Image(), src:_s.sknPth + "hide-vertical-playlist.png"},
					    {img:_s.showPlaylistN_img = new Image(), src:_s.sknPth + "show-vertical-playlist.png"}
					);
					_s.hidePlaylistSPath_str = _s.sknPth + "hide-vertical-playlist-over.png"; 
					_s.showPlaylistSPath_str = _s.sknPth + "show-vertical-playlist-over.png"; 
				}
				
				_s.skinPaths_ar.push(
				    {img:_s.scrBkTop_img = new Image(), src:_s.sknPth + "playlist-scrollbar-background-top.png"},
				    {img:_s.scrDragTop_img = new Image(), src:_s.sknPth + "playlist-scrollbar-drag-top.png"},
				    {img:_s.scrLinesN_img = new Image(), src:_s.sknPth + "playlist-scrollbar-lines.png"}
				);
				
				_s.scrBkMiddlePath_str = _s.sknPth + "playlist-scrollbar-background-middle.png";
				_s.scrBkBottomPath_str = _s.sknPth + "playlist-scrollbar-background-bottom.png";
				_s.scrDragMiddlePath_str = _s.sknPth + "playlist-scrollbar-drag-middle.png";
				_s.scrDragBottomPath_str = _s.sknPth + "playlist-scrollbar-drag-bottom.png";
				_s.scrLinesSPath_str = _s.sknPth + "playlist-scrollbar-lines-over.png";
				_s.inputArrowPath_str = _s.sknPth + "input-arrow.png";
			}

			if(_s.showChromecastButton_bl){
				_s.skinPaths_ar.push(
					{img:_s.castN_img = new Image(), src:_s.sknPth + "cast.png"},
					{img:_s.uncastN_img = new Image(), src:_s.sknPth + "uncast.png"}
				)
				_s.castSPath_str = _s.sknPth + "cast-over.png";
				_s.uncastSPath_str = _s.sknPth + "uncast-over.png";
			}
			
			_s.totalGraphics = _s.skinPaths_ar.length;
		};
		

		//####################################//
		/* Preloader load done! */
		//###################################//
		_s.onPreloaderLoadHandler = function(){
			_s.countLoadedSCript = 0;
			_s.scripts = [];
			if(_s.useAToB){
				_s.scripts.push('FWDUVPATB.js');
			}
			if(_s.thumbnailsPreview){
				_s.scripts.push('FWDUVPThumbnailsPreview.js');
			}
			if(_s.showChromecastButton_bl){
				_s.scripts.push('FWDUVPCC.js');
			}

			if(_s.useFingerPrintStamp){
				_s.scripts.push('FWDUVPFPS.js');
			}
			_s.totalScripts = _s.scripts.length;

			_s.dispatchEvent(FWDUVPData.PRELOADER_LOAD_DONE);
			_s.loadPlugin();
		};

		_s.loadPlugin = function(){
			if(_s.countLoadedSCript == _s.totalScripts){
				_s.loadSkin();	
			}else{
				var script = document.createElement('script');
				var scriptURI = _s.scripts[_s.countLoadedSCript] 
				if(/\?/.test(scriptURI)){
					scriptURI += '&version=' + FWDUVPlayer.V;
				}else{
					scriptURI += '?version=' + FWDUVPlayer.V;
				}
				document.head.appendChild(script);
				if(scriptURI.indexOf('gstatic') != -1){
					script.src = scriptURI;
				}else{
					script.src =  _s.mainFolderPath_str + 'java/' + scriptURI;
				}
				
				script.onload = _s.loadPlugin;
				script.onerror = function(e){
					console.log(e);
					if(scriptURI == 'FWDUVPFPS.js'){
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:'You have enabled the FingerPrintstamp plugin, the fingerpintstamp js file named <font color="#FF0000">FWDUVPFPS.js</font> is not found. Please make sure that the content folder contains the java folder that contains the <font color="#FF0000">FWDUVPFPS.js</font> file. '});
					}else if(scriptURI == 'FWDUVPATB.js'){
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:'You have enabled the A to B plugin, the A to B js file named <font color="#FF0000">FWDUVPATB.js</font> is not found. Please make sure that the content folder contains the java folder that contains the <font color="#FF0000">FWDUVPATB.js</font> file. '});
					}else if(scriptURI == 'FWDUVPThumbnailsPreview.js'){
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:'You have enabled the thumbnal preview plugin, the thumbnail preview js file named <font color="#FF0000">FWDUVPThumbnailsPreview.js</font> is not found. Please make sure that the content folder contains the java folder that contains the <font color="#FF0000">FWDUVPThumbnailsPreview.js</font> file. '});
					}else if(scriptURI == 'FWDUVPCC.js'){
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:'You have enabled the chromecast plugin, the js file named <font color="#FF0000">FWDUVPCC.js</font> is not found. Please make sure that the content folder contains the java folder that contains the <font color="#FF0000">FWDUVPCC.js</font> file.'});
					}
				
				}
			}
			_s.countLoadedSCript++;
		}

		
		//#####################################//
		/* Load IMA SDK */
		//#####################################//
		_s.countImaLoadedSCript = 0;
		_s.startToLoadIMA = function(){
			if(_s.imaScripts) return;
			_s.imaScripts = ['//imasdk.googleapis.com/js/sdkloader/ima3.js',  _s.mainFolderPath_str + 'java/FWDUVPIMA.js'];
			_s.totalImaScripts = _s.imaScripts.length;
			_s.loadIMA();
		}
		
		_s.loadIMA = function(){
			if(_s.countImaLoadedSCript == _s.totalImaScripts){
				_s.imaReady = true;
				_s.dispatchEvent(FWDUVPData.IMA_READY);
			}else{
				var script = document.createElement('script');
				var scriptURI = _s.imaScripts[_s.countImaLoadedSCript];
				document.head.appendChild(script);
				script.src = scriptURI;
				script.onload = _s.loadIMA;
				script.onerror = function(e){
					if(_s.countImaLoadedSCript == 1){
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:'IMA SDK can\'t be loaded'});
					}else if(_s.countImaLoadedSCript == 2){
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:'IMA file <font color="#FF0000">FWDUVPIMA.js</font> is not found. Please make sure that the content folder contains the java folder that contains the <font color="#FF0000">FWDUVPIMA.js</font> file. '});
					}
					_s.dispatchEvent(FWDUVPData.IMA_ERROR);
				}
				_s.countImaLoadedSCript++;
			}
		}
			
		
		//####################################//
		/* load buttons graphics */
		//###################################//
		_s.loadSkin = function(){
			var img;
			var src;
			for(var i=0; i<_s.totalGraphics; i++){
				img = _s.skinPaths_ar[i].img;
				src = _s.skinPaths_ar[i].src;
				img.onload = _s.onSkinLoadHandler;
				img.onerror = _s.onSkinLoadErrorHandler;
				img.src = src;
			}
		};
		
		_s.onSkinLoadHandler = function(e){
			_s.countLoadedSkinImages++;
			if(_s.countLoadedSkinImages == _s.totalGraphics){
				if(_s.showOnlyThumbnail){
					_s.thumbnailWidth = _s.thumbnailWidth - _s.scrBkTop_img.width;
					_s.showSearchInpt = false;
				}
				setTimeout(function(){
					_s.dispatchEvent(FWDUVPData.SKIN_LOAD_COMPLETE);
				}, 50);
			}
		};
		
		_s.onSkinLoadErrorHandler = function(e){
			var message;
			if (FWDUVPUtils.isIEAndLessThen9){
				message = "Graphics image not found!";
			}else{
				message = "The skin icon with label <font color='#ff0000'>" + e.target.src + "</font> can't be loaded, check path!";
			}
			
			if(window.console) console.log(e);
			var err = {text:message};
			setTimeout(function(){
				_s.dispatchEvent(FWDUVPData.LOAD_ERROR, err);
			}, 50);
		};
		

		//##########################################//
		/* Download video */
		//##########################################//
		_s.downloadVideo = function(sourcePath, pName){
				
			if(FWDUVPUtils.isLocal){
				_s.isPlaylistDispatchingError_bl = true;
				var showLoadPlaylistErrorId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Downloading video files local is not allowed or possible! To function properly please test online."});
					_s.isPlaylistDispatchingError_bl = false;
				}, 50);
				return;
			}
			
			if(!sourcePath){
				_s.isPlaylistDispatchingError_bl = true;
				var showLoadPlaylistErrorId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Not allowed to download _s video!"});
					_s.isPlaylistDispatchingError_bl = false;
				}, 50);
				return;
			}
			
			if(!sourcePath.match(/\.mp3|\.mp4/ig)){
				_s.isPlaylistDispatchingError_bl = true;
				var showLoadPlaylistErrorId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Only mp4 video files hosted on your server can be downloaded."});
					_s.isPlaylistDispatchingError_bl = false;
				}, 50);
				return;
				
			}
			
			var defaultSourcePath = sourcePath;
			var path1 = location.origin;
			var path2 = location.pathname;
		
			if(path2.indexOf(".") != -1){
				path2 = path2.substr(0, path2.lastIndexOf("/") + 1);
			}
			
			var hasHTTPorHTTPS_bl = sourcePath.indexOf("http:") == -1 && sourcePath.indexOf("https:") == -1;
		
			if(hasHTTPorHTTPS_bl){
				sourcePath = path1 + path2 + sourcePath;
			}
	
			if(!pName) return;
			pName = decodeURIComponent(pName);
			pName = pName.replace(/[^A-Z0-9\-\_\.]+/ig, "_");
		
			sourcePath = FWDUVPUtils.getValidSource(sourcePath);
			
			var url = _s.videoDownloaderPath_str;
			
			if(!_s.dlIframe){
				_s.dlIframe = document.createElement("IFRAME");
				_s.dlIframe.style.display = "none";
				document.documentElement.appendChild(_s.dlIframe);
			}
			
			if(_s.isMbl && !FWDUVPUtils.isAndroid){
				
				if(_s.openDownloadLinkOnMobile_bl){
					window.open(defaultSourcePath, "_blank");
					return;
				}
			
				var email = _s.getValidEmail();
				if(!email) return;
				
				if(_s.emailXHR != null){
					try{_s.emailXHR.abort();}catch(e){}
					_s.emailXHR.onreadystatechange = null;
					_s.emailXHR.onerror = null;
					_s.emailXHR = null;
				}
				
				_s.emailXHR = new XMLHttpRequest();
				
				_s.emailXHR.onreadystatechange = function(e){
					if(_s.emailXHR.readyState == 4){
						if(_s.emailXHR.status == 200){
							if(_s.emailXHR.responseText == "sent"){
								alert("Email sent.");
							}else{
								alert("Error sending email, _s is a server side error, the php file can't send the email!");
							}
							
						}else{
							alert("Error sending email: " + _s.emailXHR.status + ": " + _s.emailXHR.statusText);
						}
					}
				};
				
				_s.emailXHR.onerror = function(e){
					try{
						if(window.console) console.log(e);
						if(window.console) console.log(e.message);
					}catch(e){};
					alert("Error sending email: " + e.message);
				};

				_s.emailXHR.open("get", _s.mailPath_str + "?mail=" + email + "&name=" + pName + "&path=" + sourcePath, true);
				_s.emailXHR.send();
				return;
			}
			
		
			var downloadNonceParam = "";
			var downloadNonceValue = "";
			if(typeof window.fwduvpDownloadNonce !== "undefined" && window.fwduvpDownloadNonce){
				downloadNonceValue = window.fwduvpDownloadNonce;
			}else if(_s.props && _s.props.downloadNonce){
				downloadNonceValue = _s.props.downloadNonce;
			}
			if(downloadNonceValue){
				downloadNonceParam = "&fwduvp_nonce=" + encodeURIComponent(downloadNonceValue);
			}
			_s.dlIframe.src = url + "?path="+ sourcePath +"&name=" + pName + downloadNonceParam;
		};
		
		
		_s.getValidEmail = function(){
			var email = prompt("Please enter your email address where the video download link will be sent:");
			var emailRegExp = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		
			while(!emailRegExp.test(email) || email == ""){
				if(email === null) return;
				email = prompt("Please enter a valid email address:");
			}
			return email;
		};
		

		//####################################//
		/* load playlist */
		//####################################//
		_s.loadPlaylist = function(id){
			_s.id = id;
			_s.playlist_ar = undefined;
			_s.stopToLoadPlaylist();
			
			if(_s.isPlaylistDispatchingError_bl) return;
			
			clearTimeout(_s.dispatchPlaylistLoadCompleteWidthDelayId_to);
			var source = _s.catsRef_ar[id];

			if(source === undefined){
				_s.isPlaylistDispatchingError_bl = true;
				var showLoadPlaylistErrorId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"<font color='#ff0000'>loadPlaylist()</font> - Please specify a DOM playlist id or youtube playlist id!"});
					_s.isPlaylistDispatchingError_bl = false;
				}, 50);
				return;
			}
			
			if(source === null){
				_s.isPlaylistDispatchingError_bl = true;
				var showLoadPlaylistErrorId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"The playlist with id <font color='#ff0000'>" + _s.cats_ar[id].source + "</font> is not found in the DOM."});
					_s.isPlaylistDispatchingError_bl = false;
				}, 50);
				return;
			}
		
			if(!isNaN(source)){
				_s.isPlaylistDispatchingError_bl = true;
				var showLoadPlaylistErrorId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"<font color='#ff0000'>loadPlaylist()</font> - The parameter must be of type string!"});
					_s.isPlaylistDispatchingError_bl = false;
				}, 50);
				return;
			}

			_s.resetYutubeVimeoPlaylistLoader();
			_s.isYoutbe_bl = false;
			_s.loadFromFolder_bl = false;
			_s.isVimeoAlbum_bl = false;
			_s.playlist_ar = [];
			_s.playlistPass = _s.cats_ar[id].pass;
			
			if(!source.length){
				_s.parseDOMPlaylist(source, _s.cats_ar[id].source);	
			}else if(source.indexOf("list=") != -1 || source.indexOf("youtube.") != -1){
				_s.isYoutbe_bl = true;
				_s.playlist_ar = _s.plsCache_ar[_s.id];
				if(_s.playlist_ar){
					_s.youtubePlLoadComplete();
				}else{
					_s.loadYoutubePlaylist(source);
				}
			}else if(source.indexOf("vimeo.com") != -1){
				_s.isVimeo_bl = true;
				_s.loadVimeoPlaylist(source, _s.cats_ar[id]['vimeoUserId'], _s.cats_ar[id]['clientId'], _s.cats_ar[id]['vimeoSecret'], _s.cats_ar[id]['vimeoToken']);
			}else if(source.indexOf("list=") != -1){
				_s.isPlaylistDispatchingError_bl = true;
				var showLoadPlaylistErrorId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Loading youtube playlist is only possible by setting <font color='#ff0000'>useYoutube=\"yes\"</font>."});
					_s.isPlaylistDispatchingError_bl = false;
				}, 50);
				return;
			}else if(source.indexOf("folder=") != -1){
				_s.loadFolderPlaylist(source);
			}else if(source.indexOf(".xml") != -1
			  || source.indexOf("http:") != -1
			  || source.indexOf("https:") != -1
			  || source.indexOf("www.") != -1
			){
				_s.loadXMLPlaylist(source);
			}
		};

		
		//#######################################//
		/* load XML playlist (warning _s will will work only online on a web server,
		 * it is not working local!) */
		//######################################//
		_s.loadXMLPlaylist = function(url){
			if(_s.isPlaylistDispatchingError_bl) return;
			
			if(document.location.protocol == "file:"){
				_s.isPlaylistDispatchingError_bl = true;
				var showLoadPlaylistErrorId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Loading XML files local is not allowed or possible!. To function properly please test online."});
					_s.isPlaylistDispatchingError_bl = false;
				}, 50);
				return;
			}
			
			_s.sourceURL_str = url;
			_s.xhr = new XMLHttpRequest();
			_s.xhr.onreadystatechange = _s.ajaxOnLoadHandler;
			_s.xhr.onerror = _s.ajaxOnErrorHandler;
			
			try{
				_s.xhr.open("get", _s.proxyPath_str + "?url=" +  _s.sourceURL_str + "&rand=" + parseInt(Math.random() * 99999999), true);
				_s.xhr.setRequestHeader('Content-Type', 'text/xml');
				_s.xhr.send();
			}catch(e){
				var message = e;
				if(e){if(e.message)message = e.message;}
				_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"XML file can't be loaded! <font color='#ff0000'>" + _s.sourceURL_str + "</font>. " + message });
			}
		};
		

		//#######################################//
		/* load folder */
		//######################################//
		_s.loadFolderPlaylist = function(url){
			if(_s.isPlaylistDispatchingError_bl) return;
			
			if(document.location.protocol == "file:"){
				_s.isPlaylistDispatchingError_bl = true;
				var showLoadPlaylistErrorId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Creating a video playlist from a folder is not allowed or possible local! To function properly please test online."});
					_s.isPlaylistDispatchingError_bl = false;
				}, 50);
				return;
			}	
			
			_s.loadFromFolder_bl = true;
			_s.sourceURL_str = url.substr(url.indexOf("=") + 1);
			_s.xhr = new XMLHttpRequest();
			_s.xhr.onreadystatechange = _s.ajaxOnLoadHandler;
			_s.xhr.onerror = _s.ajaxOnErrorHandler;
			
			try{
				_s.xhr.open("get", _s.proxyFolderPath_str + "?dir=" +  encodeURIComponent(_s.sourceURL_str) + "&videoLabel=" + _s.folderVideoLabel_str  + "&rand=" + parseInt(Math.random() * 9999999), true);
				_s.xhr.send();
			}catch(e){
				var message = e;
				if(e){if(e.message)message = e.message;}
				_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Please make sure the folder exists and it has video or audio files in it: <font color='#ff0000'>" + encodeURIComponent(_s.sourceURL_str) + "</font>"});
			}
		};


		//##########################################//
		/* load youtube list */
		//##########################################//
		_s.loadVimeoPlaylist = function(url, userId, clientId, vimeoSecret, vimeoToken){
			if(document.location.protocol == "file:"){
				_s.isPlaylistDispatchingError_bl = true;
				var showLoadPlaylistErrorId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Loading Vimeo albums local is not allowed or possible! To function properly please test online."});
					_s.isPlaylistDispatchingError_bl = false;
				}, 50);
				return;
			}
			
			_s.isVimeoAlbum_bl = true;
			if(url) _s.vimeoAlbumURL = url;
			if(userId) _s.userId = userId;
			if(clientId) _s.clientId = clientId;
			if(vimeoSecret) _s.vimeoSecret = vimeoSecret;
			if(vimeoToken) _s.vimeoToken = vimeoToken;
			var albumId = _s.vimeoAlbumURL.match(/\/[\d]+/ig);
			albumId = albumId[0].substr(1);
			
			var vimeoNonceParam = '';
			if(window.fwduvpVimeoNonce){
				vimeoNonceParam = '&fwduvp_nonce=' + encodeURIComponent(window.fwduvpVimeoNonce);
			}
			
			if(_s.nextPageToken_str){
				_s.sourceURL_str = _s.mainFolderPath_str + 'vimeo/data.php?rand=' + Math.round(Math.random() * 99999999) +  '&type=vimeo_user_album&user=' + _s.userId + '&album_id=' + albumId + '&page='+ _s.nextPageToken_str + '&per_page=50' + vimeoNonceParam;
			}else{
				_s.sourceURL_str = _s.mainFolderPath_str + 'vimeo/data.php?rand=' + Math.round(Math.random() * 99999999) +  '&type=vimeo_user_album&user=' + _s.userId + '&album_id=' + albumId + '&page=1&per_page=50' + vimeoNonceParam;
			}
			
			_s.xhr = new XMLHttpRequest();
			_s.xhr.onreadystatechange = _s.ajaxOnLoadHandler;
			_s.xhr.onerror = _s.ajaxOnErrorHandler;
			
			try{
				_s.xhr.open("get",_s.sourceURL_str, true);
				_s.xhr.send();
			}catch(e){
				var message = e;
				if(e){if(e.message)message = e.message;}
				_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Error loading vimeo album! <font color='#ff0000'>" + _s.vimeoAlbumURL + "</font>"});
			}
		}
		
		_s.parseVimeoPlaylist = function(object){
			_s.stopToLoadPlaylist();
			if(object['body']['error']){
				_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:object['body']['error'] + ' ' + object['body']['developer_message']});
				return;
			}
			object = object['body'];
		
			var tt;
			var item;
			var videoSource;
			
			if(!_s.vimeoObject_ar){
				_s.vimeoObject_ar = [];
			}
			
			for(var i=0; i<object.data.length; i++){
				_s.vimeoObject_ar.push(object.data[i]);
			}
			
			tt = _s.vimeoObject_ar.length;
			
			
			if(object['paging']['next']){
				_s.nextPageToken_str = Number(object['page']) + 1;
				_s.loadVimeoPlaylist();
				return;
			}
		
			for(var i=0; i< tt; i++){
				
				var obj = {};
				item = _s.vimeoObject_ar[i];
				var videoId = item['uri'].match(/\/[\d]+/ig)[0].substr(1);
				obj.startAtVideo = 0;
				obj.videoSource = [{source:'https://vimeo.com/' + videoId}];
				
				obj['atb'] = 'yes';
				obj.gaStr = item['name'];
				obj.title = "<p class='ytbChangeColor fwduvp-ytb-info-title' style='color:" + _s.youtubeAndFolderVideoTitleColor_str + ";'>" + item['name'] + "</p>";
				
				var desc = item['description'];
				if(!desc) desc = "";
				if(obj.title.length > 165){
					desc = desc.substr(0, 60);
				}else{
					desc = desc.substr(0, 90);
				}
				
				desc = desc.substr(0, desc.lastIndexOf(" ")) + " ...";
				
				obj.titleText = item['name'];
				obj.titleText = item['name'];
				obj.desc = undefined;
				
				obj.desc = "<p class='fwduvp-ytb-info-title' style='color:" + _s.youtubeAndFolderVideoTitleColor_str + ";'>" + item['name'] + "</p><p class='fwduvp-ytb-info-p' style='color:" + _s.youtubeDescriptionColor_str + ";'>" + item['description'] + "</p>";
				obj.downloadable = false;
				try{
					obj.thumbSource = item['pictures']['sizes'][2]['link'];
				}catch(e){}
				obj.posterSource =  "none";
			
				obj.downloadable = false;
				_s.playlist_ar.push(obj);
			}

			if(_s.randomizePlaylist_bl){
				_s.playlist_ar = FWDUVPUtils.randomizeArray(_s.playlist_ar);
			}
		
			if(_s.maxPlaylistItems < _s.playlist_ar.length){
				_s.playlist_ar = _s.playlist_ar.splice(0, _s.maxPlaylistItems);
			}
			
			clearTimeout(_s.dispatchPlaylistLoadCompleteWidthDelayId_to);
			_s.dispatchPlaylistLoadCompleteWidthDelayId_to = setTimeout(function(){
				_s.dispatchEvent(FWDUVPData.PLAYLIST_LOAD_COMPLETE);
			}, 50);
	
			_s.isDataLoaded_bl = true;
		}
		

		//##########################################//
		/* load youtube list */
		//##########################################//
		_s.loadYoutubePlaylist = function(url){
			if(_s.isPlaylistDispatchingError_bl && !_s.isYoutbe_bl) return;
		
			_s.isChannel = url.indexOf('channel/') != -1;
			_s.url = url;
			if(!_s.youtubeUrl_str){
				if(url.indexOf('list=')  != -1){
					var rx = /list=(.*?)(?:&|$)/i;
					var arr = rx.exec(url);
				}else{
					var rx = /channel\/(.*?)(?:&|$)/i;
					var arr = rx.exec(url);
				}
				
				url = arr[1];
				_s.youtubeUrl_str = url;
			}
			
			if(_s.nextPageToken_str){
				if(_s.isChannel){
					_s.sourceURL_str = "https://www.googleapis.com/youtube/v3/search?part=snippet&pageToken=" + _s.nextPageToken_str + "&channelId=" + _s.youtubeUrl_str + "&key=" + _s.youtubeAPIKey + "&maxResults=50&callback=" + prt.instanceName_str + "._d.parseYoutubePlaylist";
				}else{
					_s.sourceURL_str = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&pageToken=" + _s.nextPageToken_str + "&playlistId=" + _s.youtubeUrl_str + "&key=" + _s.youtubeAPIKey + "&maxResults=50&callback=" + prt.instanceName_str + "._d.parseYoutubePlaylist";
				}
				
			}else{
				if(_s.isChannel){
					_s.sourceURL_str = "https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=" + _s.youtubeUrl_str + "&key=" + _s.youtubeAPIKey + "&maxResults=50&callback=" + prt.instanceName_str + "._d.parseYoutubePlaylist";
				}else{
					_s.sourceURL_str = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=" + _s.youtubeUrl_str + "&key=" + _s.youtubeAPIKey + "&maxResults=50&callback=" + prt.instanceName_str + "._d.parseYoutubePlaylist";
				}
			}
			
			if(_s.scs_el == null){
				try{
					_s.scs_el = document.createElement('script');
					_s.scs_el.src = _s.sourceURL_str;
					_s.scs_el.id = prt.instanceName_str + "._d.parseYoutubePlaylist";
					document.documentElement.appendChild(_s.scs_el);
				}catch(e){}
			}
			_s.JSONPRequestTimeoutId_to = setTimeout(function(){
				var err;
				if(_s.isChannel){
					err = 'channel';
				}
				_s.JSONPRequestTimeoutError("Error loading youtube " + err + "!<font color='#ff0000'>" + _s.youtubeUrl_str + "</font>");
			}, 6000);
		
		};
		
		_s.JSONPRequestTimeoutError = function(text){
			_s.stopToLoadPlaylist();
			_s.isPlaylistDispatchingError_bl = true;
			var showLoadPlaylistErrorId_to = setTimeout(function(){
				_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:text});
				_s.isPlaylistDispatchingError_bl = false;
			}, 50);
			return;
		};
		
		_s.resetYutubeVimeoPlaylistLoader = function(){
			_s.isYoutbe_bl = false;
			_s.youtubeObject_ar = null;
			_s.vimeoObject_ar = null;
			_s.nextPageToken_str = null;
			_s.youtubeUrl_str = null;
		};

		
		//######################################//
		/* Handle ajax response */
		//######################################//
		_s.ajaxOnErrorHandler = function(e){
			try{
				if(window.console) console.log(e);
				if(window.console) console.log(e.message);
			}catch(e){};
			if(_s.isVimeoAlbum_bl){
				_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Error loading vimeo album! <font color='#ff0000'>" + _s.vimeoAlbumURL + "</font>"});
			}else if(_s.loadFromFolder_bl){
				_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Error loading file : <font color='#ff0000'>" + _s.proxyFolderPath_str + "</font>. Make sure the path is correct"});
			}else{
				_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Error loading file : <font color='#ff0000'>" + _s.proxyPath_str + "</font>. Make sure the path is correct"});
			}
		};
		
		_s.ajaxOnLoadHandler = function(e){
			var response;
			var isXML = false;
			
			if(_s.xhr.readyState == 4){
				if(_s.xhr.status == 404){
					if(_s.isVimeoAlbum_bl){
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Error loading vimeo album! <font color='#ff0000'>" + _s.vimeoAlbumURL + "</font>"});
					}else if(_s.loadFromFolder_bl){
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Folder proxy file path is not found: <font color='#ff0000'>" + _s.proxyFolderPath_str + "</font>"});
					}else{
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Proxy file path is not found: <font color='#ff0000'>" + _s.proxyPath_str + "</font>"});
					}
					
				}else if(_s.xhr.status == 408){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Server has timeout!"});
				}else if(_s.xhr.status == 200){
					if(_s.xhr.responseText.indexOf("<b>Warning</b>:") != -1){
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Error loading folder: <font color='#ff0000'>" + _s.sourceURL_str + "</font>. Make sure that the folder path is correct!"});
						return;
					}
					
					if(window.JSON){
						response = JSON.parse(_s.xhr.responseText);
					}else{
						response = eval('('+ _s.xhr.responseText +')');
					}
				
					if(response.body){
						_s.parseVimeoPlaylist(response);
					}else if(response.folder){
						_s.parseFolderJSON(response);
					}else if(response.li){
						_s.parseXML(response);
					}else if(response.error){
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Error loading file: <font color='#ff0000'>" + _s.sourceURL_str + "</font>. Make sure the file path (xml or podcast) is correct and well formatted!"});
					}
				}
			}
		};
		
		_s.parseYoutubePlaylist = function(object){
			
			if(_s.isPlaylistDispatchingError_bl || !_s.isYoutbe_bl) return;
			if(object.error){
				var err;
				if(_s.isChannel){
					err = 'channel';
				}
				_s.JSONPRequestTimeoutError("Error loading youtube " + err + "! <font color='#ff0000'>" + _s.youtubeUrl_str + "</font>");
				if(console) console.log(object);
				return;
			}
			
			_s.playlist_ar = [];
			var tt;
			var item;
			var videoSource;
			
			if(!_s.youtubeObject_ar){
				_s.youtubeObject_ar = [];
			}
			
			for(var i=0; i<object.items.length; i++){
				_s.youtubeObject_ar.push(object.items[i]);
			}
			
			tt = _s.youtubeObject_ar.length;
			
			_s.stopToLoadPlaylist();
			
			if(object.nextPageToken){
				_s.nextPageToken_str = object.nextPageToken;
				_s.loadYoutubePlaylist(_s.url);
				return;
			}
			
			for(var i=0; i< tt; i++){
				
				var obj = {};
				item = _s.youtubeObject_ar[i];
				if(item.snippet.thumbnails){
					if(_s.isChannel){
						obj.videoSource = item.id.videoId;
					}else{
						obj.videoSource = item.snippet.resourceId.videoId;
					}
				
					obj.startAtVideo = 0;
					obj.videoSource = [{source:"https://www.youtube.com/watch?v=" + obj.videoSource}];
					obj.owner = item.snippet.channelTitle;
					obj.gaStr =  item.snippet.title;

					if(window['isWhite']){
						_s.youtubeAndFolderVideoTitleColor_str = '#000000';
					}else if(window['isDark']){
						_s.youtubeAndFolderVideoTitleColor_str = '#FFFFFF';
					}
					
					obj.title = "<p class='ytbChangeColor fwduvp-ytb-title' style='color:" + _s.youtubeAndFolderVideoTitleColor_str + ";'>" + item.snippet.title + "</p>";
					var desc = item.snippet.description;
					if(obj.title.length > 190){
						desc = desc.substr(0, 20);
					}else if(obj.title.length > 165){
						desc = desc.substr(0, 60);
					}else{
						desc = desc.substr(0, 90);
					}
					
					desc = desc.substr(0, desc.lastIndexOf(" ")) + " ...";
					obj.title += "<p class='fwduvp-ytb-p' style='color:" + _s.youtubeOwnerColor_str + ";'> " + desc + "</p>";
				
					obj.titleText = item.snippet.title;
					obj.titleText = item.snippet.title;
					obj.desc = undefined;
					
					obj.desc = "<p class='fwduvp-ytb-info-title' style='color:" + _s.youtubeAndFolderVideoTitleColor_str + ";'>" + item.snippet.title + "</p><p class='fwduvp-ytb-info-p' style='color:" + _s.youtubeDescriptionColor_str + ";'>" + item.snippet.description + "</p>";
				
					obj.downloadable = false;
				
					try{
						obj.thumbSource = item.snippet.thumbnails["default"].url;
						if(_s.showOnlyThumbnail){
							if(item.snippet.thumbnails["standard"]){
								obj.thumbSource = item.snippet.thumbnails["standard"].url;
							}else if(item.snippet.thumbnails["high"]){
								obj.thumbSource = item.snippet.thumbnails["high"].url;
							}
						}
					}catch(e){}
					obj.posterSource =  "none";
					
					if(item.snippet.title.indexOf("eleted video") == -1 && item.snippet.title.indexOf("his video is unavailable") == -1){
						_s.playlist_ar.push(obj);
					}
				}
			}

			if(_s.randomizePlaylist_bl){
				_s.playlist_ar = FWDUVPUtils.randomizeArray(_s.playlist_ar);
			}
		
			if(_s.maxPlaylistItems < _s.playlist_ar.length){
				_s.playlist_ar = _s.playlist_ar.splice(0, _s.maxPlaylistItems);
			}

			_s.plsCache_ar[_s.id] = _s.playlist_ar;
			
			_s.youtubePlLoadComplete();
		};

		_s.youtubePlLoadComplete = function(){
			clearTimeout(_s.dispatchPlaylistLoadCompleteWidthDelayId_to);
			_s.dispatchPlaylistLoadCompleteWidthDelayId_to = setTimeout(function(){
				_s.dispatchEvent(FWDUVPData.PLAYLIST_LOAD_COMPLETE);
			}, 50);
			_s.isDataLoaded_bl = true;
		}
		
			
		_s.isDataLoaded_bl = true;
		
		_s.setYoutubePlaylistHEXColor = function(color){
			_s.youtubeAndFolderVideoTitleColor_str = color;
		}
		
		_s.closeJsonPLoader = function(){
			clearTimeout(_s.JSONPRequestTimeoutId_to);
		};
		

		//##########################################//
		/* parse DOM playlist */
		//##########################################//
		_s.parseDOMPlaylist = function(element, id){
			if(_s.isPlaylistDispatchingError_bl) return;
		
			var children_ar = FWDUVPUtils.getChildren(element);
			var totalChildren = children_ar.length;
			var child;
			var has360Video = false;
			_s.playlist_ar = [];
			
			if(totalChildren == 0){
				var showLoadPlaylistErrorId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"At least one video is required in the playlist with id: <font color='#ff0000'>" + id + "</font>"});
					_s.isPlaylistDispatchingError_bl = false;
				}, 50);
				return;
			}
			
			for(var i=0; i<totalChildren; i++){
				var obj = {};
				var adsObj;
				child = children_ar[i];
				
				if(!FWDUVPUtils.hasAttribute(child, "data-thumb-source")){
					_s.isPlaylistDispatchingError_bl = true;
					var showLoadPlaylistErrorId_to = setTimeout(function(){
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Attribute <font color='#ff0000'>data-thumb-source</font> is required in the playlist at position <font color='#ff0000'>" + (i + 1)});
					}, 50);
					return;
				}
				
				if(!FWDUVPUtils.hasAttribute(child, "data-video-source")){
					_s.isPlaylistDispatchingError_bl = true;
					var showLoadPlaylistErrorId_to = setTimeout(function(){
						_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Attribute <font color='#ff0000'>data-video-source</font> is required in the playlist at position <font color='#ff0000'>" + (i + 1)});
					}, 50);
					return;
				}
				
				obj.thumbSource = encodeURI(FWDUVPUtils.getAttributeValue(child, "data-thumb-source"));
				
				obj.videoSource = FWDUVPUtils.getAttributeValue(child, "data-video-source");
				obj._dPlaybackRate  = FWDUVPUtils.getAttributeValue(child, "data-playback-rate");
				obj.startAtVideo = FWDUVPUtils.getAttributeValue(child, "data-start-at-video") || 0;
				obj.isLive = FWDUVPUtils.getAttributeValue(child, "data-is-live");
				obj.atb = FWDUVPUtils.getAttributeValue(child, "data-use-a-to-b") == "yes" ? true : false;
				obj.thumbnailsPreview = FWDUVPUtils.getAttributeValue(child, "data-thumbnails-preview");
				if(!_s.useAToB) obj.atb = false;
				
				if(obj.isLive == "yes"){
					obj.isLive = true;
				}else{
					obj.isLive = false;
				}
				
				obj.isPrivate = FWDUVPUtils.getAttributeValue(child, "data-is-private");
				if(obj.isPrivate == "yes"){
					obj.isPrivate = true;
				}else{
					obj.isPrivate = false;
				}

				obj.redirectURL = FWDUVPUtils.getAttributeValue(child, "data-redirect-url");
				obj.redirectTarget = FWDUVPUtils.getAttributeValue(child, "data-redirect-target");
				obj.privateVideoPassword_str = FWDUVPUtils.getAttributeValue(child, "data-private-video-password");
				obj.startAtTime = FWDUVPUtils.getAttributeValue(child, "data-start-at-time");
				if(obj.startAtTime == "00:00:00" || !FWDUVPUtils.checkTime(obj.startAtTime)) obj.startAtTime = undefined;
				
				obj.stopAtTime = FWDUVPUtils.getAttributeValue(child, "data-stop-at-time");
				if(obj.stopAtTime == "00:00:00" || !FWDUVPUtils.checkTime(obj.stopAtTime)) obj.stopAtTime = undefined;
				
				if(obj.videoSource.indexOf("{source:") != -1){
					
					try{
						obj.videoLabels_ar = [];
						obj.videoSource = eval(obj.videoSource);
						for(var m=0; m<obj.videoSource.length; m++){
							obj.videoLabels_ar[m] = obj.videoSource[m]["label"];
						}
						for(var m=0; m<obj.videoSource.length; m++){
							var src = obj.videoSource[m].source;
							if(src.indexOf("encrypt:") != -1) src = atob(src.substr(8));
							obj.videoSource[m].source = FWDUVPUtils.getValidSource(src);

							var mm = obj.videoSource[m].startWhenPlayButtonClick360DegreeVideo;
							if(mm == "yes"){
								mm = true;
							}else{
								mm = false;
							}
							obj.videoSource[m].startWhenPlayButtonClick360DegreeVideo = mm;

							var rr = obj.videoSource[m].rotationY360DegreeVideo;
							if(rr != undefined){
								rr = Number(obj.videoSource[m].rotationY360DegreeVideo);
							}else{
								rr = -90;
							}
							obj.videoSource[m].rotationY360DegreeVideo = rr;
						}

						for(var m=0; m<obj.videoSource.length; m++){
							obj.videoSource[m].is360 = obj.videoSource[m]['is360'];
							if(obj.videoSource[m].is360 == "yes") obj.videoSource[m].is360 = true;
							if(obj.videoSource[m].is360 == "no") obj.videoSource[m].is360 = false;
							if(obj.videoSource[m].is360 == true) has360Video = true;
						}
						
						obj.videoLabels_ar.reverse();
					}catch(e){
						_s.isPlaylistDispatchingError_bl = true;
						var showLoadPlaylistErrorId_to = setTimeout(function(){
							_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Please make sure that the <font color='#ff0000'>data-video-source</font> attribute contains an array of videos at position <font color='#ff0000'>" + (i + 1) + "</font>"});
						}, 50);
						return;
					}
				}else{
					src = obj.videoSource;
					if(src.indexOf("encrypt:") != -1) src = atob(src.substr(8));
					obj.videoSource = [{source:FWDUVPUtils.getValidSource(src)}];
				}
			
				if(FWDUVPUtils.hasAttribute(child, "data-subtitle-soruce")){
					obj.subtitleSource = FWDUVPUtils.getAttributeValue(child, "data-subtitle-soruce");
					if(obj.subtitleSource.indexOf("{source:") != -1){
						obj.startAtSubtitle = FWDUVPUtils.getAttributeValue(child, "data-start-at-subtitle") || 0;
						if(obj.subtitleSource.indexOf("{source:") != -1){
							try{
								obj.subtitleSource = eval(obj.subtitleSource);
							}catch(e){
								_s.isPlaylistDispatchingError_bl = true;
								var showLoadPlaylistErrorId_to = setTimeout(function(){
									_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Please make sure that the <font color='#ff0000'>data-subtitle-source</font> attribute contains an array of subtitles at position <font color='#ff0000'>" + (i + 1) + "</font>"});
								}, 50);
								return;
							}
							obj.subtitleSource.splice(0,0, {source:"none", label:_s.subtitlesOffLabel_str});
							obj.subtitleSource.reverse();
						}
					}else{
						obj.subtitleSource = [{source:obj.subtitleSource}];
					}
					if(obj.subtitleSource){
						for(var x=0; x<obj.subtitleSource.length; x++){
							var source = obj.subtitleSource[x].source;
							if(source.indexOf("encrypt:") != -1) obj.subtitleSource[x].source = atob(source.substr(8));
						}
					}
				}
				
				obj._dAdvertisementOnPauseSource  = FWDUVPUtils.getAttributeValue(child, "data-advertisement-on-pause-source");
				obj.scrubAtTimeAtFirstPlay = FWDUVPUtils.getAttributeValue(child, "data-scrub-at-time-at-first-play") || "none";
				if(/^((?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$)/g.test(obj.scrubAtTimeAtFirstPlay)){
					obj.scrubAtTimeAtFirstPlay = FWDUVPUtils.getSecondsFromString(obj.scrubAtTimeAtFirstPlay);
				}else{
					obj.scrubAtTimeAtFirstPlay = undefined;
				}
				
				if(FWDUVPUtils.hasAttribute(child, "data-poster-source")){
					obj.posterSource = encodeURI(FWDUVPUtils.getAttributeValue(child, "data-poster-source"));
				}else{
					obj.posterSource = "none";
				}
			
				obj.downloadPath = obj.videoSource[obj.startAtVideo];
				
				if(FWDUVPUtils.hasAttribute(child, "data-downloadable") && _s.showDownloadVideoButton_bl){
					obj.downloadable = FWDUVPUtils.getAttributeValue(child, "data-downloadable") == "yes" ? true : false;
					if(obj.downloadPath.source.indexOf(".") ==  -1)  obj.downloadable = false;
				}else{
					obj.downloadable = false;
				}

				if(FWDUVPUtils.hasAttribute(child, "data-play-if-logged-in")){
					obj.playIfLoggedIn = FWDUVPUtils.getAttributeValue(child, "data-play-if-logged-in");
					if(obj.playIfLoggedIn == 'no') obj.playIfLoggedIn = undefined;
				}
				
				//video popup adds and annotations
				var annotations_ar;
				var mainPopupAds_ar = FWDUVPUtils.getChildren(child);
				var tempPopupAds_ar;
				var popupAds_ar;
				var popupOrAnnotationChild;
				var finalPopupChild;
				var popupObj;
				
				for(var k=0; k<mainPopupAds_ar.length; k++){
					
					popupOrAnnotationChild = mainPopupAds_ar[k];	
					if(FWDUVPUtils.hasAttribute(popupOrAnnotationChild, "data-add-popup")){
						tempPopupAds_ar = FWDUVPUtils.getChildren(popupOrAnnotationChild);
						popupAds_ar = [];
						for(var x=0; x<tempPopupAds_ar.length; x++){
							finalPopupChild = tempPopupAds_ar[x];
							if(finalPopupChild){
								popupObj = {};
								popupObj.source = FWDUVPUtils.getValidSource(FWDUVPUtils.getAttributeValue(finalPopupChild, "data-image-path"));
								popupObj.timeStart = FWDUVPUtils.getSecondsFromString(FWDUVPUtils.getAttributeValue(finalPopupChild, "data-time-start"));
								popupObj.timeEnd = FWDUVPUtils.getSecondsFromString(FWDUVPUtils.getAttributeValue(finalPopupChild, "data-time-end"));
								popupObj.link = FWDUVPUtils.getAttributeValue(finalPopupChild, "data-link");
								popupObj.target = FWDUVPUtils.getAttributeValue(finalPopupChild, "data-target");
								popupObj.google_ad_width = parseInt(FWDUVPUtils.getAttributeValue(finalPopupChild, "data-google-ad-width")) || 600;
								popupObj.google_ad_height = parseInt(FWDUVPUtils.getAttributeValue(finalPopupChild, "data-google-ad-height")) || 200;
								popupObj.google_ad_client = FWDUVPUtils.getAttributeValue(finalPopupChild, "data-google-ad-client");
								popupObj.google_ad_slot = FWDUVPUtils.getAttributeValue(finalPopupChild, "data-google-ad-slot");
								popupAds_ar.push(popupObj);
							}
						}
						
						obj.popupAds_ar = popupAds_ar;
					}
					
					//ads
					if(FWDUVPUtils.hasAttribute(popupOrAnnotationChild, "data-ads")){
						var adsData_ar = FWDUVPUtils.getChildren(popupOrAnnotationChild);
						var ads_ar = [];
					
						var adsChild;
						var tt = adsData_ar.length;
						
						for(var m=0; m<tt; m++){
							var adsObj = {};
							adsChild = adsData_ar[m];
							
							adsObj.timeStart = FWDUVPUtils.getSecondsFromString(FWDUVPUtils.getAttributeValue(adsChild, "data-time-start"));
							if(FWDUVPUtils.hasAttribute(adsChild, "data-add-duration")){
								adsObj.addDuration = FWDUVPUtils.getSecondsFromString(FWDUVPUtils.getAttributeValue(adsChild, "data-add-duration"));
							}
							
							adsObj.thumbnailSource = FWDUVPUtils.getAttributeValue(adsChild, "data-thumbnail-source");
							if(adsObj.thumbnailSource == "" || adsObj.thumbnailSource == " ") adsObj.thumbnailSource = undefined;
							
							adsObj.timeToHoldAds = parseInt(FWDUVPUtils.getAttributeValue(adsChild, "data-time-to-hold-ads") || 4);
							adsObj.source = FWDUVPUtils.getValidSource(FWDUVPUtils.getAttributeValue(adsChild,"data-source"));
							adsObj.link = FWDUVPUtils.getAttributeValue(adsChild,"data-link");
							adsObj.target = FWDUVPUtils.getAttributeValue(adsChild,"data-target");
							
							ads_ar[m] = adsObj
						}
						
						obj.ads_ar = ads_ar
					}
					
					if(FWDUVPUtils.hasAttribute(child, "data-vast-url")){
						obj.ads_ar = undefined;
						var vsrc = FWDUVPUtils.getAttributeValue(child, "data-vast-url");
						
						if(FWDUVPUtils.isIMA(vsrc)){
							obj.imaURL = vsrc;
						}else{
							obj.vastURL = vsrc;
							obj.vastClickTroughTarget = FWDUVPUtils.getAttributeValue(child, "data-vast-clicktrough-target") || "_blank";
							obj.vastLinearStartTime = FWDUVPUtils.getAttributeValue(child, "data-vast-linear-astart-at-time") || "00:00:00";
						}
					}
				
					//cuepoints
					if(FWDUVPUtils.hasAttribute(popupOrAnnotationChild, "data-cuepoints")){
						var cuepointsData_ar = FWDUVPUtils.getChildren(popupOrAnnotationChild);
						var cuepoints_ar = [];
					
						var cuepointsChild;
						var tt = cuepointsData_ar.length;
						
						for(var m=0; m<tt; m++){
							var cuepointsObj = {};
							cuepointsChild = cuepointsData_ar[m];
							
							cuepointsObj.timeStart = FWDUVPUtils.getSecondsFromString(FWDUVPUtils.getAttributeValue(cuepointsChild, "data-time-start"));
							cuepointsObj.javascriptCall = FWDUVPUtils.getAttributeValue(cuepointsChild, "data-javascript-call");
							cuepointsObj.isPlayed_bl = false;
							cuepoints_ar[m] = cuepointsObj
						}
						
						obj.cuepoints_ar = cuepoints_ar
					}
					
					//annotation
					if(FWDUVPUtils.hasAttribute(popupOrAnnotationChild, "data-annotations")){
						annotations_ar = FWDUVPUtils.getChildren(popupOrAnnotationChild);
				
						var annotationChild;
						var tt = annotations_ar.length;
						
						for(var m=0; m<tt; m++){
							var annotationObj = {};
							annotationChild = annotations_ar[m];
							
							annotationObj.start = FWDUVPUtils.getSecondsFromString(FWDUVPUtils.getAttributeValue(annotationChild, "data-start-time"));
							annotationObj.end = FWDUVPUtils.getSecondsFromString(FWDUVPUtils.getAttributeValue(annotationChild, "data-end-time"));
							annotationObj.left = parseInt(FWDUVPUtils.getAttributeValue(annotationChild, "data-left"), 10);
							annotationObj.top = parseInt(FWDUVPUtils.getAttributeValue(annotationChild, "data-top"), 10);
							
							annotationObj.showCloseButton_bl = FWDUVPUtils.getAttributeValue(annotationChild, "data-show-close-button") == "yes" ? true : false; 
							annotationObj.clickSource = FWDUVPUtils.getAttributeValue(annotationChild, "data-click-source");
							annotationObj.clickSourceTarget = FWDUVPUtils.getAttributeValue(annotationChild, "data-click-source-target");
					
							annotationObj.normalStateClass = FWDUVPUtils.getAttributeValue(annotationChild, "data-normal-state-class");
							annotationObj.selectedStateClass = FWDUVPUtils.getAttributeValue(annotationChild, "data-selected-state-class");
							
							annotationObj.content = annotationChild.innerHTML;
							
							annotations_ar[m] = annotationObj
						}
						
						obj.annotations_ar = annotations_ar
					}
				}
				
				//video description
				var descChidren_ar = FWDUVPUtils.getChildren(child);
				var descChild;
				obj.title = "not defined!";
				obj.titleText = "not defined!";
				
				for(var k=0; k<descChidren_ar.length; k++){
					descChild = descChidren_ar[k];	
					if(FWDUVPUtils.hasAttribute(descChild, "data-video-short-description")){
						obj.title =  descChild.innerHTML;
						obj.titleText = descChild.textContent;
						obj.titleText = obj.titleText.replace(/^\s+/g, '')
						
					}else if(FWDUVPUtils.hasAttribute(descChild, "data-video-long-description")){
						obj.desc = descChild.innerHTML;
					}
				}
			
				var gaStr = obj.titleText.split('\n')
				for(var x=0; x<gaStr.length; x++){
				
					if(gaStr[x].length > 2){
						obj.gaStr = gaStr[x];
						break;
					}
				}
				
				if(FWDUVPUtils.hasAttribute(child, "data-ads-source")){
					adsObj = {};
					adsObj.source = FWDUVPUtils.getValidSource(FWDUVPUtils.getAttributeValue(child, "data-ads-source"));
					adsObj.pageToOpen = FWDUVPUtils.getAttributeValue(child, "data-ads-page-to-open-url");
					adsObj.pageTarget = FWDUVPUtils.getAttributeValue(child, "data-ads-page-target") || "_blank";
					adsObj.timeToHoldAds = parseInt(FWDUVPUtils.getAttributeValue(child, "data-time-to-hold-ads")) || 0;
					obj.ads = adsObj;
				}
			
				_s.playlist_ar[i] = obj;
			}

			if(_s.randomizePlaylist_bl){
				_s.playlist_ar = FWDUVPUtils.randomizeArray(_s.playlist_ar);
			}
		
			if(_s.maxPlaylistItems < _s.playlist_ar.length){
				_s.playlist_ar = _s.playlist_ar.splice(0, _s.maxPlaylistItems);
			}
		
			clearTimeout(_s.dispatchPlaylistLoadCompleteWidthDelayId_to);
			_s.dispatchPlaylistLoadCompleteWidthDelayId_to = setTimeout(function(){
				_s.dispatchEvent(FWDUVPData.PLAYLIST_LOAD_COMPLETE);
			}, 50);
	
			_s.isDataLoaded_bl = true;
		};
		

		//####################################//
		/* parse folder JSON */
		//####################################//
		_s.parseFolderJSON = function(response){
			_s.playlist_ar = [];
			var obj;
			var obj_ar = response.folder;
			var counter = 0;
			if(obj_ar && !obj_ar.length){
				_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Please make sure the folder exists and it has video or audio files in it: <font color='#ff0000'>" + encodeURIComponent(_s.sourceURL_str) + "</font>"});
				return;
			}

			for(var i=0; i<obj_ar.length; i++){
				obj = {};
				obj.videoSource = encodeURI(obj_ar[i]["@attributes"]["data-video-path"]);
				
				obj.videoSource =  obj_ar[i]["@attributes"]["data-video-path"];
				obj._dPlaybackRate  = obj_ar[i]["@attributes"]["data-playback-rate"];
				obj.startAtVideo = obj_ar[i]["@attributes"]["data-start-at-video"] || 0;
				obj.videoSource = [{source:FWDUVPUtils.getValidSource(obj.videoSource)}];
				obj.thumbSource = encodeURI(obj_ar[i]["@attributes"]["data-thumb-path"]);
				obj.posterSource = encodeURI(obj_ar[i]["@attributes"]["data-poster-path"]);
				obj.downloadPath = encodeURIComponent(obj_ar[i]["@attributes"]["download-path"]);
				
				obj.downloadable = _s.showDownloadVideoButton_bl;
				if(_s.forceDisableDownloadButtonForFolder_bl) obj.downloadable = false;
				obj.titleText = "...";
				obj.title = "<p class='fwduvp-thumbnail-title' style='color:" + _s.youtubeAndFolderVideoTitleColor_str + "'>...</p>";
					
				obj.titleText = obj_ar[i]["@attributes"]["data-title"];
				obj.title = "<p class='fwduvp-thumbnail-title' style='color:" + _s.youtubeAndFolderVideoTitleColor_str + "'>" + obj_ar[i]["@attributes"]["data-title"] + "</p>";
				obj.desc = undefined;
				
				_s.playlist_ar[i] = obj;
			}

			if(_s.randomizePlaylist_bl){
				_s.playlist_ar = FWDUVPUtils.randomizeArray(_s.playlist_ar);
			}
		
			if(_s.maxPlaylistItems < _s.playlist_ar.length){
				_s.playlist_ar = _s.playlist_ar.splice(0, _s.maxPlaylistItems);
			}
			
			clearTimeout(_s.dispatchPlaylistLoadCompleteWidthDelayId_to);
			_s.dispatchPlaylistLoadCompleteWidthDelayId_to = setTimeout(function(){
				_s.dispatchEvent(FWDUVPData.PLAYLIST_LOAD_COMPLETE);
			}, 50);
	
			_s.isDataLoaded_bl = true;
		};
		

		//####################################//
		/* parse xml JSON */
		//####################################//
		_s.parseXML = function(response){
			_s.playlist_ar = [];
			var obj;
			var obj_ar = response.li;
			var has360Video = false;
			
			if(!obj_ar.length) obj_ar = [obj_ar];
			
			for(var i=0; i<obj_ar.length; i++){
				obj = {};
				
				obj.videoSource =  obj_ar[i]["@attributes"]["data-video-source"];
				obj.startAtVideo = obj_ar[i]["@attributes"]["data-start-at-video"] || 0;

				obj.startWhenPlayButtonClick360DegreeVideo =  obj_ar[i]["@attributes"]["data-start-when-play-button-click-60D-degree-video"];
				if(obj.startWhenPlayButtonClick360DegreeVideo == 'yes') obj.startWhenPlayButtonClick360DegreeVideo = true;
				obj.rotationY360DegreeVideo =obj_ar[i]["@attributes"]["data-rotation-y-360-degree-video"];
				if(obj.rotationY360DegreeVideo === undefined) obj.rotationY360DegreeVideo = -90;
				obj.isLive = obj_ar[i]["@attributes"]["data-is-live"];
				obj.atb = obj_ar[i]["@attributes"]["data-use-a-to-b"] == "yes" ? true : false;
				if(!_s.useAToB) obj.atb = false;
									
				obj.isPrivate = obj_ar[i]["@attributes"]["data-is-private"]; 
				if(obj.isPrivate == "yes"){
					obj.isPrivate = true;
				}else{
					obj.isPrivate = false;
				}

				if(obj_ar[i]["@attributes"]["data-play-if-logged-in"]){
					obj.playIfLoggedIn = obj_ar[i]["@attributes"]["data-play-if-logged-in"];
					if(obj.playIfLoggedIn == 'no') obj.playIfLoggedIn = undefined;
				}
				
				obj.privateVideoPassword_str =  obj_ar[i]["@attributes"]["data-private-video-password"];
				
				obj.startAtTime =  obj_ar[i]["@attributes"]["data-start-at-time"];
				if(obj.startAtTime == "00:00:00" || !FWDUVPUtils.checkTime(obj.startAtTime)) obj.startAtTime = undefined;
				
				obj.stopAtTime =  obj_ar[i]["@attributes"]["data-stop-at-time"];
				if(obj.stopAtTime == "00:00:00" || !FWDUVPUtils.checkTime(obj.stopAtTime)) obj.stopAtTime = undefined;
				
				if(obj.videoSource.indexOf("{source:") != -1){
	
					try{
						obj.videoLabels_ar = [];
						obj.videoSource = eval(obj.videoSource);
						
						for(var m=0; m<obj.videoSource.length; m++){
							obj.videoLabels_ar[m] = obj.videoSource[m]["label"];
						}
						
						for(var m=0; m<obj.videoSource.length; m++){
							var src = obj.videoSource[m].source;
							if(src.indexOf("encrypt:") != -1) src = atob(src.substr(8));
							obj.videoSource[m].source = FWDUVPUtils.getValidSource(src);
						}
						
						for(var m=0; m<obj.videoSource.length; m++){
							obj.videoSource[m].is360 = obj.videoSource[m]['is360'];
							if(obj.videoSource[m].is360 == "yes") obj.videoSource[m].is360 = true;
							if(obj.videoSource[m].is360 == "no") obj.videoSource[m].is360 = false;
							if(obj.videoSource[m].is360 == true) has360Video = true;
						}
								
						obj.videoLabels_ar.reverse();
					}catch(e){
						_s.isPlaylistDispatchingError_bl = true;
						var showLoadPlaylistErrorId_to = setTimeout(function(){
							_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Please make sure that the <font color='#ff0000'>data-video-source</font> attribute contains an array of videos at position <font color='#ff0000'>" + (i + 1) + "</font>"});
						}, 50);
						return;
					}
				}else{
					var src = obj.videoSource;
					if(src.indexOf("encrypt:") != -1) src = atob(src.substr(8));
					obj.videoSource = [{source:FWDUVPUtils.getValidSource(src)}];
				}
				
				obj.subtitleSource =  obj_ar[i]["@attributes"]["data-subtitle-soruce"];
				obj.startAtSubtitle = obj_ar[i]["@attributes"]["data-start-at-subtitle"] || 0;
				if(obj.subtitleSource){
					if(obj.subtitleSource.indexOf("{source:") != -1){
						if(obj.subtitleSource.indexOf("{source:") != -1){
							try{
								obj.subtitleSource = eval(obj.subtitleSource);
								if(obj.subtitleSource.indexOf("encrypt:") != -1) obj.subtitleSource = atob(src.substr(8));
							}catch(e){
								_s.isPlaylistDispatchingError_bl = true;
								var showLoadPlaylistErrorId_to = setTimeout(function(){
									_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Please make sure that the <font color='#ff0000'>data-subtitle-source</font> attribute contains an array of subtitles at position <font color='#ff0000'>" + (i + 1) + "</font>"});
								}, 50);
								return;
							}
							obj.subtitleSource.splice(0,0, {source:"none", label:_s.subtitlesOffLabel_str});
							obj.subtitleSource.reverse();
						}
					}else{
						obj.subtitleSource = [{source:obj.subtitleSource}];
					}
					if(obj.subtitleSource){
						for(var x=0; x<obj.subtitleSource.length; x++){
							var source = obj.subtitleSource[x].source;
							if(source.indexOf("encrypt:") != -1) obj.subtitleSource[x].source = atob(source.substr(8));
						}
					}
				}
				
				obj._dAdvertisementOnPauseSource  = obj_ar[i]["@attributes"]["data-advertisement-on-pause-source"];
				obj.scrubAtTimeAtFirstPlay =  obj_ar[i]["@attributes"]["data-scrub-at-time-at-first-play"];
				if(obj.scrubAtTimeAtFirstPlay){
					if(/^((?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$)/g.test(obj.scrubAtTimeAtFirstPlay)){
						obj.scrubAtTimeAtFirstPlay = FWDUVPUtils.getSecondsFromString(obj.scrubAtTimeAtFirstPlay);
					}
				}
				
				obj.downloadPath = obj.videoSource[obj.startAtVideo];
				obj.downloadable = obj_ar[i]["@attributes"]["data-downloadable"] == "yes" ? true : false;
				if(obj.videoSource[0]["source"].indexOf(".") == -1) obj.downloadable = false;
				obj.posterSource = encodeURI(obj_ar[i]["@attributes"]["data-poster-source"]);
				obj.thumbSource = obj_ar[i]["@attributes"]["data-thumb-source"];
				obj.title = obj_ar[i]["@attributes"]["data-title"];
				obj.titleText = obj_ar[i]["@attributes"]["data-title"];
				obj.desc = obj_ar[i]["@attributes"]["data-desc"];
				
				obj.gaStr = obj.titleText;
				
				//ads
				if(obj_ar[i]["@attributes"]["data-ads-source"]){
					var adsObj = {};
					adsObj.source = FWDUVPUtils.getValidSource(obj_ar[i]["@attributes"]["data-ads-source"]);
					adsObj.pageToOpen = obj_ar[i]["@attributes"]["data-ads-page-to-open-url"];
					adsObj.pageTarget = obj_ar[i]["@attributes"]["data-ads-page-target"] || "_blank";
					adsObj.timeToHoldAds = obj_ar[i]["@attributes"]["data-time-to-hold-ads"]  || 0;
					obj.ads = adsObj;
				}

				//vast
				if(obj_ar[i]["@attributes"]["data-vast-url"]){
					obj.ads_ar = undefined;
					var vsrc = obj_ar[i]["@attributes"]["data-vast-url"];
					
					if(FWDUVPUtils.isIMA(vsrc)){
						obj.imaURL = vsrc;
					}else{
						obj.vastURL = vsrc;
						obj.vastClickTroughTarget = obj_ar[i]["@attributes"]["data-vast-clicktrough-target"];
						obj.vastLinearStartTime = obj_ar[i]["@attributes"]["data-vast-linear-astart-at-time"] || "00:00:00";
					}
				}

				//cuepoints

				if(obj_ar[i]["@attributes"]["data-cuepoints"]){
					adsObj = {};
					adsObj.timeStart = obj_ar[i]["@attributes"]["data-time-start"];
					adsObj.javascriptCall = obj_ar[i]["@attributes"]["data-javascript-call"];
					adsObj.isPlayed_bl = false
					obj.cuepoints_ar = adsObj;
				}
			
				_s.playlist_ar[i] = obj;
			}
			
			if(_s.randomizePlaylist_bl){
				_s.playlist_ar = FWDUVPUtils.randomizeArray(_s.playlist_ar);
			}
		
			if(_s.maxPlaylistItems < _s.playlist_ar.length){
				_s.playlist_ar = _s.playlist_ar.splice(0, _s.maxPlaylistItems);
			}
				
			clearTimeout(_s.dispatchPlaylistLoadCompleteWidthDelayId_to);
			_s.dispatchPlaylistLoadCompleteWidthDelayId_to = setTimeout(function(){
				_s.dispatchEvent(FWDUVPData.PLAYLIST_LOAD_COMPLETE);
			}, 50);
	
			_s.isDataLoaded_bl = true;
		};
		

		//####################################//
		/* load vast */
		//####################################//
		_s.setVastSource = function(source, startTime){
			if(!_s.vastLoaded_bl){
				_s.vastScript = document.createElement('script');
				var scriptURI = _s.scripts[_s.countLoadedSCript];
				document.head.appendChild(_s.vastScript);
				_s.vastScript.src =  _s.mainFolderPath_str + 'java/FWDUVPVast.js';
				
				_s.vastScript.onload = function(){
					FWDUVPVast.setPrototype();
					_s.vast = new FWDUVPVast(_s);
					_s.vast.setSource(source, startTime);
				}
				
				_s.vastScript.onerror = function(e){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:'VAST js plugin named <font color="#FF0000">FWDUVPVast.js</font> is not found. Please make sure that the content folder contains the java folder that contains the <font color="#FF0000">FWDUVPVast.js</font> file. '});
				}
				_s.vastLoaded_bl = true;
				return;
			}
			_s.vast.setSource(source);
		}
		
		_s.closeVast = function(){
			if(_s.vast) _s.vast.closeVast();
		}
		
		_s.fixVmapTimes = function(duration, curAddData, curPopupAdsData, id){
			if(_s.vast) _s.vast.fixVmapTimes(duration, curAddData, curPopupAdsData, id); 
		}
		
		_s.resetVastId = function(){
			if(_s.vast) _s.vast.id = -1;
		}
		
		
		//####################################//
		/* show error if a required property is not defined */
		//####################################//
		_s.showPropertyError = function(error){
			_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"The property called <font color='#FF0000'>" + error + "</font> is not defined."});
		};
		
		
		//####################################//
		/* stop to load current playlist... */
		//####################################//
		_s.stopToLoadPlaylist = function(){
			_s.closeJsonPLoader();
			try{
				_s.scs_el.src = null;
				document.documentElement.removeChild(_s.scs_el);
				_s.scs_el = null;
			}catch(e){}
			
			if(_s.xhr != null){
				try{_s.xhr.abort();}catch(e){}
				_s.xhr.onreadystatechange = null;
				_s.xhr.onerror = null;
				_s.xhr = null;
			}
		};
		

		//####################################//
		/* show error if a required property is not defined */
		//####################################//
		_s.showPropertyError = function(error){
			_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"The property called <font color='#ff0000'>" + error + "</font> is not defined."});
		};
		
		_s.init();
	};
	

	/* set prototype */
	FWDUVPData.setPrototype = function(){
		FWDUVPData.prototype = new FWDUVPEventDispatcher();
	};
	
	FWDUVPData.VAST_LOADING = 'vastLoading';
	FWDUVPData.VAST_LOADED = "vastLoaded";
	FWDUVPData.PLAYLIST_LOAD_COMPLETE = "playlistLoadComplete";
	FWDUVPData.PRELOADER_LOAD_DONE = "onPreloaderLoadDone";
	FWDUVPData.LOAD_DONE = "onLoadDone";
	FWDUVPData.LOAD_ERROR = "onLoadError";
	FWDUVPData.IMAGE_LOADED = "onImageLoaded";
	FWDUVPData.SKIN_LOAD_COMPLETE = "onSkinLoadComplete";
	FWDUVPData.SKIN_PROGRESS = "onSkinProgress";
	FWDUVPData.IMAGES_PROGRESS = "onImagesPogress";
	FWDUVPData.IMA_READY = 'imaReady';
	FWDUVPData.IMA_ERROR = 'ima_error';
	
	window.FWDUVPData = FWDUVPData;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Display object.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	/*
	 * @ type values: div, img.
	 * @ positon values: relative, absolute.
	 * @ positon values: hidden.
	 * @ display values: block, inline-block, _s applies only if the position is relative.
	 */
	var FWDUVPDisplayObject = function(type, position, overflow, display){

		'use strict';
		
		var _s = this;
		_s.listeners = {events_ar:[]};
		
		if(type == "div" || type == "img" || type == "canvas" || "input"){
			_s.type = type;	
		}else{
			throw Error("Type is not valid! " + type);
		}
	
		_s.children_ar = [];
		_s.position = position || "absolute";
		_s.overflow = overflow || "hidden";
		_s.display = display || "inline-block";
		_s.visible = true;
		_s.buttonMode;
		_s.x = 0;
		_s.y = 0;
		_s.w = 0;
		_s.h = 0;
		_s.rect;
		_s.alpha = 1;
		_s.innerHTML = "";
		_s.opacityType = "";
		
		_s.hasTransform3d_bl =  FWDUVPUtils.hasTransform3d;
		_s.hasTransform2d_bl =  FWDUVPUtils.hasTransform2d;
		_s.hasBeenSetSelectable_bl = false;
		

		//##############################//
		/* init */
		//#############################//
		_s.init = function(){
			_s.setScreen();
		};	

		
		//######################################//
		/* check if it supports transforms. */
		//######################################//
		_s.getTransform = function() {
		    var properties = ['transform', 'msTransform', 'WebkitTransform', 'MozTransform', 'OTransform'];
		    var p;
		    while (p = properties.shift()) {
		       if (typeof _s.screen.style[p] !== 'undefined') {
		            return p;
		       }
		    }
		    return false;
		};
		

		//######################################//
		/* set opacity type */
		//######################################//
		_s.getOpacityType = function(){
			var opacityType;
			if (typeof _s.screen.style.opacity != "undefined") {//ie9+ 
				opacityType = "opacity";
			}else{ //ie8
				opacityType = "filter";
			}
			return opacityType;
		};

		
		//######################################//
		/* setup main screen */
		//######################################//
		_s.setScreen = function(element){
			if(_s.type == "img" && element){
				_s.screen = null;
				_s.screen = element;
				_s.setMainProperties();
			}else{
				_s.screen = document.createElement(_s.type);
				_s.setMainProperties();
			}
		};
		

		//########################################//
		/* set main properties */
		//########################################//
		_s.setMainProperties = function(){
			
			_s.transform = _s.getTransform();
			_s.setPosition(_s.position);
			_s.setOverflow(_s.overflow);
			_s.opacityType = _s.getOpacityType();
			
			if(_s.opacityType == "opacity") _s.isHtml5_bl = true;
			
			if(_s.opacityType == "filter") _s.screen.style.filter = "inherit";
			_s.screen.style.left = "0px";
			_s.screen.style.top = "0px";
			_s.screen.style.margin = "0px";
			_s.screen.style.padding = "0px";
			_s.screen.style.maxWidth = "none";
			_s.screen.style.maxHeight = "none";
			_s.screen.style.border = "none";
			_s.screen.style.lineHeight = "1";
			_s.screen.style.backfaceVisibility = "hidden";
			_s.screen.style.webkitBackfaceVisibility = "hidden";
			_s.screen.style.MozBackfaceVisibility = "hidden";
			
			if(type == "img"){
				_s.setWidth(_s.screen.width);
				_s.setHeight(_s.screen.height);
			}
		};
			
		_s.setBackfaceVisibility =  function(){
			_s.screen.style.backfaceVisibility = "visible";
			_s.screen.style.webkitBackfaceVisibility = "visible";
			_s.screen.style.MozBackfaceVisibility = "visible";		
		};

		
		//###################################################//
		/* set / get various peoperties.*/
		//###################################################//
		_s.setSelectable = function(val){
			
			if(!val){
				_s.screen.style.userSelect = "none";
				_s.screen.style.MozUserSelect = "none";
				_s.screen.style.webkitUserSelect = "none";
				_s.screen.style.khtmlUserSelect = "none";
				_s.screen.style.oUserSelect = "none";
				_s.screen.style.msUserSelect = "none";
				_s.screen.msUserSelect = "none";
				_s.screen.ondragstart = function(e){return false;};
				_s.screen.onselectstart = function(){return false;};
				_s.screen.ontouchstart = function(){return false;};
				_s.screen.style.webkitTouchCallout='none';
				_s.hasBeenSetSelectable_bl = true;
			}else{
				if(FWDUVPUtils.isFirefox || FWDUVPUtils.isIE){
					_s.screen.style.userSelect = "element";
					_s.screen.style.MozUserSelect = "element";
					_s.screen.style.msUserSelect = "element";
				}else if(FWDUVPUtils.isSafari){
					_s.screen.style.userSelect = "text";
					_s.screen.style.webkitUserSelect = "text";
				}else{
					_s.screen.style.userSelect = "auto";
					_s.screen.style.webkitUserSelect = "auto";
				}
				
				_s.screen.style.khtmlUserSelect = "auto";
				_s.screen.style.oUserSelect = "auto";
				
				if(FWDUVPUtils.isIEAndLessThen9){
					_s.screen.ondragstart = null;
					_s.screen.onselectstart = null;
					_s.screen.ontouchstart = null;
				}else{
					_s.screen.ondragstart = undefined;
					_s.screen.onselectstart = undefined;
					_s.screen.ontouchstart = undefined;
				}
				
				_s.screen.style.webkitTouchCallout='default';
				_s.hasBeenSetSelectable_bl = false;
			}
			
		};
		
		_s.getScreen = function(){
			return _s.screen;
		};
		
		_s.setVisible = function(val){
			_s.visible = val;
			if(_s.visible == true){
				_s.screen.style.visibility = "visible";
			}else{
				_s.screen.style.visibility = "hidden";
			}
		};
		
		_s.getVisible = function(){
			return _s.visible;
		};
			
		_s.setResizableSizeAfterParent = function(){
			_s.screen.style.width = "100%";
			_s.screen.style.height = "100%";
		};
		
		_s.getStyle = function(){
			return _s.screen.style;
		};
		
		_s.setOverflow = function(val){
			_s.overflow = val;
			_s.screen.style.overflow = _s.overflow;
		};
		
		_s.setPosition = function(val){
			_s.position = val;
			_s.screen.style.position = _s.position;
		};
		
		_s.setDisplay = function(val){
			_s.display = val;
			_s.screen.style.display = _s.display;
		};
		
		_s.setButtonMode = function(val){
			_s.buttonMode = val;
			if(_s.buttonMode ==  true){
				_s.screen.style.cursor = "pointer";
			}else{
				_s.screen.style.cursor = "default";
			}
		};
		
		_s.setBkColor = function(val){
			_s.screen.style.backgroundColor = val;
		};
		
		_s.setInnerHTML = function(val){
			_s.innerHTML = val;
			_s.screen.innerHTML = _s.innerHTML;
		};
		
		_s.getInnerHTML = function(){
			return _s.innerHTML;
		};
		
		_s.getRect = function(){
			return _s.screen.getBoundingClientRect();
		};
		
		_s.setAlpha = function(val){
			_s.alpha = val;
			if(_s.opacityType == "opacity"){
				_s.screen.style.opacity = _s.alpha;
			}else if(_s.opacityType == "filter"){
				_s.screen.style.filter = "alpha(opacity=" + _s.alpha * 100 + ")";
				_s.screen.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + Math.round(_s.alpha * 100) + ")";
			}
		};
		
		_s.getAlpha = function(){
			return _s.alpha;
		};
		
		_s.getRect = function(){
			return _s.screen.getBoundingClientRect();
		};
		
		_s.getGlobalX = function(){
			return _s.getRect().left;
		};
		
		_s.getGlobalY = function(){
			return _s.getRect().top;
		};
		
		_s.setX = function(val){
			_s.x = val;
			if(_s.hasTransform3d_bl){
				_s.screen.style[_s.transform] = 'translate3d(' + _s.x + 'px,' + _s.y + 'px,0)';
			}else if(_s.hasTransform2d_bl){
				_s.screen.style[_s.transform] = 'translate(' + _s.x + 'px,' + _s.y + 'px)';
			}else{
				_s.screen.style.left = _s.x + "px";
			}
		};
		
		_s.getX = function(){
			return  _s.x;
		};
		
		_s.setY = function(val){
			_s.y = val;
			if(_s.hasTransform3d_bl){
				_s.screen.style[_s.transform] = 'translate3d(' + _s.x + 'px,' + _s.y + 'px,0)';	
			}else if(_s.hasTransform2d_bl){
				_s.screen.style[_s.transform] = 'translate(' + _s.x + 'px,' + _s.y + 'px)';
			}else{
				_s.screen.style.top = _s.y + "px";
			}
		};
		
		_s.getY = function(){
			return  _s.y;
		};
		
		_s.setWidth = function(val){
			_s.w = val;
			if(_s.type == "img"){
				_s.screen.width = _s.w;
				_s.screen.style.width = _s.w + "px";
			}else{
				_s.screen.style.width = _s.w + "px";
			}
		};
		
		_s.getWidth = function(){
			if(_s.type == "div" || _s.type == "input"){
				if(_s.screen.offsetWidth != 0) return  _s.screen.offsetWidth;
				return _s.w;
			}else if(_s.type == "img"){
				if(_s.screen.offsetWidth != 0) return  _s.screen.offsetWidth;
				if(_s.screen.width != 0) return  _s.screen.width;
				return _s._w;
			}else if( _s.type == "canvas"){
				if(_s.screen.offsetWidth != 0) return  _s.screen.offsetWidth;
				return _s.w;
			}
		};
		
		_s.setHeight = function(val){
			_s.h = val;
			if(_s.type == "img"){
				_s.screen.height = _s.h;
				_s.screen.style.height = _s.h + "px";
			}else{
				_s.screen.style.height = _s.h + "px";
			}
		};
		
		_s.getHeight = function(){
			if(_s.type == "div" || _s.type == "input"){
				if(_s.screen.offsetHeight != 0) return  _s.screen.offsetHeight;
				return _s.h;
			}else if(_s.type == "img"){
				if(_s.screen.offsetHeight != 0) return  _s.screen.offsetHeight;
				if(_s.screen.height != 0) return  _s.screen.height;
				return _s.h;
			}else if(_s.type == "canvas"){
				if(_s.screen.offsetHeight != 0) return  _s.screen.offsetHeight;
				return _s.h;
			}
		};
		

		//#####################################//
		/* DOM list */
		//#####################################//
		_s.addChild = function(e){
			if(_s.contains(e)){	
				_s.children_ar.splice(FWDUVPUtils.indexOfArray(_s.children_ar, e), 1);
				_s.children_ar.push(e);
				_s.screen.appendChild(e.screen);
			}else{
				_s.children_ar.push(e);
				_s.screen.appendChild(e.screen);
			}
		};
		
		_s.removeChild = function(e){
			if(_s.contains(e)){
				_s.children_ar.splice(FWDUVPUtils.indexOfArray(_s.children_ar, e), 1);
				_s.screen.removeChild(e.screen);
			}else{
				throw Error("##removeChild()## Child dose't exist, it can't be removed!");
			};
		};
		
		_s.contains = function(e){
			if(FWDUVPUtils.indexOfArray(_s.children_ar, e) == -1){
				return false;
			}else{
				return true;
			}
		};
		
		_s.addChildAt = function(e, index){
			if(_s.getNumChildren() == 0){
				_s.children_ar.push(e);
				_s.screen.appendChild(e.screen);
			}else if(index == 1){
				_s.screen.insertBefore(e.screen, _s.children_ar[0].screen);
				_s.screen.insertBefore(_s.children_ar[0].screen, e.screen);	
				if(_s.contains(e)){
					_s.children_ar.splice(FWDUVPUtils.indexOfArray(_s.children_ar, e), 1, e);
				}else{
					_s.children_ar.splice(FWDUVPUtils.indexOfArray(_s.children_ar, e), 0, e);
				}
			}else{
				if(index < 0  || index > _s.getNumChildren() -1) throw Error("##getChildAt()## Index out of bounds!");
				
				_s.screen.insertBefore(e.screen, _s.children_ar[index].screen);
				if(_s.contains(e)){
					_s.children_ar.splice(FWDUVPUtils.indexOfArray(_s.children_ar, e), 1, e);
				}else{
					_s.children_ar.splice(FWDUVPUtils.indexOfArray(_s.children_ar, e), 0, e);
				}
			}
		};
		
		_s.getChildAt = function(index){
			if(index < 0  || index > _s.getNumChildren() -1) throw Error("##getChildAt()## Index out of bounds!");
			if(_s.getNumChildren() == 0) throw Error("##getChildAt## Child dose not exist!");
			return _s.children_ar[index];
		};
		
		_s.getChildIndex = function(child){
			if(_s.contains(child)){
				return FWDUVPUtils.indexOfArray(_s.children_ar, child);
			}
			return 0;
		};
		
		_s.removeChildAtZero = function(){
			_s.screen.removeChild(_s.children_ar[0].screen);
			_s.children_ar.shift();
		};
		
		_s.getNumChildren = function(){
			return _s.children_ar.length;
		};
		
		
		//################################//
		/* event dispatcher */
		//#################################//
		_s.addListener = function (type, listener){
	    	
	    	if(type == undefined) throw Error("type is required.");
	    	if(typeof type === "object") throw Error("type must be of type String.");
	    	if(typeof listener != "function") throw Error("listener must be of type Function.");
	    	
	    	
	        var event = {};
	        event.type = type;
	        event.listener = listener;
	        event.target = _s;
	        _s.listeners.events_ar.push(event);
	    };
	    
	    _s.dispatchEvent = function(type, props){
	    	if(_s.listeners == null) return;
	    	if(type == undefined) throw Error("type is required.");
	    	if(typeof type === "object") throw Error("type must be of type String.");
	    	
	        for (var i=0, len=_s.listeners.events_ar.length; i < len; i++){
	        	if(_s.listeners.events_ar[i].target === _s && _s.listeners.events_ar[i].type === type){		
	    	        if(props){
	    	        	for(var prop in props){
	    	        		_s.listeners.events_ar[i][prop] = props[prop];
	    	        	}
	    	        }
	        		_s.listeners.events_ar[i].listener.call(_s, _s.listeners.events_ar[i]);
	        	}
	        }
	    };
	    
	    _s.removeListener = function(type, listener){
	    	
	    	if(type == undefined) throw Error("type is required.");
	    	if(typeof type === "object") throw Error("type must be of type String.");
	    	if(typeof listener != "function") throw Error("listener must be of type Function." + type);
	    	
	        for (var i=0, len=_s.listeners.events_ar.length; i < len; i++){
	        	if(_s.listeners.events_ar[i].target === _s 
	        			&& _s.listeners.events_ar[i].type === type
	        			&& _s.listeners.events_ar[i].listener ===  listener
	        	){
	        		_s.listeners.events_ar.splice(i,1);
	        		break;
	        	}
	        }  
	    };
	    

	    //###########################################//
	    /* destroy methods*/
	    //###########################################//
		_s.disposeImage = function(){
			if(_s.type == "img") _s.screen.src = null;
		};
		
		
		_s.destroy = function(){
			
			if(_s.hasBeenSetSelectable_bl){
				_s.screen.ondragstart = null;
				_s.screen.onselectstart = null;
				_s.screen.ontouchstart = null;
			};
			
			_s.screen.removeAttribute("style");
			
			//destroy properties
			_s.listeners = [];
			_s.listeners = null;
			_s.children_ar = [];
			_s.children_ar = null;
			_s.style = null;
			_s.screen = null;
			_s.transform = null;
			_s.position = null;
			_s.overflow = null;
			_s.display = null;
			_s.visible = null;
			_s.buttonMode = null;
			_s.x = null;
			_s.y = null;
			_s.w = null;
			_s.h = null;
			_s.rect = null;
			_s.alpha = null;
			_s.innerHTML = null;
			_s.opacityType = null;
			_s.isHtml5_bl = null;
		
			_s.hasTransform3d_bl = null;
			_s.hasTransform2d_bl = null;
			_s = null;
		};
		
	    /* init */
		_s.init();
	};
	
	window.FWDUVPDisplayObject = FWDUVPDisplayObject;
}(window));/**
 * Easy Video Player PACKAGED v8.4
 * Embed window.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPEmbedWindow = function(_d, prt){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPEmbedWindow.prototype;
		
		_s.embedColoseN_img = _d.embedColoseN_img;	
		_s.useHEX = _d.useHEX;
		_s.nBC = _d.nBC
		_s.sBC = _d.sBC;

		_s.embedWindowBackground_str = _d.embedWindowBackground_str;
		_s.embedWindowInputBackgroundPath_str = _d.embedWindowInputBackgroundPath_str;
		_s.secondaryLabelsColor_str = _d.secondaryLabelsColor_str;
		_s.inputColor_str = _d.inputColor_str;
		_s.mainLabelsColor_str = _d.mainLabelsColor_str;
		_s.sendButtonNPath_str = _d.sendButtonNPath_str;
		_s.sendButtonSPath_str = _d.sendButtonSPath_str;
		_s.inputBackgroundColor_str = _d.inputBackgroundColor_str;
		_s.borderColor_str = _d.borderColor_str;
		_s.sendToAFriendPath_str = _d.sendToAFriendPath_str;
		
		_s.maxTextWidth = 0;
		_s.totalWidth = 0;
		_s.sW = 0;
		_s.sH = 0;
		_s.buttonWidth = 44;
		_s.buttonHeight = 19;
		_s.embedWindowCloseButtonMargins = _d.embedWindowCloseButtonMargins;

		_s.shareAndEmbedTextColor_str = _d.shareAndEmbedTextColor_str;

		_s.isMbl = FWDUVPUtils.isMobile;
		_s.useVectorIcons_bl = _d.useVectorIcons_bl
	

		//#################################//
		/* init */
		//#################################//
		_s.init = function(){
			if(_s.clsBtn) return;
			if(_d.sknPth.indexOf("hex_white") != -1){
				_s.sBC = "#FFFFFF";
			} 
		
			_s.setBackfaceVisibility();
			_s.mainHld = new FWDUVPDisplayObject("div");
			
			_s.bk_do = new FWDUVPDisplayObject("div");
			_s.bk_do.getStyle().width = "100%";
			_s.bk_do.getStyle().height = "100%";
			_s.bk_do.setAlpha(.9);
			_s.bk_do.getStyle().background = "url('" + _s.embedWindowBackground_str + "')";
		
			//setup link and embed text
			_s.linkAndEmbedHld =  new FWDUVPDisplayObject("div");
			
			_s.lnkAndEbdHldBk = new FWDUVPDisplayObject("div");
			_s.lnkAndEbdHldBk.getStyle().background = "url('" + _s.embedWindowBackground_str + "')";
			_s.lnkAndEbdHldBk.getStyle().borderStyle = "solid";
			_s.lnkAndEbdHldBk.getStyle().borderWidth = "1px";
			_s.lnkAndEbdHldBk.getStyle().borderColor =  _s.borderColor_str;
			
			_s.mainLbl = new FWDUVPDisplayObject("div");
			_s.mainLbl.setBackfaceVisibility();
			_s.mainLbl.getStyle().fontFamily = "Arial";
			_s.mainLbl.getStyle().fontSize= "12px";
			_s.mainLbl.getStyle().color = _s.mainLabelsColor_str;
			_s.mainLbl.getStyle().whiteSpace= "nowrap";
			_s.mainLbl.getStyle().fontSmoothing = "antialiased";
			_s.mainLbl.getStyle().webkitFontSmoothing = "antialiased";
			_s.mainLbl.getStyle().textRendering = "optimizeLegibility";
			_s.mainLbl.getStyle().padding = "0px";
			_s.mainLbl.screen.className = 'UVP-main-label';
			_s.mainLbl.setInnerHTML("SHARE & EMBED");	
			
			_s.linkLbl = new FWDUVPDisplayObject("div");
			_s.linkLbl.screen.className = 'UVP-secnd-label';
			_s.linkLbl.setBackfaceVisibility();
			_s.linkLbl.getStyle().fontFamily = "Arial";
			_s.linkLbl.getStyle().fontSize= "12px";
			_s.linkLbl.getStyle().color = _s.secondaryLabelsColor_str;
			_s.linkLbl.getStyle().whiteSpace= "nowrap";
			_s.linkLbl.getStyle().fontSmoothing = "antialiased";
			_s.linkLbl.getStyle().webkitFontSmoothing = "antialiased";
			_s.linkLbl.getStyle().textRendering = "optimizeLegibility";
			_s.linkLbl.getStyle().padding = "0px";
			_s.linkLbl.setInnerHTML("Link to _s video:");	
			
			_s.linkTxt = new FWDUVPDisplayObject("div");
			_s.linkTxt.screen.className = 'UVP-embed-inpt';
			_s.linkTxt.setBackfaceVisibility();
			_s.linkTxt.getStyle().fontFamily = "Arial";
			_s.linkTxt.getStyle().fontSize= "12px";
			_s.linkTxt.getStyle().color = _s.shareAndEmbedTextColor_str;
			if(!FWDUVPUtils.isIEAndLessThen9) _s.linkTxt.getStyle().wordBreak = "break-all";
			_s.linkTxt.getStyle().fontSmoothing = "antialiased";
			_s.linkTxt.getStyle().webkitFontSmoothing = "antialiased";
			_s.linkTxt.getStyle().textRendering = "optimizeLegibility";
			_s.linkTxt.getStyle().padding = "6px";
			_s.linkTxt.getStyle().paddingTop = "4px";
			_s.linkTxt.getStyle().paddingBottom = "4px";
			_s.linkTxt.getStyle().backgroundColor = _s.inputBackgroundColor_str;
			_s.linkTxt.screen.addEventListener('touchstart',function(){
				selectText(_s.linkTxt.screen);
			});
			
			_s.embedLbl = new FWDUVPDisplayObject("div");
			_s.embedLbl.setBackfaceVisibility();
			_s.embedLbl.screen.className = 'UVP-secnd-label';
			_s.embedLbl.getStyle().fontFamily = "Arial";
			_s.embedLbl.getStyle().fontSize= "12px";
			_s.embedLbl.getStyle().color = _s.secondaryLabelsColor_str;
			_s.embedLbl.getStyle().whiteSpace= "nowrap";
			_s.embedLbl.getStyle().fontSmoothing = "antialiased";
			_s.embedLbl.getStyle().webkitFontSmoothing = "antialiased";
			_s.embedLbl.getStyle().textRendering = "optimizeLegibility";
			_s.embedLbl.getStyle().padding = "0px";
			_s.embedLbl.setInnerHTML("Embed _s video:");
			
			_s.embdTxt = new FWDUVPDisplayObject("div");
			_s.embdTxt.screen.className = 'UVP-embed-inpt';
			_s.embdTxt.setBackfaceVisibility();
			if(!FWDUVPUtils.isIEAndLessThen9) _s.embdTxt.getStyle().wordBreak = "break-all";
			_s.embdTxt.getStyle().fontFamily = "Arial";
			_s.embdTxt.getStyle().fontSize= "12px";
			_s.embdTxt.getStyle().lineHeight = "16px";
			_s.embdTxt.getStyle().color = _s.shareAndEmbedTextColor_str;
			_s.embdTxt.getStyle().fontSmoothing = "antialiased";
			_s.embdTxt.getStyle().webkitFontSmoothing = "antialiased";
			_s.embdTxt.getStyle().textRendering = "optimizeLegibility";
			_s.embdTxt.getStyle().backgroundColor = _s.inputBackgroundColor_str;
			_s.embdTxt.getStyle().padding = "6px";
			_s.embdTxt.getStyle().paddingTop = "4px";
			_s.embdTxt.getStyle().paddingBottom = "4px";
			_s.embdTxt.screen.addEventListener('touchstart',function(){
				selectText(_s.embdTxt.screen);
			});
		
			//setup flash buttons
			FWDUVPSimpleSizeButton.setPrototype();
			_s.copyLinkBtn = new FWDUVPSimpleSizeButton(
					_d.embedCopyButtonNPath_str,
					_d.embedCopyButtonSPath_str,
					_s.buttonWidth,
					_s.buttonHeight,
					_d.useHEX,
					_d.nBC,
					_d.sBC,
					true
			);
			_s.copyLinkBtn.screen.style.position = 'absolute';
			_s.copyLinkBtn.addListener(FWDUVPSimpleSizeButton.CLICK, function(){
				_s.copyToClipboard(_s.linkTxt.screen);
			});

			FWDUVPSimpleSizeButton.setPrototype();
			_s.copyEmbedBtn = new FWDUVPSimpleSizeButton(
					_d.embedCopyButtonNPath_str,
					_d.embedCopyButtonSPath_str,
					_s.buttonWidth,
					_s.buttonHeight,
					_d.useHEX,
					_d.nBC,
					_d.sBC,
					true
			);
			
			_s.copyEmbedBtn.screen.style.position = 'absolute';
			_s.copyEmbedBtn.addListener(FWDUVPSimpleSizeButton.CLICK,function(){
				_s.copyToClipboard(_s.embdTxt.screen);
			});

			//setup send to a friend
			_s.sendMainHld =  new FWDUVPDisplayObject("div");
			
			_s.sendMainHldBk = new FWDUVPDisplayObject("div");
			_s.sendMainHldBk.getStyle().background = "url('" + _s.embedWindowBackground_str + "')";
			_s.sendMainHldBk.getStyle().borderStyle = "solid";
			_s.sendMainHldBk.getStyle().borderWidth = "1px";
			_s.sendMainHldBk.getStyle().borderColor =  _s.borderColor_str;
			
			_s.sendMainLbl = new FWDUVPDisplayObject("div");
			_s.sendMainLbl.setBackfaceVisibility();
			_s.sendMainLbl.getStyle().fontFamily = "Arial";
			_s.sendMainLbl.getStyle().fontSize= "12px";
			_s.sendMainLbl.getStyle().color = _s.mainLabelsColor_str;
			_s.sendMainLbl.getStyle().whiteSpace= "nowrap";
			_s.sendMainLbl.getStyle().fontSmoothing = "antialiased";
			_s.sendMainLbl.getStyle().webkitFontSmoothing = "antialiased";
			_s.sendMainLbl.getStyle().textRendering = "optimizeLegibility";
			_s.sendMainLbl.getStyle().padding = "0px";
			_s.sendMainLbl.screen.className = 'UVP-main-label';
			_s.sendMainLbl.setInnerHTML("SEND TO A FRIEND");	
			
			_s.yourEmailLabel_do = new FWDUVPDisplayObject("div");
			_s.yourEmailLabel_do.setBackfaceVisibility();
			_s.yourEmailLabel_do.screen.className = 'UVP-secnd-label';
			_s.yourEmailLabel_do.getStyle().fontFamily = "Arial";
			_s.yourEmailLabel_do.getStyle().fontSize= "12px";
			_s.yourEmailLabel_do.getStyle().color = _s.secondaryLabelsColor_str;
			_s.yourEmailLabel_do.getStyle().whiteSpace= "nowrap";
			_s.yourEmailLabel_do.getStyle().padding = "0px";
			_s.yourEmailLabel_do.setInnerHTML("Your email:");
			
			_s.yourEmailInpt = new FWDUVPDisplayObject("input");
			_s.yourEmailInpt.screen.className = 'UVP-embed-inpt';
			_s.yourEmailInpt.setBackfaceVisibility();
			_s.yourEmailInpt.getStyle().fontFamily = "Arial";
			_s.yourEmailInpt.getStyle().fontSize= "12px";
			_s.yourEmailInpt.getStyle().backgroundColor = _s.inputBackgroundColor_str;
			_s.yourEmailInpt.getStyle().color = _s.inputColor_str;
			_s.yourEmailInpt.getStyle().outline = 0;
			_s.yourEmailInpt.getStyle().whiteSpace= "nowrap";
			_s.yourEmailInpt.getStyle().padding = "6px";
			_s.yourEmailInpt.getStyle().paddingTop = "4px";
			_s.yourEmailInpt.getStyle().paddingBottom = "4px";
			
			_s.friendEmailLbl = new FWDUVPDisplayObject("div");
			_s.friendEmailLbl.setBackfaceVisibility();
			_s.friendEmailLbl.screen.className = 'UVP-secnd-label';
			_s.friendEmailLbl.getStyle().fontFamily = "Arial";
			_s.friendEmailLbl.getStyle().fontSize= "12px";
			_s.friendEmailLbl.getStyle().color = _s.secondaryLabelsColor_str;
			_s.friendEmailLbl.getStyle().whiteSpace= "nowrap";
			_s.friendEmailLbl.getStyle().padding = "0px";
			_s.friendEmailLbl.setInnerHTML("Your friend's email:");
			
			_s.friendEmailInpt = new FWDUVPDisplayObject("input");
			_s.friendEmailInpt.screen.className = 'UVP-embed-inpt';
			_s.friendEmailInpt.setBackfaceVisibility();
			_s.friendEmailInpt.getStyle().fontFamily = "Arial";
			_s.friendEmailInpt.getStyle().fontSize= "12px";
			_s.friendEmailInpt.getStyle().backgroundColor = _s.inputBackgroundColor_str;
			_s.friendEmailInpt.getStyle().color = _s.inputColor_str;
			_s.friendEmailInpt.getStyle().outline= 0;
			_s.friendEmailInpt.getStyle().whiteSpace= "nowrap";
			_s.friendEmailInpt.getStyle().padding = "6px";
			_s.friendEmailInpt.getStyle().paddingTop = "4px";
			_s.friendEmailInpt.getStyle().paddingBottom = "4px";	

			FWDUVPSimpleSizeButton.setPrototype();
			_s.sndBtn = new FWDUVPSimpleSizeButton(
					_s.sendButtonNPath_str, 
					_s.sendButtonSPath_str,
					_s.buttonWidth,
					_s.buttonHeight,
					_s.useHEX,
					_d.nBC,
					_d.sBC,
					true);
			_s.sndBtn.addListener(FWDUVPSimpleSizeButton.MOUSE_UP, _s.sendClickHandler);
			
		
			_s.infoText_do = new FWDUVPDisplayObject("div");
			_s.infoText_do.setBackfaceVisibility();
			_s.infoText_do.getStyle().fontFamily = "Arial";
			_s.infoText_do.getStyle().fontSize= "12px";
			_s.infoText_do.getStyle().color = _s.secondaryLabelsColor_str;
			_s.infoText_do.getStyle().whiteSpace= "nowrap";
			_s.infoText_do.getStyle().fontSmoothing = "antialiased";
			_s.infoText_do.getStyle().webkitFontSmoothing = "antialiased";
			_s.infoText_do.getStyle().textRendering = "optimizeLegibility";
			_s.infoText_do.getStyle().padding = "0px";
			_s.infoText_do.getStyle().paddingTop = "4px";
			_s.infoText_do.getStyle().textAlign = "center";
			_s.infoText_do.getStyle().color = _s.mainLabelsColor_str;
			
			//setup close button
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.clsBtn = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<div class='table-fwduvp-button'><span class='table-cell-fwduvp-button fwdicon-close'></span></div>",
						undefined,
						"UVPCloseButtonNormalState",
						"UVPCloseButtonSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.clsBtn = new FWDUVPSimpleButton(_d.embedColoseN_img, _d.embedWindowClosePathS_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						_d.sBC,
						false, false, false, false, true);
			}
			_s.clsBtn.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.closeButtonOnMouseUpHandler);
			
			_s.addChild(_s.mainHld);
			_s.mainHld.addChild(_s.bk_do)
			
			_s.linkAndEmbedHld.addChild(_s.lnkAndEbdHldBk);
			_s.linkAndEmbedHld.addChild(_s.mainLbl);
			_s.linkAndEmbedHld.addChild(_s.linkLbl);
			_s.linkAndEmbedHld.addChild(_s.linkTxt);
			_s.linkAndEmbedHld.addChild(_s.embedLbl);
			_s.linkAndEmbedHld.addChild(_s.embdTxt);
			_s.linkAndEmbedHld.addChild(_s.copyLinkBtn);
			_s.linkAndEmbedHld.addChild(_s.copyEmbedBtn);
			
			_s.sendMainHld.addChild(_s.sendMainHldBk);
			_s.sendMainHld.addChild(_s.sendMainLbl);
			_s.sendMainHld.addChild(_s.yourEmailLabel_do);
			_s.sendMainHld.addChild(_s.yourEmailInpt);
			_s.sendMainHld.addChild(_s.friendEmailLbl);
			_s.sendMainHld.addChild(_s.friendEmailInpt);
			_s.sendMainHld.addChild(_s.sndBtn);
			
			_s.mainHld.addChild(_s.linkAndEmbedHld);
			_s.mainHld.addChild(_s.sendMainHld);
			
			_s.mainHld.addChild(_s.clsBtn); 
		};
	
		_s.closeButtonOnMouseUpHandler = function(){
			if(!_s.isShowed_bl) return;
			_s.hide();
		};
	
		_s.copyToClipboard = function(element){
			  selectText(element);
			  document.execCommand("copy");
		}
	
		function selectText(element){
			if(window.top != window && FWDEVPUtils.isIE) return;
			if(!element) element = _s;
			
			var range, selection;
			if (document.body.createTextRange) {
				range = document.body.createTextRange();
			    range.moveToElementText(element);
			    range.select();
			}else if(window.getSelection && document.createRange) {
			    selection = window.getSelection();
			    range = document.createRange();
			    range.selectNodeContents(element);
			    selection.removeAllRanges();
			    selection.addRange(range);
			}
		};
		
		_s.positionAndResize = function(){
			_s.sW = prt.sW;
			_s.sH = prt.sH;
			
			_s.maxTextWidth = Math.min(_s.sW - 150, 500);
			_s.totalWidth = _s.maxTextWidth + _s.buttonWidth + 40;
			
			if(_s.isMbl){
				_s.linkTxt.setWidth(_s.maxTextWidth + 52);
				_s.embdTxt.setWidth(_s.maxTextWidth + 52);
			}else{
				_s.linkTxt.setWidth(_s.maxTextWidth);
				_s.embdTxt.setWidth(_s.maxTextWidth);
			}
			
			_s.positionFinal();
			
			_s.clsBtn.setX(_s.sW - _s.clsBtn.w - _s.embedWindowCloseButtonMargins);
			_s.clsBtn.setY(_s.embedWindowCloseButtonMargins);
			
			_s.setWidth(_s.sW);
			_s.setHeight(_s.sH);
			_s.mainHld.setWidth(_s.sW);
			_s.mainHld.setHeight(_s.sH);
		};
		
		_s.positionFinal = function(){
			
			var totalHeight;
			var isEmbeddedAndFScreenOnIE11Bug_bl = false;
			
			if(_s.sH < 360 || _s.sW < 350){
				_s.linkTxt.getStyle().whiteSpace= "nowrap";
				_s.embdTxt.getStyle().whiteSpace= "nowrap";
			}else{
				_s.linkTxt.getStyle().whiteSpace = "normal";
				_s.embdTxt.getStyle().whiteSpace= "normal";
			}
			
			if(_s.linkLbl.screen.offsetHeight < 6) isEmbeddedAndFScreenOnIE11Bug_bl = true;
			
			var embedAndLinkMainLabelHeight;
			if(isEmbeddedAndFScreenOnIE11Bug_bl){
				embedAndLinkMainLabelHeight = Math.round(_s.mainLbl.screen.getBoundingClientRect().height * 100);
			}else{
				embedAndLinkMainLabelHeight = _s.mainLbl.getHeight();
			}
			_s.mainLbl.setX(16);
			_s.linkLbl.setX(16);
			_s.linkLbl.setY(embedAndLinkMainLabelHeight + 14);
			
			var linkTextLabelHeight;
			var linkTextHeight;
			if(isEmbeddedAndFScreenOnIE11Bug_bl){
				linkTextLabelHeight = Math.round(_s.linkLbl.screen.getBoundingClientRect().height * 100);
				linkTextHeight = Math.round(_s.linkTxt.screen.getBoundingClientRect().height * 100);
			}else{
				linkTextLabelHeight = _s.linkLbl.getHeight();
				linkTextHeight = _s.linkTxt.getHeight();
			}
			
			_s.linkTxt.setX(10);
			_s.linkTxt.setY(_s.linkLbl.y + linkTextLabelHeight + 5);
			if(_s.isMbl){
				_s.copyLinkBtn.setX(-100);
			}else{
				_s.copyLinkBtn.setX(_s.maxTextWidth + 30);
			}
			
			_s.copyLinkBtn.setY(_s.linkTxt.y + linkTextHeight - _s.buttonHeight);
			_s.embedLbl.setX(16);
			_s.embedLbl.setY(_s.copyLinkBtn.y + _s.copyLinkBtn.h + 14);
			
			var embedTextHeight;
			if(isEmbeddedAndFScreenOnIE11Bug_bl){
				embedTextHeight = Math.round(_s.embdTxt.screen.getBoundingClientRect().height * 100);
			}else{
				embedTextHeight = _s.embdTxt.getHeight();
			}
			_s.embdTxt.setX(10);
			_s.embdTxt.setY(_s.embedLbl.y + linkTextLabelHeight + 5);
			if(_s.isMbl){
				_s.copyEmbedBtn.setX(-100);
			}else{
				_s.copyEmbedBtn.setX(_s.maxTextWidth + 30);
			}
			_s.copyEmbedBtn.setY(_s.embdTxt.y + embedTextHeight - _s.buttonHeight);
			_s.lnkAndEbdHldBk.setY(_s.linkLbl.y - 9);
			_s.lnkAndEbdHldBk.setWidth(_s.totalWidth - 2);
			_s.lnkAndEbdHldBk.setHeight(_s.embdTxt.y + embedTextHeight - 9);
			_s.linkAndEmbedHld.setWidth(_s.totalWidth);
			_s.linkAndEmbedHld.setHeight(_s.embdTxt.y + embedTextHeight + 14);
			
			var sendMainLabelHeight;
			var inputHeight;
			if(isEmbeddedAndFScreenOnIE11Bug_bl){
				sendMainLabelHeight = Math.round(_s.sendMainLbl.screen.getBoundingClientRect().height * 100);
				inputHeight = Math.round(_s.yourEmailInpt.screen.getBoundingClientRect().height * 100);
			}else{
				sendMainLabelHeight = _s.sendMainLbl.getHeight();
				inputHeight = _s.yourEmailInpt.getHeight();
			}
			_s.sendMainLbl.setX(16);
			_s.yourEmailLabel_do.setX(16);
			_s.yourEmailLabel_do.setY(sendMainLabelHeight + 14);
			
			if(_s.sW > 400){
				_s.yourEmailInpt.setX(10);
				_s.yourEmailInpt.setWidth(parseInt(_s.totalWidth - 52 - _s.buttonWidth)/2);
				_s.yourEmailInpt.setY(_s.yourEmailLabel_do.y + linkTextLabelHeight + 5);
				
				_s.friendEmailLbl.setX(_s.yourEmailInpt.x + _s.yourEmailInpt.w + 26);
				_s.friendEmailLbl.setY(_s.yourEmailLabel_do.y);
				_s.friendEmailInpt.setX(_s.yourEmailInpt.x + _s.yourEmailInpt.w + 20);
				_s.friendEmailInpt.setWidth(parseInt((_s.maxTextWidth - 30)/2));
				_s.friendEmailInpt.setY(_s.yourEmailLabel_do.y + linkTextLabelHeight + 5);
				_s.sndBtn.setX(_s.friendEmailInpt.x + _s.yourEmailInpt.w + 10);
				_s.sndBtn.setY(_s.friendEmailInpt.y +inputHeight - _s.buttonHeight);
			}else{
				_s.yourEmailInpt.setX(10);
				_s.yourEmailInpt.setWidth(_s.totalWidth -32);
				_s.yourEmailInpt.setY(_s.yourEmailLabel_do.y + linkTextLabelHeight + 5);
				
				_s.friendEmailLbl.setX(16);
				_s.friendEmailLbl.setY(_s.yourEmailInpt.y + inputHeight + 14);
				_s.friendEmailInpt.setX(10);
				_s.friendEmailInpt.setY(_s.friendEmailLbl.y + linkTextLabelHeight + 5);
				_s.friendEmailInpt.setWidth(_s.totalWidth - 32);
				
				_s.sndBtn.setX(_s.totalWidth - _s.buttonWidth - 10);
				_s.sndBtn.setY(_s.friendEmailInpt.y + inputHeight + 10);
			}
			
			_s.sendMainHldBk.setY(_s.yourEmailLabel_do.y - 9);
			_s.sendMainHldBk.setWidth(_s.totalWidth - 2);
			_s.sendMainHldBk.setHeight(_s.sndBtn.y + _s.sndBtn.h - 9);
			_s.sendMainHld.setWidth(_s.totalWidth);
			_s.sendMainHld.setHeight(_s.sndBtn.y + _s.sndBtn.h + 14);
			
			if(isEmbeddedAndFScreenOnIE11Bug_bl){
				totalHeight = Math.round(_s.linkAndEmbedHld.screen.getBoundingClientRect().height * 100 + _s.sendMainHld.screen.getBoundingClientRect().height * 100);
			}else{
				totalHeight = _s.linkAndEmbedHld.getHeight() + _s.sendMainHld.getHeight();
			}
			
			_s.linkAndEmbedHld.setX(parseInt((_s.sW - _s.totalWidth)/2));
			_s.linkAndEmbedHld.setY(parseInt((_s.sH - totalHeight)/2) - 8);
			_s.sendMainHld.setX(parseInt((_s.sW - _s.totalWidth)/2));
			if(isEmbeddedAndFScreenOnIE11Bug_bl){
				_s.sendMainHld.setY(Math.round(_s.linkAndEmbedHld.y + _s.linkAndEmbedHld.screen.getBoundingClientRect().height * 100 + 20));
			}else{
				_s.sendMainHld.setY(_s.linkAndEmbedHld.y + _s.linkAndEmbedHld.getHeight() + 20);
			}
		};
		
		//##############################################//
		/* Send email */
		//##############################################//
		_s.sendClickHandler = function(){
			var hasError_bl = false;
			if(!_s.getValidEmail(_s.yourEmailInpt.screen.value)){
				if(FWDAnimation.isTweening(_s.yourEmailInpt.screen)) return;
				FWDAnimation.to(_s.yourEmailInpt.screen, .1, {css:{backgroundColor:'#FF0000'}, yoyo:true, repeat:3});
				hasError_bl = true;
			}
			if(!_s.getValidEmail(_s.friendEmailInpt.screen.value)){
				if(FWDAnimation.isTweening(_s.friendEmailInpt.screen)) return;
				FWDAnimation.to(_s.friendEmailInpt.screen, .1, {css:{backgroundColor:'#FF0000'}, yoyo:true, repeat:3});
				hasError_bl = true;
			}
			if(hasError_bl) return;
			_s.sendEmail();
		};
		
		
		//############ send email ####################//
		_s.sendEmail = function(){
			if(_s.isSending_bl) return;
			_s.isSending_bl = true;
			_s.xhr = new XMLHttpRequest();
			_s.xhr.onreadystatechange = _s.onChange;
			_s.xhr.onerror = _s.ajaxOnErrorHandler;
			
			try{
				var nonceParam = "";
				var sendMailNonceValue = "";
				if(typeof window.fwduvpSendMailNonce !== "undefined" && window.fwduvpSendMailNonce){
					sendMailNonceValue = window.fwduvpSendMailNonce;
				}else if(_d && _d.props && _d.props.sendMailNonce){
					sendMailNonceValue = _d.props.sendMailNonce;
				}else if(_d && _d.sendMailNonce){
					sendMailNonceValue = _d.sendMailNonce;
				}
				if(sendMailNonceValue){
					nonceParam = "&fwduvp_nonce=" + encodeURIComponent(sendMailNonceValue);
				}
				var sendToAFriendSeparator = _s.sendToAFriendPath_str.indexOf("?") == -1 ? "?" : "&";
				_s.xhr.open("get", _s.sendToAFriendPath_str + sendToAFriendSeparator + "friendMail=" + _s.friendEmailInpt.screen.value + "&yourMail=" + _s.yourEmailInpt.screen.value + "&link=" + encodeURI(_s.linkToVideo_str) + nonceParam , true);
				_s.xhr.send();
			}catch(e){
				_s.showInfo("ERROR", true);
				if(console) console.log(e);
				if(e.message && window.console) console.log(e.message);
			}
			_s.resetInputs();
		};
		
		_s.ajaxOnErrorHandler = function(e){
			_s.showInfo("ERROR", true);
			try{
				if(window.console) console.log(e);
				if(window.console) console.log(e.message);
			}catch(e){};
			_s.isSending_bl = false;
		};
		
		_s.onChange = function(response){
			if(_s.xhr.readyState == 4 && _s.xhr.status == 200){
				if(_s.xhr.responseText == "sent"){
					_s.showInfo("SENT");
				}else{
					_s.showInfo("ERROR", true);
					if(window.console) console.log("Error The server can't send the email!");
				}
				_s.isSending_bl = false;
			}
		};
		
		_s.resetInputs = function(){
			_s.yourEmailInpt.screen.value = "";
			_s.friendEmailInpt.screen.value = "";
		};
	
		_s.getValidEmail = function(email){
			var emailRegExp = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
			if(!emailRegExp.test(email) || email == "") return false;
			return true;
		};

		
		//#############################################//
		/* Set embed data */
		//#############################################//
		_s.setEmbedData = function(){
		
			var allUrl = location.href;
			var host = location.protocol + "//" + location.host;
			var pathName = location.pathname;
			var hash = location.hash;
			var search = location.search;
			var pathWithoutHashOrSearch = host + pathName;
			
		
			search = search.replace(/&?UVPInstanceName=.+UVPVideoId=[0-9]+/g, "");
			allUrl = allUrl.replace(/&?UVPInstanceName=.+UVPVideoId=[0-9]+/g, "");
		
			if(search){
				if(hash){
					_s.finalEmbedPath_str = pathWithoutHashOrSearch + search + "&UVPInstanceName=" + prt.instanceName_str + "&UVPPlaylistId=" + prt.catId + "&UVPVideoId=" + prt.id + hash;
				}else{
					_s.finalEmbedPath_str = pathWithoutHashOrSearch + search + "&UVPInstanceName=" + prt.instanceName_str + "&UVPPlaylistId=" + prt.catId + "&UVPVideoId=" + prt.id;
				}
			}else{
				if(hash){
					_s.finalEmbedPath_str = pathWithoutHashOrSearch + "?UVPInstanceName=" + prt.instanceName_str + "&UVPPlaylistId=" + prt.catId + "&UVPVideoId=" + prt.id + hash;
				}else{
					_s.finalEmbedPath_str = pathWithoutHashOrSearch + "?UVPInstanceName=" + prt.instanceName_str + "&UVPPlaylistId=" + prt.catId + "&UVPVideoId=" + prt.id;
				}
			}
			
			if(hash){
				if(hash.indexOf("playlistId=") == -1){
					_s.linkToVideo_str = pathWithoutHashOrSearch + search + hash + "&playlistId=" + prt.catId + "&videoId=" + prt.id;
				}else{
					_s.linkToVideo_str = allUrl;
				}
			}else{
				_s.linkToVideo_str = allUrl + "#/?playlistId=" + prt.catId + "&videoId=" + prt.id;;
			}
	
			_s.finalEmbedPath_str = encodeURI(_s.finalEmbedPath_str);
			_s.linkToVideo_str = encodeURI(_s.linkToVideo_str);	
			_s.finalEmbedCode_str = "<iframe src='" + _s.finalEmbedPath_str + "' width='" + prt.sW + "' height='" + prt.sH + "' frameborder='0' scrolling='no' allowfullscreen></iframe>";
		
			if(FWDUVPUtils.isIE){
				_s.linkTxt.screen.innerText = _s.linkToVideo_str;
				_s.embdTxt.screen.innerText = _s.finalEmbedCode_str;
			}else{
				_s.linkTxt.screen.textContent = _s.linkToVideo_str;
				_s.embdTxt.screen.textContent = _s.finalEmbedCode_str;
			}
		};	
		

		//#########################################//
		/* show hide info */
		//#########################################//
		_s.showInfo = function(text, hasError){
				
			_s.infoText_do.setInnerHTML(text);
			_s.sendMainHld.addChild(_s.infoText_do);
			_s.infoText_do.setWidth(_s.buttonWidth);
			_s.infoText_do.setHeight(_s.buttonHeight - 4);
			_s.infoText_do.setX(_s.sndBtn.x);
			_s.infoText_do.setY(_s.sndBtn.y - 23);

			_s.infoText_do.setAlpha(0);
			if(hasError){
				_s.infoText_do.getStyle().color = "#FF0000";
			}else{
				_s.infoText_do.getStyle().color = _s.mainLabelsColor_str;
			}
			FWDAnimation.killTweensOf(_s.infoText_do);
			FWDAnimation.to(_s.infoText_do, .16, {alpha:1, yoyo:true, repeat:7});
		};

		
		//###########################################//
		/* show / hide */
		//###########################################//
		_s.show = function(id){
			if(_s.isShowed_bl) return;
			_s.isShowed_bl = true;
			prt.main_do.addChild(_s);
			_s.init();
			
			_s.resetInputs();
			_s.setEmbedData();
			if(!FWDUVPUtils.isMobile || (FWDUVPUtils.isMobile && FWDUVPUtils.hasPointerEvent)) prt.main_do.setSelectable(true);
			
			if(_s.useVectorIcons_bl){
				_s.checkButtonsId_to = setInterval(function(){
					
					if(_s.clsBtn.w != 0){	
						_s.positionAndResize();
						
						clearInterval(_s.checkButtonsId_to);
						clearTimeout(_s.hideCompleteId_to);
						clearTimeout(_s.showCompleteId_to);
						_s.mainHld.setY(- _s.sH);
						
						_s.showCompleteId_to = setTimeout(_s.showCompleteHandler, 900);
						setTimeout(function(){
							FWDAnimation.to(_s.mainHld, .8, {y:0, delay:.1, ease:Expo.easeInOut});
						}, 100);
					
					}
				
				}, 50);
			}else{
				_s.positionAndResize();
			
				clearTimeout(_s.hideCompleteId_to);
				clearTimeout(_s.showCompleteId_to);
				_s.mainHld.setY(- _s.sH);
				
				_s.showCompleteId_to = setTimeout(_s.showCompleteHandler, 900);
				setTimeout(function(){
					FWDAnimation.to(_s.mainHld, .8, {y:0, delay:.1, ease:Expo.easeInOut});
				}, 100);
			}
		};
		
		_s.showCompleteHandler = function(){};
		
		_s.hide = function(){
			if(!_s.isShowed_bl) return;
			_s.isShowed_bl = false;
			
			if(prt.customContextMenu_do) prt.customContextMenu_do.enable();
			_s.positionAndResize();
			
			clearTimeout(_s.hideCompleteId_to);
			clearTimeout(_s.showCompleteId_to);
			
			if(!FWDUVPUtils.isMobile || (FWDUVPUtils.isMobile && FWDUVPUtils.hasPointerEvent)) prt.main_do.setSelectable(false);
			_s.hideCompleteId_to = setTimeout(_s.hideCompleteHandler, 800);
			FWDAnimation.killTweensOf(_s.mainHld);
			FWDAnimation.to(_s.mainHld, .8, {y:-_s.sH, ease:Expo.easeInOut});
		};
		
		_s.hideCompleteHandler = function(){
			prt.main_do.removeChild(_s);
			_s.dispatchEvent(FWDUVPEmbedWindow.HIDE_COMPLETE);
		};

		if(_s.useHEX){
			_s.init();
		}
	};
		
		
	/* set prototype */
	FWDUVPEmbedWindow.setPrototype = function(){
		FWDUVPEmbedWindow.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPEmbedWindow.ERROR = "error";
	FWDUVPEmbedWindow.HIDE_COMPLETE = "hideComplete";
	
	FWDUVPEmbedWindow.prototype = null;
	window.FWDUVPEmbedWindow = FWDUVPEmbedWindow;
}(window));/**
 * Easy Video Player PACKAGED v8.4
 * Event dispatcher.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (){
	
	var FWDUVPEventDispatcher = function (){

		'use strict';
		
	    this.listeners = {events_ar:[]};
	     
	    this.addListener = function (type, listener){
	    	
	    	if(type == undefined) throw Error("type is required.");
	    	if(typeof type === "object") throw Error("type must be of type String.");
	    	if(typeof listener != "function") throw Error("listener must be of type Function.");
	    	
	    	
	        var event = {};
	        event.type = type;
	        event.listener = listener;
	        event.target = this;
	        this.listeners.events_ar.push(event);
	    };
	    
	    this.dispatchEvent = function(type, props){
	    	if(this.listeners == null) return;
	    	if(type == undefined) throw Error("type is required.");
	    	if(typeof type === "object") throw Error("type must be of type String.");
	    	
	        for (var i=0, len=this.listeners.events_ar.length; i < len; i++){
	        	if(this.listeners.events_ar[i].target === this && this.listeners.events_ar[i].type === type){		
	    	        if(props){
	    	        	for(var prop in props){
	    	        		this.listeners.events_ar[i][prop] = props[prop];
	    	        	}
	    	        }
	        		this.listeners.events_ar[i].listener.call(this, this.listeners.events_ar[i]);
	        	}
	        }
	    };
	    
	   this.removeListener = function(type, listener){
	    	
	    	if(type == undefined) throw Error("type is required.");
	    	if(typeof type === "object") throw Error("type must be of type String.");
	    	if(typeof listener != "function") throw Error("listener must be of type Function." + type);
	    	
	        for (var i=0, len=this.listeners.events_ar.length; i < len; i++){
	        	if(this.listeners.events_ar[i].target === this 
	        			&& this.listeners.events_ar[i].type === type
	        			&& this.listeners.events_ar[i].listener ===  listener
	        	){
	        		this.listeners.events_ar.splice(i,1);
	        		break;
	        	}
	        }  
	    };
	    
	    /* destroy */
	    this.destroy = function(){
	    	this.listeners = null;
	    	
	    	this.addListener = null;
		    this.dispatchEvent = null;
		    this.removeListener = null;
	    };
	    
	};	
	
	window.FWDUVPEventDispatcher = FWDUVPEventDispatcher;
}(window));/**
 * Easy Video Player PACKAGED v8.4
 * Timeout hider.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
    var FWDUVPHider = function(screenToTest, screenToTest2, hideDelay){

    	'use strict';
    	
    	var _s = this;
    	var prototype = FWDUVPHider.prototype;
   
    	_s.screenToTest = screenToTest;
    	_s.screenToTest2 = screenToTest2;
    	_s.hideDelay = hideDelay;
    	_s.globalX = 0;
    	_s.globalY = 0;
    	
    	_s.dispatchOnceShow_bl = true;
    	_s.isStopped_bl = true;
    	_s.isMbl = FWDUVPUtils.isMobile;
    	_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
    	
		_s.init = function(){};
	
		_s.start = function(){
			_s.currentTime = new Date().getTime();
			clearInterval(_s.checkIntervalId_int);
			_s.checkIntervalId_int = setInterval(_s.update, 100);
			_s.addMouseOrTouchCheck();
			_s.isStopped_bl = false;
		};
		
		_s.stop = function(){
			clearInterval(_s.checkIntervalId_int);
			_s.isStopped_bl = true;
			_s.removeMouseOrTouchCheck();
			_s.removeMouseOrTouchCheck2();
		};
		
		_s.addMouseOrTouchCheck = function(){	
			if(_s.hasInitialTestEvents_bl) return;
			_s.hasInitialTestEvents_bl = true;
			if(_s.isMbl){
				if(_s.hasPointerEvent_bl){
					_s.screenToTest.screen.addEventListener("pointerdown", _s.onMouseOrTouchUpdate);
					_s.screenToTest.screen.addEventListener("MSPointerMove", _s.onMouseOrTouchUpdate);
				}else{
					_s.screenToTest.screen.addEventListener("touchstart", _s.onMouseOrTouchUpdate);
				}
			}else if(window.addEventListener){
				window.addEventListener("mousemove", _s.onMouseOrTouchUpdate);
			}else if(document.attachEvent){
				document.attachEvent("onmousemove", _s.onMouseOrTouchUpdate);
			}
		};
		
		_s.removeMouseOrTouchCheck = function(){	
			if(!_s.hasInitialTestEvents_bl) return;
			_s.hasInitialTestEvents_bl = false;
			if(_s.isMbl){
				if(_s.hasPointerEvent_bl){
					_s.screenToTest.screen.removeEventListener("pointerdown", _s.onMouseOrTouchUpdate);
					_s.screenToTest.screen.removeEventListener("MSPointerMove", _s.onMouseOrTouchUpdate);
				}else{
					_s.screenToTest.screen.removeEventListener("touchstart", _s.onMouseOrTouchUpdate);
				}
			}else if(window.removeEventListener){
				window.removeEventListener("mousemove", _s.onMouseOrTouchUpdate);
			}else if(document.detachEvent){
				document.detachEvent("onmousemove", _s.onMouseOrTouchUpdate);
			}
		};
		
		_s.addMouseOrTouchCheck2 = function(){	
			if(_s.addSecondTestEvents_bl) return;
			_s.addSecondTestEvents_bl = true;
			if(_s.screenToTest.screen.addEventListener){
				_s.screenToTest.screen.addEventListener("mousemove", _s.secondTestMoveDummy);
			}else if(_s.screenToTest.screen.attachEvent){
				_s.screenToTest.screen.attachEvent("onmousemove", _s.secondTestMoveDummy);
			}
		};
		
		_s.removeMouseOrTouchCheck2 = function(){	
			if(!_s.addSecondTestEvents_bl) return;
			_s.addSecondTestEvents_bl = false;
			if(_s.screenToTest.screen.removeEventListener){
				_s.screenToTest.screen.removeEventListener("mousemove", _s.secondTestMoveDummy);
			}else if(_s.screenToTest.screen.detachEvent){
				_s.screenToTest.screen.detachEvent("onmousemove", _s.secondTestMoveDummy);
			}
		};
		
		_s.secondTestMoveDummy = function(){
			_s.removeMouseOrTouchCheck2();
			_s.addMouseOrTouchCheck();
		};
		
		_s.onMouseOrTouchUpdate = function(e){
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			
			if(_s.globalX != vc.screenX
			   && _s.globalY != vc.screenY){
				_s.currentTime = new Date().getTime();
			}
			
			_s.globalX = vc.screenX;
			_s.globalY = vc.screenY;
			
			if(!_s.isMbl){
				if(!FWDUVPUtils.hitTest(_s.screenToTest.screen, _s.globalX, _s.globalY)){
					_s.removeMouseOrTouchCheck();
					_s.addMouseOrTouchCheck2();
				}
			}
		};
	
		_s.update = function(e){
			if(new Date().getTime() > _s.currentTime + _s.hideDelay){
				if(_s.dispatchOnceShow_bl){	
					_s.dispatchOnceHide_bl = true;
					_s.dispatchOnceShow_bl = false;	
					_s.dispatchEvent(FWDUVPHider.HIDE);
					clearTimeout(_s.hideCompleteId_to);
					_s.hideCompleteId_to = setTimeout(function(){
						_s.dispatchEvent(FWDUVPHider.HIDE_COMPLETE);
					}, 1000);
				}
			}else{
				if(_s.dispatchOnceHide_bl){
					clearTimeout(_s.hideCompleteId_to);
					_s.dispatchOnceHide_bl = false;
					_s.dispatchOnceShow_bl = true;
					_s.dispatchEvent(FWDUVPHider.SHOW);
				}
			}
		};

		_s.reset = function(){
			clearTimeout(_s.hideCompleteId_to);
			_s.currentTime = new Date().getTime();
			_s.dispatchEvent(FWDUVPHider.SHOW);
		};
		
		_s.init();
     };
     
	 FWDUVPHider.HIDE = "hide";
	 FWDUVPHider.SHOW = "show";
	 FWDUVPHider.HIDE_COMPLETE = "hideComplete";
	 
	 FWDUVPHider.setPrototype = function(){
		 FWDUVPHider.prototype = new FWDUVPEventDispatcher();
	 };
	 

	 window.FWDUVPHider = FWDUVPHider;
}(window));/**
 * Easy Video Player PACKAGED v8.4
 * Error info window.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPInfo = function(prt, warningIconPath, showErrorInfo){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPInfo.prototype;
	
		_s.warningIconPath_str = warningIconPath;
		_s.showErrorInfo_bl = showErrorInfo;
		_s.allowToRemove_bl = true;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;

		
		//#################################//
		/* init */
		//#################################//
		_s.init = function(){
			_s.setResizableSizeAfterParent();
			
			_s.bk_do = new FWDUVPDisplayObject("div");
			_s.bk_do.setAlpha(.6);
			_s.bk_do.setBkColor("#000000");
			_s.addChild(_s.bk_do);
			
			_s.textHolder_do = new FWDUVPDisplayObject("div");
			if(!FWDUVPUtils.isIEAndLessThen9) _s.textHolder_do.getStyle().font = "Arial";
			_s.textHolder_do.getStyle().wordWrap = "break-word";
			_s.textHolder_do.getStyle().padding = "10px";
			_s.textHolder_do.getStyle().paddingLeft = "42px";
			_s.textHolder_do.getStyle().lineHeight = "18px";
			_s.textHolder_do.getStyle().color = "#000000";
			_s.textHolder_do.setBkColor("#EEEEEE");
			
			var img_img = new Image();
			img_img.src = _s.warningIconPath_str;
			_s.img_do = new FWDUVPDisplayObject("img");
			_s.img_do.setScreen(img_img);
			_s.img_do.setWidth(28);
			_s.img_do.setHeight(28);
			
			_s.addChild(_s.textHolder_do);
			_s.addChild(_s.img_do);
		};
		
		_s.showText = function(txt){
			if(!_s.isShowedOnce_bl){
				if(_s.hasPointerEvent_bl){
					_s.screen.addEventListener("pointerdown", _s.closeWindow);
				}else{
					_s.screen.addEventListener("click", _s.closeWindow);
					_s.screen.addEventListener("touchend", _s.closeWindow);
				}
				_s.isShowedOnce_bl = true;
			}
			
			_s.setVisible(false);
			
			_s.textHolder_do.getStyle().paddingBottom = "10px";
			_s.textHolder_do.setInnerHTML(txt);
			clearTimeout(_s.show_to);
			_s.show_to = setTimeout(_s.show, 60);
			setTimeout(function(){
				_s.positionAndResize();
			}, 10);
		};
		
		_s.show = function(){
			var finalW = Math.min(640, prt.sW - 120);
			_s.isShowed_bl = true;
		
			_s.textHolder_do.setWidth(finalW);
			setTimeout(function(){
				if(_s.showErrorInfo_bl) _s.setVisible(true);
				_s.positionAndResize();
			}, 100);
		};
		
		_s.positionAndResize = function(){
			
			var finalW = _s.textHolder_do.getWidth();
			var finalH = _s.textHolder_do.getHeight();
			var finalX = parseInt((prt.sW - finalW)/2);
			var finalY = parseInt((prt.sH - finalH)/2);
			
			_s.bk_do.setWidth(prt.sW);
			_s.bk_do.setHeight(prt.sH);
			_s.textHolder_do.setX(finalX);
			_s.textHolder_do.setY(finalY);
			
			_s.img_do.setX(finalX + 6);
			_s.img_do.setY(finalY + parseInt((_s.textHolder_do.getHeight() - _s.img_do.h)/2));
		};
		
		_s.closeWindow = function(){
			if(!_s.allowToRemove_bl) return;
			_s.isShowed_bl = false;
			clearTimeout(_s.show_to);
			setTimeout(function(){
			try{prt.main_do.removeChild(_s);}catch(e){}
			}, 100);
		};
		
		_s.init();
	};
	
		
	/* set prototype */
	FWDUVPInfo.setPrototype = function(){
		FWDUVPInfo.prototype = new FWDUVPDisplayObject("div", "relative");
	};
	
	FWDUVPInfo.prototype = null;
	window.FWDUVPInfo = FWDUVPInfo;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Info window.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPInfoWindow = function(prt, _d){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPInfoWindow.prototype;
		
		_s.embedColoseN_img = _d.embedColoseN_img;
		
		_s.embedWindowBackground_str = _d.embedWindowBackground_str;
		_s.embedWindowInputBackgroundPath_str = _d.embedWindowInputBackgroundPath_str;
		_s.secondaryLabelsColor_str = _d.secondaryLabelsColor_str;
		_s.inputColor_str = _d.inputColor_str;
		_s.sendButtonNPath_str = _d.sendButtonNPath_str;
		_s.sendButtonSPath_str = _d.sendButtonSPath_str;
		_s.inputBackgroundColor_str = _d.inputBackgroundColor_str;
		_s.borderColor_str = _d.borderColor_str;
		_s.sendToAFriendPath_str = _d.sendToAFriendPath_str;
		
		_s.maxTextWidth = 0;
		_s.totalWidth = 0;
		_s.sW = 0;
		_s.sH = 0;
		_s.buttonWidth = 44;
		_s.buttonHeight = 19;
		_s.embedWindowCloseButtonMargins = _d.embedWindowCloseButtonMargins;
		_s.shareAndEmbedTextColor_str = _d.shareAndEmbedTextColor_str;

		_s.isDark = true;
		if(_s.embedWindowBackground_str.indexOf('dark') == -1){
			_s.isDark = false;
		}

		_s.isMbl = FWDUVPUtils.isMobile;
		_s.useVectorIcons_bl = _d.useVectorIcons_bl;
	

		//#################################//
		/* init */
		//#################################//
		_s.init = function(){
			_s.setBackfaceVisibility();
			_s.mainHld = new FWDUVPDisplayObject("div");
			var css = 'fwduvp-info-window-white';
			
			if(_s.isDark){
				css = 'fwduvp-info-window-dark';
			}
			_s.mainHld.screen.className = css;
			
			_s.mainBk_do = new FWDUVPDisplayObject("div");
			_s.mainBk_do.getStyle().width = "100%";
			_s.mainBk_do.getStyle().height = "100%";
			_s.mainBk_do.setAlpha(.9);
			_s.mainBk_do.getStyle().background = "url('" + _s.embedWindowBackground_str + "')";
		
			//setup link and embed text
			_s.mainTextHolder_do =  new FWDUVPDisplayObject("div", "absolute");
			
			_s.bk_do = new FWDUVPDisplayObject("div");
			_s.bk_do.getStyle().background = "url('" + _s.embedWindowBackground_str + "')";
			_s.bk_do.getStyle().borderStyle = "solid";
			_s.bk_do.getStyle().borderWidth = "1px";
			_s.bk_do.getStyle().borderColor =  _s.borderColor_str;
			
			_s.text_do = new FWDUVPDisplayObject("div", "relative");
			_s.text_do.hasTransform3d_bl = false;
			_s.text_do.hasTransform2d_bl = false;
			_s.text_do.getStyle().fontFamily = "Arial";
			_s.text_do.getStyle().fontSize= "12px";
			_s.text_do.getStyle().fontSmoothing = "antialiased";
			_s.text_do.getStyle().webkitFontSmoothing = "antialiased";
			_s.text_do.getStyle().textRendering = "optimizeLegibility";

			//setup close button
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.clsBtn = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<div class='table-fwduvp-button'><span class='table-cell-fwduvp-button fwdicon-close'></span></div>",
						undefined,
						"UVPCloseButtonNormalState",
						"UVPCloseButtonSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.clsBtn = new FWDUVPSimpleButton(_d.infoWindowClooseN_img, _d.embedWindowClosePathS_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						_d.sBC,
						false, false, false, false, true);
			}
			_s.clsBtn.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.closeButtonOnMouseUpHandler);
			
			_s.mainHld.addChild(_s.mainBk_do);
			_s.mainTextHolder_do.addChild(_s.bk_do);
			_s.mainTextHolder_do.addChild(_s.text_do);	
			_s.mainHld.addChild(_s.mainTextHolder_do);
			_s.addChild(_s.mainHld);

			_s.mainHld.addChild(_s.clsBtn); 
		};
	
		_s.closeButtonOnMouseUpHandler = function(){
			if(!_s.isShowed_bl) return;
			_s.hide();
		};
		
		_s.positionAndResize = function(){
		
			_s.sW = prt.sW;
			_s.sH = prt.sH;
			
			_s.maxTextWidth = Math.min(_s.sW - 150, 500);
			_s.totalWidth = _s.maxTextWidth + _s.buttonWidth + 40;
			
			_s.positionFinal();
			
			_s.clsBtn.setX(_s.sW - _s.clsBtn.w - _s.embedWindowCloseButtonMargins);
			_s.clsBtn.setY(_s.embedWindowCloseButtonMargins);
			
			_s.setWidth(_s.sW);
			_s.setHeight(_s.sH);
			_s.mainHld.setWidth(_s.sW);
			_s.mainHld.setHeight(_s.sH);
		};
		
		_s.positionFinal = function(){
			var totalHeight;
			var isEmbeddedAndFScreenOnIE11Bug_bl = false;
			_s.mainTextHolder_do.setWidth(_s.totalWidth);
			
			if(isEmbeddedAndFScreenOnIE11Bug_bl){
				totalHeight = Math.round(_s.mainTextHolder_do.screen.getBoundingClientRect().height * 100);
			}else{
				totalHeight = _s.mainTextHolder_do.getHeight();
			}
			
			_s.bk_do.setWidth(_s.totalWidth - 2);
			_s.bk_do.setHeight(totalHeight - 2);
			
			_s.mainTextHolder_do.setX(parseInt((_s.sW - _s.totalWidth)/2));
			_s.mainTextHolder_do.setY(parseInt((_s.sH - totalHeight)/2) - 8);
		};

		
		//###########################################//
		/* show / hide */
		//###########################################//
		_s.show = function(videoDesc){
			if(_s.isShowed_bl) return;
			_s.isShowed_bl = true;
			prt.main_do.addChild(_s);
			_s.text_do.setInnerHTML(videoDesc);
		
			_s.positionAndResize();
			
			clearTimeout(_s.hideCompleteId_to);
			clearTimeout(_s.showCompleteId_to);
			_s.mainHld.setY(- _s.sH);
			
			_s.showCompleteId_to = setTimeout(_s.showCompleteHandler, 900);
			setTimeout(function(){
				FWDAnimation.to(_s.mainHld, .8, {y:0, delay:.1, ease:Expo.easeInOut});
			}, 100);
		};
		
		_s.showCompleteHandler = function(){};
		
		_s.hide = function(){
			if(!_s.isShowed_bl) return;
			_s.isShowed_bl = false;
			
			if(prt.customContextMenu_do) prt.customContextMenu_do.enable();
			_s.positionAndResize();
			
			clearTimeout(_s.hideCompleteId_to);
			clearTimeout(_s.showCompleteId_to);
			
			_s.hideCompleteId_to = setTimeout(_s.hideCompleteHandler, 800);
			FWDAnimation.killTweensOf(_s.mainHld);
			FWDAnimation.to(_s.mainHld, .8, {y:-_s.sH, ease:Expo.easeInOut});
		};
		
		_s.hideCompleteHandler = function(){
			prt.main_do.removeChild(_s);
			_s.dispatchEvent(FWDUVPInfoWindow.HIDE_COMPLETE);
		};
	
		_s.init();
	};
	
		
	/* set prototype */
	FWDUVPInfoWindow.setPrototype = function(){
		FWDUVPInfoWindow.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPInfoWindow.ERROR = "error";
	FWDUVPInfoWindow.HIDE_COMPLETE = "hideComplete";
	
	FWDUVPInfoWindow.prototype = null;
	window.FWDUVPInfoWindow = FWDUVPInfoWindow;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Main class.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPlayer = function(props){

		'use strict';

		FWDUVPlayer.V = '8.4';
		
		var _s = this;
		_s.isInstantiate_bl = false;
		_s.displayType = props.displayType || FWDUVPlayer.RESPONSIVE;
		
		if(_s.displayType.toLowerCase() != FWDUVPlayer.RESPONSIVE 
		   && _s.displayType.toLowerCase() != FWDUVPlayer.FULL_SCREEN
		   && _s.displayType.toLowerCase() != FWDUVPlayer.STICKY
		   && _s.displayType.toLowerCase() != FWDUVPlayer.AFTER_PARENT
		   && _s.displayType.toLowerCase() != FWDUVPlayer.LIGHTBOX){
			_s.displayType = FWDUVPlayer.RESPONSIVE;
		}
		_s.displayType = _s.displayType.toLowerCase();
		
		_s.stickyOnScroll = props.stickyOnScroll || "no";
		_s.stickyOnScroll = _s.stickyOnScroll == "yes" ? true : false;
		if(_s.displayType != FWDUVPlayer.RESPONSIVE) _s.stickyOnScroll = false;
		_s.isMinShowed = true;
		
		_s.stickyOnScrollWidth = props.stickyOnScrollWidth || 700;
		_s.stickyOnScrollHeight = props.stickyOnScrollHeight || 394; 

		_s.maxWidth = props.maxWidth || 640;
		_s.maxHeight = props.maxHeight || 380;
	
		_s.useYoutube_bl = props.useYoutube || "no"; 
		_s.useYoutube_bl = _s.useYoutube_bl == "yes" ? true : false;
		
		_s.useVimeo_bl = props.useVimeo || "no"; 
		_s.useVimeo_bl = _s.useVimeo_bl == "yes" ? true : false;
		
		_s.mainFolderPath_str = props.mainFolderPath;
		if((_s.mainFolderPath_str.lastIndexOf("/") + 1) != _s.mainFolderPath_str.length){
			_s.mainFolderPath_str += "/";
		}
		
		_s.sknPth = props.skinPath;
		if((_s.sknPth.lastIndexOf("/") + 1) != _s.sknPth.length){
			_s.sknPth += "/";
		}
		
		_s.warningIconPath_str = _s.mainFolderPath_str + _s.sknPth + "warningIcon.png";
		
		FWDUVPlayer.YTAPIReady = false;
		_s.fillEntireVideoScreen_bl = false;
	
		/* init gallery */
		_s.init = function(){
			if(_s.isInstantiate_bl) return;
			FWDUVPlayer.instaces_ar.push(_s);
			
			FWDTweenLite.ticker.useRAF(false);
			_s.props = props;
			
			_s.instanceName_str = _s.props.instanceName;
			
			if(!_s.instanceName_str){
				alert("FWDUVPlayer instance name is required please make sure that the instanceName parameter exsists and it's value is uinique.");
				return;
			}
			
			if(window[_s.instanceName_str]){
				alert("FWDUVPlayer instance name " + _s.instanceName_str +  " is already defined and contains a different instance reference, set a different instance name.");
				return;
			}else{
				window[_s.instanceName_str] = _s;
			}
		
			if(!_s.props){
				alert("FWDUVPlayer constructor properties object is not defined!");
				return;
			}
			
			if(!_s.props.parentId){		
				alert("Property parentId is not defined in the FWDUVPlayer constructor, _s property represents the div id into which the megazoom is added as a child!");
				return;
			}
			
			if(_s.displayType == FWDUVPlayer.RESPONSIVE) _s.mustHaveHolderDiv_bl = true;
		
			if(_s.mustHaveHolderDiv_bl && !FWDUVPUtils.getChildById(_s.props.parentId)){
				alert("FWDUVPlayer holder div is not found, please make sure that the div exsists and the id is correct! " + _s.props.parentId);
				return;
			}
			
			_s.body = document.getElementsByTagName("body")[0];
			if(_s.displayType == FWDUVPlayer.STICKY){
				_s.stageContainer = document.createElement("div");
				_s.stageContainer.style.position = "fixed";
				_s.stageContainer.style.width = "100%";
				_s.stageContainer.style.zIndex = "999999";
				_s.stageContainer.style.height = "0px";
			
				document.documentElement.appendChild(_s.stageContainer);
				_s.stageContainer.style.overflow = "visible";
				
			}else if(_s.displayType == FWDUVPlayer.FULL_SCREEN  || _s.displayType == FWDUVPlayer.LIGHTBOX){
				_s.stageContainer = document.documentElement;
			}else{
				_s.stageContainer = FWDUVPUtils.getChildById(_s.props.parentId);
			}
		
			_s.position_str = _s.props.verticalPosition;
			if(!_s.position_str) _s.position_str = FWDUVPlayer.POSITION_TOP;
			if(_s.position_str == "bottom"){
				_s.position_str = FWDUVPlayer.POSITION_BOTTOM;
			}else{
				_s.position_str = FWDUVPlayer.POSITION_TOP;
			}
			
			_s.horizontalPosition_str = _s.props.horizontalPosition;
			if(!_s.horizontalPosition_str) _s.horizontalPosition_str = FWDUVPlayer.CENTER;
			if(_s.horizontalPosition_str == "center"){
				_s.horizontalPosition_str = FWDUVPlayer.CENTER;
			}else if(_s.horizontalPosition_str == "left"){
				_s.horizontalPosition_str = FWDUVPlayer.LEFT;
			}else if(_s.horizontalPosition_str == "right"){
				_s.horizontalPosition_str = FWDUVPlayer.RIGHT;
			}else{
				_s.horizontalPosition_str = FWDUVPlayer.CENTER;
			}
			
			if(_s.isEmbedded_bl) _s.displayType = FWDUVPlayer.FULL_SCREEN;
			
			_s.listeners = {events_ar:[]};
			_s.spaceBetweenControllerAndPlaylist = _s.props.spaceBetweenControllerAndPlaylist || 1;
			_s.autoScale_bl = _s.props.autoScale;
			_s.autoScale_bl = _s.autoScale_bl == "yes" ? true : false;

			_s.ec = document.getElementById('fwduvp_extra_content');
			
			_s.showPreloader_bl = _s.props.showPreloader;
			_s.showPreloader_bl = _s.showPreloader_bl == "yes" ? true : false;
			
			_s.preloaderColors = _s.props.preloaderColors || ["#666666", "#FFFFFF"];
			
			_s.backgroundColor_str = _s.props.backgroundColor || "transparent";
			_s.videoBackgroundColor_str = _s.props.videoBackgroundColor || "transparent";
			
			_s.mainBackgroundImagePath_str = _s.props.mainBackgroundImagePath;
			if(_s.mainBackgroundImagePath_str && _s.mainBackgroundImagePath_str.length < 3) _s.mainBackgroundImagePath_str = undefined;
			
			_s.animate_bl = true; 
			_s.isShowedFirstTime_bl = true;
			
			_s.offsetX = parseInt(_s.props.offsetX) || 0;
			_s.offsetY = parseInt(_s.props.offsetY) || 0
			_s.lastX = 0;
			_s.lastY = 0;
			_s.tempStageWidth = 0;
			_s.tempStageHeight = 0;
			_s.tempVidStageWidth = 0;
			_s.tempVidStageHeight = 0;
			_s.sW = 0;
			_s.sH = 0;
			_s.vidStageWidth = 0;
			_s.vidStageHeight = 0;
			_s.catId = -1;
			_s.id = -1;
			_s.totaadsIdeos = 0;
			_s.prevCatId = -1;
			_s.totalTimePlayed = 0;
			_s.isFullScreen_bl = false;
			
			_s.videoSourcePath_str = "";
			_s.prevVideoSourcePath_str;
			_s.posterPath_str = _s.props.posterPath;
			_s.playListThumbnailWidth = _s.props.thumbnailWidth || 80;
			_s.playListThumbnailHeight = _s.props.thumbnailHeight || 80;

			_s.showOnlyThumbnail = _s.props.showOnlyThumbnail;
			_s.showOnlyThumbnail = _s.showOnlyThumbnail == "yes" ? true : false;

			_s.playlistWidth = _s.props.playlistRightWidth || 250;
			_s.playlistHeight = 0;
			
			_s.showPlaylistButtonAndPlaylist_bl = _s.props.showPlaylistButtonAndPlaylist;
			_s.showPlaylistButtonAndPlaylist_bl = _s.showPlaylistButtonAndPlaylist_bl == "no" ? false : true;
			
			_s.isPlaylistShowed_bl = _s.props.showPlaylistByDefault;
			_s.isPlaylistShowed_bl = _s.isPlaylistShowed_bl == "no" ? false : true;
			
			_s.showErrorInfo_bl = _s.props.showErrorInfo; 
			_s.showErrorInfo_bl = _s.showErrorInfo_bl == "no" ? false : true;
			
			_s.showAnnotationsPositionTool_bl =  _s.props.showAnnotationsPositionTool;
			_s.showAnnotationsPositionTool_bl = _s.showAnnotationsPositionTool_bl == "yes" ? true : false;
			if(_s.showAnnotationsPositionTool_bl) _s.isPlaylistShowed_bl = false;
			
			if(FWDUVPlayer.videoStartBehaviour != "pause" 
			&& FWDUVPlayer.videoStartBehaviour != "stop"
			&& FWDUVPlayer.videoStartBehaviour != "default"
			){
				FWDUVPlayer.videoStartBehaviour = "pause";
			}
			
			_s.lightBoxBackgroundOpacity = _s.props.lightBoxBackgroundOpacity || 1;
			_s.lightBoxBackgroundColor_str = _s.props.lightBoxBackgroundColor || "transparent";
			_s.preloaderBackgroundColor = _s.props.preloaderBackgroundColor || "#000000";
			_s.preloaderFillColor = _s.props.preloaderFillColor || "#FFFFFF";
			_s.addPrevId = Math.random() * 999999999;
			_s.orintationChangeComplete_bl = true;
			_s.isInstantiate_bl = true;
			_s.useDeepLinking_bl = _s.props.useDeepLinking;
			_s.useDeepLinking_bl = _s.useDeepLinking_bl == "yes" ? true : false;
			
			_s.isMbl = FWDUVPUtils.isMobile;
			_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
			
			_s.lightBoxWidth = _s.props.maxWidth || 500;
			_s.lightBoxHeight =  _s.props.maxHeight || 400;
			
			_s.isShowed_bl = _s.props.showPlayerByDefault; 
			_s.isShowed_bl = _s.isShowed_bl == "yes" ? true : false;
			
			_s.googleAnalyticsMeasurementId = _s.props.googleAnalyticsMeasurementId; 
			if(!window['gtag'] && _s.googleAnalyticsMeasurementId){
				var script = document.createElement('script');
			    script.src = 'https://www.googletagmanager.com/gtag/js?id=' + _s.googleAnalyticsMeasurementId;
			    script.setAttribute("async", "true");
			    script.onload = function() {

			      _s.initGoogleAnalytics();
			    };
			    document.head.appendChild(script);
			}else if(window['gtag'] && _s.googleAnalyticsMeasurementId){
				_s.initGoogleAnalytics();
			}

		
			if(_s.displayType == FWDUVPlayer.LIGHTBOX){
				_s.setupLightBox();
			}else if(_s.displayType == FWDUVPlayer.STICKY){
				_s.setupPlayer();
				_s.startResizeHandler();
			}else{
				if(_s.initializeOnlyWhenVisible_bl){
					_s.startResizeHandler();
					window.addEventListener("scroll", _s.onInitlalizeScrollHandler);
					setTimeout(_s.onInitlalizeScrollHandler, 500);
				}else{
					_s.setupPlayer();
					_s.startResizeHandler();
				}
			}
		};

		_s.initGoogleAnalytics = function(){
			  // Once the script is loaded, initialize Google Analytics
		      window.dataLayer = window.dataLayer || [];
			  _s.gtag = function(){dataLayer.push(arguments);}

		      _s.gtag('js', new Date());
		      _s.gtag('config', _s.googleAnalyticsMeasurementId);
		}

		_s.addMinOnScroll = function(){
			if(_s.displayType != FWDUVPlayer.RESPONSIVE) return;
			if(_s.stickyOnScroll) window.addEventListener("scroll", _s.minimizeOnScrollHandler);
		}

		_s.removeMinOnScroll = function(){
			if(_s.stickyOnScroll) window.removeEventListener("scroll", _s.minimizeOnScrollHandler);
		}

		_s.minimizeOnScrollHandler = function(e){
			var scrollOffsets = FWDUVPUtils.getScrollOffsets();
			_s.pageXOffset = scrollOffsets.x;
			_s.pageYOffset = scrollOffsets.y;
			
			if(_s.stageContainer.getBoundingClientRect().bottom < 0){
				_s.setMinimized();
			}else{
				_s.setNormal();
			}
		}

		_s.setMinimized = function(){
			if(_s.isMin || _s.isFullscreen_bl) return;
			_s.isMin = true;
			_s.main_do.getStyle().position = 'fixed';
			_s.main_do.getStyle().zIndex = 9999999999999;
			_s.main_do.setAlpha(0);
			_s.startPosisionOnMin();
		}

		_s.startPosisionOnMin = function(){
			_s.wasPlaylistShowed_bl = _s.isPlaylistShowed_bl;
			_s.showPlaylist();
			_s.resizeHandler();
			_s.positionOnMin();
		}

		_s.setNormal = function(){
			if(!_s.isMin) return;
			_s.isMinShowed = true;
			_s.isMin = false;
			_s.main_do.getStyle().position = "relative";
			_s.main_do.getStyle().zIndex = 0;
			FWDAnimation.killTweensOf(_s.main_do);
			_s.main_do.setAlpha(1);
			_s.main_do.setX(0);
			_s.main_do.setY(0);
			if(_s.opener_do) _s.opener_do.setX(-1000);
						
			_s.startPosisionOnNormal();
		}

		_s.startPosisionOnNormal = function(){
			if(_s.opener_do) _s.opener_do.showCloseButton();
			_s.isPlaylistShowed_bl = _s.wasPlaylistShowed_bl;
			if(_s.isPlaylistShowed_bl) _s.hidePlaylist(true);
			_s.resizeHandler();
		}
		
		_s.positionOnMin = function(animate){
			if(!_s.isMin && !animate) return;
			var offset = 5;
			var dl = .2;
			if(_s.isMbl) offset= 0;
			var offsetTop = 0;
			if(!_s.isMinShowed){
				dl = 0;
				offsetTop = Math.round(_s.tempStageHeight) + offset;
			} 

			if(_s.opener_do){
				var oX = _s.ws.w - _s.opener_do.w - offset;
				var oY = _s.ws.h - _s.tempStageHeight - offset + offsetTop - _s.opener_do.h;
			}
			
			_s.main_do.setX(_s.ws.w - _s.tempStageWidth - offset);
			if(_s.main_do.alpha == 0 || animate){
				if(_s.main_do.alpha == 0){
					_s.main_do.setY(_s.ws.h);
					if(_s.opener_do){
						_s.opener_do.setX(oX);
						_s.opener_do.setY(_s.ws.h);
					}
				}
				FWDAnimation.to(_s.main_do, .8, {alpha:1, y:_s.ws.h - _s.tempStageHeight - offset + offsetTop, delay:dl, ease:Expo.easeInOut});
				if(_s.opener_do){
					FWDAnimation.killTweensOf(_s.opener_do);
					FWDAnimation.to(_s.opener_do, .8, {x:oX, y:oY, delay:dl, ease:Expo.easeInOut});
				}
			}else{
				FWDAnimation.killTweensOf(_s.main_do);
				_s.main_do.setAlpha(1);
				_s.main_do.setY(_s.ws.h - _s.tempStageHeight - offset + offsetTop);
				if(_s.opener_do){
					FWDAnimation.killTweensOf(_s.opener_do);
					_s.opener_do.setX(oX);
					_s.opener_do.setY(oY);
				}
			}			
		}

		_s.onInitlalizeScrollHandler = function(){
			var scrollOffsets = FWDUVPUtils.getScrollOffsets();
			_s.pageXOffset = scrollOffsets.x;
			_s.pageYOffset = scrollOffsets.y;
			
			if(_s.main_do.getRect().top >= -_s.sH && _s.main_do.getRect().top < _s.ws.h){
				window.removeEventListener("scroll", _s.onInitlalizeScrollHandler);
				_s.setupPlayer();
			}
		};
		
		_s.setupPlayer = function(){
			if(!_s.main_do){
				_s.setupMainDo();
				_s.setupInfo();
				_s.setupData();
			}
		}
		
		//#############################################//
		/* setup  lighbox...*/
		//#############################################//
		_s.setupLightBox = function(){
			
			FWDUVPLightBox.setPrototype();
			_s.lightBox_do =  new FWDUVPLightBox(_s, 
					_s.lightBoxBackgroundColor_str, 
					_s.backgroundColor_str, 
					_s.lightBoxBackgroundOpacity, 
					_s.lightBoxWidth, 
					_s.lightBoxHeight);
					
			_s.lightBox_do.addListener(FWDUVPLightBox.SHOW, _s.lightBoxShowHandler);
			_s.lightBox_do.addListener(FWDUVPLightBox.CLOSE, _s.lightBoxCloseHandler);
			_s.lightBox_do.addListener(FWDUVPLightBox.HIDE_COMPLETE, _s.lightBoxHideCompleteHandler);
			_s.setupPlayer();
		};
		
		_s.lightBoxShowHandler = function(){}
		
		_s.lightBoxCloseHandler = function(){
		
			_s.stop();
			_s.stopResizeHandler();
		};
		
		_s.lightBoxHideCompleteHandler = function(){
			_s.dispatchEvent(FWDUVPlayer.HIDE_LIGHTBOX_COMPLETE);
		};

	
		//#############################################//
		/* setup main do */
		//#############################################//
		_s.setupMainDo = function(){
		
			_s.main_do = new FWDUVPDisplayObject("div", "relative");
			_s.main_do.screen.className = 'fwduvp';
			if(_s.hasPointerEvent_bl) _s.main_do.getStyle().touchAction = "none";
			_s.main_do.getStyle().webkitTapHighlightColor = "rgba(0, 0, 0, 0)";
			_s.main_do.getStyle().webkitFocusRingColor = "rgba(0, 0, 0, 0)";
			_s.main_do.getStyle().width = "100%";
			_s.main_do.getStyle().height = "100%";
			_s.main_do.setBackfaceVisibility();
			_s.main_do.setBkColor(_s.backgroundColor_str);
			if(!FWDUVPUtils.isMobile || (FWDUVPUtils.isMobile && FWDUVPUtils.hasPointerEvent)) _s.main_do.setSelectable(false);	
			_s.videoHolder_do = new FWDUVPDisplayObject("div");
			_s.main_do.addChild(_s.videoHolder_do);

			if(_s.displayType ==  FWDUVPlayer.STICKY){
				_s.background_do = new FWDUVPDisplayObject("div");
				_s.background_do.getStyle().width = "100%";
				if(_s.mainBackgroundImagePath_str){
					_s.mainBackground_do =  new FWDUVPDisplayObject("div");
					_s.stageContainer.appendChild(_s.mainBackground_do.screen);
				}
				_s.stageContainer.appendChild(_s.background_do.screen);
				_s.stageContainer.appendChild(_s.main_do.screen);
			}else if(_s.displayType == FWDUVPlayer.FULL_SCREEN){	
				_s.stageContainer.style.overflow = "hidden";
				_s.main_do.getStyle().position = "absolute";
				document.documentElement.appendChild(_s.main_do.screen);
				_s.stageContainer.style.zIndex = 9999999999998;
				_s.main_do.getStyle().zIndex = 9999999999998;
			}else if(_s.displayType == FWDUVPlayer.BACKGROUND_VIDEO){	
				document.documentElement.appendChild(_s.main_do.screen);
				_s.main_do.getStyle().zIndex = -9999999999998;
				_s.main_do.getStyle().position = "fixed";
				document.documentElement.insertBefore(_s.main_do.screen, document.documentElement.firstChild);
			}else if(_s.displayType == FWDUVPlayer.LIGHTBOX){
				_s.main_do.getStyle().position = "absolute";
			
				_s.stageContainer = _s.lightBox_do.mainLightBox_do.screen;
				_s.stageContainer.appendChild(_s.main_do.screen);
				_s.main_do.setX(-10000);
				_s.main_do.setY(-10000);
				_s.main_do.setWidth(0);
				_s.main_do.setHeight(0);
			}else{
				_s.stageContainer.style.overflow = "hidden";
				_s.stageContainer.appendChild(_s.main_do.screen);
			}	

			if(_s.isEmbedded_bl) _s.main_do.getStyle().zIndex = 9999999999998;
		};
		
		
		//#############################################//
		/* setup info_do */
		//#############################################//
		_s.setupInfo = function(){
			FWDUVPInfo.setPrototype();
			_s.info_do = new FWDUVPInfo(_s, _s.warningIconPath_str, _s.showErrorInfo_bl);
			_s.info_do.getStyle().zIndex = "9999999999999999";
		};		
		

		//#############################################//
		/* resize handler */
		//#############################################//
		_s.startResizeHandler = function(){
			
			if(_s.displayType == FWDUVPlayer.STICKY){
				if(FWDUVPUtils.isAndroid) window.addEventListener("orientationchange", _s.orientationChange);
				window.addEventListener("scroll", _s.onScrollHandler);
			}
			
			if(_s.displayType == FWDUVPlayer.LIGHTBOX){
				window.addEventListener("scroll", _s.onScrollHandler);
			}
			
			window.addEventListener("resize", _s.onResizeHandler);
		
			_s.onResizeHandler(true);
			_s.resizeHandlerId_to = setTimeout(function(){_s.resizeHandler();}, 500);
		};
		
		_s.orientationChange = function(){
			_s.orintationChangeComplete_bl = false;	
			clearTimeout(_s.resizeHandlerId_to);
			clearTimeout(_s.resizeHandler2Id_to);
			clearTimeout(_s.orientationChangeId_to);
		
			_s.orientationChangeId_to = setTimeout(function(){
				_s.orintationChangeComplete_bl = true; 
				_s.stageContainer.style.left = "0";
				_s.resizeHandler(true);
				}, 1000);
			
			_s.stageContainer.style.left = "-5000px";
			if(_s.preloader_do) _s.preloader_do.setX(-5000);	
		};
		
		_s.onScrollHandler = function(e){
			if(_s.displayType == FWDUVPlayer.STICKY && _s.isMbl) _s.onResizeHandler();
			if(_s.lightBox_do && !_s.lightBox_do.isShowed_bl) return;
			_s.scrollHandler();
			var scrollOffsets = FWDUVPUtils.getScrollOffsets();
			_s.scrollOffsets = scrollOffsets;
		};
		
		_s.scrollHandler = function(){
			var scrollOffsets = FWDUVPUtils.getScrollOffsets();
			_s.pageXOffset = scrollOffsets.x;
			_s.pageYOffset = scrollOffsets.y;
			if(_s.displayType == FWDUVPlayer.LIGHTBOX){
				_s.lightBox_do.setX(scrollOffsets.x);
				_s.lightBox_do.setY(scrollOffsets.y);
			}else if(_s.isFullScreen_bl || _s.displayType == FWDUVPlayer.FULL_SCREEN){	
				_s.main_do.setX(scrollOffsets.x);
				_s.main_do.setY(scrollOffsets.y);
			}
		};
		
		_s.stopResizeHandler = function(){
			if(window.removeEventListener){
				window.removeEventListener("resize", _s.onResizeHandler);
			}else if(window.detachEvent){
				window.detachEvent("onresize", _s.onResizeHandler);
			}	
			clearTimeout(_s.resizeHandlerId_to);
		};

		
		_s.onResizeHandler = function(e){
			_s.resizeHandler();
			clearTimeout(_s.resizeHandler2Id_to);
			_s.resizeHandler2Id_to = setTimeout(function(){_s.resizeHandler();}, 300);
		};
		
		_s.prevVpW;
		_s.resizeHandler = function(allowToResizeFinal, resizePlaylistWithAnim){
			_s.tempPlaylistPosition_str;
		
			var viewportSize = FWDUVPUtils.getViewportSize();
			var scrollOffsets = FWDUVPUtils.getScrollOffsets();
			_s.ws = viewportSize;
			_s.showPlaylistOnFullScreen = _s._d.showPlaylistOnFullScreen;
			if(_s.ws.w < 1000) _s.showPlaylistOnFullScreen = false;
			
			if(_s.displayType == FWDUVPlayer.STICKY  && !_s.isFullScreen_bl){	
				_s.main_do.getStyle().width = "100%";
				if(_s.main_do.getWidth() > _s.maxWidth){
					_s.main_do.setWidth(_s.maxWidth);
				}
				
				_s.sW = _s.main_do.getWidth();
				if(_s.autoScale_bl){
					_s.sH = parseInt(_s.maxHeight * (_s.sW/_s.maxWidth));
				}else{
					_s.sH = _s.maxHeight;
				}
			
			}else if(_s.displayType == FWDUVPlayer.LIGHTBOX && !_s.isFullScreen_bl){
				if(!_s.lightBox_do.isShowed_bl ||  !_s.main_do) return;
				if(_s.lightBoxWidth > viewportSize.w){
					_s.finalLightBoxWidth = viewportSize.w;
					_s.finalLightBoxHeight = parseInt(_s.lightBoxHeight * (viewportSize.w/_s.lightBoxWidth));
				}else{
					_s.finalLightBoxWidth = _s.lightBoxWidth;
					_s.finalLightBoxHeight = _s.lightBoxHeight;
				}
				_s.lightBox_do.setWidth(viewportSize.w);
				_s.lightBox_do.setHeight(viewportSize.h);
				_s.lightBox_do.setX(scrollOffsets.x);
				_s.lightBox_do.setY(scrollOffsets.y);
				_s.lightBox_do.mainLightBox_do.setX(parseInt((viewportSize.w - _s.finalLightBoxWidth)/2));
				_s.lightBox_do.mainLightBox_do.setY(parseInt((viewportSize.h - _s.finalLightBoxHeight)/2));
				if(_s.lightBox_do.clsBtn && _s.lightBox_do.isShowed_bl){ 
					_s.lightBox_do.clsBtn.setX(viewportSize.w - _s.lightBox_do.clsBtn.w - 15);
					_s.lightBox_do.clsBtn.setY(15);
				}
				_s.main_do.setX(0);
				_s.main_do.setY(0);
				_s.lightBox_do.mainLightBox_do.setWidth(_s.finalLightBoxWidth);
				_s.lightBox_do.mainLightBox_do.setHeight(_s.finalLightBoxHeight);	
				_s.sW = _s.finalLightBoxWidth;
				_s.sH = _s.finalLightBoxHeight;
			}else if(_s.isFullScreen_bl || _s.displayType == FWDUVPlayer.FULL_SCREEN){	
				_s.main_do.setX(0);
				_s.main_do.setY(0);
				_s.sW = viewportSize.w;
				_s.sH = viewportSize.h;
			}else if(_s.displayType == FWDUVPlayer.AFTER_PARENT){
				_s.main_do.setX(0);
				_s.main_do.setY(0);
				_s.sW = _s.stageContainer.offsetWidth;
				_s.sH = _s.stageContainer.offsetHeight;
			}else{
				_s.stageContainer.style.width = "100%";
				if(_s.stageContainer.offsetWidth > _s.maxWidth){
					_s.stageContainer.style.width = _s.maxWidth + "px";
				}
				_s.sW = _s.stageContainer.offsetWidth;
				if(_s.autoScale_bl){
					_s.sH = parseInt(_s.maxHeight * (_s.sW/_s.maxWidth));
					_s.tempStageHeight = _s.sH;
				}else{
					_s.sH = _s.maxHeight;
					_s.tempStageHeight = _s.sH;
				}
			}
			
			if(_s.sH > viewportSize.h && _s.isFullScreen_bl) _s.sH = viewportSize.h;
			if(_s._d && _s.playlist_do){
				_s.playlistHeight = parseInt(_s._d.playlistBottomHeight);
			}

			if(_s.isMin && !_s.isFullScreen_bl){
				_s.sW = Math.min(_s.stickyOnScrollWidth - 10, _s.ws.w - 10)
				_s.sH = parseInt(_s.stickyOnScrollHeight * (_s.sW/_s.stickyOnScrollWidth));
				_s.tempStageHeight = _s.sH;
			}
		
			if(_s._d){
				_s.tempPlaylistPosition_str = _s._d.playlistPosition_str;
				if(_s.sW < 800 || (_s.ec && _s.sH < 600)){
					_s.tempPlaylistPosition_str = "bottom";
				}
				_s.playlistPosition_str = _s.tempPlaylistPosition_str;
				if(_s.playlist_do) _s.playlist_do.position_str = _s.tempPlaylistPosition_str;
			}

		
			if(_s.playlist_do && _s.isPlaylistShowed_bl){

				if(_s.playlistPosition_str == "bottom"){
					_s.vidStageWidth = _s.sW;
					_s.sH += _s.playlistHeight + _s.spaceBetweenControllerAndPlaylist;
					_s.vidStageHeight = _s.sH - _s.playlistHeight - _s.spaceBetweenControllerAndPlaylist;
					if(_s.displayType == FWDUVPlayer.FULL_SCREEN) _s.controller_do.disablePlaylistButton();
				
					
				}else if(_s.playlistPosition_str == "right"){
					if(_s.isFullScreen_bl && !_s.showPlaylistOnFullScreen){
						_s.vidStageWidth = _s.sW;
					}else{
						_s.vidStageWidth = _s.sW - _s.playlistWidth - _s.spaceBetweenControllerAndPlaylist;
					}
					if(_s.controller_do) _s.controller_do.enablePlaylistButton();
					_s.vidStageHeight = _s.sH;
				}

				if(!this.isFullScreen_bl){
					if(_s.controller_do) _s.controller_do.enablePlaylistButton();
				}
			}else{
				if(!this.isFullScreen_bl){
					if(_s.controller_do) _s.controller_do.enablePlaylistButton();
				}
			
				_s.vidStageWidth = _s.sW;
				_s.vidStageHeight = _s.sH;
			}
				
			if(_s.controller_do){
				if(_s.playlist_do){
					if(_s.playlistPosition_str == "right"){
						if(_s.isFullScreen_bl && !_s.showPlaylistOnFullScreen){
							_s.controller_do.disablePlaylistButton();
						}else{
							_s.controller_do.enablePlaylistButton();
						}
					}else if(_s.isEmbedded_bl){
						_s.controller_do.disablePlaylistButton();
					}
				}
			}
			
			if(_s.mainBackground_do){
				_s.mainBackground_do.setWidth(_s.ws.w);
				_s.mainBackground_do.setHeight(_s.sH);
			}
			
			if(!allowToResizeFinal){
				FWDAnimation.killTweensOf(_s);
				
				_s.tempStageWidth = _s.sW;
				_s.tempStageHeight = _s.sH;
				_s.tempVidStageWidth = _s.vidStageWidth;
				_s.tempVidStageHeight = Math.max(0, _s.vidStageHeight);
				
				_s.resizeFinal(resizePlaylistWithAnim);
				if(_s.prevVpW != viewportSize.w || _s.displayType != FWDUVPlayer.STICKY){
					_s.setStageContainerFinalHeightAndPosition(resizePlaylistWithAnim);
				}
			}	

			setTimeout(function(){
				_s.prevVpW = viewportSize.w;
			},50)
		};

		_s.resizeFinal = function(resizePlaylistWithAnim){

			if(_s.displayType != FWDUVPlayer.STICKY && !_s.isMin) _s.stageContainer.style.height = _s.tempStageHeight + "px";

			if(_s.mainBackground_do){
				_s.mainBackground_do.setWidth(_s.ws.w);
				_s.mainBackground_do.setHeight(_s.tempStageHeight);
			}
			
			_s.main_do.setWidth(_s.tempStageWidth);
			_s.videoHolder_do.setWidth(_s.tempVidStageWidth);
			_s.videoHolder_do.setHeight(_s.tempVidStageHeight);
			
			if(_s.showPlaylistButtonAndPlaylist_bl && _s.isPlaylistShowed_bl && _s.playlistPosition_str == "bottom"){
				_s.main_do.setHeight(_s.tempStageHeight);
			}else{
				_s.main_do.setHeight(_s.tempStageHeight);
			}
			
			if(_s.displayType == FWDUVPlayer.LIGHTBOX) _s.lightBox_do.mainLightBox_do.setY(parseInt((_s.ws.h - _s.tempStageHeight)/2));
			
			if(_s.audioScreen_do && _s.videoType_str == FWDUVPlayer.MP3){
				_s.audioScreen_do.resizeAndPosition(_s.tempVidStageWidth, _s.tempVidStageHeight);
			}
			
			if(_s.ytb_do && _s.videoType_str == FWDUVPlayer.YOUTUBE){
				_s.ytb_do.setWidth(_s.tempVidStageWidth);
				_s.ytb_do.setHeight(_s.tempVidStageHeight);
			}
			
			if(_s.logo_do) _s.logo_do.positionAndResize();
			if(_s.playlist_do && !FWDAnimation.isTweening(_s)){
				_s.playlist_do.resizeAndPosition(resizePlaylistWithAnim);
			}
		
			if(_s.annotations_do){
				if(FWDAnimation.isTweening(_s)){
					_s.annotations_do.position(true);
				}else{
					_s.annotations_do.position(false);
				}
			}

			if(_s.controller_do) _s.controller_do.resizeAndPosition();
			if(_s.categories_do) _s.categories_do.resizeAndPosition();
			
			if(_s.videoScreen_do && (_s.videoType_str == FWDUVPlayer.VIDEO || _s.videoType_str == FWDUVPlayer.HLS_JS || _s.videoType_str == FWDUVPlayer.DASH)){
				_s.finaadsIdeoScreenW = _s.tempVidStageWidth;
				_s.finaadsIdeoScreenH = _s.tempVidStageHeight;
				_s.finaadsIdeoScreenX = _s.finaadsIdeoScreenY = 0;
				
				_s.videoScreen_do.resizeAndPosition(_s.finaadsIdeoScreenW, _s.finaadsIdeoScreenH, _s.finaadsIdeoScreenX, _s.finaadsIdeoScreenY);
			}

			if(_s.isIMA && _s.IMA) _s.IMA.resizeAndPosition();
		
			if(_s.ytb_do && _s.ytb_do.ytb && _s.videoType_str == FWDUVPlayer.YOUTUBE){
				_s.ytb_do.resizeAndPosition();
			}
			
			if(_s.vimeo_do && _s.videoType_str == FWDUVPlayer.VIMEO){
				_s.vimeo_do.resizeAndPosition();
			}
			
			if(_s.preloader_do) _s.positionPreloader();
			if(_s.dClk_do){
				if(_s.is360 && _s.videoType_str == FWDUVPlayer.YOUTUBE){
					_s.dClk_do.setWidth(0);
				}else if(_s.videoType_str == FWDUVPlayer.VIMEO && !_s._d.showDefaultControllerForVimeo_bl){
					_s.dClk_do.setWidth(0);
				}else{
					_s.dClk_do.setWidth(_s.tempVidStageWidth);
					if(_s.isMbl){
						_s.dClk_do.setHeight(_s.tempVidStageHeight);
					}else{
						if(_s.videoType_str == FWDUVPlayer.YOUTUBE && !_s.isAdd_bl){
							_s.dClk_do.setHeight(_s.tempVidStageHeight);
						}else{
							_s.dClk_do.setHeight(_s.tempVidStageHeight);
						}
					}
				}
			}
			
			if(_s.videoHider_do) _s.resizeVideoHider();
			if(_s.lrgPlayBtn) _s.positionLargePlayButton();
			if(_s.videoPoster_do && _s.videoPoster_do.allowToShow_bl) _s.videoPoster_do.positionAndResize();
			if(_s.popw_do && _s.popw_do.isShowed_bl) _s.popw_do.positionAndResize();
			if(_s.embedWindow_do && _s.embedWindow_do.isShowed_bl) _s.embedWindow_do.positionAndResize();
			if(_s.passWindow_do && _s.passWindow_do.isShowed_bl) _s.passWindow_do.positionAndResize();
			if(_s.lg_do && _s.lg_do.isShowed_bl) _s.lg_do.positionAndResize();
			if(_s.infoWindow_do && _s.infoWindow_do.isShowed_bl) _s.infoWindow_do.positionAndResize();
			if(_s.info_do && _s.info_do.isShowed_bl) _s.info_do.positionAndResize();
			if(_s.shareWindow_do && _s.shareWindow_do.isShowed_bl) _s.shareWindow_do.positionAndResize();
			if(_s.adsStart_do && _s.isAdd_bl) _s.positionAds();
			if(_s.subtitle_do) _s.subtitle_do.position(resizePlaylistWithAnim);
			if(_s.popupAds_do) _s.popupAds_do.position(resizePlaylistWithAnim);
			_s.positionAdsImage();
			
			_s.positionOnMin();
			
		};
		
		_s.setStageContainerFinalHeightAndPosition = function(animate){
			if(_s.displayType != FWDUVPlayer.STICKY) return;
			
			_s.allowToResizeAndPosition_bl = true;
			clearTimeout(_s.showPlaylistWithDelayId_to);
			
			if(_s.horizontalPosition_str == FWDUVPlayer.LEFT){
				_s.main_do.setX(_s.offsetX);
				if(_s.opener_do){
					if(_s._d.openerAlignment_str == "right"){
						_s.opener_do.setX(Math.round(_s.sW - _s.opener_do.w + _s.offsetX));
					}else{
						_s.opener_do.setX(_s.offsetX);
					}
				}
			}else if(_s.horizontalPosition_str == FWDUVPlayer.CENTER){
				_s.main_do.setX(Math.round((_s.ws.w - _s.sW)/2));
				if(_s.opener_do){
					if(_s._d.openerAlignment_str == "right"){
						_s.opener_do.setX(parseInt((_s.ws.w - _s.sW)/2) + _s.sW - _s.opener_do.w);
					}else{
						_s.opener_do.setX(_s.main_do.x);
					}
				}
			}else if(_s.horizontalPosition_str == FWDUVPlayer.RIGHT){
				_s.main_do.setX(Math.round(_s.ws.w - _s.sW - _s.offsetX));
				if(_s.opener_do){
					if(_s._d.openerAlignment_str == "right"){
						_s.opener_do.setX(Math.round(_s.ws.w - _s.opener_do.w - _s.offsetX));
					}else{
						_s.opener_do.setX(Math.round(_s.ws.w - _s.sW - _s.offsetX));
					}
				}
			}
		
			if(animate){		
				if(_s.position_str ==  FWDUVPlayer.POSITION_TOP){
					if(_s.isShowed_bl && !_s.isShowedFirstTime_bl){
						FWDAnimation.to(_s.stageContainer, .8, {css:{top:_s.offsetY}, ease:Expo.easeInOut});
					}else{
						FWDAnimation.to(_s.stageContainer, .8, {css:{top:-_s.sH}, ease:Expo.easeInOut});
					}
					
					if(_s.isShowedFirstTime_bl){
						if(_s.opener_do) FWDAnimation.to(_s.opener_do, .8, {y:_s.sH - _s.opener_do.h, ease:Expo.easeInOut});
					}else{
						if(_s.opener_do) FWDAnimation.to(_s.opener_do, .8, {y:_s.sH, ease:Expo.easeInOut});
					}
				}else{
					if(_s.isShowed_bl && !_s.isShowedFirstTime_bl){
						FWDAnimation.to(_s.stageContainer, .8, {css:{top:_s.ws.h - _s.sH - _s.offsetY}, ease:Expo.easeInOut});
					}else{
						FWDAnimation.to(_s.stageContainer, .8, {css:{top:_s.ws.h}, ease:Expo.easeInOut, onComplete:_s.moveWheyLeft});
					}
					
					if(_s.isShowedFirstTime_bl){
						if(_s.opener_do) FWDAnimation.to(_s.opener_do, .8, {y:0, ease:Expo.easeInOut});
					}else{
						if(_s.opener_do) FWDAnimation.to(_s.opener_do, .8, {y:-_s.opener_do.h, ease:Expo.easeInOut});
					}
				}
			}else{
				FWDAnimation.killTweensOf(_s.stageContainer);
				if(_s.position_str ==  FWDUVPlayer.POSITION_TOP){
					if(_s.isShowed_bl && !_s.isShowedFirstTime_bl){
						_s.stageContainer.style.top = _s.offsetY + "px";
					}else{
						_s.stageContainer.style.top = -_s.sH + "px";
					}
					if(_s.isShowedFirstTime_bl){
						if(_s.opener_do) _s.opener_do.setY(_s.sH - _s.opener_do.h);
					}else{
						if(_s.opener_do) _s.opener_do.setY(_s.sH);
					}
				}else{
					
					if(_s.isShowed_bl && !_s.isShowedFirstTime_bl){
						_s.stageContainer.style.top = (_s.ws.h - _s.sH - _s.offsetY) + "px";
					}else{
						_s.stageContainer.style.top = _s.ws.h + "px";
					}
					
					if(_s.isShowedFirstTime_bl){
						if(_s.opener_do) _s.opener_do.setY(0);
					}else{
						if(_s.opener_do) _s.opener_do.setY(-_s.opener_do.h);
					}
				}
			}
		}
		
		
		//###############################################//
		/* Setup click screen */
		//###############################################//
		_s.setupClickScreen = function(){
			_s.dClk_do = new FWDUVPDisplayObject("div");
			if(FWDUVPUtils.isIE){
				_s.dClk_do.setBkColor("rgba(255,0,0,.00001");
			}
			
			if(_s.hasPointerEvent_bl){
				_s.dClk_do.screen.addEventListener("pointerdown", _s.playPauseDownHandler);
				_s.dClk_do.screen.addEventListener("pointerup", _s.playPauseClickHandler);
				_s.dClk_do.screen.addEventListener("pointermove", _s.playPauseMoveHandler);
			}else{	
				if(!_s.isMbl){
					_s.dClk_do.screen.addEventListener("mousedown", _s.playPauseDownHandler);
					_s.dClk_do.screen.addEventListener("mouseup", _s.playPauseClickHandler);
					_s.dClk_do.screen.addEventListener("mousemove", _s.playPauseMoveHandler);
				}else{
					_s.dClk_do.screen.addEventListener("click", _s.playPauseClickHandler);
				}
			}
			
			_s.hideClickScreen();
			_s.videoHolder_do.addChild(_s.dClk_do);
		};
		
		_s.playPauseDownHandler = function(e){
			_s.isClickHandlerMoved_bl = false;
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);
			_s.firstDommyTapX = vc.screenX;
			_s.firstDommyTapY = vc.screenY;
			if(_s.is360) _s.dClk_do.getStyle().cursor = 'url(' + _s._d.grabPath_str + '), default';
		}
		
		_s.playPauseMoveHandler = function(e){
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);
			var dx;
			var dy;
			
			if(e.touches && e.touches.length != 1) return;
			dx = Math.abs(vc.screenX - _s.firstDommyTapX);   
			dy = Math.abs(vc.screenY - _s.firstDommyTapY); 
			
			if(_s.isMbl && (dx > 10 || dy > 10)){
				_s.isClickHandlerMoved_bl = true;
			}else if(!_s.isMbl && (dx > 2 || dy > 2)){
				_s.isClickHandlerMoved_bl = true;
			}
		}
		
		_s.playPauseClickHandler = function(e){
			if(_s.is360) _s.dClk_do.getStyle().cursor = 'url(' + _s._d.handPath_str + '), default';
			if(e.button == 2) return;
			if(_s.isClickHandlerMoved_bl) return;
			if(_s.isAdd_bl){
				
				if(_s._d.adsPageToOpenURL_str && _s._d.adsPageToOpenURL_str != "none"){
					if(_s.ClickTracking) _s.executeVastEvent(_s.ClickTracking);
					window.open(_s._d.adsPageToOpenURL_str, _s._d.adsPageToOpenTarget_str);
					_s.pause();
				}
				return;
			}
			
			if(_s.disableClick_bl) return;
			_s.firstTapPlaying_bl = _s.isPlaying_bl;
			
			FWDUVPlayer.keyboardCurInstance = _s;
			
			if(_s.controller_do && _s.controller_do.mainHld.y != 0 && _s.isMbl) return;
			
			if(!_s.isMbl){
				if(FWDUVPlayer.videoStartBehaviour == FWDUVPlayer.PAUSE_ALL_VIDEOS){
					FWDUVPlayer.pauseAllVideos(_s);
				}else if(FWDUVPlayer.videoStartBehaviour == FWDUVPlayer.STOP_ALL_VIDEOS){
					FWDUVPlayer.stopAllVideos(_s);
				}
			}
			
			if(_s.videoType_str == FWDUVPlayer.YOUTUBE){
				_s.ytb_do.togglePlayPause();
			}else if(_s.videoType_str == FWDUVPlayer.MP3){
				_s.audioScreen_do.togglePlayPause();
			}else if(_s.videoType_str == FWDUVPlayer.VIMEO){
				_s.vimeo_do.togglePlayPause();
			}else{
				if(_s.videoScreen_do) _s.videoScreen_do.togglePlayPause();	
			}
		};
		
		_s.showClickScreen = function(){
			_s.dClk_do.setVisible(true);
			if(_s.isAdd_bl && _s._d.adsPageToOpenURL_str && _s._d.adsPageToOpenURL_str != "none"){
				_s.dClk_do.setButtonMode(true);
			}else{	
				if(_s.is360){
					_s.dClk_do.getStyle().cursor = 'url(' + _s._d.handPath_str + '), default';
				}else{
					_s.dClk_do.setButtonMode(false);
				}
			}
		};
		
		_s.hideClickScreen = function(){
			_s.dClk_do.setVisible(false);
		};
		

		//#####################################//
		/* Setup disable click */
		//#####################################//
		_s.setupDisableClick = function(){
			_s.disableClick_do = new FWDUVPDisplayObject("div");
			if(FWDUVPUtils.isIE){
				_s.disableClick_do.setBkColor('rgba(0,255,0,.0001');
			}
			_s.main_do.addChild(_s.disableClick_do);
			
		};
		
		_s.disableClick = function(){
			_s.disableClick_bl = true;
			clearTimeout(_s.disableClickId_to);
			if(_s.disableClick_do){
				_s.disableClick_do.setWidth(_s.sW);
				_s.disableClick_do.setHeight(_s.sH);
			}
			_s.disableClickId_to =  setTimeout(function(){
				if(_s.disableClick_do){
					_s.disableClick_do.setWidth(0);
					_s.disableClick_do.setHeight(0);
				}
				_s.disableClick_bl = false;
			}, 500);
		};
		
		_s.showDisable = function(){
			_s.disableClick_do.setWidth(_s.sW);
			_s.disableClick_do.setHeight(_s.sH);
		};
		
		_s.hideDisable = function(){
			if(!_s.disableClick_do) return;
			if(_s.disableClick_do.w == 0) return;
			_s.disableClick_do.setWidth(0);
			_s.disableClick_do.setHeight(0);
		};

		
		//########################################//
		/* add double click and tap support */
		//########################################//
		_s.addDoubleClickSupport = function(){
			
			if(_s.hasPointerEvent_bl){
				_s.dClk_do.screen.addEventListener("pointerdown", _s.onFirstDown);
			}else{
				if(!_s.isMbl){
					_s.dClk_do.screen.addEventListener("mousedown", _s.onFirstDown);
				}
				_s.dClk_do.screen.addEventListener("touchstart", _s.onFirstDown);
			}
			_s.setupVisualization();
		};
		
		_s.onFirstDown = function(e){
			if(e.button == 2) return;
			if(_s.isFullscreen_bl && e.preventDefault) e.preventDefault();
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);
			_s.firstTapX = vc.screenX - _s.main_do.getGlobalX();
			_s.firstTapY = vc.screenY - _s.main_do.getGlobalY();
		
			_s.firstTapPlaying_bl = _s.isPlaying_bl;
			
			if(FWDUVPUtils.isIEWebKit) return;
			if(_s.hasPointerEvent_bl){
				
				_s.dClk_do.screen.removeEventListener("pointerdown", _s.onFirstDown);
				_s.dClk_do.screen.addEventListener("pointerdown", _s.onSecondDown);
			}else{
				if(!_s.isMbl){
					_s.dClk_do.screen.addEventListener("mousedown", _s.onSecondDown);
					_s.dClk_do.screen.removeEventListener("mousedown", _s.onFirstDown);
				}
				_s.dClk_do.screen.addEventListener("touchstart", _s.onSecondDown);
				_s.dClk_do.screen.removeEventListener("touchstart", _s.onFirstDown);
			}
			clearTimeout(_s.secondTapId_to);
			_s.secondTapId_to = setTimeout(_s.doubleTapExpired, 500);
		};
		
		_s.doubleTapExpired = function(){
			clearTimeout(_s.secondTapId_to);
			if(_s.hasPointerEvent_bl){
				_s.dClk_do.screen.removeEventListener("pointerdown", _s.onSecondDown);
				_s.dClk_do.screen.addEventListener("pointerdown", _s.onFirstDown);
			}else{
				_s.dClk_do.screen.removeEventListener("touchstart", _s.onSecondDown);
				_s.dClk_do.screen.addEventListener("touchstart", _s.onFirstDown);
				if(!_s.isMbl){
					_s.dClk_do.screen.removeEventListener("mousedown", _s.onSecondDown);
					_s.dClk_do.screen.addEventListener("mousedown", _s.onFirstDown);
				}
			}
		};
		
		_s.onSecondDown = function(e){
			if(e.preventDefault) e.preventDefault();
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);
			var dx;
			var dy;
			
			if(FWDUVPUtils.isIEWebKit) _s.firstTapPlaying_bl = _s.isPlaying_bl;
			if(e.touches && e.touches.length != 1) return;
			dx = Math.abs((vc.screenX - _s.main_do.getGlobalX()) - _s.firstTapX);   
			dy = Math.abs((vc.screenY - _s.main_do.getGlobalY()) - _s.firstTapY); 
			if(dx > 10 || dy > 10) return;

			if(_s.firstTapX < _s.tempVidStageWidth * 0.33){
				if(!_s.isPlaying_bl){
					_s.skipOnDb_bl = true;
					_s.rewind(_s._d.rewTm);
					_s.addVisualization('left');
					setTimeout(function(){
						if(!_s.isPlaying_bl) _s.play();
					}, 200);
					setTimeout(function(){
						_s.skipOnDb_bl = false;
					}, 500);
				} 
			}else if(_s.firstTapX > _s.tempVidStageWidth * 0.67){
					if(!_s.isPlaying_bl){
						_s.skipOnDb_bl = true;
						_s.rewind(- _s._d.rewTm);
						_s.addVisualization('right');
						setTimeout(function(){
							if(!_s.isPlaying_bl) _s.play();
						}, 200);
						setTimeout(function(){
							_s.skipOnDb_bl = false;
						}, 500);
				} 
			}else{
				_s.switchFullScreenOnDoubleClick();
				if(_s.firstTapPlaying_bl){
					_s.play();
				}else{
					_s.pause();
				}
			}
		};
		
		_s.switchFullScreenOnDoubleClick = function(){
			_s.disableClick();
			if(!_s.isFullScreen_bl){
				_s.goFullScreen();
			}else{
				_s.goNormalScreen();
			}
		};


		//############################################//
		/* Setup double click visualization */
		//############################################//
		_s.lasPosition;
		_s.setupVisualization = function(){
			_s.mainVz_do = new FWDUVPDisplayObject('div');
			_s.mainVz_do.getStyle().pointerEvents = 'none';
			_s.mainVz_do.getStyle().backgroundColor = 'rgba(0,0,0,0.01)';
			_s.mainVzBackgrond_do = new FWDUVPDisplayObject('div');
			_s.mainVzBackgrond_do.getStyle().width = '100%';
			_s.mainVzBackgrond_do.getStyle().height = '100%';
			_s.mainVzBackgrond_do.getStyle().backgroundColor = 'rgba(255,255,255, .15)';
			_s.mainVz_do.getStyle().borderRadius = '100%';
			_s.mainVz_do.addChild(_s.mainVzBackgrond_do);

			_s.circle_do = new FWDUVPTransformDisplayObject('div');
			_s.circle_do.getStyle().backgroundColor = 'rgba(255,255,255, .15)';
			_s.circle_do.getStyle().borderRadius = '100%';
			_s.mainVz_do.addChild(_s.circle_do);

			var vzImg1 = new Image();
			vzImg1.src = _s.mainFolderPath_str + _s.sknPth + 'vis.png';
			_s.vzImg1_do = new FWDUVPTransformDisplayObject('img');
			_s.vzImg1_do.setScreen(vzImg1);
			_s.vzImg1_do.setWidth(17);
			_s.vzImg1_do.setHeight(23);
			_s.mainVz_do.addChild(_s.vzImg1_do);

			var vzImg2 = new Image();
			vzImg2.src = _s.mainFolderPath_str + _s.sknPth + 'vis.png';
			_s.vzImg2_do = new FWDUVPTransformDisplayObject('img');
			_s.vzImg2_do.setScreen(vzImg2);
			_s.vzImg2_do.setWidth(17);
			_s.vzImg2_do.setHeight(23);
			_s.mainVz_do.addChild(_s.vzImg2_do);

			var vzImg3 = new Image();
			vzImg3.src = _s.mainFolderPath_str + _s.sknPth + 'vis.png';
			_s.vzImg3_do = new FWDUVPTransformDisplayObject('img');
			_s.vzImg3_do.setScreen(vzImg3);
			_s.vzImg3_do.setWidth(17);
			_s.vzImg3_do.setHeight(23);
			_s.mainVz_do.addChild(_s.vzImg3_do);
		}

		_s.addVisualization = function(pos){
			clearTimeout(_s.vizFinisedId_to);
			clearTimeout(_s.vizFinished2Id_to);
			var w = Math.round(_s.tempVidStageWidth/2);
			var h = Math.round(_s.tempVidStageHeight * 1.5);

			FWDAnimation.killTweensOf(_s.mainVzBackgrond_do);
			if(_s.lasPosition != pos) _s.mainVzBackgrond_do.setAlpha(0);
			FWDAnimation.to(_s.mainVzBackgrond_do, .4, {alpha:1});

			_s.mainVz_do.setVisible(true);
			_s.mainVz_do.setWidth(w);
			_s.mainVz_do.setHeight(h);
			_s.mainVz_do.setY((_s.tempVidStageHeight - h)/2);
			var offsetY = Math.abs(_s.mainVz_do.y);
			if(_s.controller_do && _s.controller_do.isShowed_bl) offsetY -= _s.controller_do.sH/2;
			if(!_s.videoHolder_do.contains(_s.mainVz_do)){
				if(_s.controller_do){
					_s.videoHolder_do.addChildAt(_s.mainVz_do, _s.videoHolder_do.getChildIndex(_s.controller_do) - 1);
				}else{
					_s.videoHolder_do.addChild(_s.mainVz_do);
				}
			} 
			if(pos == 'right'){
				_s.mainVz_do.getStyle().borderRadius = '100% 0% 0% 100%';
				_s.mainVz_do.setX(w);
				_s.vzImg1_do.setRotation(0);
				_s.vzImg2_do.setRotation(0);
				_s.vzImg3_do.setRotation(0);
			}else{
				_s.mainVz_do.getStyle().borderRadius = '0% 100% 100% 0%';
				_s.mainVz_do.setX(0);
				_s.vzImg1_do.setRotation(180);
				_s.vzImg2_do.setRotation(180);
				_s.vzImg3_do.setRotation(180);
			}

			_s.vzImg1_do.setX(Math.round(w - (_s.vzImg1_do.w * 3))/2);
			_s.vzImg1_do.setY(Math.round(offsetY + (_s.tempVidStageHeight - _s.vzImg1_do.h)/2));
			_s.vzImg2_do.setX(_s.vzImg1_do.x + _s.vzImg1_do.w);
			_s.vzImg2_do.setY(_s.vzImg1_do.y);
			_s.vzImg3_do.setX(_s.vzImg2_do.x + _s.vzImg2_do.w);
			_s.vzImg3_do.setY(_s.vzImg2_do.y);
			
			FWDAnimation.killTweensOf(_s.vzImg1_do);
			FWDAnimation.killTweensOf(_s.vzImg2_do);
			FWDAnimation.killTweensOf(_s.vzImg3_do);
			_s.vzImg1_do.setAlpha(0);
			_s.vzImg2_do.setAlpha(0);
			_s.vzImg3_do.setAlpha(0);
			if(pos == 'right'){
				FWDAnimation.to(_s.vzImg1_do, .4, {alpha:1});
				FWDAnimation.to(_s.vzImg1_do, .4, {alpha:0, delay:.3});
				FWDAnimation.to(_s.vzImg2_do, .4, {alpha:1, delay:.3});
				FWDAnimation.to(_s.vzImg2_do, .4, {alpha:0, delay:.6});
				FWDAnimation.to(_s.vzImg3_do, .4, {alpha:1, delay:.6});
				FWDAnimation.to(_s.vzImg3_do, .4, {alpha:0, delay:.9});
			}else{
				FWDAnimation.to(_s.vzImg3_do, .4, {alpha:1});
				FWDAnimation.to(_s.vzImg3_do, .4, {alpha:0, delay:.3});
				FWDAnimation.to(_s.vzImg2_do, .4, {alpha:1, delay:.3});
				FWDAnimation.to(_s.vzImg2_do, .4, {alpha:0, delay:.6});
				FWDAnimation.to(_s.vzImg1_do, .4, {alpha:1, delay:.6});
				FWDAnimation.to(_s.vzImg1_do, .4, {alpha:0, delay:.9});
			}

			FWDAnimation.killTweensOf(_s.circle_do);
			_s.circle_do.setAlpha(1);
			_s.circle_do.setScale2(1);
			_s.circle_do.setWidth(w);
			_s.circle_do.setHeight(w);
			_s.circle_do.setScale2(0);
			_s.circle_do.setX(_s.firstTapX - _s.mainVz_do.x - _s.circle_do.w/2);
			_s.circle_do.setY(_s.firstTapY + offsetY - _s.circle_do.w/2);
			FWDAnimation.to(_s.circle_do, .8, {scale:2, ease:Expo.easeInOut});

			_s.vizFinisedId_to = setTimeout(function(){
				FWDAnimation.to(_s.mainVzBackgrond_do, .4, {alpha:0});
				FWDAnimation.to(_s.circle_do, .4, {alpha:0});
				_s.vizFinished2Id_to = setTimeout(function(){
					_s.mainVz_do.setVisible(false);
				}, 400)
			}, 800);

			_s.lasPosition = pos;
		}

		_s.stopVisualization =  function(){
			if(!_s.mainVz_do) return;
			clearTimeout(_s.vizFinisedId_to);
			clearTimeout(_s.vizFinished2Id_to);
			_s.mainVz_do.setVisible(false);
		}
		

		//############################################//
		/* Setup video hider */
		//############################################//
		_s.setupVideoHider = function(){
			_s.videoHider_do = new FWDUVPDisplayObject("div");
			_s.videoHolder_do.addChild(_s.videoHider_do);
		};
		
		_s.showVideoHider = function(){
			if(_s.isVideoHiderShowed_bl || !_s.videoHider_do) return;
			_s.isVideoHiderShowed_bl = true;
			_s.videoHider_do.setVisible(true);
			_s.resizeVideoHider();
		};
		
		_s.hideVideoHider = function(){
			if(!_s.isVideoHiderShowed_bl) return;
			_s.isVideoHiderShowed_bl = false;
			clearTimeout(_s.videoHilderId_to);
			_s.videoHilderId_to = setTimeout(function(){
				_s.videoHider_do.setVisible(false);
			}, 300);
		};
		
		_s.resizeVideoHider = function(){
			if(_s.isVideoHiderShowed_bl){
				_s.videoHider_do.setWidth(_s.tempStageWidth);
				_s.videoHider_do.setHeight(_s.tempStageHeight);
			}
		};
		

		//############################################//
		/* Setup youtube player */
		//############################################//
		_s.setupYoutubeAPI = function(){
			if(_s.ytb_do) return;
			if(typeof YT != "undefined" && YT.Player){
				_s.setupYoutubePlayer();
				return;
			}else{
				if(FWDUVPlayer.isYoutubeAPILoadedOnce_bl){
					_s.keepCheckingYoutubeAPI_int =  setInterval(function(){
						if(typeof YT != "undefined" && YT && YT.Player){
							if(_s.videoSourcePath_str.indexOf("youtube.") == -1) clearInterval(_s.keepCheckingYoutubeAPI_int);
							clearInterval(_s.keepCheckingYoutubeAPI_int);
							_s.setupYoutubePlayer();
						}
					}, 50);
					return;
				}
				
				var tag = document.createElement("script");
				tag.src = "https://www.youtube.com/iframe_api";
				var firstScriptTag = document.getElementsByTagName("script")[0];
				firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
			
				tag.onload = function(){
					_s.checkIfYoutubePlayerIsReadyId_int = setInterval(function(){
						if(YT && YT.Player){
							clearInterval(_s.checkIfYoutubePlayerIsReadyId_int);
							_s.setupYoutubePlayer();
						}
					}, 50);
				}
				
				tag.onerror = function(){
					setTimeout(function(){
						_s.showSourceError("Error loading Youtube API");
					}, 500);
					return;
				}
				
				FWDUVPlayer.isYoutubeAPILoadedOnce_bl = true;
			}
		};
		
		_s.setupYoutubePlayer = function(){
			if(_s.ytb_do) return;
			
			
			FWDUVPYoutubeScreen.setPrototype();
			_s.ytb_do = new FWDUVPYoutubeScreen(_s, _s._d.volume);
			_s.ytb_do.addListener(FWDUVPYoutubeScreen.READY, _s.youtubeReadyHandler);
			_s.ytb_do.addListener(FWDUVPVideoScreen.ERROR, _s.videoScreenErrorHandler);
			_s.ytb_do.addListener(FWDUVPYoutubeScreen.SAFE_TO_SCRUBB, _s.videoScreenSafeToScrubbHandler);
			_s.ytb_do.addListener(FWDUVPYoutubeScreen.STOP, _s.videoScreenStopHandler);
			_s.ytb_do.addListener(FWDUVPYoutubeScreen.PLAY, _s.videoScreenPlayHandler);
			_s.ytb_do.addListener(FWDUVPYoutubeScreen.PAUSE, _s.videoScreenPauseHandler);
			_s.ytb_do.addListener(FWDUVPYoutubeScreen.UPDATE, _s.videoScreenUpdateHandler);
			_s.ytb_do.addListener(FWDUVPYoutubeScreen.UPDATE_TIME, _s.videoScreenUpdateTimeHandler);
			_s.ytb_do.addListener(FWDUVPYoutubeScreen.LOAD_PROGRESS, _s.videoScreenLoadProgressHandler);
			_s.ytb_do.addListener(FWDUVPYoutubeScreen.PLAY_COMPLETE, _s.videoScreenPlayCompleteHandler);
			_s.ytb_do.addListener(FWDUVPYoutubeScreen.CUED, _s.youtubeScreenCuedHandler);
			_s.ytb_do.addListener(FWDUVPYoutubeScreen.QUALITY_CHANGE, _s.youtubeScreenQualityChangeHandler);
			_s.ytb_do.addListener(FWDUVPYoutubeScreen.UPDATE_SUBTITLE, _s.videoScreenUpdateSubtitleHandler);

			if(!_s.isMobile_bl) _s.ytb_do.showDisable();
		};
		
		_s.youtubeReadyHandler = function(e){
			
			_s.isYoutubeReady_bl = true;
		
			_s.hidePreloaderId_to = setTimeout(function(){
				if(_s.preloader_do) _s.preloader_do.hide(true);}
			, 50);
			
			_s.isTempYoutubeAdd_bl = _s.isAdd_bl;
			if(_s.isAdd_bl){
				if(_s.videoType_str == FWDUVPlayer.YOUTUBE) _s.setSource(_s.addSource_str);
			}else{
				if(_s.videoType_str == FWDUVPlayer.YOUTUBE) _s.updateAds(0, true);
			}
		};
		
		_s.youtubeScreenCuedHandler = function(){
			if(_s.main_do) if(_s.main_do.contains(_s.info_do)) _s.main_do.removeChild(_s.info_do);
		};
		
		_s.youtubeScreenQualityChangeHandler = function(e){
			if(_s.videoType_str == FWDUVPlayer.VIDEO) _s.curDurration = _s.videoScreen_do.curDuration;
			if(_s.controller_do) _s.controller_do.updateQuality(e.levels, e.qualityLevel);
		};

		
		//############################################//
		/* Setup Vimeo API */
		//############################################//
		_s.setupVimeoAPI = function(){
			if(_s.vimeo_do) return;
			if(typeof Vimeo != "undefined" && Vimeo.Player){
				_s.setupVimeoPlayer();
				return;
			}else{
				if(FWDUVPlayer.isVimeoAPILoadedOnce_bl){
					_s.keepCheckingVimeoAPI_int =  setInterval(function(){
						if(typeof Vimeo != "undefined" && Vimeo && Vimeo.Player){
							if(_s.videoSourcePath_str.indexOf("vimeo.") == -1) clearInterval(_s.keepCheckingVimeoAPI_int);
							clearInterval(_s.keepCheckingVimeoAPI_int);
							_s.setupVimeoPlayer();
						}
					}, 50);
					return;
				}
				
				var tag = document.createElement("script");
				tag.src = "https://player.vimeo.com/api/player.js";
				var firstScriptTag = document.getElementsByTagName("script")[0];
				firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
			
				tag.onload = function(){
					_s.keepCheckingVimeoAPI_int = setInterval(function(){
						if(typeof Vimeo != "undefined" && Vimeo && Vimeo.Player){
							clearInterval(_s.keepCheckingVimeoAPI_int);
							_s.setupVimeoPlayer();
						}
					}, 50);
				}
										
				tag.onerror = function(){
					setTimeout(function(){
						_s.showSourceError("Error loading Vimeo API");
					}, 500);
					return;
				}
				
				FWDUVPlayer.isVimeoAPILoadedOnce_bl = true;
			}
		};
		

		//############################################//
		/* Setup Vimeo player */
		//############################################// 
		_s.setupVimeoPlayer = function(){
			if(_s.vimeo_do) return;
			FWDUVPVimeoScreen.setPrototype();

			_s.vimeo_do = new FWDUVPVimeoScreen(_s, _s._d.volume);
			_s.vimeo_do.addListener(FWDUVPVimeoScreen.ERROR, _s.vimeoInitErrorHandler);
			_s.vimeo_do.addListener(FWDUVPVimeoScreen.READY, _s.vimeoReadyHandler);
			
			_s.vimeo_do.addListener(FWDUVPVimeoScreen.SAFE_TO_SCRUBB, _s.videoScreenSafeToScrubbHandler);
			_s.vimeo_do.addListener(FWDUVPVimeoScreen.STOP, _s.videoScreenStopHandler);
			_s.vimeo_do.addListener(FWDUVPVimeoScreen.PLAY, _s.videoScreenPlayHandler);
			_s.vimeo_do.addListener(FWDUVPVimeoScreen.PAUSE, _s.videoScreenPauseHandler);
			_s.vimeo_do.addListener(FWDUVPVimeoScreen.UPDATE, _s.videoScreenUpdateHandler);
			_s.vimeo_do.addListener(FWDUVPVimeoScreen.UPDATE_TIME, _s.videoScreenUpdateTimeHandler);
			_s.vimeo_do.addListener(FWDUVPVimeoScreen.LOAD_PROGRESS, _s.videoScreenLoadProgressHandler);
			_s.vimeo_do.addListener(FWDUVPVimeoScreen.PLAY_COMPLETE, _s.videoScreenPlayCompleteHandler);
			_s.vimeo_do.addListener(FWDUVPVimeoScreen.UPDATE_SUBTITLE, _s.videoScreenUpdateSubtitleHandler);
			
		};
		
		_s.vimeoInitErrorHandler = function(e){
			_s.showSourceError(e.error);
		};
		
		_s.vimeoReadyHandler = function(e){
			_s.isVimeoReady_bl = true;
	
			clearInterval(_s.hidePreloaderId_to);
			_s.hidePreloaderId_to = setTimeout(function(){
				if(_s.preloader_do) _s.preloader_do.hide(true);}
			, 50);
		
			if(_s.isAdd_bl){
				if(_s.videoType_str == FWDUVPlayer.VIMEO) _s.setSource(_s.addSource_str);
			}else{
				if(_s.videoType_str == FWDUVPlayer.VIMEO) _s.updateAds(0, true);
				if(_s.forceResumeVimeoAfterSkip_bl){
					clearTimeout(_s.forceResumeVimeoAfterSkipId_to);
					_s.forceResumeVimeoAfterSkipId_to = setTimeout(function(){
						if(!_s.isAdd_bl && _s.videoType_str == FWDUVPlayer.VIMEO && !_s.isPlaying_bl){
							_s.play();
						}
					}, 120);
				}
			}
		};		

		
		//#############################################//
		/* setup context menu */
		//#############################################//
		_s.setupContextMenu = function(){
			FWDUVPContextMenu.setPrototype();
			_s.customContextMenu_do = new FWDUVPContextMenu(_s, _s._d);
		};


		//#############################################//
		/* setup RSM */
		//#############################################//
		_s.setupRSM = function(){
			window.addEventListener("beforeunload", function (e) {
				var test = Math.random() * 1000;
				if(_s.isPlaying_bl && !_s.isAdd_bl){
					document.cookie = "fwduvp_video_path=" + _s.videoSourcePath_str + "; expires=Thu, 18 Dec 2040 00:00:01 GMT; path=/";
					var curTime = _s.getCurrentTime();
					if(curTime.length == 5) curTime = "00:" + curTime;
					document.cookie = "fwduvp_time=" + curTime + "; expires=Thu, 18 Dec 2040 00:00:01 GMT; path=/";	
				}
			});
		};
		
		
		//#############################################//
		/* setup _d */
		//#############################################//
		_s.setupData = function(){
			FWDUVPData.setPrototype();
			_s._d = new FWDUVPData(_s.props, _s.rootElement_el, _s);
			_s._d.useYoutube_bl = _s.useYoutube_bl;
			
			if(_s.mainBackground_do) _s.mainBackground_do.getStyle().background = "url('" + _s.mainBackgroundImagePath_str + "')";
			
			_s._d.addListener(FWDUVPData.VAST_LOADED, _s.vastLoaded);
			_s._d.addListener(FWDUVPData.PRELOADER_LOAD_DONE, _s.onPreloaderLoadDone);
			_s._d.addListener(FWDUVPData.LOAD_ERROR, _s._dLoadError);
			_s._d.addListener(FWDUVPData.SKIN_PROGRESS, _s._dSkinProgressHandler);
			_s._d.addListener(FWDUVPData.SKIN_LOAD_COMPLETE, _s._dSkinLoadComplete);
			_s._d.addListener(FWDUVPData.PLAYLIST_LOAD_COMPLETE, _s._dPlayListLoadComplete);
			_s._d.addListener(FWDUVPData.IMA_READY, _s._dImaReady);
			_s._d.addListener(FWDUVPData.IMA_ERROR, _s._dImaError);
			
		};
		
		_s.vastLoaded = function(e){
			_s.isAdd_bl = false
			_s.isVastLoading_bl = false;
			_s._d.playlist_ar[_s.id].popupAds_ar = e.popupAds;
			_s._d.playlist_ar[_s.id].ads_ar = e.ads;
			_s.adsId = -1;
			_s.updateAds(0);
			_s.dispatchEvent(FWDUVPData.VAST_LOADED);
		}
	
		_s.onPreloaderLoadDone = function(){
			if(_s.showPreloader_bl) _s.setupPreloader();
			if(!_s.isMbl) _s.setupContextMenu();
			_s.fillEntireVideoScreen_bl = _s._d.fillEntireVideoScreen_bl;
			_s.resizeHandler();
		};
		
		_s._dLoadError = function(e){
			_s.showSourceError(e.text);
			if(_s.playlist_do) _s.playlist_do.catId = -1;
			_s.dispatchEvent(FWDUVPlayer.ERROR, {error:e.text});
		};
		
		_s._dSkinProgressHandler = function(e){};
		
		_s._dSkinLoadComplete = function(){
			if(location.protocol.indexOf("file:") != -1){
				if(FWDUVPUtils.isOpera || FWDUVPUtils.isIEAndLessThen9){
					_s.showSourceError("This browser can't play video local, please test online or use a browser like Firefox of Chrome.");
					return;
				}
			}

			if(_s.showOnlyThumbnail){
				_s.playlistWidth = _s.playListThumbnailWidth;
			}
			
			_s.volume = _s._d.volume;
			_s.playlistHeight = _s._d.playlistBottomHeight;
			
			if(_s.displayType == FWDUVPlayer.FULL_SCREEN  && !FWDUVPUtils.hasFullScreen){
				_s._d.showFullScreenButton_bl = false;
			}
		
			if(_s.isEmbedded_bl){
				_s.useDeepLinking_bl = false;
				_s._d.playlistPosition_str = "right";
			}
			
			if(FWDUVPlayer.atLeastOnePlayerHasDeeplinking_bl) _s.useDeepLinking_bl = false;
			if(_s.useDeepLinking_bl) FWDUVPlayer.atLeastOnePlayerHasDeeplinking_bl = true;
			
			if(_s.useDeepLinking_bl){
				setTimeout(function(){_s.setupDL();}, 200);
			}else{
				if(_s.isEmbedded_bl){
					_s.catId = _s.embeddedPlaylistId;
					_s.id = _s.embeddedVideoId;
				}else{
					var args = FWDUVPUtils.getHashUrlArgs(window.location.hash);
					if(_s.useDeepLinking_bl && args.playlistId !== undefined && args.videoId !== undefined){
						_s.catId = args.playlistId;
						_s.id = args.videoId;
					}else{
						if(args.videoId){
							_s.id = args.videoId;
						}else{
							_s.id = _s._d.startAtVideo;
						}

						if(args.playlistId){
							_s.catId = args.playlistId;
						}else{
							_s.catId = _s._d.startAtPlaylist;
						}
						
					}
				}
				_s.loadInternalPlaylist();
			}
		};
		
		_s._dPlayListLoadComplete = function(){
			if(_s._d.cats_ar[_s.catId].pass) _s.playlistPass = _s._d.cats_ar[_s.catId].pass;
			
			_s.loadAddFirstTime_bl = true;
			if(!_s.isPlaylistLoadedFirstTime_bl){
				_s.setupNormalVideoPlayers();
				if(!FWDUVPUtils.isIEAndLessThen9) _s.updatePlaylist();
			}
			
			if(_s.isPlaylistLoadedFirstTime_bl) _s.updatePlaylist();	
			_s.isPlaylistLoaded_bl = true;
			_s.videoHolder_do.setY(0);
			_s.resizeHandler();
			setTimeout(function(){
				_s.positionLargePlayButton();
				if(_s.controller_do) _s.controller_do.resizeAndPosition();
				if(_s.playlist_do) _s.playlist_do.resizeAndPosition();
			}, 350);
		};
		
		_s.updatePlaylist = function(){
			_s.videoType_str =  "none";
			if(!_s._d.playlist_ar || !_s._d.playlist_ar[_s.id]) return;
			
			if(_s.main_do) if(_s.main_do.contains(_s.info_do)) _s.main_do.removeChild(_s.info_do);
			if(_s.preloader_do){
				_s.preloader_do.hide(true);
			} 

			_s.totaadsIdeos = _s._d.playlist_ar.length;
			
	    	if(_s.id < 0){
				_s.id = 0;
			}else if(_s.id > _s.totaadsIdeos - 1){
				_s.id = _s.totaadsIdeos - 1;
			}
			
	    	
			if(_s.playlist_do) _s.playlist_do.updatePlaylist(_s._d.playlist_ar, _s.catId, _s.id, _s._d.cats_ar[_s.catId].playlistName);
			_s.hideVideoHider();
			
			if(_s._d.startAtRandomVideo_bl){
				_s.id = parseInt(Math.random() * _s._d.playlist_ar.length);
				if(_s.useDeepLinking_bl){
					FWDUVPDL.setValue("?playlistId=" + _s.catId + "&videoId=" + _s.id);
					return;
				}
	    	}
			_s.plPassPassed = false;
			_s.prevSource = Math.random() * 99999999999;
	    	_s.posterPath_str = _s._d.playlist_ar[_s.id].posterSource;
			_s.updateAds(0);
			
			if(_s.isFirstPlaylistLoaded_bl && !_s.isMbl && !_s._d.startAtRandomVideo_bl && _s._d.autoPlay_bl) _s.play();
			_s._d.startAtRandomVideo_bl = false;
			_s.isFirstPlaylistLoaded_bl = true;
			_s.dispatchEvent(FWDUVPlayer.LOAD_PLAYLIST_COMPLETE);
			
			if(_s.displayType == FWDUVPlayer.STICKY){
				setTimeout(function(){
					_s.isShowedFirstTime_bl = false;
					_s.setStageContainerFinalHeightAndPosition(_s.animate_bl);
				}, 50);
			}
		};
		
		_s._dImaReady = function(){
			if(_s.isIMA) _s.setSource(_s.videoSourcePath_str);
		}
		
		_s._dImaError = function(){
			_s.errorImaSDK = true;
			_s.setSource(_s.videoSourcePath_str);
		}

		
		//############################################//
		/* Load playlists */
		//############################################//
		_s.loadInternalPlaylist = function(){
			
			_s.isPlaylistLoaded_bl = false;
			_s.isThumbClick_bl = false;
			_s.playlistPass = false;
			_s.isAdd_bl = false;
			_s.adsId = -1;
			
			_s.prvAdSource = Math.random() * 999999999;
			if(_s.prevCatId == _s.catId) return;
			_s.prevCatId = _s.catId;

			if(_s.preloader_do){
				 _s.positionPreloader();
				 _s.preloader_do.show(false);
			}
		
			_s.stop();
			_s.videoHolder_do.setY(-5000);
			if(_s.hider) _s.hider.stop();
			_s.setPosterSource("none");
			if(_s.videoPoster_do){
				_s.videoPoster_do.id = -1;
				_s.videoPoster_do.hide(true);
			}
		
			if(_s.lrgPlayBtn) _s.lrgPlayBtn.hide();
			if(_s.controller_do) _s.controller_do.hide(false, 10);
			_s.showVideoHider();
			_s._d.resetVastId();
			if(_s.popupAds_do) _s.popupAds_do.resetId();

			_s._d.loadPlaylist(_s.catId);
			if(_s.logo_do) _s.logo_do.hide(false, true);
			if(_s.isAdd_bl){
				_s.adsSkip_do.hide(false);
				_s.adsStart_do.hide(false);
			}
			

			if(_s.playlist_do) _s.playlist_do.destroyPlaylist();
			
			if(_s.isAPIReady_bl) _s.dispatchEvent(FWDUVPlayer.START_TO_LOAD_PLAYLIST);
		};

		
		//############################################//
		/* update deeplink */
		//############################################//
		_s.setupDL = function(){
			_s.initFirstDL = true;
			FWDUVPDL.onChange = _s.dlChangeHandler;
			if(_s.isEmbedded_bl){
				FWDUVPDL.setValue("?playlistId=" + _s.embeddedPlaylistId + "&videoId=" + _s.embeddedVideoId);
			}
			_s.dlChangeHandler();
		};
		
		_s.dlChangeHandler = function(){
			if(_s.hasOpenedInPopup_bl) return;
			
			var mustReset_bl = false;
			
			if(_s.categories_do && _s.categories_do.isOnDOM_bl){
				_s.categories_do.hide();
				return;
			}
			
			_s.prevId = _s.id;
			_s.prevEventCatId = _s.catId;
			
			_s.catId = parseInt(FWDUVPDL.getParameter("playlistId"));
			_s.id = parseInt(FWDUVPDL.getParameter("videoId"));
			
			if(_s.catId == undefined || _s.id == undefined || isNaN(_s.catId) || isNaN(_s.id)){
				_s.catId = _s._d.startAtPlaylist;
				_s.id = _s._d.startAtVideo;
				mustReset_bl = true;
			}
		
			if(_s.catId < 0 || _s.catId > _s._d.totalCategories - 1 && !mustReset_bl){
				_s.catId = _s._d.startAtPlaylist;
				_s.id = _s._d.startAtVideo;
				mustReset_bl = true;
			}
			
			if(_s._d.playlist_ar){
				if(_s.id < 0 && !mustReset_bl){
					_s.id = _s._d.startAtVideo;
					mustReset_bl = true;
				}else if(_s.prevCatId == _s.catId && _s.id > _s._d.playlist_ar.length - 1  && !mustReset_bl){
					_s.id = _s._d.playlist_ar.length - 1;
					mustReset_bl = true;
				}
			}
			_s.totalDuration = 0;
			var curValue = _s.catId +  ' - ' + _s.id;
			if(mustReset_bl){
				FWDUVPDL.setValue("?playlistId=" + _s.catId + "&videoId=" + _s.id);
				return;
			}
			if(_s.lastValue == curValue) return;
			_s.lastValue = _s.catId +  ' - ' + _s.id;
			
			if(_s.prevId == -1) _s.prevId  = _s.id;
			if(_s.prevEventCatId == -1) _s.prevEventCatId = _s.catId;
			
			if(_s.prevCatId != _s.catId){
				_s.loadInternalPlaylist();
				_s.prevCatId = _s.catId;
			}else{
				_s.stop();
				_s.isThumbClick_bl = true;
				_s.updateAds(0, true);
				_s._d.startAtRandomVideo_bl = false;
			}
			
			_s.pastHref = window['location']['href'];
		};
		
		
		//###########################################//
		/* Setup normal video players */
		//###########################################//
		_s.setupNormalVideoPlayers = function(){
			if(_s.videoScreen_do) return;
			
			_s.isAPIReady_bl = true;
			_s.setupRSM();
			_s.setupVideoScreen();
			_s.setupAudioScreen();
			_s.setupVideoPoster();
			if(_s.preloader_do) _s.main_do.addChild(_s.preloader_do);
			_s.setupSubtitle();
			_s.setupClickScreen();
			_s.setupPopupAds();
			if(_s._d.showLogo_bl) _s.setupLogo();
			_s.addDoubleClickSupport();
			_s.setupVideoHider();
			_s.setupAnnotations();
			if(_s._d.showController_bl) _s.setupController();
			_s.setupAdsStart();
			if(_s._d.showPlaylistButtonAndPlaylist_bl) _s.setupPlaylist();
			_s.setupLargePlayPauseButton();
			if(_s._d.showChromecastButton_bl) _s.setupChormecast();
			if(_s._d.showController_bl) _s.setupHider();
			if(_s._d.showPlaylistsButtonAndPlaylists_bl) _s.setupCategories();
			_s.setupDisableClick();
			if(_s._d.showEmbedButton_bl) _s.setupEmbedWindow();
			_s.setupPasswordWindow();
			if(!_s._d.isLoggedIn_bl && _s._d.showController_bl) _s.setupLoginWindow();
			if(_s._d.showShareButton_bl) _s.setupShareWindow();
			_s.setupAopw();
			if(_s._d.showInfoButton_bl) _s.setupInfoWindow();
			if((_s._d.showOpener_bl && _s.displayType == FWDUVPlayer.STICKY)
				|| (_s._d.stickyOnScrollShowOpener_bl && _s.stickyOnScroll)){
				_s.setupOpener();
			} 

			if(_s._d.useFingerPrintStamp){
				_s.setupFingerPrintStamp();
			}
			
			if(FWDUVPlayer.useYoutube == "no") _s.isPlaylistLoadedFirstTime_bl = true;
			_s.addMinOnScroll();
			_s.isAPIReady_bl = true;
			_s.dispatchEvent(FWDUVPlayer.READY);
			
			if(_s._d.addKeyboardSupport_bl) _s.addKeyboardSupport();
		
		};


		//###########################################//
		/* setup finger print stamp */
		//###########################################//
		_s.setupFingerPrintStamp = function(){
			FWDUVPFPS.setPrototype();
			_s.fps = new FWDUVPFPS(_s)
			_s.videoHolder_do.addChild(_s.fps);
		}
		
		
		//###########################################//
		/* setup opener */
		//###########################################//
		_s.setupOpener = function(){
	
			FWDUVPOpener.setPrototype();
			_s.opener_do = new FWDUVPOpener(_s._d, _s.position_str, _s.isShowed_bl);
			if(FWDUVPUtils.isIEAndLessThen9){
				_s.opener_do.getStyle().zIndex = "2147483634";
			}else{
				_s.opener_do.getStyle().zIndex = "99999999994";
			}
			_s.opener_do.setX(-10000);
			if(_s.isShowed_bl){
				_s.opener_do.showCloseButton();
			}else{
				_s.opener_do.showOpenButton();
			}
			_s.opener_do.addListener(FWDUVPOpener.SHOW, _s.openerShowHandler);
			_s.opener_do.addListener(FWDUVPOpener.HIDE, _s.openerHideHandler);
			_s.opener_do.addListener(FWDUVPController.PLAY, _s.controllerOnPlayHandler);
			_s.opener_do.addListener(FWDUVPController.PAUSE, _s.controllerOnPauseHandler);
			_s.stageContainer.appendChild(_s.opener_do.screen);
			if(_s.stickyOnScroll){
				 _s.opener_do.getStyle().position = 'fixed';
				 document.documentElement.appendChild(_s.opener_do.screen);
			}
		};
		
		_s.openerShowHandler = function(){
			_s.showPlayer();
		};
		
		_s.openerHideHandler = function(){
			_s.hidePlayer();
		};
		

		//#############################################//
		/* setup preloader */
		//#############################################//
		_s.setupPreloader = function(){
			FWDUVPPreloader.setPrototype();
			_s.preloader_do = new FWDUVPPreloader(_s, 'center', 10, _s.preloaderBackgroundColor, _s.preloaderFillColor, 3, 0.8);
			_s.preloader_do.show(false);
			if(_s.showPreloader_bl){
				if(_s.displayType == FWDUVPlayer.STICKY){
					document.documentElement.appendChild(_s.preloader_do.screen);
				}else{
					_s.main_do.addChild(_s.preloader_do);
				}
			}
		};
	
		_s.positionPreloader = function(){
			if(_s.displayType == FWDUVPlayer.STICKY){
				if(!_s.main_do.contains(_s.preloader_do)){
					_s.preloader_do.setX(Math.round((_s.ws.w - _s.preloader_do.w)/2));
					if(_s.position_str == FWDUVPlayer.POSITION_BOTTOM){
						_s.preloader_do.setY(Math.round((_s.ws.h - _s.preloader_do.h) - 10) + FWDUVPUtils.getScrollOffsets().y);
					}else{
						_s.preloader_do.setY(10);
					}
				}else{
					posPreloader();
				}
			}else{
				posPreloader();
			}

			function posPreloader(){
				var x;
				if(!_s.isPlaylistLoaded_bl){
					x = _s.sW;
				}else{
					x = _s.tempVidStageWidth;
				}
				_s.preloader_do.setX(parseInt((x - _s.preloader_do.w)/2));
				_s.preloader_do.setY(parseInt((_s.tempVidStageHeight - _s.preloader_do.h)/2));
			}
		};
		

		//###########################################//
		/* setup categories */
		//###########################################//
		_s.setupCategories = function(){
			FWDUVPCategories.setPrototype();
			_s.categories_do = new FWDUVPCategories(_s._d, _s);
			_s.categories_do.getStyle().zIndex = "2147483647";
			_s.categories_do.addListener(FWDUVPCategories.HIDE_COMPLETE, _s.categoriesHideCompleteHandler);
			if(_s._d.showPlaylistsByDefault_bl){
				_s.showCatWidthDelayId_to = setTimeout(function(){
					_s.showCategories();
				}, 1400);
			};
		};
		
		_s.categoriesHideCompleteHandler = function(e){
			if(_s.controller_do){
				_s.controller_do.setCategoriesButtonState("unselected");
				_s.controller_do.categoriesButton_do.setNormalState(true);
			}
			
			if(_s.useDeepLinking_bl){
				if(_s.categories_do.id != _s.catId){
					_s.catId = _s.categories_do.id;
					_s.id = 0;
					FWDUVPDL.setValue("?playlistId=" + _s.catId + "&videoId=" + _s.id);
					return;
				}
			}else{
				if(_s.catId == _s.categories_do.id) return;
				_s.catId = _s.categories_do.id;
				_s.id = 0;
				_s.loadInternalPlaylist(_s.catId);
			}
			
			if(_s.isVideoPlayingWhenOpenWindows_bl) _s.resume();
		};
		

		//##########################################//
		/* setup video poster */
		//##########################################//
		_s.setupVideoPoster = function(){
			FWDUVPPoster.setPrototype();
			_s.videoPoster_do = new FWDUVPPoster(_s,  _s._d.show, _s._d.posterBackgroundColor_str);
			_s.videoHolder_do.addChild(_s.videoPoster_do);
		};
		

		//##########################################//
		/* setup info window */
		//##########################################//
		_s.setupInfoWindow = function(){
			FWDUVPInfoWindow.setPrototype();
			_s.infoWindow_do = new FWDUVPInfoWindow(_s, _s._d);
			_s.infoWindow_do.addListener(FWDUVPInfoWindow.HIDE_COMPLETE, _s.infoWindowHideCompleteHandler);
			_s.main_do.addChild(_s.infoWindow_do);
		};
		
		_s.infoWindowHideCompleteHandler = function(){
			
			if(_s.isVideoPlayingWhenOpenWindows_bl) _s.resume();
			
			if(_s.controller_do && !_s.isMbl){
				_s.controller_do.infoButton_do.isDisabled_bl = false;
				_s.controller_do.infoButton_do.setNormalState(true);
			}
		};

		
		//##########################################//
		/* setup chromecast */
		//##########################################//
		_s.setupChormecast = function(){
			if(!_s._d.showController_bl) return;
			_s.controller_do.addCCButton();
			_s.controller_do.addListener(FWDUVPController.CAST, _s.ensureChromecastReady);
		}

		_s.tryOpenChromecastDialog = function(waitForLauncher){
			var attempts = 0;
			var openCastDialog = function(){
				if(!_s.controller_do || !_s.controller_do.ccBtn_do || !_s.controller_do.ccBtn_do.screen) return false;
				var launcher = _s.controller_do.ccBtn_do.screen.querySelector('google-cast-launcher');
				if(launcher && typeof launcher.click === 'function'){
					launcher.click();
					return true;
				}
				return false;
			};

			if(openCastDialog() || !waitForLauncher) return;

			var waitCastLauncherId_int = setInterval(function(){
				attempts++;
				if(openCastDialog() || attempts > 30) clearInterval(waitCastLauncherId_int);
			}, 100);
		};

		_s.ensureChromecastReady = function(){
			// Intentional empty!
		}

		
		//###########################################//
		/* Setup large play / pause button */
		//###########################################//
		_s.setupLargePlayPauseButton = function(){
			if(_s._d.useVectorIcons_bl){				
				FWDUVPSimpleButton.setPrototype();
				_s.lrgPlayBtn = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<div class='table-fwduvp-button'><span class='table-cell-fwduvp-button fwdicon-play'></span></div>",
						undefined,
						"UVPLargePlayButtonNormalState",
						"UVPLargePlayButtonSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				if(_s.sknPth.indexOf("hex_white") != -1){
					_s.lrgPlayBtn = new FWDUVPSimpleButton(_s._d.largePlayN_img, _s._d.largePlayS_str, undefined, true,
															 _s._d.useHEX,
															 _s._d.nBC,
															 "#FFFFFF",
															 false, false, false, false, true);
				}else{
					_s.lrgPlayBtn = new FWDUVPSimpleButton(_s._d.largePlayN_img, _s._d.largePlayS_str, undefined, true,
															 _s._d.useHEX,
															 _s._d.nBC,
															 _s._d.sBC,
															 false, false, false, false, true);
				}
			}
			
			_s.lrgPlayBtn.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.largePlayButtonUpHandler);
			_s.lrgPlayBtn.setOverflow("visible");
			_s.lrgPlayBtn.hide(false);
			_s.main_do.addChild(_s.lrgPlayBtn);
		};
		
		_s.largePlayButtonUpHandler = function(){
			if(_s.isIMA && _s.IMA && !_s.IMA.isReady) return;
			_s.isThumbClick_bl = true;
			_s.disableClick();
			_s.lrgPlayBtn.hide();
			_s.play();
			if(_s._d.goFullScreenOnPlay_bl) _s.goFullScreen();
		};
		
		_s.positionLargePlayButton =  function(){
			_s.lrgPlayBtn.setX(parseInt((_s.tempVidStageWidth - _s.lrgPlayBtn.w)/2));
			_s.lrgPlayBtn.setY(parseInt((_s.tempVidStageHeight - _s.lrgPlayBtn.h)/2));
		};

		
		//###########################################//
		/* Setup logo */
		//###########################################//
		_s.setupLogo = function(){
			FWDUVPLogo.setPrototype();
			_s.logo_do = new FWDUVPLogo(_s, _s._d.logoPath_str, _s._d.logoPosition_str, _s._d.logoMargins, _s._d.logoTarget);
			_s.main_do.addChild(_s.logo_do);
		};
		

		//###########################################//
		/* Setup playlist */
		//###########################################//
		_s.setupPlaylist = function(){
			FWDUVPPlaylist.setPrototype();
			_s.playlist_do = new FWDUVPPlaylist(_s, _s._d);
			_s.playlist_do.addListener(FWDUVPPlaylist.THUMB_MOUSE_UP, _s.playlistThumbMouseUpHandler);
			_s.playlist_do.addListener(FWDUVPPlaylist.PLAY_PREV_VIDEO, _s.playPrevVideoHandler);
			_s.playlist_do.addListener(FWDUVPPlaylist.PLAY_NEXT_VIDEO, _s.playNextVideoHandler);
			_s.playlist_do.addListener(FWDUVPPlaylist.ENABLE_SHUFFLE, _s.enableShuffleHandler);
			_s.playlist_do.addListener(FWDUVPPlaylist.DISABLE_SHUFFLE, _s.disableShuffleHandler);
			_s.playlist_do.addListener(FWDUVPPlaylist.ENABLE_LOOP, _s.enableLoopHandler);
			_s.playlist_do.addListener(FWDUVPPlaylist.DISABLE_LOOP, _s.disableLoopHandler);
			_s.playlist_do.addListener(FWDUVPPlaylist.CHANGE_PLAYLIST, _s.changePlaylistHandler);
			_s.main_do.addChildAt(_s.playlist_do, 0);
			if(_s._d.useVectorIcons_bl){
				setTimeout(function(){
					_s.playlist_do.resizeAndPosition(true);
				}, 340);
			}
		};
		
		_s.changePlaylistHandler = function(e){
			_s.loadPlaylist(e.id);
		}
		
		_s.playlistThumbMouseUpHandler = function(e){
			if(_s.disableClick_bl) return;
			
			if(_s._d.playlist_ar){
				_s.videoNameGa = _s._d.playlist_ar[_s.id]["gaStr"]
				_s.videoCat = _s._d.cats_ar[_s.catId]["playlistName"];
			}
			_s.totalDuration = 0;
			
			if(_s.useDeepLinking_bl && _s.id != e.id){
				FWDUVPDL.setValue("?playlistId=" + _s.catId + "&videoId=" + e.id);
				_s.id = e.id;
				_s.isThumbClick_bl = true;
			}else{
				_s.stop();
				_s.id = e.id;
				_s.changeHLS_bl = true;
				_s.isThumbClick_bl = true;
				_s.isAdd_bl = false;
				
				_s.updateAds(0);			
			}
			if(_s._d.goFullScreenOnPlay_bl) _s.goFullScreen();
		};
		
		_s.playPrevVideoHandler = function(){
			_s.isThumbClick_bl = true;
			if(_s._d.shuffle_bl){
				_s.playShuffle();
			}else{
				_s.playPrev();
			}
		};
		
		_s.playNextVideoHandler = function(){
		
			_s.isThumbClick_bl = true;
			if(_s._d.shuffle_bl){
				_s.playShuffle();
			}else{
				_s.playNext();
			}
		};
		
		_s.enableShuffleHandler = function(e){
			_s._d.shuffle_bl = true;
			_s._d.loop_bl = false;
			_s.playlist_do.setShuffleButtonState("selected");
			_s.playlist_do.setLoopStateButton("unselected");
		};
		
		_s.disableShuffleHandler = function(e){
			_s._d.shuffle_bl = false;
			_s.playlist_do.setShuffleButtonState("unselected");
		};
		
		_s.enableLoopHandler = function(e){
			_s._d.loop_bl = true;
			_s._d.shuffle_bl = false;
			_s.playlist_do.setLoopStateButton("selected");
			_s.playlist_do.setShuffleButtonState("unselected");
		};
		
		_s.disableLoopHandler = function(e){
			_s._d.loop_bl = false;
			_s.playlist_do.setLoopStateButton("unselected");
		};


		//###########################################//
		/* Setup autoplay click. */
		//###########################################//
		_s.setupAPT = function(){
			if(!_s.apt && _s._d.autoPlayText && _s._d.autoPlay_bl){
				_s.apt = new FWDUVPTransformDisplayObject('div');
				_s.apt.screen.className = 'fwduvp-autoplay-text';
				_s.apt.setButtonMode(true);
				_s.apt.setInnerHTML(_s._d.autoPlayText + '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0)"><path d="M9.4272 0.430497C9.4272 0.267667 9.33293 0.113407 9.18724 0.0448468C9.03298 -0.0322832 8.86158 -0.00657319 8.73303 0.0962667L4.93652 3.12147L9.4272 7.61215V0.430497Z" fill="black"/><path d="M11.8742 11.2702L0.733188 0.129242C0.566073 -0.0378725 0.294404 -0.0378725 0.127289 0.129242C-0.0398256 0.296357 -0.0398256 0.568026 0.127289 0.735141L2.82341 3.43212H2.57231C2.30664 3.43212 2.07525 3.5521 1.92099 3.74064C1.79244 3.88633 1.71531 4.08344 1.71531 4.28912V7.71712C1.71531 8.18847 2.10096 8.57412 2.57231 8.57412H4.56055L8.73413 11.9078C8.81126 11.9678 8.90553 12.0021 8.9998 12.0021C9.05979 12.0021 9.12835 11.985 9.18834 11.9593C9.33403 11.8907 9.4283 11.7364 9.4283 11.5736V10.037L11.2674 11.8761C11.3514 11.9601 11.4611 12.0021 11.5708 12.0021C11.6805 12.0021 11.7902 11.9601 11.8742 11.877C12.0413 11.709 12.0413 11.4382 11.8742 11.2702Z" fill="black"/></g></svg>');
				_s.main_do.addChild(_s.apt);

				_s.apt.screen.addEventListener('click', function(e){
					_s.setVolume(_s._d.volume, true);
				});
			}
			_s.showAPT();
		}

		_s.removeAPT = function(){
			if(_s.apt && _s.main_do.contains(_s.apt)) _s.main_do.removeChild(_s.apt);
			_s.aptRemoved = true;
		}

		_s.hideAPT = function(){
			if(_s.apt) _s.apt.setX(-5000);
		}

		_s.showAPT = function(){
			if(_s.apt && !_s.aptRemoved){
				 _s.apt.setX(0);
				 _s.apt.setScale2(0);
				 FWDAnimation.to(_s.apt, 1, {scale:1, ease:Elastic.easeInOut});
			}
		}
		

		//###########################################//
		/* Setup popup ads */
		//###########################################//
		_s.setupPopupAds = function(){
			FWDUVPPupupAds.setPrototype();
			_s.popupAds_do =  new FWDUVPPupupAds(_s, _s._d);
			_s.videoHolder_do.addChild(_s.popupAds_do);
		};
		
		
		//###########################################//
		/* Setup subtitle */
		//###########################################//
		_s.setupSubtitle = function(){
			FWDUVPSubtitle.setPrototype();
			_s.subtitle_do =  new FWDUVPSubtitle(_s, _s._d);
			_s.subtitle_do.addListener(FWDUVPSubtitle.LOAD_COMPLETE, _s.subtitleLoadComplete);
		};
		
		_s.subtitleLoadComplete = function(){
			_s.subtitle_do.show();
			if(_s.controller_do) _s.controller_do.enableSubtitleButton();
		};
		
		_s.loadSubtitle = function(path){
			if(_s.isCasting){
				_s.cc.loadSubtitle();
				return;
			}
			
			if(_s.controller_do) _s.controller_do.disableSubtitleButton();
			if(path){
				_s.subtitle_do.loadSubtitle(path);
				_s.videoHolder_do.addChildAt(_s.subtitle_do, _s.videoHolder_do.getChildIndex(_s.dClk_do) - 1);
				
			}
		}

		
		//###########################################//
		/* setup controller */
		//###########################################//
		_s.setupController = function(){
			FWDUVPController.setPrototype();
			_s.controller_do = new FWDUVPController(_s._d, _s);
			
			_s.controller_do.addListener(FWDUVPController.CHANGE_AUDIO_TRACKS, _s.audioTracksHanlder);
			_s.controller_do.addListener(FWDUVPController.VR, _s.vrHanlder);
			_s.controller_do.addListener(FWDUVPData.LOAD_ERROR, _s.controllerErrorHandler);
			_s.controller_do.addListener(FWDUVPController.REWIND, _s.rewindHandler);
			_s.controller_do.addListener(FWDUVPController.CHANGE_PLAYBACK_RATES, _s.changePlaybackRateHandler);
			_s.controller_do.addListener(FWDUVPController.CHANGE_SUBTITLE, _s.changeSubtitileHandler);
			_s.controller_do.addListener(FWDUVPController.SHOW_CATEGORIES, _s.showCategoriesHandler);
			_s.controller_do.addListener(FWDUVPController.SHOW_PLAYLIST, _s.showPlaylistHandler);
			_s.controller_do.addListener(FWDUVPController.HIDE_PLAYLIST, _s.hidePlaylistHandler);
			_s.controller_do.addListener(FWDUVPController.PLAY, _s.controllerOnPlayHandler);
			_s.controller_do.addListener(FWDUVPController.PAUSE, _s.controllerOnPauseHandler);
			_s.controller_do.addListener(FWDUVPController.START_TO_SCRUB, _s.controllerStartToScrubbHandler);
			_s.controller_do.addListener(FWDUVPController.SCRUB, _s.controllerScrubbHandler);
			_s.controller_do.addListener(FWDUVPController.STOP_TO_SCRUB, _s.controllerStopToScrubbHandler);
			_s.controller_do.addListener(FWDUVPController.CHANGE_VOLUME, _s.controllerChangeVolumeHandler);
			_s.controller_do.addListener(FWDUVPController.DOWNLOAD_VIDEO, _s.controllerDownloadVideoHandler);
			_s.controller_do.addListener(FWDUVPController.CHANGE_YOUTUBE_QUALITY, _s.controllerChangeYoutubeQualityHandler);
			_s.controller_do.addListener(FWDUVPController.FULL_SCREEN, _s.controllerFullScreenHandler);
			_s.controller_do.addListener(FWDUVPController.NORMAL_SCREEN, _s.controllerNormalScreenHandler);
			_s.controller_do.addListener(FWDUVPPlaylist.PLAY_PREV_VIDEO, _s.playPrevVideoHandler);
			_s.controller_do.addListener(FWDUVPPlaylist.PLAY_NEXT_VIDEO, _s.playNextVideoHandler);
			_s.controller_do.addListener(FWDUVPController.SHOW_EMBED_WINDOW, _s.showEmbedWindowHandler);
			_s.controller_do.addListener(FWDUVPController.SHOW_INFO_WINDOW, _s.showInfoWindowHandler);
			_s.controller_do.addListener(FWDUVPController.SHOW_SHARE_WINDOW, _s.controllerShareHandler);
			_s.controller_do.addListener(FWDUVPController.SHOW_SUBTITLE, _s.showSubtitleHandler);
			_s.controller_do.addListener(FWDUVPController.HIDE_SUBTITLE, _s.hideSubtitleHandler);
			_s.videoHolder_do.addChild(_s.controller_do);
		};

		_s.audioTracksHanlder = function(e){
			if(_s.hlsJS){
				_s.hlsJS.audioTrack = e.id;
			}else{
				_s.videoScreen_do.setAudioTrack(e.id);
			}
		}

		_s.vrHanlder = function(){
			_s.play();
			if(!_s.videoScreen_do.vrSupport_bl){
				_s.videoScreen_do.showVrMessage();
			}else{
				_s.videoScreen_do.startVR();
			}
		}
		
		_s.controllerErrorHandler = function(e){
			_s.showSourceError(e.text);
		}
		
		_s.rewindHandler = function(){
			_s.rewind(_s._d.rewTm);
		}

		_s.rewind = function(offset){
			var curTime = _s.getCurrentTime();
			if(curTime.length == 5) curTime = "00:" + curTime;
			if(curTime.length == 7) curTime = "0" + curTime;
			curTime = FWDUVPUtils.getSecondsFromString(curTime);
			curTime -= offset;
			curTime = FWDUVPUtils.formatTime(curTime);
			if(curTime.length == 5) curTime = "00:" + curTime;
			if(curTime.length == 7) curTime = "0" + curTime;
			_s.scrubbAtTime(curTime);
		}
		
		_s.changePlaybackRateHandler = function(e){
			_s.setPlaybackRate(e.rate);
		}
		
		_s.changeSubtitileHandler = function(e){
			_s._d.playlist_ar[_s.id].startAtSubtitle = e.id;
			_s.controller_do.updateSubtitleButtons(_s._d.playlist_ar[_s.id].subtitleSource, _s._d.playlist_ar[_s.id].startAtSubtitle);
			_s.ccSS = Number(_s._d.playlist_ar[_s.id].subtitleSource.length - e.id);
			if(!_s.isAdd_bl) _s.loadSubtitle(_s._d.playlist_ar[_s.id].subtitleSource[_s._d.playlist_ar[_s.id].subtitleSource.length - 1 - _s._d.playlist_ar[_s.id].startAtSubtitle]["source"]);
			
		}
		
		_s.showSubtitleHandler = function(){
			_s.subtitle_do.show();
			_s.subtitle_do.isShowed_bl = true;
			
		};
		
		_s.hideSubtitleHandler = function(){
			_s.subtitle_do.isShowed_bl = false;
			_s.subtitle_do.hide();
		};
		
		_s.showCategoriesHandler = function(e){
			
			_s.showCategories();
			if(_s.controller_do) _s.controller_do.setCategoriesButtonState("selected");
		};
		
		_s.showPlaylistHandler = function(e){
			_s.disableClick();
			_s.showPlaylist();			
		};
		
		_s.hidePlaylistHandler = function(e){
			_s.disableClick();
			_s.hidePlaylist();	
		};
		
		_s.controllerOnPlayHandler = function(e){
			_s.play();
			if(_s._d.goFullScreenOnPlay_bl) _s.goFullScreen();
		};
		
		_s.controllerOnPauseHandler = function(e){
			_s.pause();
		};
		
		_s.controllerStartToScrubbHandler = function(e){
			if(_s.isCasting){
				_s.cc.startToScrub();
				return;
			}
			_s.startToScrub();
		};
		
		_s.controllerScrubbHandler = function(e){
			if(_s.isCasting){
				_s.cc.seek(e.percent);
				return;
			}
			_s.scrub(e.percent);
		};
		
		_s.controllerStopToScrubbHandler = function(e){
			if(_s.isCasting){
				_s.cc.stopToScrub();
				return;
			}
			_s.stopToScrub();
		};
		
		_s.controllerChangeVolumeHandler = function(e){
			_s.setVolume(e.percent);
		};
		
		_s.controllerDownloadVideoHandler = function(){
			_s.downloadVideo();
		};
		
		_s.controllerShareHandler = function(e){
			_s.setVideoPlayingStateOnWindowShow();
			_s.pause();
			
			_s.shareWindow_do.show();
			if(_s.controller_do && !_s.isMbl){
				_s.controller_do.shareButton_do.setSelectedState();
				_s.controller_do.shareButton_do.isDisabled_bl = true;
			}
		};
		
		_s.controllerChangeYoutubeQualityHandler = function(e){
			if(_s.videoType_str == FWDUVPlayer.HLS_JS){
				_s.curHlsLevel = Math.abs(e.id - _s.hlsLevels_ar.length + 1);
				_s.hlsJS.currentLevel = _s.curHlsLevel;
				
			}else if(_s.videoType_str == FWDUVPlayer.YOUTUBE){
				_s.ytb_do.setQuality(e.quality);
			}else{
				_s.curDurration = _s.curTimeInSecond;
				_s._d.playlist_ar[_s.id].startAtVideo = _s._d.playlist_ar[_s.id].videoSource.length - 1 - e.id;
				_s.setSource(_s._d.playlist_ar[_s.id].videoSource[_s._d.playlist_ar[_s.id].startAtVideo]["source"], false, _s._d.playlist_ar[_s.id].videoSource[_s._d.playlist_ar[_s.id].startAtVideo]["is360"]);
				_s.isQualityChanging_bl = true;
				_s.play();
			}
		};
		
		_s.controllerFullScreenHandler = function(){
			_s.goFullScreen();
		};
		
		_s.controllerNormalScreenHandler = function(){
			_s.goNormalScreen();
		};
		
		_s.showEmbedWindowHandler = function(){
			_s.setVideoPlayingStateOnWindowShow();
			_s.pause();
		
			_s.embedWindow_do.show();
			
			if(_s.controller_do && !_s.isMbl){
				_s.controller_do.embedButton_do.setSelectedState();
				_s.controller_do.embedButton_do.isDisabled_bl = true;
			}
		};
		
		_s.showInfoWindowHandler = function(){
			_s.setVideoPlayingStateOnWindowShow();
			_s.pause();
			
			_s.infoWindow_do.show(_s._d.playlist_ar[_s.id].desc);
			
			if(_s.controller_do && !_s.isMbl){
				_s.controller_do.infoButton_do.setSelectedState();
				_s.controller_do.infoButton_do.isDisabled_bl = true;
			}
		};
		
		_s.setVideoPlayingStateOnWindowShow =  function(){
			if(_s.isCasting){
				_s.isVideoPlayingWhenOpenWindows_bl = _s.cc.playerState == 'PLAYING';
			}else if(_s.isIMA && _s.IMA.started){
				_s.isVideoPlayingWhenOpenWindows_bl = _s.IMA.isPlaying;
			}else if(_s.videoType_str == FWDUVPlayer.YOUTUBE && _s.ytb_do){
				_s.isVideoPlayingWhenOpenWindows_bl = _s.ytb_do.isPlaying_bl;
			}else if(_s.videoType_str == FWDUVPlayer.VIMEO && _s.vimeo_do){
				_s.isVideoPlayingWhenOpenWindows_bl = _s.vimeo_do.isPlaying_bl;
			}else{
				if(_s.videoScreen_do) _s.isVideoPlayingWhenOpenWindows_bl = _s.videoScreen_do.isPlaying_bl;
			}
		}

		
		//###########################################//
		/* setup FWDUVPAudioScreen */
		//###########################################//
		_s.setupAudioScreen = function(){	
			if(_s.audioScreen_do) return;
			FWDUVPAudioScreen.setPrototype();
			_s.audioScreen_do = new FWDUVPAudioScreen(_s, _s._d.volume);
			
			_s.audioScreen_do.addListener(FWDUVPAudioScreen.ERROR, _s.videoScreenErrorHandler);
			_s.audioScreen_do.addListener(FWDUVPAudioScreen.SAFE_TO_SCRUBB, _s.videoScreenSafeToScrubbHandler);
			_s.audioScreen_do.addListener(FWDUVPAudioScreen.STOP, _s.videoScreenStopHandler);
			_s.audioScreen_do.addListener(FWDUVPAudioScreen.PLAY, _s.videoScreenPlayHandler);
			_s.audioScreen_do.addListener(FWDUVPAudioScreen.PAUSE, _s.videoScreenPauseHandler);
			_s.audioScreen_do.addListener(FWDUVPAudioScreen.UPDATE, _s.videoScreenUpdateHandler);
			_s.audioScreen_do.addListener(FWDUVPAudioScreen.UPDATE_TIME, _s.videoScreenUpdateTimeHandler);
			_s.audioScreen_do.addListener(FWDUVPAudioScreen.LOAD_PROGRESS, _s.videoScreenLoadProgressHandler);
			_s.audioScreen_do.addListener(FWDUVPVideoScreen.START_TO_BUFFER, _s.videoScreenStartToBuferHandler);
			_s.audioScreen_do.addListener(FWDUVPVideoScreen.STOP_TO_BUFFER, _s.videoScreenStopToBuferHandler);
			_s.audioScreen_do.addListener(FWDUVPAudioScreen.PLAY_COMPLETE, _s.videoScreenPlayCompleteHandler);
			_s.audioScreen_do.addListener(FWDUVPAudioScreen.UPDATE_SUBTITLE, _s.videoScreenUpdateSubtitleHandler);
			
			_s.videoHolder_do.addChild(_s.audioScreen_do);
		};

		
		//###########################################//
		/* setup FWDUVPVideoScreen */
		//###########################################//
		_s.setupVideoScreen = function(){
			FWDUVPVideoScreen.setPrototype();
			_s.videoScreen_do = new FWDUVPVideoScreen(_s, _s._d.volume);
			_s.videoScreen_do.addListener(FWDUVPVideoScreen.ERROR, _s.videoScreenErrorHandler);
			_s.videoScreen_do.addListener(FWDUVPVideoScreen.SAFE_TO_SCRUBB, _s.videoScreenSafeToScrubbHandler);
			_s.videoScreen_do.addListener(FWDUVPVideoScreen.STOP, _s.videoScreenStopHandler);
			_s.videoScreen_do.addListener(FWDUVPVideoScreen.PLAY, _s.videoScreenPlayHandler);
			_s.videoScreen_do.addListener(FWDUVPVideoScreen.PAUSE, _s.videoScreenPauseHandler);
			_s.videoScreen_do.addListener(FWDUVPVideoScreen.UPDATE, _s.videoScreenUpdateHandler);
			_s.videoScreen_do.addListener(FWDUVPVideoScreen.UPDATE_TIME, _s.videoScreenUpdateTimeHandler);
			_s.videoScreen_do.addListener(FWDUVPVideoScreen.LOAD_PROGRESS, _s.videoScreenLoadProgressHandler);
			_s.videoScreen_do.addListener(FWDUVPVideoScreen.START_TO_BUFFER, _s.videoScreenStartToBuferHandler);
			_s.videoScreen_do.addListener(FWDUVPVideoScreen.STOP_TO_BUFFER, _s.videoScreenStopToBuferHandler);
			_s.videoScreen_do.addListener(FWDUVPVideoScreen.PLAY_COMPLETE, _s.videoScreenPlayCompleteHandler);
			_s.videoScreen_do.addListener(FWDUVPVideoScreen.UPDATE_SUBTITLE, _s.videoScreenUpdateSubtitleHandler);
			_s.videoHolder_do.addChild(_s.videoScreen_do);
		};
		
		_s.videoScreenErrorHandler = function(e){

			var error;
			_s.isPlaying_bl = false;
			if(FWDUVPlayer.hasHTML5Video || _s.videoType_str == FWDUVPlayer.YOUTUBE){
				error = e.text;
				if(window.console) console.log(e.text);
				_s.showSourceError(error);
				
				if(_s.controller_do){
					_s.controller_do.disableMainScrubber();
					_s.controller_do.disablePlayButton();
					if(!_s._d.showControllerWhenVideoIsStopped_bl) _s.controller_do.hide(!_s.isMbl);
					_s.lrgPlayBtn.hide();
					_s.hideClickScreen();
					if(_s.hider) _s.hider.stop();
				}
			}else{
				error = e;
				_s.showSourceError(error);
			}
			
			if(_s.logo_do) _s.logo_do.hide(false);
			if(_s.preloader_do) _s.preloader_do.hide(false);
			_s.showCursor();
			_s.dispatchEvent(FWDUVPlayer.ERROR, {error:error});
		};
		
		_s.videoScreenSafeToScrubbHandler = function(){
			var curPlaylist = _s._d.playlist_ar[_s.id];

			if(_s.preloader_do) _s.preloader_do.hide();
			
			if(_s.controller_do){
				if(_s.isAdd_bl){
					_s.controller_do.disableMainScrubber();
					if(_s._d.timeToHoldAds) _s.adsStart_do.show(true);
					if(_s._d.adsThumbnailPath_str && _s._d.adsThumbnailPath_str != "none") _s.adsStart_do.loadThumbnail(_s._d.adsThumbnailPath_str);
					_s.positionAds();
				}else{
					_s.controller_do.enableMainScrubber();
				}
				
				_s.controller_do.enablePlayButton();
				_s.controller_do.show(true);
				
				if(!_s.isAdd_bl){
					if(_s.controller_do.ytbQualityButton_do){
						_s.controller_do.ytbQualityButton_do.enable();
						_s.controller_do.enablePlaybackRateButton();
					}
					_s.controller_do.enableAtButton();
				}
				if(!_s.isAdd_bl && _s.controller_do.playbackRateButton_do) _s.controller_do.enablePlaybackRateButton();
				if(!_s.isAdd_bl){
					 if(_s.controller_do.downloadButton_do) _s.controller_do.downloadButton_do.enable();
					 if(_s.controller_do.rewindButton_do) _s.controller_do.rewindButton_do.enable();
				}

				if(_s.hider) _s.hider.start();
			}
			
			if(!_s.isAdd_bl && !_s.isIMA && curPlaylist && curPlaylist.subtitleSource){
				_s.loadSubtitle(curPlaylist.subtitleSource[curPlaylist.subtitleSource.length - 1 - curPlaylist.startAtSubtitle]["source"]);
			}
			
			if(!_s.isAdd_bl){
				if(_s.customContextMenu_do) _s.customContextMenu_do.enable();
				if((_s.controller_do && _s.controller_do.thumbnailsPreview_do && curPlaylist['thumbnailsPreview'])
					|| ((_s.controller_do && _s.controller_do.thumbnailsPreview_do && curPlaylist['thumbnailsPreview'] == 'auto')
						&& (_s.videoType_str == FWDUVPlayer.VIDEO || _s.videoType_str == FWDUVPlayer.HLS_JS))){
						_s._d.tempShowMainScrubberToolTipLabel_bl = false;
						_s.controller_do.thumbnailsPreview_do.load(curPlaylist['thumbnailsPreview'], _s.videoType_str, _s.videoSourcePath_str, _s.videoScreen_do.video_el);
					} 
			}
			
			if(_s.controller_do){
				if( !_s.isQualityChanging_bl) _s.controller_do.disableSubtitleButton();
				_s.controller_do.enableAtbButton();
				if(_s.isAdd_bl && window['FWDUVPCC'] && typeof FWDUVPCC.disableButton === 'function') FWDUVPCC.disableButton();
			} 
			
			if(_s.isMbl){
				_s.adsSkip_do.hide(false);
			}

			if(_s.isQualityChanging_bl && !_s.isAdd_bl){
				_s.scrubbAtTime(_s.curDurration);
				_s.curDurration = 0;
				_s.isQualityChanging_bl = false;
			}
			
			_s.videoPoster_do.hide(true);
			
			_s.callVastEvent("start");
			_s.executeVastEvent(_s.Impression);
			
			_s.showClickScreen();
			setTimeout(function(){
				if(_s.totalDuration && _s.controller_do) _s.controller_do.positionAdsLines(_s.totalDuration);
			}, 1500);

			if(_s.getStartTimeStamp("t") != "00:00:00"){
				if(args['uvpi']){
					if(args['uvpi'] == _s.instanceName_str) _s.scrubbAtTime(_s.getStartTimeStamp("t"));
				}else{
					_s.scrubbAtTime(_s.getStartTimeStamp("t"));
				}
			}
			
			if(document.cookie && _s._d.useResumeOnPlay_bl && !_s.isAdd_bl){
				if(FWDUVPUtils.getCookie("fwduvp_video_path") && FWDUVPUtils.getCookie("fwduvp_time") 
				   && FWDUVPUtils.getCookie("fwduvp_video_path") == _s.videoSourcePath_str){
					var curTime = FWDUVPUtils.getCookie("fwduvp_time");
					if(!_s.rmsPlayed_bl){
						_s.scrubbAtTime(FWDUVPUtils.getCookie("fwduvp_time"));
					}
				}
				_s.rmsPlayed_bl = true;
			}

			_s.dispatchEvent(FWDUVPlayer.SAFE_TO_SCRUB);
		};
		
		_s.videoScreenUpdateSubtitleHandler = function(e){
			if(_s.subtitle_do) _s.subtitle_do.updateSubtitle(e.curTime);
		}
	
		_s.videoScreenStopHandler = function(e){
			if(_s.main_do) if(_s.main_do.contains(_s.info_do)) _s.main_do.removeChild(_s.info_do);
			_s.videoPoster_do.allowToShow_bl = true;
			_s.isPlaying_bl = false;
			
			if(_s.controller_do){
				_s.controller_do.disableMainScrubber();
				_s.controller_do.showPlayButton();
				if(!_s._d.showControllerWhenVideoIsStopped_bl){
					_s.controller_do.hide(!_s.isMbl);
				}else{
					_s.controller_do.show(!_s.isMbl);
				}
				if(_s.hider) _s.hider.stop();
			}
			
			if(_s.ytb_do){
				_s.ytb_do.stopVideo();
			}
			
			if(_s.logo_do) _s.logo_do.hide(true);
			
			_s.hideClickScreen();
			
			if(_s.isMbl){
				_s.adsSkip_do.hide(false);
				_s.adsStart_do.hide(false);
			}
			
			_s.showCursor();
			_s.dispatchEvent(FWDUVPlayer.STOP);
		};
		
		_s.videoScreenPlayHandler = function(){
			if(_s.preloader_do) _s.preloader_do.hide();
			if(_s.is360) _s.dClk_do.getStyle().cursor = 'url(' + _s._d.handPath_str + '), default';
			FWDUVPlayer.keyboardCurInstance = _s;
			
			if(_s.videoType_str == FWDUVPlayer.YOUTUBE
			   && _s.ytb_do && _s.ytb_do.isStopped_bl) return;
			 
			_s.setupAPT();
			_s.callVastEvent("resume");
			
			if(_s.isMbl){
				if(FWDUVPlayer.videoStartBehaviour == FWDUVPlayer.STOP_ALL_VIDEOS){
					FWDUVPlayer.stopAllVideos(_s);
				}
			}else{
				if(FWDUVPlayer.videoStartBehaviour == FWDUVPlayer.PAUSE_ALL_VIDEOS){
					FWDUVPlayer.pauseAllVideos(_s);
				}
			}
		
			if(_s.logo_do) _s.logo_do.show(true);
			  
			if(_s.controller_do){
				_s.controller_do.showPauseButton();
				_s.controller_do.show(true);
			}
			
			_s.playAtTime_bl = false;
			_s.hasHlsPlayedOnce_bl = true;
			if(_s.lrgPlayBtn) _s.lrgPlayBtn.hide();
			if(_s.hider) _s.hider.start();
			_s.showCursor();

			_s.videoScreenStopToBuferHandler();
			
			if(_s.popw_do) _s.popw_do.hide();
		
			if((!_s.hasStartedToPlay_bl && _s._d.playlist_ar[_s.id] && _s._d.playlist_ar[_s.id].startAtTime && !_s.isAdd_bl && !_s.wasAdd_bl)
				|| (_s._d.playlist_ar[_s.id].startAtTime &&  !_s.isAdd_bl && _s.addStartAtZero)
			){
				_s.scrubbAtTime(_s._d.playlist_ar[_s.id].startAtTime);
			} 
			
			if(!_s.isMbl || _s.source.indexOf('.m3u') == -1 || (_s.isMbl && _s.source.indexOf('.m3u') == -1)){
				_s.resumeAfterAd();
			} 

			if(!_s.hasStartedToPlay_bl && _s.castStartAtTime && !_s.isAdd_bl){
				_s.scrubbAtTime(_s.castStartAtTime);
				_s.castStartAtTime = undefined;
			}
			
			_s.isPlaying_bl = true;
			_s.forceResumeVimeoAfterSkip_bl = false;
			//_s.isThumbClick_bl = false;
			_s.loadAddFirstTime_bl = false;
			_s.hasStartedToPlay_bl = true;
			if(_s.opener_do) _s.opener_do.showPauseButton();
			if(_s.fps) _s.fps.start();
			
			_s.dispatchEvent(FWDUVPlayer.PLAY);
		};

		_s.resumeAfterAd = function(){
			if(_s.wasAdd_bl){
				if(FWDUVPUtils.isSafari){
					setTimeout(function(){
						_s.scrubbAtTime(_s.scrubAfterAddDuration);
					},500);
				}else{
					if(_s.videoType_str == FWDUVPlayer.VIMEO){
						setTimeout(function(){
							_s.scrubbAtTime(_s.scrubAfterAddDuration);
						},500);
					}else{
						_s.scrubbAtTime(_s.scrubAfterAddDuration)
					}
				
				}
				_s.wasAdd_bl = _s.addStartAtZero = false;
			}
		}
		
		_s.videoScreenPauseHandler = function(){
			if(_s.forceResumeVimeoAfterSkip_bl && !_s.isAdd_bl && _s.videoType_str == FWDUVPlayer.VIMEO){
				clearTimeout(_s.forceResumeVimeoAfterSkipId_to);
				_s.forceResumeVimeoAfterSkipId_to = setTimeout(function(){
					if(!_s.isAdd_bl && _s.videoType_str == FWDUVPlayer.VIMEO && !_s.isPlaying_bl){
						_s.play();
					}
				}, 120);
				return;
			}

			if(_s.videoType_str == FWDUVPlayer.YOUTUBE
			   && _s.ytb_do && _s.ytb_do.isStopped_bl) return;
			   
			if(_s.videoType_str == FWDUVPlayer.VIMEO
			   && _s.vimeo_do && _s.vimeo_do.isStopped_bl) return;
			   
			_s.callVastEvent("pause");
			if(_s.preloader_do) _s.preloader_do.hide();

			_s.isPlaying_bl = false;
			if(_s.controller_do){
				_s.controller_do.showPlayButton();
				_s.controller_do.show(true);
			}
			
			var isShareWIndowShowed_bl = _s.shareWindow_do && _s.shareWindow_do.isShowed_bl;
			var isEmbedWIndowShowed_bl = _s.embedWindow_do && _s.embedWindow_do.isShowed_bl;

			if(!isShareWIndowShowed_bl && !isEmbedWIndowShowed_bl){
				if(_s.showPopW_bl) _s.popw_do.show(_s.popwSource);	
			}
				
			if(_s.lrgPlayBtn && !_s._d.showAnnotationsPositionTool_bl) _s.lrgPlayBtn.show();
			
			if(_s.hider){
				_s.hider.reset();
				_s.hider.stop();
			}
			
			_s.showClickScreen();
			
			_s.showCursor();
			if(_s.opener_do) _s.opener_do.showPlayButton();
			if(_s.fps) _s.fps.stop();
			_s.dispatchEvent(FWDUVPlayer.PAUSE);
		};
		
		_s.videoScreenUpdateHandler = function(e){
			var percent;	
			if(FWDUVPlayer.hasHTML5Video || _s.videoType_str == FWDUVPlayer.YOUTUBE){
				percent = e.percent;
				if(_s.controller_do) _s.controller_do.updateMainScrubber(percent);
			}else{
				percent = e;
				console.log(e)
				if(_s.controller_do) _s.controller_do.updateMainScrubber(percent);
			}
			_s.dispatchEvent(FWDUVPlayer.UPDATE, {percent:percent});
		};
		
		_s.videoScreenUpdateTimeHandler = function(e, e2, e3){
			if(_s.isStopped_bl) return;
			
			if(_s.prevSeconds != Math.round(e.seconds)) _s.totalTimePlayed += 1;
			_s.totalTimeInSeconds = Math.round(e.totalTimeInSeconds);
			_s.totalTimeInMilliseconds = e.totalTimeInSeconds;
			_s.curTimeInSecond = Math.round(e.seconds);
			_s.curTimeInmilliseconds = e.seconds;
			_s.prevSeconds =  Math.round(e.seconds)
			_s.totalPercentPlayed = _s.totalTimePlayed/e.totalTimeInSeconds;

			if(!isFinite(_s.totalPercentPlayed)) _s.totalPercentPlayed = 0;
			
			if(FWDUVPUtils.getSecondsFromString(_s.getStartTimeStamp("e"))){
				if(_s.curTimeInSecond >= parseInt(FWDUVPUtils.getSecondsFromString(_s.getStartTimeStamp("e")))) _s.stop();
			}
		
			if(_s.controller_do 
			   && !_s.controller_do.isMainScrubberScrubbing_bl
			   && _s.controller_do.atb
			   && _s.controller_do.atb.isShowed_bl
			   && !_s.controller_do.atb.scrub){
				
				var a = Math.round(_s.totalTimeInSeconds * _s.controller_do.atb.pa);
				var b = Math.round(_s.totalTimeInSeconds * _s.controller_do.atb.pb);
				
				
				if(_s.prevCurTimeInSeconds != _s.curTimeInSecond){
					_s.prevCurTimeInSeconds = _s.curTimeInSecond;
					if(_s.curTimeInSecond < a){
						_s.scrub(_s.controller_do.atb.pa);
					}else if(_s.curTimeInSecond > b){
						_s.scrub(_s.controller_do.atb.pa);
					}
				}
			}
			
			if(_s.isAdd_bl){
				if(_s.totalPercentPlayed >= .25 && _s.callFirstQuartile){
					_s.callVastEvent("firstQuartile");
					_s.callFirstQuartile = false;
				}else if(_s.totalPercentPlayed >= .50 && _s.callMidpoint){
					_s.callVastEvent("midpoint");
					_s.callMidpoint = false;
				}else if(_s.totalPercentPlayed >= .75 && _s.callThirdQuartile){
					_s.callVastEvent("thirdQuartile");
					_s.callThirdQuartile = false;
				}
			}

			var time;
			var seconds;
			if(FWDUVPlayer.hasHTML5Video || _s.videoType_str == FWDUVPlayer.YOUTUBE || _s.videoType_str == FWDUVPlayer.VIMEO){
				_s.curTime = e.curTime;
				_s.totalTime = e.totalTime;
				time = _s.curTime + "/" + _s.totalTime;
				seconds = _s.curTimeInSecond;
				if(_s.controller_do) _s.controller_do.updateTime(time);
			}else{
				_s.curTime = e;
				_s.totalTime = e2;
				time = _s.curTime + "/" + _s.totalTime;
				if(e == undefined || e2 ==  undefined) time = "00:00/00:00";
				seconds = Math.round(e3);
				if(_s.controller_do) _s.controller_do.updateTime(time);
			}
			
			_s.currentSecconds = e.seconds;
			
			if(_s.popupAds_do && !_s.isAdd_bl) _s.popupAds_do.update(_s.curTimeInSecond);
			if(_s.annotations_do && !_s.isAdd_bl) _s.annotations_do.update(_s.curTimeInSecond);
			
			if(_s._d.playlist_ar && _s._d.playlist_ar[_s.id]){
				_s.cuePointsSource_ar = _s._d.playlist_ar[_s.id].cuepoints_ar;
			}
			
			if(_s.cuePointsSource_ar && !_s.isAdd_bl){
				var length = _s.cuePointsSource_ar.length;
				for(var i=0; i<length; i++){
					if(_s.cuePointsSource_ar){
						var cuePoint = _s.cuePointsSource_ar[i];
						if(cuePoint.timeStart == _s.curTimeInSecond && !cuePoint.played_bl){
							if(_s._d.executeCuepointsOnlyOnce_bl ){
								if(!cuePoint.played_bl) eval(cuePoint.javascriptCall);
							}else{
								eval(cuePoint.javascriptCall);
							}
							cuePoint.played_bl = true;
						}
					}
				}
			}
			
			if(!_s.isAdd_bl){
				if(_s.totalTime.length>5){
					_s.totalDuration = FWDUVPUtils.getSecondsFromString(_s.totalTime);
				}else{
					_s.totalDuration = FWDUVPUtils.getSecondsFromString("00:" + _s.totalTime);
				}
			}
			
			if(_s.isIMA){
				_s.IMA.updateCuepointLines(seconds);
			}
			
			if(_s.isAdd_bl){
				if(_s._d.timeToHoldAds > seconds){
					_s.adsStart_do.updateText(_s._d.skipToVideoText_str + Math.abs(_s._d.timeToHoldAds - seconds));
					if(_s.isMbl) _s.adsSkip_do.hide(false);
					if(_s.videoType_str == FWDUVPlayer.IMAGE || _s.videoType_str == FWDUVPlayer.IFRAME){
						_s.adsStart_do.show(true);
					}
				}else if(_s.isPlaying_bl){
					_s.adsStart_do.hide(true);
					if(_s._d.timeToHoldAds) _s.adsSkip_do.show(true);
				}
			}else{
				_s.adsStart_do.hide(true);
				_s.adsSkip_do.hide(true);
			}
		
			if(seconds != 0){
				_s.updateAds(seconds);
			}

			if(_s.isPlaying_bl && _s._d.playlist_ar[_s.id] && FWDUVPUtils.getSecondsFromString(_s._d.playlist_ar[_s.id].stopAtTime) <= e.seconds){
				if(_s._d.playAfterVideoStop_bl){
					if(_s._d.stopAfterLastVideoHasPlayed_bl && _s._d.playlist_ar.length - 1 == _s.id){
						_s.stop();
					}else{
						_s.playNext();
					}
				}else if(!_s._d.stopAfterLastVideoHasPlayed_bl && _s._d.playlist_ar.length - 1 == _s.id && _s._d.playlist_ar.length > 1){
					_s.playNext();
				}else{
					_s.stop();
				}
			}

			_s.dispatchEvent(FWDUVPlayer.UPDATE_TIME, {currentTime:_s.curTime, totalTime:_s.totalTime});
		};
		
		_s.videoScreenLoadProgressHandler = function(e){
			if(FWDUVPlayer.hasHTML5Video || _s.videoType_str == FWDUVPlayer.YOUTUBE){
				if(_s.controller_do) _s.controller_do.updatePreloaderBar(e.percent);
			}else{
				if(_s.controller_do) _s.controller_do.updatePreloaderBar(e);
			}
		};
		
		_s.videoScreenStartToBuferHandler = function(){
			if(_s.preloader_do){
				_s.preloader_do.show(false);
			}
		};
		
		_s.videoScreenStopToBuferHandler = function(){
			if(_s.preloader_do && _s.isPlaylistLoaded_bl) _s.preloader_do.hide(true);
		};
		
		_s.videoScreenPlayCompleteHandler = function(e, buttonUsedToSkipAds){
			if(_s._d.playlist_ar){
				_s.videoNameGa = _s._d.playlist_ar[_s.id]["gaStr"]
				_s.videoCat = _s._d.cats_ar[_s.catId]["playlistName"];
			}
			
			_s.stopedAtComplete = true;
			_s.callVastEvent("complete");
			
			if(_s.isIMA && _s.IMA.hasPostRoll && _s.curTimeInSecond >= _s.totalTimeInSeconds - 1){
				_s.IMA.playPostRoll();
				return;
			}
			
			if(!_s.isAdd_bl && _s._d.playlist_ar[_s.id].redirectURL){
				if(_s._d.playlist_ar[_s.id].redirectTarget == "_self"){
					location.replace(_s._d.playlist_ar[_s.id].redirectURL);
				}else{
					window.open(_s._d.playlist_ar[_s.id].redirectURL, _s._d.playlist_ar[_s.id].redirectTarget);
				}
			}
			
			var tempIsAdd_bl = _s.isAdd_bl;
			
			if(_s.isAdd_bl){
				_s.isThumbClick_bl = true;
				var mainVideoSource = "";
				var isMainVimeoAfterSkip_bl = false;
				if(_s._d.playlist_ar && _s._d.playlist_ar[_s.id] && _s._d.playlist_ar[_s.id].videoSource){
					mainVideoSource = _s._d.playlist_ar[_s.id].videoSource[_s._d.playlist_ar[_s.id].startAtVideo]["source"] || "";
					isMainVimeoAfterSkip_bl = mainVideoSource.indexOf("vimeo.") != -1;
				}
				if(_s._d.openNewPageAtTheEndOfTheAds_bl && _s._d.adsPageToOpenURL_str != "none" && !buttonUsedToSkipAds){
					if(_s._d.adsPageToOpenTarget_str == "_self"){
						location.href = _s._d.adsPageToOpenURL_str;
					}else{
						window.open(_s._d.adsPageToOpenURL_str, _s._d.adsPageToOpenTarget_str);
					}
				}

				_s.sendGAPlayedAdEvent();
				
				_s.isAdd_bl = false;
				_s.updateAds(0);
				_s.wasAdd_bl = true;

				if(buttonUsedToSkipAds && (_s.videoType_str == FWDUVPlayer.VIDEO || _s.videoType_str == FWDUVPlayer.HLS_JS || _s.videoType_str == FWDUVPlayer.DASH)){	
					_s.play();
				}else if(isMainVimeoAfterSkip_bl){
					_s.forceResumeVimeoAfterSkip_bl = true;
					clearTimeout(_s.forceResumeVimeoAfterSkipId_to);
					_s.forceResumeVimeoAfterSkipId_to = setTimeout(function(){
						if(!_s.isAdd_bl && _s.videoType_str == FWDUVPlayer.VIMEO && !_s.isPlaying_bl){
							_s.play();
						}
					}, 160);
					clearTimeout(_s.forceResumeVimeoAfterSkipId2_to);
					_s.forceResumeVimeoAfterSkipId2_to = setTimeout(function(){
						if(!_s.isAdd_bl && _s.videoType_str == FWDUVPlayer.VIMEO && !_s.isPlaying_bl){
							_s.play();
						}
					}, 700);
				}else{
					if(!_s.isMbl && (_s.videoType_str != FWDUVPlayer.DASH && _s.videoType_str != FWDUVPlayer.VIMEO)) _s.play();
				}
			}
			
			if(!tempIsAdd_bl){

				if((_s.lightBox_do && _s.lightBox_do.isShowed_bl && _s._d.closeLightBoxWhenPlayComplete)){
					_s.stop();
					_s.lightBox_do.closeButtonOnStartHandler();
				}

				if(_s._d.loop_bl){
					if(_s.videoType_str == FWDUVPlayer.HLS_JS
					|| _s.videoType_str == FWDUVPlayer.DASH){
						setTimeout(function(){
							_s.scrub(0);
							_s.resume();
						}, 50);
					}else{						
						_s.scrub(0);
						_s.play();
					}
				}else if((_s._d.stopVideoWhenPlayComplete_bl || _s._d.playlist_ar.length == 1)
				||  (_s._d.stopAfterLastVideoHasPlayed_bl && _s._d.playlist_ar.length - 1 == _s.id)
				){	
					_s.stop();
				}else if(_s._d.shuffle_bl){
					_s.playShuffle();
					if(_s.isMbl) _s.stop();
					if(_s.videoType_str == FWDUVPlayer.DASH){
						_s.setSource(_s.source);
					}
				}else{
					_s.playNext();
					if(_s.isMbl){
						if(_s.videoType_str == FWDUVPlayer.DASH){
							_s.setSource(_s.source);
						}
					} 
				}
			}
			if(_s.hider) _s.hider.reset();
			_s.dispatchEvent(FWDUVPlayer.PLAY_COMPLETE);
		};
		

		//##########################################//
		/* Setup annotations */
		//##########################################//
		_s.setupAnnotations = function(){
			FWDUVPAnnotations.setPrototype();
			_s.annotations_do = new FWDUVPAnnotations(_s, _s._d);
			_s.videoHolder_do.setBkColor = props.backgroundColor;
			_s.videoHolder_do.screen.className = 'fwduvp-video-holder';
			_s.videoHolder_do.addChild(_s.annotations_do);
		};
		

		//##########################################//
		/* Setup skip adds buttons */
		//##########################################//
		_s.setupAdsStart = function(){
			FWDUVPAdsStart.setPrototype();
			_s.adsStart_do = new FWDUVPAdsStart(
					_s._d.adsButtonsPosition_str, 
					_s._d.adsBorderNormalColor_str, 
					"", 
					_s._d.adsBackgroundPath_str,
					_s._d.adsTextNormalColor);
			
			FWDUVPAdsButton.setPrototype();
			_s.adsSkip_do = new FWDUVPAdsButton(
					_s,
					_s._d.skipIconPath_img,
					_s._d.skipIconSPath_str,
					_s._d.skipToVideoButtonText_str,
					_s._d.adsButtonsPosition_str, 
					_s._d.adsBorderNormalColor_str, 
					_s._d.adsBorderSelectedColor_str, 
					_s._d.adsBackgroundPath_str,
					_s._d.adsTextNormalColor,
					_s._d.adsTextSelectedColor,
					_s._d.useHEX,
					_s._d.nBC,
					_s._d.sBC);
			_s.adsSkip_do.addListener(FWDUVPAdsButton.MOUSE_UP, _s.skipAdsMouseUpHandler);
			
			_s.videoHolder_do.addChild(_s.adsSkip_do);
			_s.videoHolder_do.addChild(_s.adsStart_do);
		};
		
		_s.skipAdsMouseUpHandler = function(){
			_s.isThumbClick_bl = true;
			_s.callVastEvent("skip");
			_s.videoScreenPlayCompleteHandler(null, true);
		};
		
		_s.positionAds = function(animate){
			
			var finalX;
			var finalY;
		
			if(_s._d.adsButtonsPosition_str == "left"){
				finalX = 0;
			}else{
				finalX = _s.tempVidStageWidth;
			}
			
			if(_s.controller_do){
				if(_s.controller_do.isShowed_bl){
					finalY = _s.tempVidStageHeight - _s.adsStart_do.h - _s._d.controllerHeight - 30;
				}else{
					finalY = _s.tempVidStageHeight - _s.adsStart_do.h - _s._d.controllerHeight;
				}
			}else{
				finalY = _s.tempVidStageHeight - _s.adsStart_do.h
			}
			
			FWDAnimation.killTweensOf(_s.adsStart_do);
			if(animate){
				FWDAnimation.to(_s.adsStart_do, .8, {y:finalY, ease:Expo.easeInOut});
			}else{
				_s.adsStart_do.setY(finalY);
			}
			
			_s.adsStart_do.setX(finalX);

			var mbl = false;
			if(_s.tempStageWidth < 600) mbl = true;
		
			_s.adsSkip_do.resize(mbl);
			
			if(_s._d.adsButtonsPosition_str == "left"){
				finalX = 0;
			}else{
				finalX = _s.tempVidStageWidth;
			}
			
			if(_s.controller_do){
				if(_s.controller_do.isShowed_bl){
					finalY = _s.tempVidStageHeight - _s.adsSkip_do.h - _s._d.controllerHeight - 30;
				}else{
					finalY = _s.tempVidStageHeight - _s.adsSkip_do.h - _s._d.controllerHeight;
				}
			}else{
				finalY = _s.tempVidStageHeight - _s.adsSkip_do.h
			}
			
			FWDAnimation.killTweensOf(_s.adsSkip_do);
			if(animate){
				FWDAnimation.to(_s.adsSkip_do, .8, {y:finalY, ease:Expo.easeInOut});
			}else{
				_s.adsSkip_do.setY(finalY);
			}
			
			_s.adsSkip_do.setX(finalX);
			
		};

		
		//##########################################//
		/* Setup embed window */
		//##########################################//
		_s.setupShareWindow = function(){
			FWDUVPShareWindow.setPrototype();
			_s.shareWindow_do = new FWDUVPShareWindow(_s._d, _s);
			_s.shareWindow_do.addListener(FWDUVPShareWindow.HIDE_COMPLETE, _s.shareWindowHideCompleteHandler);
		};
		
		_s.shareWindowHideCompleteHandler = function(){
			if(_s.isVideoPlayingWhenOpenWindows_bl) _s.resume();
			
			if(_s.controller_do && !_s.isMbl){
				_s.controller_do.shareButton_do.isDisabled_bl = false;
				_s.controller_do.shareButton_do.setNormalState(true);
			}
		};


		//##########################################//
		/* Setup login window */
		//##########################################//
		_s.setupLoginWindow =  function(){
			FWDUVPPassword.setPrototype();
			_s.lg_do = new FWDUVPPassword(_s._d, _s, true);
		}

		
		//##########################################//
		/* Setup embed window */
		//##########################################//
		_s.setupPasswordWindow = function(){
			FWDUVPPassword.setPrototype();
			_s.passWindow_do = new FWDUVPPassword(_s._d, _s);
			_s.passWindow_do.addListener(FWDUVPPassword.CORRECT, _s.passordCorrect);
		};
		
		_s.passordCorrect = function(){
			_s.passWindow_do.hide();
			_s.hasPassedPassowrd_bl = true;
			_s.play();
		}

		_s.checkPassWindow = function(){
			if(!_s.isAdd_bl && (_s._d.playlist_ar[_s.id]["isPrivate"] || _s.playlistPass) && !_s.hasPassedPassowrd_bl && _s.passWindow_do && !_s.plPassPassed){
				if(_s.lrgPlayBtn) _s.lrgPlayBtn.show();
				_s.passWindow_do.show();
				_s.videoPoster_do.show();
				return;
			}

			return true;
		}
		

		//##########################################//
		/* Setup embed window */
		//##########################################//
		_s.setupEmbedWindow = function(){
			FWDUVPEmbedWindow.setPrototype();
			_s.embedWindow_do = new FWDUVPEmbedWindow(_s._d, _s);
			_s.embedWindow_do.addListener(FWDUVPEmbedWindow.ERROR, _s.embedWindowErrorHandler);
			_s.embedWindow_do.addListener(FWDUVPEmbedWindow.HIDE_COMPLETE, _s.embedWindowHideCompleteHandler);
		};
		
		_s.embedWindowErrorHandler = function(e){
			_s.showSourceError(e.error);
		};
		
		_s.embedWindowHideCompleteHandler = function(){
			if(_s.isVideoPlayingWhenOpenWindows_bl) _s.resume();
			
			if(_s.controller_do && !_s.isMbl){
				_s.controller_do.embedButton_do.isDisabled_bl = false;
				_s.controller_do.embedButton_do.setNormalState(true);
			}
		};
		
		_s.copyLinkButtonOnMouseOver = function(){
			_s.embedWindow_do.copyLinkButton_do.setSelectedState();
		};
		
		_s.copyLinkButtonOnMouseOut = function(){
			_s.embedWindow_do.copyLinkButton_do.setNormalState();
		};
		
		_s.getLinkCopyPath = function(){
			return _s.embedWindow_do.linkToVideo_str;
		};
		
		_s.embedkButtonOnMouseOver = function(){
			_s.embedWindow_do.copyEmbedButton_do.setSelectedState();
		};
		
		_s.embedButtonOnMouseOut = function(){
			_s.embedWindow_do.copyEmbedButton_do.setNormalState();
		};
		
		_s.getEmbedCopyPath = function(){
			return _s.embedWindow_do.finalEmbedCode_str;
		};
		
		
		//######################################//
		/* Add keyboard support */
		//######################################//
		_s.setInputs = function(){
			var numInputs = document.querySelectorAll('input');
			for (var i = 0; i < numInputs.length; i++) {
				numInputs[i].addEventListener("mousedown", _s.inputFocusInHandler);
				numInputs[i].addEventListener("touchstart", _s.inputFocusInHandler);
			}

			var numTextA = document.querySelectorAll('textarea');
			for (var i = 0; i < numTextA.length; i++) {
				numTextA[i].addEventListener("mousedown", _s.inputFocusInHandler);
				numTextA[i].addEventListener("touchstart", _s.inputFocusInHandler);
			}
		}
		
		_s.inputFocusInHandler = function(e){
			_s.curInput = e.target;
			setTimeout(function(){
				if(_s.hasPointerEvent_bl){
					window.addEventListener("pointerdown", _s.inputFocusOutHandler);
				}else if(window.addEventListener){
					window.addEventListener("mousedown", _s.inputFocusOutHandler);
					window.addEventListener("touchstart", _s.inputFocusOutHandler);
				}
				FWDUVPlayer.isSearchedFocused_bl = true;
			}, 50);
		}
		
		_s.inputFocusOutHandler = function(e){
			
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			if(!FWDUVPUtils.hitTest(_s.curInput, vc.screenX, vc.screenY)){
				if(_s.hasPointerEvent_bl){
					window.removeEventListener("pointerdown", _s.inputFocusOutHandler);
				}else if(window.removeEventListener){
					window.removeEventListener("mousedown", _s.inputFocusOutHandler);
					window.removeEventListener("touchstart", _s.inputFocusOutHandler);
				}
				FWDUVPlayer.isSearchedFocused_bl = false;
				return;
			}
		};
		
		_s.addKeyboardSupport = function(){
			_s.setInputs();
			document.addEventListener("keydown",  _s.onKeyDownHandler);	
			document.addEventListener("keyup",  _s.onKeyUpHandler);
		};
		
		_s.onKeyDownHandler = function(e){
			if((_s.isSpaceDown_bl || !_s.hasStartedToPlay_bl || FWDUVPlayer.isSearchedFocused_bl) && !_s.isCasting) return;
			if(_s != FWDUVPlayer.keyboardCurInstance && (FWDUVPlayer.videoStartBehaviour == "pause" || FWDUVPlayer.videoStartBehaviour == "none")) return;
			if(_s.embedWindow_do && _s.embedWindow_do.isShowed_bl) return;
			_s.isSpaceDown_bl = true;
			if(e.preventDefault) e.preventDefault();

			if (e.keyCode == 32){
				
				_s.stickOnCurrentInstanceKey_bl = true;
				if(_s.isCasting){
					_s.cc.togglePlayPause();
				}else if(_s.videoType_str == FWDUVPlayer.IMAGE || _s.videoType_str == FWDUVPlayer.IFRAME){
					if(_s.isImageAdsPlaying_bl){
						_s.stopUpdateImageInterval();
					}else{
						_s.startUpdateImageInterval();
					}
				}else if(_s.isIMA && _s.IMA.started){
					_s.IMA.togglePlayPause();
				}else if(_s.videoType_str == FWDUVPlayer.YOUTUBE){
					if(!_s.ytb_do.isSafeToBeControlled_bl) return;
					_s.ytb_do.togglePlayPause();
				}else if(_s.videoType_str == FWDUVPlayer.VIMEO){
					if(!_s.vimeo_do.isSafeToBeControlled_bl) return;
					_s.vimeo_do.togglePlayPause();
				}else if(_s.videoType_str == FWDUVPlayer.MP3){
					if(!_s.audioScreen_do.isSafeToBeControlled_bl) return;
					_s.audioScreen_do.togglePlayPause();
				}else if(FWDUVPlayer.hasHTML5Video){
					if(!_s.videoScreen_do.isSafeToBeControlled_bl) return;
					if(_s.videoScreen_do) _s.videoScreen_do.togglePlayPause();
				}
				if(e.preventDefault) e.preventDefault();
				return false;
			}else if (e.keyCode == 70){
				if(_s.isFullScreen_bl){
					_s.goNormalScreen();
				}else{
					_s.goFullScreen();
				}
			}else if (e.keyCode == 77){
				if(_s.volume != 0) _s.lastVolume = _s.volume;
				if(_s.volume != 0){
					_s.volume = 0;
				}else{
					_s.volume = _s.lastVolume;
				}
				_s.setVolume(_s.volume);
			}else if (e.keyCode == 38){
				_s.volume += .1;
				if(_s.volume > 1) _s.volume = 1;
				_s.setVolume(_s.volume);
			}else if (e.keyCode == 40){
				_s.volume -= .1;
				if(_s.volume < 0) _s.volume = 0;
				_s.setVolume(_s.volume);
			}else if (e.keyCode == 77){
				
				if(_s.volume < 0) _s.volume = 0;
				_s.setVolume(_s.volume);
			}else if (e.keyCode == 39 && !_s.isAdd_bl && !_s.isIMA){
				var curTime = _s.getCurrentTime();
				if(curTime.length == 5) curTime = "00:" + curTime;
				if(curTime.length == 7) curTime = "0" + curTime;
				curTime = FWDUVPUtils.getSecondsFromString(curTime);
				curTime += 5;
				curTime = FWDUVPUtils.formatTime(curTime);
				if(curTime.length == 5) curTime = "00:" + curTime;
				if(curTime.length == 7) curTime = "0" + curTime;
				
				_s.scrubbAtTime(curTime);
			}else if (e.keyCode == 37 && !_s.isAdd_bl && !_s.isIMA){
				var curTime = _s.getCurrentTime();
				if(curTime.length == 5) curTime = "00:" + curTime;
				if(curTime.length == 7) curTime = "0" + curTime;
				curTime = FWDUVPUtils.getSecondsFromString(curTime);
				curTime -= 5;
				curTime = FWDUVPUtils.formatTime(curTime);
				if(curTime.length == 5) curTime = "00:" + curTime;
				if(curTime.length == 7) curTime = "0" + curTime;
				_s.scrubbAtTime(curTime);
			}
		};
		
		_s.onKeyUpHandler = function(e){
			_s.isSpaceDown_bl = false;
		};
		
		_s.setupAopw = function(){
			FWDUVPOPWindow.setPrototype();
			_s.popw_do = new FWDUVPOPWindow(_s._d, _s);
		}
		

		//####################################//
		/* Setup hider */
		//####################################//
		_s.setupHider = function(){
			FWDUVPHider.setPrototype();
			_s.hider = new FWDUVPHider(_s.main_do, _s.controller_do, _s._d.controllerHideDelay);
			_s.hider.addListener(FWDUVPHider.SHOW, _s.hiderShowHandler);
			_s.hider.addListener(FWDUVPHider.HIDE, _s.hiderHideHandler);
			_s.hider.addListener(FWDUVPHider.HIDE_COMPLETE, _s.hiderHideCompleteHandler);
		};
		
		_s.hiderShowHandler = function(){
			if(_s.controller_do && _s.isPlaying_bl) _s.controller_do.show(true);
			if(_s.logo_do && _s._d.hideLogoWithController_bl && _s.isPlaying_bl) _s.logo_do.show(true);
			_s.showCursor();
			
			if(_s.isAdd_bl){
				_s.positionAds(true);
				_s.adsStart_do.showWithOpacity();
				_s.adsSkip_do.showWithOpacity();	
			}
			
			if(_s.subtitle_do) _s.subtitle_do.position(true);
			if(_s.popupAds_do) _s.popupAds_do.position(true);
			
		};
		

		_s.hiderHideHandler = function(){
			if(_s.controller_do.volumeScrubber_do && _s.controller_do.isVolumeScrubberShowed_bl){
				_s.hider.reset();
				return;
			}

			if(_s.controller_do.atb && _s.controller_do.atb.isShowed_bl){
				if(FWDUVPUtils.hitTest(_s.controller_do.atb.mainHld.screen, _s.hider.globalX, _s.hider.globalY)){
					_s.hider.reset();
					return;
				}
			}
		
			if(_s._d.showYoutubeQualityButton_bl && FWDUVPUtils.hitTest(_s.controller_do.ytbButtonsHolder_do.screen, _s.hider.globalX, _s.hider.globalY)){
				_s.hider.reset();
				return;
			}
			
			if(_s._d.showPlaybackRateButton_bl && _s.controller_do && FWDUVPUtils.hitTest(_s.controller_do.playbackRatesButtonsHolder_do.screen, _s.hider.globalX, _s.hider.globalY)){
				_s.hider.reset();
				return;
			}

			if(_s._d.showAudioTracksButton_bl && _s.controller_do && FWDUVPUtils.hitTest(_s.controller_do.ATBButtonsHolder_do.screen, _s.hider.globalX, _s.hider.globalY)){
				_s.hider.reset();
				return;
			}
			
			if(_s.controller_do && _s._d.showSubBtn && FWDUVPUtils.hitTest(_s.controller_do.subtitlesButtonsHolder_do.screen, _s.hider.globalX, _s.hider.globalY)){
				_s.hider.reset();
				return;
			}
			
			if(FWDUVPUtils.hitTest(_s.controller_do.screen, _s.hider.globalX, _s.hider.globalY)){
				_s.hider.reset();
				return;
			}
			
			if(FWDUVPUtils.hitTest(_s.controller_do.mainScrubber_do.screen, _s.hider.globalX, _s.hider.globalY)){
				_s.hider.reset();
				return;
			}
			
			
			if(_s._d.showDefaultControllerForVimeo_bl || _s.videoType_str != FWDUVPlayer.VIMEO){
				_s.controller_do.hide(true);
			}
			
			if(_s.logo_do && _s._d.hideLogoWithController_bl) _s.logo_do.hide(true);
			if(_s.isFullScreen_bl) _s.hideCursor();
			
			if(_s.isAdd_bl){
				_s.positionAds(true);
				_s.adsStart_do.hideWithOpacity();
				_s.adsSkip_do.hideWithOpacity();	
			}
			
			_s.subtitle_do.position(true);
			if(_s.popupAds_do) _s.popupAds_do.position(true);
		};
		
		_s.hiderHideCompleteHandler = function(){
			_s.controller_do.positionScrollBarOnTopOfTheController();
		};
		

		//####################################//
		// API
		//###################################//
		_s.play = function(){
			
			if(!_s.isAPIReady_bl) return;
			
			if(_s.isCasting){
				_s.cc.play();
				return;
			}
		
			// if(_s.videoType_str == FWDUVPlayer.HLS_JS){
			// 	if(location.protocol.indexOf("file:") >= 0){
			// 		_s.showSourceError("HLS m3u8 videos can't be played local on _s browser, please test it online!.");
			// 		return;
			// 	}
			// }

			var check = _s.checkPassWindow();
			if(!check) return;
			_s.hasPassedPassowrd_bl = true;

			if(_s._d.playIfLoggedIn || _s._d.playlist_ar[_s.id]['playIfLoggedIn']){
				_s.lg_do.show();
				_s.videoPoster_do.show();
				return;
			}
			
			if(_s.isMbl){
				  FWDUVPlayer.stopAllVideos(_s);
			}else{
				if(FWDUVPlayer.videoStartBehaviour == FWDUVPlayer.PAUSE_ALL_VIDEOS){
					FWDUVPlayer.pauseAllVideos(_s);
				}else if(FWDUVPlayer.videoStartBehaviour == FWDUVPlayer.STOP_ALL_VIDEOS){
					FWDUVPlayer.stopAllVideos(_s);
				}
			}
			
			if(_s.isIMA){
				if(_s.isIMA && _s.IMA && !_s.IMA.isReady) return;
				_s.IMA.play();
			}else if(_s.videoType_str == FWDUVPlayer.IMAGE || _s.videoType_str == FWDUVPlayer.IFRAME){
				_s.startUpdateImageInterval();
			}else if(_s.videoType_str == FWDUVPlayer.YOUTUBE){
				if(_s.ytb_do) _s.ytb_do.play();
			}else if(_s.videoType_str == FWDUVPlayer.MP3){
				if(_s.audioScreen_do) _s.audioScreen_do.play();
				if(!FWDUVPUtils.isLocal) _s.audioScreen_do.setupSpectrum();
			}else if(_s.videoType_str == FWDUVPlayer.VIMEO){
				if(_s.vimeo_do) _s.vimeo_do.play();
			}else if(FWDUVPlayer.hasHTML5Video){
				if(_s.videoType_str == FWDUVPlayer.HLS_JS && !_s.isHLSManifestReady_bl){
					_s.videoScreen_do.initVideo();
					if(window['Hls']){
						_s.setupHLS();
						_s.hlsJS.loadSource(_s.videoSourcePath_str);
						_s.hlsJS.attachMedia(_s.videoScreen_do.video_el);
						
						_s.hlsJS.on(Hls.Events.MANIFEST_PARSED,function(e){
							_s.isHLSManifestReady_bl = true;
							if(_s.videoType_str == FWDUVPlayer.HLS_JS){
								_s.play();
								_s.parseLevels();
							} 
						});
					}
				}else if(_s.videoType_str == FWDUVPlayer.DASH && !_s.isDASHManifestReady_bl){
					_s.videoScreen_do.initVideo();
					
					if(window['dashjs']){
						_s.setupDASH();
						_s.dashJS.initialize(_s.videoScreen_do.video_el, _s.videoSourcePath_str, false);
	                 	_s.dashJS.attachSource(_s.videoSourcePath_str);
	                 	_s.dashJS.on(dashjs.MediaPlayer.events.MANIFEST_LOADED, function(e){
	                 		_s.isDASHManifestReady_bl = true;
	                 		if(_s.videoType_str == FWDUVPlayer.DASH) setTimeout(_s.play, 100);
	                 	});
                 	}
				}else{
					_s.videoScreen_do.play();
				}
			}

			_s.lrgPlayBtn.hide();
			_s.videoPoster_do.hide();
		};
		
		_s.pause = function(){
			if(!_s.isAPIReady_bl) return;
			
			if(_s.isCasting){
				_s.cc.pause();
				return;
			}
			if(_s.isIMA){
				_s.IMA.pause();
			}else if(_s.videoType_str == FWDUVPlayer.IMAGE || _s.videoType_str == FWDUVPlayer.IFRAME){
				_s.stopUpdateImageInterval();
			}else if(_s.videoType_str == FWDUVPlayer.YOUTUBE){
				_s.ytb_do.pause();
			}else if(_s.videoType_str == FWDUVPlayer.MP3){
				if(_s.audioScreen_do) _s.audioScreen_do.pause();
			}else if(_s.videoType_str == FWDUVPlayer.VIMEO){
				_s.vimeo_do.pause();
			}else if(FWDUVPlayer.hasHTML5Video){
				if(_s.videoScreen_do) _s.videoScreen_do.pause();
			}
		};
		
		_s.resume = function(){
			if(!_s.isAPIReady_bl) return;
			
			if(_s.isCasting){
				_s.cc.play();
			}else if(_s.isIMA && _s.IMA.started){
				_s.IMA.play();
			}else if(_s.videoType_str == FWDUVPlayer.IMAGE || _s.videoType_str == FWDUVPlayer.IFRAME){
				_s.startUpdateImageInterval();
			}else if(_s.videoType_str == FWDUVPlayer.YOUTUBE && _s.ytb_do){
				_s.ytb_do.resume();
			}else if(_s.videoType_str == FWDUVPlayer.MP3){
				if(_s.audioScreen_do) _s.audioScreen_do.resume();
			}else if(_s.videoType_str == FWDUVPlayer.VIMEO && _s.vimeo_do){
				_s.vimeo_do.resume();
			}else if(FWDUVPlayer.hasHTML5Video){
				if(_s.videoScreen_do) _s.videoScreen_do.resume();
			}
		};

		_s.sendGAPlayedEvent = function(){
			if(!isNaN(_s.totalPercentPlayed) && _s.gtag && !_s.isAdd_bl){
				if(Math.round(_s.totalPercentPlayed * 100)){

					var params = {
						'video_name': _s.videoNameGa,
						'video_url': _s.source,
						'percent_played' : Math.round(_s.totalPercentPlayed * 100),
						'stopped_at_time': _s.getCurrentTime(),
						'duration' : _s.getTotalTime(),
						'full_screen': _s.isFullScreen_bl
					}

					_s.gtag('event', 'played', params);
				
					_s.totalTimePlayed = 0;
					_s.totalPercentPlayed = 0;
				}
			}
		}	

		_s.sendGAPlayedAdEvent = function(source, percentPlayed, duration){
			if(!source){
				source = _s.source;
			}

			if(!percentPlayed){
				percentPlayed = _s.totalPercentPlayed;
			}

			if(!duration){
				duration = _s.getTotalTime();
			}
			
			if(!isNaN(percentPlayed) && _s.gtag){
				if(Math.round(_s.totalPercentPlayed * 100)){

					var params = {
						'video_url': source,
						'percent_played' : Math.round(percentPlayed * 100),
						'stopped_at_time': _s.getCurrentTime(),
						'duration': duration,
						'full_screen': _s.isFullScreen_bl
					}
				
					_s.gtag('event', 'ads', params);

					_s.totalTimePlayed = 0;
					_s.totalPercentPlayed = 0;
				}
			}
		}	
		
		_s.stop = function(source){
			if(!_s.isAPIReady_bl) return;
			if(_s.isStopped_bl) return;
			
			_s.sendGAPlayedEvent();
			
			if(_s.isCasting){
				_s.cc.stop();
			}
			if(_s.IMA) _s.IMA.stop();
			
			FWDUVPPassword.isCorect = true;
			_s.totalTimePlayed = 0;
			_s.totalDuration = 0;
			_s.isIMA = undefined;
			_s.hlsLevels_ar = null;
			_s.hasPassedPassowrd_bl = false;
			_s.isHLSManifestReady_bl = false;
			_s.isDASHManifestReady_bl = false;
			clearInterval(_s.tryHLS_int);
			clearInterval(_s.checkIfYoutubePlayerIsReadyId_int);
			clearInterval(_s.keepCheckingYoutubeAPI_int);
			_s.hideAPT();
			_s.destroyDASH();
			_s.destroyHLS();
			_s._d.closeVast();
			if(_s.fps) _s.fps.stop();
			_s.isPlaying_bl = false;
			if(_s.customContextMenu_do) _s.customContextMenu_do.disable();
				
			if(_s.videoType_str == FWDUVPlayer.IMAGE || _s.videoType_str == FWDUVPlayer.IFRAME){
				_s.stopUpdateImageInterval();
			}else if(_s.videoType_str == FWDUVPlayer.YOUTUBE && _s.ytb_do){
				_s.ytb_do.stop();
			}else if(_s.videoType_str == FWDUVPlayer.MP3){
				if(_s.audioScreen_do) _s.audioScreen_do.stop();
			}else if(_s.videoType_str == FWDUVPlayer.VIMEO && _s.vimeo_do){
				_s.vimeo_do.stop();
			}else if(FWDUVPlayer.hasHTML5Video){
				_s.videoScreen_do.stop();
			}
			
			clearTimeout(_s.playVimeoWhenLoadedId_to); 
			if(_s.popw_do) _s.popw_do.hide();
			
			if(_s._d.playlist_ar[_s.id]){
				_s.posterPath_str = _s._d.playlist_ar[_s.id].posterSource;
			}
			
			if(_s.isMbl){
				if(_s._d.showControllerWhenVideoIsStopped_bl && _s.controller_do) _s.controller_do.show(true);
				
				_s.videoPoster_do.show();
				_s.lrgPlayBtn.show();
				
			}else{
				if(!_s.isThumbClick_bl){
					if(_s.controller_do && _s._d.showControllerWhenVideoIsStopped_bl) _s.controller_do.show(true);
					if(_s.videoPoster_do) _s.videoPoster_do.show();
					if(_s.lrgPlayBtn) _s.lrgPlayBtn.show();
				}
			}
			
			if(_s.controller_do){
				if(_s.controller_do.atb) _s.controller_do.atb.hide(true);
				if(_s.controller_do.subtitleButton_do){
					_s.controller_do.disableSubtitleButton();
					if(_s.subtitle_do){
						if(_s.subtitle_do.showSubByDflt){
							_s.controller_do.subtitleButton_do.setButtonState(0);
						}else{
							_s.controller_do.subtitleButton_do.setButtonState(1);
						}
					}
				}
				if(_s.controller_do.thumbnailsPreview_do) _s.controller_do.thumbnailsPreview_do.remove();

				if(_s.controller_do.atbButton_do){
					_s.controller_do.atbButton_do.doNotallowToSetNormal = false;
					_s.controller_do.atbButton_do.isSelected = false;
					_s.controller_do.atbButton_do.setNormalState();
				}

				_s.controller_do.disableAtbButton();
				if(_s.controller_do.ttm) _s.controller_do.ttm.hide();
				if(_s.controller_do.ytbQualityButton_do) _s.controller_do.ytbQualityButton_do.disable();
				if(_s.controller_do.playbackRateButton_do) _s.controller_do.playbackRateButton_do.disable();
				if(_s.controller_do && _s.controller_do.rewindButton_do) _s.controller_do.rewindButton_do.disable();
			}
			
			if(_s.popupAds_do){
				_s.popupAds_do.hideAllPopupButtons(false);
			}
			
			_s.hasHlsPlayedOnce_bl = false;
			_s.isSafeToScrub_bl = false;
			_s.hlsState = undefined;
			_s.changeHLS_bl = false;
			_s.totalDuration = 0;
			_s.hasStartedToPlay_bl = false;
			
			if(_s.controller_do){
				_s.controller_do.disablePlaybackRateButton();
				_s.controller_do.disableAtButton();
			}
			if(_s.subtitle_do) _s.subtitle_do.hide();
			if(_s.annotations_do) _s.annotations_do.update(-1);
			if(_s.hider) _s.hider.reset();
			_s.showCursor();
			if(_s.adsStart_do) _s.adsStart_do.hide(true);
			if(_s.adsSkip_do) _s.adsSkip_do.hide(true);
			if(_s.controller_do) _s.controller_do.hideAdsLines();
			_s.stopVisualization();
			_s.isStopped_bl = false;
		};
		
		_s.startToScrub = function(){
			if(!_s.isAPIReady_bl) return;
			if(_s.videoType_str == FWDUVPlayer.YOUTUBE && _s.ytb_do && _s.ytb_do.isSafeToBeControlled_bl){
				_s.ytb_do.startToScrub();
			}else if(_s.videoType_str == FWDUVPlayer.MP3){
				if(_s.audioScreen_do) _s.audioScreen_do.startToScrub();
			}else{
				if(_s.videoScreen_do) _s.videoScreen_do.startToScrub();
			}
		};
		
		_s.stopToScrub = function(){
			if(!_s.isAPIReady_bl) return;
			if(_s.videoType_str == FWDUVPlayer.YOUTUBE && _s.ytb_do && _s.ytb_do.isSafeToBeControlled_bl){
				_s.ytb_do.stopToScrub();
			}else if(_s.videoType_str == FWDUVPlayer.MP3){
				if(_s.audioScreen_do) _s.audioScreen_do.stopToScrub();
			}else {
				if(_s.videoScreen_do) _s.videoScreen_do.stopToScrub();
			}
		};
		
		_s.scrubbAtTime = function(duration){
			if(!_s.isAPIReady_bl || !duration) return;
			if(String(duration).indexOf(":") != -1) duration = FWDUVPUtils.getSecondsFromString(duration);
			if(_s.isCasting){
				_s.cc.scrubbAtTime(duration);
			}else if(_s.videoType_str == FWDUVPlayer.YOUTUBE && _s.ytb_do && _s.ytb_do.isSafeToBeControlled_bl){
				_s.ytb_do.scrubbAtTime(duration);
			}else if(_s.videoType_str == FWDUVPlayer.VIMEO && _s.vimeo_do){
				_s.vimeo_do.scrubbAtTime(duration);
			}else if(_s.videoType_str == FWDUVPlayer.MP3){
				if(_s.audioScreen_do) _s.audioScreen_do.scrubbAtTime(duration);
			}else if(FWDUVPlayer.hasHTML5Video){
				if(_s.videoScreen_do) _s.videoScreen_do.scrubbAtTime(duration);
			}
		};
		
		_s.scrub = function(percent){
			if(!_s.isAPIReady_bl) return;
			if(isNaN(percent)) return;
			if(percent < 0){
				percent = 0;
			}else if(percent > 1){
				percent = 1;
			}
			
			if(_s.videoType_str == FWDUVPlayer.YOUTUBE && _s.ytb_do && _s.ytb_do.isSafeToBeControlled_bl){
				_s.ytb_do.scrub(percent);
			}else if(_s.videoType_str == FWDUVPlayer.MP3){
				if(_s.audioScreen_do) _s.audioScreen_do.scrub(percent);
			}else if(_s.videoType_str == FWDUVPlayer.VIMEO && _s.vimeo_do && _s.vimeo_do.isSafeToBeControlled_bl){
				_s.vimeo_do.scrub(percent);
			}else{
				if(_s.videoScreen_do) _s.videoScreen_do.scrub(percent);
			}
		};
		
		_s.setVolume = function(volume, removeAutoPlay){
			if(!_s.isAPIReady_bl) return;
			_s.volume = volume;

			if(volume && removeAutoPlay){
				_s._d.autoPlay_bl = false;
				_s.removeAPT();
			} 

			if(_s.controller_do) _s.controller_do.updateVolume(volume, true);
			
			if(_s.isIMA) _s.IMA.setVolume(volume);
			if(_s.videoType_str == FWDUVPlayer.YOUTUBE && _s.ytb_do){
				_s.ytb_do.setVolume(volume);
			}
			
			if(_s.videoType_str == FWDUVPlayer.VIMEO && _s.vimeo_do){
				_s.vimeo_do.setVolume(volume);
			}
			
			if(_s.audioScreen_do){
				_s.audioScreen_do.setVolume(volume);
			}
			
			if(FWDUVPlayer.hasHTML5Video){
				if(_s.videoScreen_do) _s.videoScreen_do.setVolume(volume);
			}
			
			if(_s.isCasting){
				_s.cc.setVolume();
			}
			
			_s.dispatchEvent(FWDUVPlayer.VOLUME_SET, {volume:volume});
		};
			
		_s.showCategories = function(){
			
			if(!_s.isAPIReady_bl) return;
			_s.setVideoPlayingStateOnWindowShow();
			
			if(_s.categories_do){
				_s.categories_do.show(_s.catId);
				if(_s.controller_do) _s.controller_do.setCategoriesButtonState("selected");
				_s.pause();
			}
		};
		
		_s.hideCategories = function(){
			if(!_s.isAPIReady_bl) return;
			if(_s.categories_do){
				_s.categories_do.hide();
				if(_s.controller_do) _s.controller_do.setCategoriesButtonState("unselected");
			}
		};
		
		_s.showPlaylist = function(){
			if(!_s.isAPIReady_bl || !_s.showPlaylistButtonAndPlaylist_bl) return;
			_s.isPlaylistShowed_bl = false;
			
			if(_s.controller_do) _s.controller_do.showHidePlaylistButton();
			_s.playlist_do.hide(_s.animate_bl);
			if(_s.playlistPosition_str == 'right'){
				_s.resizeHandler(!_s.isMbl);
			}
			
			_s.sH = _s.vidStageHeight;
			_s.setStageContainerFinalHeightAndPosition(_s.animate_bl);

			FWDAnimation.to(_s, .8, {tempStageWidth:_s.sW,
										 tempStageHeight:_s.sH,
										 tempVidStageWidth:_s.vidStageWidth,
										 tempVidStageHeight:_s.vidStageHeight,
										 ease:Expo.easeInOut,
										 onUpdate:_s.resizeFinal});
		};
		
		_s.hidePlaylist = function(resNoAnim){
			if(!_s.isAPIReady_bl || !_s.showPlaylistButtonAndPlaylist_bl) return;
			
			_s.isPlaylistShowed_bl = true;
			if(_s.controller_do) _s.controller_do.showShowPlaylistButton();
			if(resNoAnim){
				_s.playlist_do.show(false);
			}else{
				_s.playlist_do.show(_s.animate_bl);
			}
			
			_s.resizeHandler(_s.animate_bl);
			_s.setStageContainerFinalHeightAndPosition(_s.animate_bl);
			
			FWDAnimation.to(_s, .8, {tempStageWidth:_s.sW,
										 tempStageHeight:_s.sH,
										 tempVidStageWidth:_s.vidStageWidth,
										 tempVidStageHeight:_s.vidStageHeight,
										 ease:Expo.easeInOut,
										 onUpdate:_s.resizeFinal});
		
		};
		
		_s.setPosterSource = function(path){
			
			if(!_s.isAPIReady_bl || !path || _s.videoType_str == 'none') return;
			var path_ar = path.split(",");
				
			if(_s.isMbl && path_ar[1] != undefined){
				path = path_ar[1];
			}else{
				path = path_ar[0];
			}

			if(!_s.videoPoster_do) return;
			_s.posterPath_str = path;
			
			_s.videoPoster_do.setPoster(_s.posterPath_str);
			if(_s.prUVPosterSource_str != path) _s.dispatchEvent(FWDUVPlayer.UPDATE_POSTER_SOURCE);
			
			_s.prUVPosterSource_str = path;
		};
		
		_s.setThumbnailPreviewSource = function(source){
			if(!_s.isAPIReady_bl || FWDUVPUtils.isLocal) return;
			if(_s.controller_do){
				
				if(!_s.thumbnailsPreviewLoaded_bl){
					var script = document.createElement('script');
					script.src =  _s.mainFolderPath_str + 'java/FWDUVPThumbnailsPreview.js'
					document.head.appendChild(script);
	
					script.onload = function () {
						_s.thumbnailsPreviewLoaded_bl = true;
						_s.setThumbnailPreviewSource(source);
					}
					return;
				}
					
				_s.hasThumbnailsPreview = true;
				_s.controller_do.setupThumbnailsPreview()
				_s.controller_do.thumbnailsPreview_do.load(source);
			}
		}

		
		//#####################################################//
		/* Update ads */
		//#####################################################//
		_s.updateAds = function(duration, setSourceOverwrite){
			if(_s._d.vastXML && !_s._d.isVastXMLParsed_bl){
				if(_s.controller_do){
					_s.controller_do.hideAdsLines();
					_s.controller_do.resetsAdsLines();
				}
				_s._d.setVastSource(_s._d.vastXML);
				return;
			} 

			if(!_s._d.playlist_ar[_s.id]) return;
			_s.curAddData = _s._d.playlist_ar[_s.id].ads_ar;

			_s.curPopupAdsData = _s._d.playlist_ar[_s.id].popupAds_ar;
			var hasPopupAds = (_s.curPopupAdsData && _s.curPopupAdsData.length > 0);
			
			if(_s.adsId != _s.id){
				if(_s.popupAds_do) _s.popupAds_do.hideAllPopupButtons(true);
				if(_s.controller_do) _s.controller_do.resetsAdsLines();
			}
			
			if(_s._d.playlist_ar[_s.id].vastURL && !_s.curAddData){
				if(_s.adsId != _s.id){
					_s._d.setVastSource(_s._d.playlist_ar[_s.id].vastURL, _s._d.playlist_ar[_s.id].vastLinearStartTime);
				}
				_s.adsId = _s.id;
				return;
			}
			_s.adsId = _s.id;
			
			if(!_s.isAdd_bl){
				_s.TrackingEvents = undefined;
				_s.Impression = undefined;
				_s.ClickTracking = undefined;
				if(_s.curAddData){
					_s.callFirstQuartile = true;
					_s.callMidpoint = true;
					_s.callThirdQuartile = true;
				}
			}
			
			if(!_s.isAdd_bl){
				if(_s.controller_do){

					if(_s.totalDuration){
						_s._d.fixVmapTimes(_s.totalDuration, _s.curAddData, _s.curPopupAdsData, _s.id);
						_s.controller_do.setupAdsLines(_s.curAddData, _s.id, _s.catId);
						if(_s.totalDuration) _s.controller_do.positionAdsLines(_s.totalDuration);
						if(hasPopupAds){
							_s.popupAds_do.resetPopups(_s.curPopupAdsData, _s.id);
							_s.popupAds_do.id = _s.id;
						}
					}
				}
				
				_s.curSource = _s._d.playlist_ar[_s.id].videoSource[_s._d.playlist_ar[_s.id].startAtVideo]["source"];
				
				if(_s.curAddData){
					for(var i=0; i<_s.curAddData.length; i++){
						if(duration >= _s.curAddData[i].timeStart && duration <= (_s.curAddData[i].timeStart + 1) 
							&& !_s.curAddData[i].played_bl && duration != _s.prevDuration){
								
							_s.addId = i;
							if(_s.curAddData[i].timeStart == 0){
								setSourceOverwrite = false;
								_s.addStartAtZero = true;
							}else{
								_s.addStartAtZero = false;
							}
							_s.isAdd_bl = true;
						
							_s.addSource_str = _s.curAddData[i].source;
							_s.curAddData[_s.addId].played_bl = true;
							_s.adDuation = duration;
						
							_s._d.adsThumbnailPath_str = _s.curAddData[i].thumbnailSource;
							_s._d.timeToHoldAds = _s.curAddData[i].timeToHoldAds;
							_s._d.adsPageToOpenURL_str = _s.curAddData[i].link;
							_s._d.adsPageToOpenTarget_str = _s.curAddData[i].target;
							_s.TrackingEvents = _s.curAddData[i].TrackingEvents;
							_s.Impression = _s.curAddData[i].Impression
							_s.ClickTracking = _s.curAddData[i].ClickTracking
							_s.scrubAfterAddDuration = _s.curAddData[i].timeStart;
							_s.curImageTotalTime = _s.curAddData[i].addDuration;
							_s.setSource(_s.addSource_str);
						
							if(_s.controller_do && _s.controller_do.line_ar) _s.controller_do.line_ar[i].setVisible(false);
							_s.prvAdSource = _s.addSource_str;
							return;
						}
					}
				}
			}else{
				if(!_s.isAdd_bl){
					_s.curSource = _s._d.playlist_ar[_s.id].videoSource[_s._d.playlist_ar[_s.id].startAtVideo]["source"];
				}else{
					_s.curSource = "FWDUVPDummy" + new Date().getTime();
				}
			}
		
			
			_s.isLive = _s._d.playlist_ar[_s.id]["isLive"];
			
			if(!_s.isAdd_bl && _s.prevSource != _s.curSource && _s.curSource.indexOf("FWDUVPDummy") == -1 || setSourceOverwrite){
				if(setSourceOverwrite){
					_s.isAdd_bl = false;
					_s.curSource = _s._d.playlist_ar[_s.id].videoSource[_s._d.playlist_ar[_s.id].startAtVideo]["source"]
				}
				_s.setSource(_s.curSource, false, _s._d.playlist_ar[_s.id].videoSource[_s._d.playlist_ar[_s.id].startAtVideo]["is360"]);
			}
			if(_s.controller_do) _s.controller_do.positionAdsLines(_s.curDuration);
			_s.prevDuration = duration;
			_s.prevSource = _s.curSource;
		};
		

		//#####################################################//
		/* Setup image screen */
		//#####################################################//
		_s.updateImageScreen = function(source){
			if(_s.videoType_str == FWDUVPlayer.IFRAME){
				if(!_s.ifr_do){		
					_s.ifr_do = new FWDUVPDisplayObject("iframe");
					_s.ifr_do.hasTransform3d_bl = false;
					_s.ifr_do.hasTransform2d_bl = false;
					_s.ifr_do.setBackfaceVisibility();
				}
				
				_s.videoHolder_do.addChildAt(_s.ifr_do, _s.videoHolder_do.getChildIndex(_s.dClk_do) + 1);
				_s.showClickScreen();
				
				_s.ifr_do.screen.src = source;
				_s.ifr_do.setBkColor("#000000");
				_s.positionAdsImage();
				_s.startToUpdateAdsButton();
				return;
			}

			if(!_s.imgH_do){
				_s.imgH_do = new FWDUVPDisplayObject("div");
				_s.imgH_do.setX(0);
				_s.imgH_do.setY(0);
				_s.imgH_do.setBkColor("#000000");
			}
			
			_s.videoHolder_do.addChildAt(_s.imgH_do,  _s.videoHolder_do.getChildIndex(_s.dClk_do) - 1);
			_s.showClickScreen();
			if(_s.imgH_do.contains(_s.imageScreen_do)) _s.imgH_do.removeChild(_s.imageScreen_do);
			_s.imageScreen_do = null;
			
			_s.imageScreen_do = new FWDUVPDisplayObject("img");
			
			_s.imageAdd_img = new Image()
			_s.imageAdd_img.src = source;
		
			if(_s.preloader_do){
				_s.preloader_do.show(false);
			}
			if(_s.lrgPlayBtn) _s.lrgPlayBtn.hide();
			
			_s.imageAdd_img.onload = function(){
				_s.imageScreen_do.setScreen(_s.imageAdd_img);
				_s.imageScreen_do.setAlpha(0);
				FWDAnimation.to(_s.imageScreen_do, 1, {alpha:1});
				_s.imageAddOriginalWidth = _s.imageAdd_img.width;
				_s.imageAddOriginalHeight = _s.imageAdd_img.height;
				if(_s.preloader_do) _s.preloader_do.hide();
				_s.imgH_do.addChild(_s.imageScreen_do);
				_s.positionAdsImage();
				_s.startToUpdateAdsButton();
			}
			
			_s.imageAdd_img.onerror = function(){
				_s.showSourceError("Advertisment image with path " +  source + " can't be found");
				return;
			}
		}
		
		_s.positionAdsImage = function(){

			if(_s.videoType_str == FWDUVPlayer.IFRAME && _s.ifr_do){
				_s.ifr_do.setWidth(_s.tempVidStageWidth);
				_s.ifr_do.setHeight(_s.tempVidStageHeight);
			}

			if(!_s.imageScreen_do || _s.videoType_str != FWDUVPlayer.IMAGE) return;
			var scaleX = _s.tempVidStageWidth/_s.imageAddOriginalWidth;
			var scaleY = _s.tempVidStageHeight/_s.imageAddOriginalHeight;
			
			var totalScale = 0;
			if(scaleX >= scaleY){
				totalScale = scaleX;
			}else if(scaleX <= scaleY){
				totalScale = scaleY;
			}
			
			var finalW = parseInt(_s.imageAddOriginalWidth * totalScale);
			var finalH = parseInt(_s.imageAddOriginalHeight * totalScale);
			var finalX = parseInt((_s.tempVidStageWidth - finalW)/2);
			var finalY = parseInt((_s.tempVidStageHeight - finalH)/2);
			
			_s.imageScreen_do.setWidth(finalW); 
			_s.imageScreen_do.setHeight(finalH); 
			_s.imageScreen_do.setX(finalX); 
			_s.imageScreen_do.setY(finalY); 
			_s.imgH_do.setWidth(_s.tempVidStageWidth);
			_s.imgH_do.setHeight(_s.tempVidStageHeight);
		}
		
		_s.startToUpdateAdsButton = function(){
			_s.curImageTime = 0;
			_s.updateAdsButton();
			_s.stopUpdateImageInterval();
			
			if(_s._d.autoPlay_bl || _s.adDuation || _s.isThumbClick_bl){ 
				_s.startUpdateImageInterval();
				_s.setPlayAndPauseButtonState();	
			}
		}
		
		_s.stopUpdateImageInterval = function(){
			_s.isImageAdsPlaying_bl = false;
			clearInterval(_s.startUpdateAdsId_int);
			_s.setPlayAndPauseButtonState();
			_s.isPlaying_bl = false;
			_s.hider.stop();	
		}
		
		_s.startUpdateImageInterval = function(){
			_s.isImageAdsPlaying_bl = true;
			_s.startUpdateAdsId_int = setInterval(_s.updateAdsButton, 1000);
			_s.setPlayAndPauseButtonState();
			if(_s.lrgPlayBtn) _s.lrgPlayBtn.hide();
			_s.isPlaying_bl = true;
			_s.hider.start();
		}
		
		_s.updateAdsButton = function(){
			_s.videoScreenUpdateTimeHandler({curTime:FWDUVPUtils.formatTime(_s.curImageTime), totalTime:FWDUVPUtils.formatTime(_s.curImageTotalTime), seconds:_s.curImageTime});
			_s.videoScreenUpdateHandler({percent:_s.curImageTime/_s.curImageTotalTime});
			if(_s.curImageTime == _s.curImageTotalTime) _s.videoScreenPlayCompleteHandler();
			_s.curImageTime += 1;
		}
		
		_s.setPlayAndPauseButtonState = function(){
			if(_s.isImageAdsPlaying_bl){
				if(_s.controller_do) _s.controller_do.showPauseButton();
			}else{
				if(_s.controller_do) _s.controller_do.showPlayButton();
			}
		}
		
		// Set source
		_s.showSourceError = function(txt){
			_s.main_do.addChild(_s.info_do);
			_s.info_do.showText(txt);
			if(_s.preloader_do) _s.preloader_do.hide();
			_s.resizeHandler();
		}
		
		_s.setSource = function(source, overwrite, is360){
			
			if(source) _s.source = source;

			if(_s._d.playlist_ar && _s._d.playlist_ar[_s.id] && !_s._d.playlist_ar[_s.id]['playIfLoggedIn']){
				if(_s.lg_do) _s.lg_do.hide();
			}
			
			_s.is360 = is360;

			// Thumbnails preview.
			if(_s._d.playlist_ar && _s._d.playlist_ar[_s.id]['thumbnailsPreview']){
				if(location.protocol.indexOf("file:") != -1){
					setTimeout(function(){
						_s.showSourceError("This browser doesn't allow thumbnails preview videos local, please test online.")
					}, 50);
				}

				if(_s._d.playlist_ar[_s.id]['thumbnailsPreview'].length > 2
				   && location.protocol.indexOf("file:") == -1
				   && !_s.thumbnailsPreviewLoaded_bl){
					var script = document.createElement('script');
					script.src =  _s.mainFolderPath_str + 'java/FWDUVPThumbnailsPreview.js'
					document.head.appendChild(script);
					
					script.onerror = function(e){
						_s.main_do.addChild(_s.info_do);
						_s.showSourceError('The thumbnails preview javascript file named <font color="#FF0000">FWDUVPThumbnailsPreview.js</font> is not found. Please make sure that the content folder contains the java folder that contains the <font color="#FF0000">FWDUVPThumbnailsPreview.js</font> file.');
					}
					
					script.onload = function () {
						_s.thumbnailsPreviewLoaded_bl = true;
						_s.setSource(_s.source, false, _s.is360);
					}
					return;
				}
			}
			
			_s.hasThumbnailsPreview = false;
			if(_s._d.playlist_ar[_s.id]['thumbnailsPreview'] && _s._d.playlist_ar[_s.id]['thumbnailsPreview'].length > 2){
				_s.hasThumbnailsPreview = true;
				if(_s.controller_do) _s.controller_do.setupThumbnailsPreview();
			}
			
			if(!_s.isAPIReady_bl || _s.id == -1) return;
			
			if(_s.id < 0){
				_s.id = 0;
			}else if(_s.id > _s.totaadsIdeos - 1){
				_s.id = _s.totaadsIdeos - 1;
			}
			
			if(_s._d.playlist_ar[_s.id] == undefined) return;
			
			_s.stop(source);

			// Remove APT.
			if(_s.isThumbClick_bl && !_s.aptRemoved){
				_s._d.autoPlay_bl = false;
				_s.removeAPT();
				_s.setVolume(_s._d.volume, true);
			}

			// Cuepoints.
			_s.cuePointsSource_ar = _s._d.playlist_ar[_s.id].cuepoints_ar;
			
			// Advertisement.
			if(_s.playlist_do && _s.playlist_do.curId != _s.id && !_s.isAdd_bl){
				_s.prvAdSource = Math.random() * 999999999;
				if(!_s._d.playAdsOnlyOnce_bl){
					for(var i=0; i<_s._d.playlist_ar.length; i++){
						if(_s._d.playlist_ar[i].ads_ar){
							for(var j=0; j<_s._d.playlist_ar[i].ads_ar.length; j++){
								_s._d.playlist_ar[i].ads_ar[j].played_bl = false;
							}
						}	
						if(_s._d.playlist_ar[i].popupAds_ar){
							for(var j=0; j<_s._d.playlist_ar[i].popupAds_ar.length; j++){
								_s._d.playlist_ar[i].popupAds_ar[j].isClsd = false;
							}
						}	
					}
				}

				if(!_s._d.executeCuepointsOnlyOnce_bl){
					if(_s.cuePointsSource_ar){
						for(var i=0; i<_s.cuePointsSource_ar.length; i++){
							_s.cuePointsSource_ar[i].played_bl = false;
						}
					}
				}
			}
		
			if(source.toLowerCase().indexOf("vimeo.com") != -1 
			   && source.toLowerCase().indexOf(".m3u8") == -1
			   && source.toLowerCase().indexOf(".mp4") == -1){
				_s.videoType_str = FWDUVPlayer.VIMEO;
			}else if(source.toLowerCase().indexOf("youtube.") != -1){
				_s.videoType_str = FWDUVPlayer.YOUTUBE;
			}else if(source.toLowerCase().indexOf(".mp3") != -1){
				_s.videoType_str = FWDUVPlayer.MP3;
				if(_s.controller_do) _s.controller_do.setX(0);
			}else if(source.toLowerCase().indexOf(".jpg") != -1 
					|| source.toLowerCase().indexOf(".jpeg") != -1 
					|| source.toLowerCase().indexOf(".png") != -1
			){
				_s.videoType_str = FWDUVPlayer.IMAGE;
				if(_s.controller_do) _s.controller_do.setX(0);
			}else if(!source.match(/\.mpd|\.m3u8|\.mp4|\.mov|google.com|lh3.|myqnapcloud/ig)){
				_s.videoType_str = FWDUVPlayer.IFRAME;
				if(_s.controller_do) _s.controller_do.setX(0);
			}else{
				if(_s.controller_do) _s.controller_do.setX(0);
				if(!FWDUVPlayer.hasHTMLHLS && source.toLowerCase().indexOf(".m3u8") != -1){
					_s.videoType_str = FWDUVPlayer.HLS_JS;
				}else if(source.toLowerCase().indexOf(".mpd") != -1){
					_s.videoType_str = FWDUVPlayer.DASH;
				}else{
					_s.videoType_str = FWDUVPlayer.VIDEO;
				}
			}

			_s.videoSourcePath_str = source;
			_s.finalVideoPath_str = source;
			_s.posterPath_str = _s._d.playlist_ar[_s.id].posterSource;

			// Set is live.
			if(_s.controller_do) _s.controller_do.setIsLive(_s.isLive);
			
			// IMA
			var isIMA = _s._d.playlist_ar[_s.id].imaURL;
			if(_s.videoType_str != FWDUVPlayer.VIDEO || _s.errorImaSDK) isIMA = false;
			if(isIMA){
				_s.isIMA = isIMA;
				if(!_s._d.imaReady){
					_s._d.startToLoadIMA();
					return;
				}
				
				if(!_s.IMA){
					FWDUVPIMA.setPrototype();
					_s.IMA = new FWDUVPIMA(_s);
				}
			}
			if(!_s.IMA) _s.isIMA = false;
			
			// Casting
			if(_s.cc){
				_s.cc.checkButtonState();
			}else if(_s.controller_do && _s._d.showChromecastButton_bl){
				var isCastSupportedType = _s.videoType_str == FWDUVPlayer.VIDEO || _s.videoType_str == FWDUVPlayer.MP3 || _s.videoType_str == FWDUVPlayer.HLS_JS;
				if(isCastSupportedType){
					_s.controller_do.addCCButton();
				}else{
					_s.controller_do.removeCCButton();
				}
			}

			//DASH
			if(source.indexOf(".mpd") != -1 && !_s.isDASHLoaded_bl && !FWDUVPlayer.isDASHLoaded_bl){
				if(location.protocol.indexOf("file:") != -1){
					_s.showSourceError("This browser doesn't allow playing MPEG DASH videos local, please test online.");
					return;
				}

				var script = document.createElement('script');
				script.src = _s._d.dashPath_str;
				document.head.appendChild(script);
				script.onerror = function(){
					_s.showSourceError("Error loading MPEG DASH library <font color='#FF0000'>" + _s._d.dashPath_str + "</font>.")
					return;
				}

				script.onload = function () {
					_s.isDASHLoaded_bl = true;
					FWDUVPlayer.isDASHLoaded_bl = true;
					_s.setupDASH();
					_s.setSource(source, false, _s.is360);
				}

				if(_s.isMbl) _s.isThumbClick_bl = false;

				if(!_s._d.autoPlay_bl && !_s.isThumbClick_bl){
					_s.setPosterSource(_s.posterPath_str);
					if(_s.videoPoster_do) _s.videoPoster_do.show();
					if(_s.lrgPlayBtn) _s.lrgPlayBtn.show();
				}
				return;
			}
			

			// HLS
			if(!FWDUVPlayer.hasHTMLHLS && source.indexOf(".m3u8") != -1 && !_s.isHLSJsLoaded_bl && !FWDUVPlayer.isHLSJsLoaded_bl){
				// if(location.protocol.indexOf("file:") != -1){
				// 	_s.showSourceError("This browser doesn't allow playing HLS videos local, please test online.")
				// 	return;
				// }
				
				var script = document.createElement('script');
				script.src = _s._d.hlsPath_str;
				document.head.appendChild(script);
				script.onerror = function(){3
					_s.showSourceError("Error loading HLS library <font color='#FF0000'>" + _s._d.hlsPath_str + "</font>.")
					return;
				}
				
				script.onload = function () {
					_s.isHLSJsLoaded_bl = true;
					FWDUVPlayer.isHLSJsLoaded_bl = true;
					_s.setupHLS();
					_s.setSource(source, false, _s.is360);
				}
				
				if(!_s._d.autoPlay_bl && !_s.isThumbClick_bl){
					_s.setPosterSource(_s.posterPath_str);
					if(_s.videoPoster_do) _s.videoPoster_do.show();
					if(_s.lrgPlayBtn) _s.lrgPlayBtn.show();
				}
				return;
			}
			
			if(source.indexOf("youtube.") != -1 && !_s.ytb_do){
				setTimeout(function(){
					
					if(_s.showPreloader_bl){
						_s.main_do.addChild(_s.preloader_do);	
						if(_s.preloader_do){
							_s.preloader_do.show(false);
						}
						if(_s.lrgPlayBtn) _s.lrgPlayBtn.hide();
						
						if(location.protocol.indexOf("file:") != -1 && FWDUVPUtils.isIE) _s.main_do.addChild(_s.info_do);
					}
				}, 50);
				
				if(location.protocol.indexOf("file:") != -1 && FWDUVPUtils.isIE){
					_s.showSourceError("This browser doesn't allow the Youtube API to run local, please test it online or in another browser like Firefox or Chrome.");
					return;
				}	
				
				_s.setupYoutubeAPI();
				return;
			}
		
			if(source.indexOf("vimeo.") != -1 && !_s.vimeo_do && _s.videoType_str == FWDUVPlayer.VIMEO){
					
				if(location.protocol.indexOf("file:") != -1){
					_s.showSourceError("This browser doesn't allow playing Vimeo videos local, please test online.");
					return;
				}
				
				if(_s.showPreloader_bl){
					_s.main_do.addChild(_s.preloader_do);	
					if(_s.preloader_do){
						_s.preloader_do.show(false);
					}
				}
				if(_s.lrgPlayBtn) _s.lrgPlayBtn.hide();
			
				_s.setupVimeoAPI();
				return;
			}
			
			
			if(_s.is360  && !_s.isThreeJsOrbigLoaded_bl && (_s.videoType_str == FWDUVPlayer.VIDEO && _s.videoType_str != FWDUVPlayer.HLS_JS)){
					
				if(FWDUVPUtils.isLocal){
					_s.showSourceError("This browser doesn't allow playing 360 videos local, please test online.");
					return;
				}
				
				if(!FWDUVPUtils.hasWEBGL){
					_s.showSourceError("Playing 360 videos in _s browser is not possible because it doesn't support WEBGL.");
					return;
				}
				
				if(!_s.isThreeJsLoaded_bl && !FWDUVPlayer.hasThreeJsLoaded_bl){
					var script = document.createElement('script');
					script.src = _s._d.threeJsPath_str;
					script.onerror = function(){
						_s.showSourceError("Error loading 360 degree library <font color='#FF0000'>" + _s._d.threeJsPath_str + "</font>.");
						return;
					}
					script.onload = function () {
						_s.isThreeJsOrbigLoaded_bl = true;
						
							var script2 = document.createElement('script');
							script2.src = _s._d.threeJsControlsPath_str;
							script2.onerror = function(){
								_s.showSourceError("Error loading three.js from <font color='#FF0000'>" + _s._d.threeJsControlsPath_str + "</font>.");
								return;
							}
							script2.onload = function () {
								FWDUVPlayer.hasThreeJsLoaded_bl = true;
								_s.isThreeJsOrbitLoaded_bl = true;
								if(_s.isThreeJsOrbigLoaded_bl && _s.isThreeJsOrbitLoaded_bl) _s.setSource(source, true, true);
								clearTimeout(_s.load360ScriptsId_to);
								if(_s.preloader_do) _s.preloader_do.hide();
							};
							document.head.appendChild(script2);
							};

					document.head.appendChild(script);
					
					
					_s.load360ScriptsId_to = setTimeout(function(){
						if(_s.showPreloader_bl){
							if(_s.preloader_do){
								_s.preloader_do.show(false);
							}
						}
					},1000);
					return;
				}
			}
			
			if(_s.is360){
				_s.dClk_do.getStyle().cursor = 'url(' + _s._d.handPath_str + '), default';
			}else{
				_s.dClk_do.getStyle().cursor = "auto";
			}

			_s.rotationY360DegreeVideo = _s._d.playlist_ar[_s.id].videoSource[_s._d.playlist_ar[_s.id].startAtVideo]["rotationY360DegreeVideo"];
			_s.startWhenPlayButtonClick360DegreeVideo = _s._d.playlist_ar[_s.id].videoSource[_s._d.playlist_ar[_s.id].startAtVideo]["startWhenPlayButtonClick360DegreeVideo"];


			if(_s._d.playlist_ar[_s.id] && _s._d.playlist_ar[_s.id].scrubAtTimeAtFirstPlay) _s.playAtTime_bl = true;
			if(_s.controller_do && _s.controller_do.rewindButton_do) _s.controller_do.rewindButton_do.disable();
		
			_s.popwSource = _s._d.playlist_ar[_s.id]._dAdvertisementOnPauseSource;
			if(_s._d.playlist_ar[_s.id] && _s._d.playlist_ar[_s.id]._dAdvertisementOnPauseSource){
				_s.showPopW_bl = true;
			}else{
				_s.showPopW_bl = false;
			}

			if(!source) source = _s._d.playlist_ar[_s.id].videoSource[_s._d.playlist_ar[_s.id].startAtVideo].source;

			if(source.indexOf("youtube.") != -1){
				var regExp = /^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
				source = source.match(regExp)[2];
			}
			
			if(_s.controller_do) _s.controller_do.enablePlayButton();
			_s.prevVideoSource_str = source;
			
			if(!source){
				_s.showSourceError("Video source is not defined!");
				return;
			}
		
			if(_s.playlist_do){
				_s.playlist_do.curId = _s.id;
				_s.playlist_do.checkThumbsState();
			}
			
			if(_s.controller_do && _s._d.playlist_ar[_s.id].subtitleSource && _s._d.playlist_ar[_s.id].subtitleSource.length > 1){
				_s.subsSource_ar = _s._d.playlist_ar[_s.id].subtitleSource;
				_s.subsStartAtSubtitle = Number(_s._d.playlist_ar[_s.id].startAtSubtitle);
				_s.controller_do.updateSubtitleButtons(_s.subsSource_ar, _s.subsStartAtSubtitle);
				_s.ccSS = Number(_s._d.playlist_ar[_s.id].subtitleSource.length - _s._d.playlist_ar[_s.id].startAtSubtitle);
			}
			_s.subtitle_do.stopToLoadSubtitle();
			
			if(_s.controller_do){
				_s.controller_do.updateHexColorForScrubber(_s.isAdd_bl);
				_s.controller_do.removeAtButton();
			} 
			
			_s.annotations_ar = _s._d.playlist_ar[_s.id].annotations_ar;
			_s.annotations_do.setupAnnotations(_s.annotations_ar);
			
			_s.startAtPlaybackIndex = _s._d.startAtPlaybackIndex;
			
			if(_s._d.playlist_ar[_s.id]["_dPlaybackRate"] == "0.25"){
				_s.startAtPlaybackIndex = 5;
			}else if(_s._d.playlist_ar[_s.id]["_dPlaybackRate"] == "0.5"){
				_s.startAtPlaybackIndex = 4;
			}else if(_s._d.playlist_ar[_s.id]["_dPlaybackRate"] == "1"){
				_s.startAtPlaybackIndex = 3;
			}else if(_s._d.playlist_ar[_s.id]["_dPlaybackRate"] == "1.25"){
				_s.startAtPlaybackIndex = 2;
			}else if(_s._d.playlist_ar[_s.id]["_dPlaybackRate"] == "1.5"){
				_s.startAtPlaybackIndex = 1;
			}else if(_s._d.playlist_ar[_s.id]["_dPlaybackRate"] == "2"){
				_s.startAtPlaybackIndex = 0;
			}
			
			_s.prevVideoSourcePath_str = _s.videoSourcePath_str;
			_s.resizeHandler(false, true);
			
			// Image & iframe
			if(_s.videoType_str == FWDUVPlayer.IMAGE || _s.videoType_str == FWDUVPlayer.IFRAME){
				_s.updateImageScreen(_s.videoSourcePath_str);
				if(_s.videoPoster_do) _s.videoPoster_do.setX(-5000);
				return;
			}else{
				if(_s.videoHolder_do.contains(_s.ifr_do)) _s.videoHolder_do.removeChild(_s.ifr_do);
				if(_s.videoHolder_do.contains(_s.imgH_do)) _s.videoHolder_do.removeChild(_s.imgH_do);
		   		if(_s.videoPoster_do) _s.videoPoster_do.setX(0);
			}
			
			if(_s.getVideoSource()) _s.dispatchEvent(FWDUVPlayer.UPDATE_VIDEO_SOURCE);
			

			//Vimeo
			if(_s.videoType_str == FWDUVPlayer.VIMEO){
				
				if(_s.ytb_do && _s.ytb_do.ytb ){
					_s.ytb_do.showDisable();
				}
				if(_s.ytb_do) _s.ytb_do.setX(-5000);

				if(_s.videoScreen_do) _s.videoScreen_do.setX(-5000);
				if(_s.vimeo_do.x != 0) _s.vimeo_do.setX(0);
			
				if(_s.isAdd_bl){
					_s.showClickScreen();
				}else{
					_s.hideClickScreen();
				}
				
				if(_s.audioScreen_do) _s.audioScreen_do.setX(-5000);
				_s.audioScreen_do.setVisible(false);
				
				if(_s.videoScreen_do) _s.videoScreen_do.setVisible(false);
				if(_s.controller_do) _s.controller_do.removePlaybackRateButton();

				if(_s.controller_do){
					_s.controller_do.hideQualityButtons(false);
					_s.controller_do.removeYtbQualityButton();
				}
				
				 _s.videoPoster_do.hide(true);
				_s.setPosterSource(_s.posterPath_str);
				
				_s.vimeo_do.setSource(source);

				if(_s.getVideoSource()) _s.dispatchEvent(FWDUVPlayer.UPDATE_VIDEO_SOURCE);
				_s.resizeHandler();
				return;
			}
			
			//Youtube
			if(_s.videoType_str == FWDUVPlayer.YOUTUBE){
				
				if(_s.vimeo_do) _s.vimeo_do.setX(-5000);
				_s.videoScreen_do.setX(-5000);
				_s.videoScreen_do.setVisible(false);
				
				if(_s.audioScreen_do) _s.audioScreen_do.setX(-5000);
				_s.audioScreen_do.setVisible(false);
								
				if(_s.ytb_do) _s.ytb_do.setX(0);

				if(_s.ytb_do && _s.ytb_do.ytb && !_s.is360){
					_s.ytb_do.showDisable();
				}else{
					_s.ytb_do.hideDisable();
				}
				
				_s.videoPoster_do.hide(true);
				_s.setPosterSource(_s.posterPath_str);

				if(_s.lrgPlayBtn && !_s._d.showAnnotationsPositionTool_bl){
					if(_s.videoPoster_do) _s.videoPoster_do.show();
					_s.lrgPlayBtn.show();
				}
				
				_s.isTempYoutubeAdd_bl = false;
				_s.ytb_do.setSource(source);

				if(_s.controller_do){
					_s.controller_do.addYtbQualityButton();
					if(_s.controller_do){
						if(_s.videoType_str == FWDUVPlayer.VIMEO || _s.videoType_str == FWDUVPlayer.IMAGE || _s.videoType_str == FWDUVPlayer.IFRAME){
							_s.controller_do.removePlaybackRateButton();
						}else{
							_s.controller_do.addPlaybackRateButton(_s.startAtPlaybackIndex);
						}
					}
				}

				if(_s.isAdd_bl){
					_s.setPlaybackRate(1);
				}else{
					_s.setPlaybackRate(_s._d.defaultPlaybackRate_ar[_s._d.startAtPlaybackIndex]);
				}

				if(_s.controller_do && _s._d.showPlaybackRateButton_bl){
					_s.controller_do.updatePlaybackRateButtons(_s.startAtPlaybackIndex);
				}
				
				_s.resizeHandler(false, true);
				if(_s.getVideoSource()) _s.dispatchEvent(FWDUVPlayer.UPDATE_VIDEO_SOURCE);
				return;
			}
			
			_s.finalVideoPath_str = source;
			
			if(_s.videoType_str == FWDUVPlayer.MP3){
				
				if(_s.vimeo_do) _s.vimeo_do.setX(-5000);
				if(_s.ytb_do) _s.ytb_do.setX(-5000);
				if(_s.ytb_do && _s.ytb_do.ytb){
					_s.ytb_do.showDisable();
				}
				
				if(_s.audioScreen_do) _s.audioScreen_do.setX(-5000);
				_s.audioScreen_do.setVisible(false);
				_s.videoScreen_do.setVisible(true);
				
				
				if(_s.controller_do && _s._d.playlist_ar[_s.id].videoSource.length > 1){
					_s.controller_do.updatePreloaderBar(0);
					if(_s.controller_do){
						_s.controller_do.addYtbQualityButton();
					}
					_s.controller_do.updateQuality(_s._d.playlist_ar[_s.id].videoLabels_ar, _s._d.playlist_ar[_s.id].videoLabels_ar[_s._d.playlist_ar[_s.id].videoLabels_ar.length - 1 - _s._d.playlist_ar[_s.id].startAtVideo]);
				}else if(_s.controller_do){
					_s.controller_do.removeYtbQualityButton();
				}
				
				if(_s.controller_do){
					if(_s.videoType_str == FWDUVPlayer.VIMEO || _s.videoType_str == FWDUVPlayer.IMAGE || _s.videoType_str == FWDUVPlayer.IMAGE){
						_s.controller_do.removePlaybackRateButton();
					}else{
						_s.controller_do.addPlaybackRateButton(_s.startAtPlaybackIndex);
					}
				}

				_s._d.autoPlay_bl = false;
				_s.removeAPT();
				
				_s.audioScreen_do.setX(0);
				_s.audioScreen_do.setVisible(true);
				if(!_s.isAdd_bl && window['FWDUVPCC'] && typeof FWDUVPCC.enableButton === 'function') FWDUVPCC.enableButton();
				_s.videoPoster_do.hide(true);
				_s.setPosterSource(_s.posterPath_str);
				_s.audioScreen_do.setSource(source);

				if(_s.isAdd_bl && !_s.isMbl){
					_s.play();
				}else if(_s.isThumbClick_bl){
					if(_s.displayType != FWDUVPlayer.LIGHTBOX  || _s.lightBox_do.isShowed_bl){
						_s.play();
					} 
				}else{
					if(_s.videoPoster_do) _s.videoPoster_do.show();
					if(_s.lrgPlayBtn) _s.lrgPlayBtn.show();
				}
			}
			
			if(FWDUVPlayer.hasHTML5Video 
			   && _s.videoType_str == FWDUVPlayer.VIDEO
			   || _s.videoType_str == FWDUVPlayer.HLS_JS
			   || _s.videoType_str == FWDUVPlayer.DASH){
				
				if(_s.vimeo_do) _s.vimeo_do.setX(-5000);
				if(_s.ytb_do) _s.ytb_do.setX(-5000);
				if(_s.ytb_do && _s.ytb_do.ytb){
					_s.ytb_do.showDisable();
				}
				
				if(_s.audioScreen_do) _s.audioScreen_do.setX(-5000);
				_s.audioScreen_do.setVisible(false);
				
				_s.videoScreen_do.setVisible(true);
				
				if(_s.controller_do && _s._d.playlist_ar[_s.id].videoSource.length > 1){
					_s.controller_do.updatePreloaderBar(0);
					if(_s.controller_do){
						_s.controller_do.addYtbQualityButton();
					}
				
					_s.controller_do.updateQuality(_s._d.playlist_ar[_s.id].videoLabels_ar, _s._d.playlist_ar[_s.id].videoLabels_ar[_s._d.playlist_ar[_s.id].videoLabels_ar.length - 1 - _s._d.playlist_ar[_s.id].startAtVideo]);
				}else if(_s.controller_do){
					_s.controller_do.removeYtbQualityButton();
				}
				
				if(_s.controller_do){
					if(_s.controller_do){
						if(_s.videoType_str == FWDUVPlayer.VIMEO || _s.videoType_str == FWDUVPlayer.IMAGE || _s.videoType_str == FWDUVPlayer.IFRAME){
							_s.controller_do.removePlaybackRateButton();
						}else{
							_s.controller_do.addPlaybackRateButton(_s.startAtPlaybackIndex);
						}
					}
				}
				
				if(_s.videoType_str == FWDUVPlayer.DASH){
					_s.setPosterSource(_s.posterPath_str);
					if(_s._d.autoPlay_bl || _s.isThumbClick_bl || (!_s.isMbl && _s.isAdd_bl && !_s.loadAddFirstTime_bl)){
						_s.videoPoster_do.hide(true);
					} 
					_s.videoScreen_do.setSource(source);
					_s.setupDASH();

					_s.dashJS.initialize(_s.videoScreen_do.video_el, _s.videoSourcePath_str, false);
                 	_s.dashJS.attachSource(_s.videoSourcePath_str);

                 	_s.dashJS.on(dashjs.MediaPlayer.events.MANIFEST_LOADED, function(e){
                 		_s.isDASHManifestReady_bl = true;
                 		
                 		if(!_s.isMbl && _s.isAdd_bl && !_s.loadAddFirstTime_bl){
							setTimeout(_s.play, 100);
						}

                 		if(_s._d.autoPlay_bl || _s.isThumbClick_bl){
                 			
                 			if(_s.isThumbClick_bl){
								if(_s.videoType_str == FWDUVPlayer.DASH){
									setTimeout(_s.play, 100);
								}
							}

							if(_s._d.autoPlay_bl){
								if(_s.controller_do) _s.controller_do.updateVolume(0);
								if(_s.displayType != FWDUVPlayer.LIGHTBOX  || _s.lightBox_do.isShowed_bl){
									if(_s.videoType_str == FWDUVPlayer.DASH){
										setTimeout(_s.play, 100);
									}
								} 
							}
						}else{
							_s.videoPoster_do.show(true);
							_s.lrgPlayBtn.show();
						}

						if(_s.isAdd_bl){
							_s.setPlaybackRate(1);
						}else{
							_s.setPlaybackRate(_s._d.defaultPlaybackRate_ar[_s.startAtPlaybackIndex]);
						}
						if(_s.controller_do && _s._d.showPlaybackRateButton_bl){
							_s.controller_do.updatePlaybackRateButtons(_s.startAtPlaybackIndex);
						}
                 	});
					
				}else if(_s.videoType_str == FWDUVPlayer.HLS_JS){
					_s.setPosterSource(_s.posterPath_str);
					if(_s._d.autoPlay_bl || _s.isThumbClick_bl || (!_s.isMbl && _s.isAdd_bl && !_s.loadAddFirstTime_bl)){
						_s.videoPoster_do.hide(true);
					} 
					_s.videoScreen_do.setSource(source);
					_s.videoScreen_do.initVideo();
					_s.setupHLS();
					_s.hlsJS.loadSource(_s.videoSourcePath_str);
					_s.hlsJS.attachMedia(_s.videoScreen_do.video_el);
					
					_s.hlsJS.on(Hls.Events.MANIFEST_PARSED,function(e){
						if(_s.videoType_str == FWDUVPlayer.HLS_JS){
							
							_s.isHLSManifestReady_bl = true;
							

							if(_s.controller_do){
								_s.controller_do.addYtbQualityButton();
							}

							if(_s.isAdd_bl && !_s.loadAddFirstTime_bl){
								_s.play();
							}
							
							if(_s._d.autoPlay_bl || _s.isThumbClick_bl){
				
								if( _s.isThumbClick_bl) _s.play();

								if(_s._d.autoPlay_bl){
									if(_s.controller_do) _s.controller_do.updateVolume(0);
									if(_s.displayType != FWDUVPlayer.LIGHTBOX  || _s.lightBox_do.isShowed_bl){
										_s.play();
									} 
								}
							}
							
							if(_s.isAdd_bl){
								_s.setPlaybackRate(1);
							}else{
								_s.setPlaybackRate(_s._d.defaultPlaybackRate_ar[_s.startAtPlaybackIndex]);
							}
							if(_s.controller_do && _s._d.showPlaybackRateButton_bl){
								_s.controller_do.updatePlaybackRateButtons(_s.startAtPlaybackIndex);
							}

							_s.parseLevels();
						}
					});
				}else{
					if(!_s.isAdd_bl && window['FWDUVPCC'] && typeof FWDUVPCC.enableButton === 'function') FWDUVPCC.enableButton();
					_s.setPosterSource(_s.posterPath_str);
					_s.videoPoster_do.hide(true);
					_s.videoScreen_do.setSource(source);

					if(_s.isAdd_bl && !_s.loadAddFirstTime_bl){
						_s.play();
					}
					
					if(_s._d.autoPlay_bl || _s.isThumbClick_bl){

						if(_s.isThumbClick_bl ) _s.play();

						if(_s._d.autoPlay_bl){
							if(_s.controller_do) _s.controller_do.updateVolume(0);
							if(_s.displayType != FWDUVPlayer.LIGHTBOX  || _s.lightBox_do.isShowed_bl){
								_s.play();
							} 
						}

						if(_s.isCasting){
							_s.videoPoster_do.show();
						}
					}else{
						_s.videoPoster_do.show(true);
						_s.lrgPlayBtn.show();
					}
					
					if(_s.isAdd_bl){
						_s.setPlaybackRate(1);
					}else{
						_s.setPlaybackRate(_s._d.defaultPlaybackRate_ar[_s.startAtPlaybackIndex]);
					}
					if(_s.controller_do && _s._d.showPlaybackRateButton_bl){
						_s.controller_do.updatePlaybackRateButtons(_s.startAtPlaybackIndex);
					}
					
				}
				
				if(_s.isIMA) _s.IMA.setSource(_s.isIMA);
			}
			_s.resizeHandler();
		};
		
		// DASH
		_s.setupDASH = function(){
			if(_s.dashJS) return;
			_s.isDASHLoaded_bl = true;
			_s.dashJS = dashjs.MediaPlayer().create();

			_s.dashJS.on(dashjs.MediaPlayer.events.ERROR, function(e){
				console.log(e);
				_s.main_do.addChild(_s.info_do);
				_s.info_do.showText(e.error.message);
			});
		}

		_s.destroyDASH = function(o){
			if(_s.dashJS){
				try{	
					_s.dashJS.reset();
				}catch(e){}
			 _s.dashJS = null;
			}
		}

		// HLS
		_s.destroyHLS = function(){
			if(_s.hlsJS){
				_s.hlsJS.destroy();
				_s.hlsJS = null;
			}
		}

		_s.setupHLS = function(){
			
			if(_s.hlsJS || !window['Hls']) return;
			_s.isHLSJsLoaded_bl = true;
			_s.hlsJS = new Hls();
			
			FWDUVPRegisterHLSError(_s);

			_s.hlsJS.on(Hls.Events.MANIFEST_LOADED,function(event, data){
				_s.setAudioTracks(_s.hlsJS.audioTracks);
			});

			_s.hlsJS.on(Hls.Events.LEVEL_UPDATED,function(event, data){
				_s.curHlsLevel = data.level;
				_s.updateHlsControllerLevels();
			});

			_s.hlsJS.on(Hls.Events.LEVEL_SWITCHING,function(event, data){
				_s.curHlsLevel = data.level;
				_s.updateHlsControllerLevels();
			});
		}

		_s.setAudioTracks = function(audioTracks_ar){
			if(audioTracks_ar && audioTracks_ar.length > 1){
				_s.controller_do.addAtButton();

				_s.audioTracks_ar = [];
				audioTracks_ar.forEach((o,i) =>{
					_s.audioTracks_ar[i] = {'label':o['name'] || o['label']};
				})
				_s.audioTracks_ar.reverse();
				_s.controller_do.updateATBButtons(_s.audioTracks_ar, 0);
			}
		}

		_s.updateHlsControllerLevels = function(){
			if(_s.controller_do && _s.hlsLevels_ar){
				_s.curHlsLevel = Math.abs(_s.curHlsLevel - _s.hlsLevels_ar.length + 1)
				_s.controller_do.disableQualityButtons('', _s.curHlsLevel);
			}
		}

		_s.parseLevels = function(){
			var hlsLevels = _s.hlsJS.levels;
			_s.hlsLevels_ar = [];

			setTimeout(function(){
				
				hlsLevels.forEach(function(el){
					var level = '';
					var levelW = el.width;
					var levelH = el.height;
					if(levelW == 320){
						level = 'tiny';
					}else if(levelW == 480){
						level = 'small';
					}else if(levelW == 640){
						level = 'medium';
					}else if(levelW == 960){
						level = 'large';
					}else if(levelW == 1280){
						level = 'hd720';
					}else if(levelW == 1920){
						level = 'hd1080';
					}else if(levelW == 2560){
						level = 'hd1440p';
					}else if(levelW == 3840){
						level = 'hd2160';
					}else if(levelW == 3840){
						level = 'hd2160';
					}else if(levelW == 5120){
						level = 'hd2880';
					}else if(levelW == 7680){
						level = 'hd4320';
					}else{
						level = levelW + 'x' + levelH;
					}

					_s.hlsLevels_ar.push(level);					
				});
				
				if(!_s.hlsLevels_ar) return;
				
				_s.hlsLevels_ar.reverse();
			
				if(_s.controller_do){
					_s.curHlsLevel = Math.abs(_s.hlsLevels_ar.length - _s.hlsLevels_ar.length);
					_s.curHlsLevel = _s.curHlsLevel;
					_s.controller_do.updateQuality(_s.hlsLevels_ar, _s.curHlsLevel, _s.curHlsLevel);
				}
			}, 500);
		
		}

	
		//#############################################//
		/* go fullscreen / normal screen */
		//#############################################//
		_s.goFullScreen = function(){
			if(!_s.isAPIReady_bl) return;
			_s.wasMin = _s.isMin;
			_s.isFullScreen_bl = true;
			_s.removeMinOnScroll();
			
			if(document.addEventListener){
				document.addEventListener("fullscreenchange", _s.onFullScreenChange);
				document.addEventListener("mozfullscreenchange", _s.onFullScreenChange);
				document.addEventListener("webkitfullscreenchange", _s.onFullScreenChange);
				document.addEventListener("MSFullscreenChange", _s.onFullScreenChange);
			}
			
			if(FWDUVPUtils.isSafari && FWDUVPUtils.isWin){
				
			}else{
				if(document.documentElement.requestFullScreen) {
					_s.main_do.screen.requestFullScreen();
				}else if(document.documentElement.mozRequestFullScreen){ 
					_s.main_do.screen.mozRequestFullScreen();
				}else if(document.documentElement.webkitRequestFullScreen){
					_s.main_do.screen.webkitRequestFullScreen();
				}else if(document.documentElement.msRequestFullscreen){
					_s.main_do.screen.msRequestFullscreen();
				}
			}
			
			_s.callVastEvent("playerExpand");
			_s.stopVisualization();
			_s.disableClick();
			
			if(!_s.isEmbedded_bl){
				_s.main_do.getStyle().position = "fixed";
				document.documentElement.style.overflow = "hidden";
				_s.main_do.getStyle().zIndex = 2147483641;
			}
			
			if(_s.controller_do){
				_s.controller_do.showNormalScreenButton();
				_s.controller_do.setNormalStateToFullScreenButton();
			}
			if(_s.customContextMenu_do) _s.customContextMenu_do.updateFullScreenButton(1);
			var scrollOffsets = FWDUVPUtils.getScrollOffsets();
			_s.lastX = scrollOffsets.x;
			_s.lastY = scrollOffsets.y;
			window.scrollTo(0,0);

			if(_s.isMbl) window.addEventListener("touchmove", _s.disableFullScreenOnMobileHandler);
			_s.dispatchEvent(FWDUVPlayer.GO_FULLSCREEN);
			_s.resizeHandler();
		};
		
		_s.disableFullScreenOnMobileHandler = function(e){
			if(e.preventDefault) e.preventDefault();
		};
		
		_s.goNormalScreen = function(){		
			if(!_s.isAPIReady_bl) return;
			
			if (document.cancelFullScreen) {  
				document.cancelFullScreen();  
			}else if (document.mozCancelFullScreen) {  
				document.mozCancelFullScreen();  
			}else if (document.webkitCancelFullScreen) {  
				document.webkitCancelFullScreen();  
			}else if (document.msExitFullscreen) {  
				document.msExitFullscreen();  
			}

			_s.disableClick();
			_s.addMainDoToTheOriginalParent();
			_s.isFullScreen_bl = false;
		};
		
		_s.addMainDoToTheOriginalParent = function(){
			if(!_s.isFullScreen_bl) return;
			
			if(document.removeEventListener){
				document.removeEventListener("fullscreenchange", _s.onFullScreenChange);
				document.removeEventListener("mozfullscreenchange", _s.onFullScreenChange);
				document.removeEventListener("webkitfullscreenchange", _s.onFullScreenChange);
				document.removeEventListener("MSFullscreenChange", _s.onFullScreenChange);
			}
			
			_s.callVastEvent("playerCollapse");
				
			if(_s.controller_do){
				_s.controller_do.setNormalStateToFullScreenButton();
			}

			if(_s.categories_do && _s.categories_do.isShowed_bl){
				try{
					_s.main_do.removeChild(_s.categories_do);
				}catch(e){}
				document.documentElement.appendChild(_s.categories_do.screen);
			}
		
			if(!_s.isEmbedded_bl){
				if(_s.displayType == FWDUVPlayer.RESPONSIVE
				   || _s.displayType == FWDUVPlayer.AFTER_PARENT
				   || _s.displayType == FWDUVPlayer.LIGHTBOX
				    || _s.displayType == FWDUVPlayer.STICKY
				 ){
					
					document.documentElement.style.overflow = "visible";
					if(_s.isMin){
						_s.main_do.getStyle().position = 'fixed';
						_s.main_do.getStyle().zIndex = 9999999999999;
					}else{
						_s.main_do.getStyle().position = "relative";
						_s.main_do.getStyle().zIndex = 0;
					}
				
				}else{
					_s.main_do.getStyle().position = "absolute";
					_s.main_do.getStyle().zIndex = 9999999999998;
				}
			}
			
			if(_s.displayType != FWDUVPlayer.FULL_SCREEN) _s.controller_do.enablePlaylistButton();
			
			if(_s.customContextMenu_do) _s.customContextMenu_do.updateFullScreenButton(0);
			_s.controller_do.showFullScreenButton();
			window.scrollTo(_s.lastX, _s.lastY);

			_s.showCursor();
			_s.resizeHandler();

			setTimeout(function(){
				_s.addMinOnScroll();
				_s.resizeHandler();
			}, 500);
			
			window.scrollTo(_s.lastX, _s.lastY);
			if(!FWDUVPUtils.isIE){
				setTimeout(function(){
					window.scrollTo(_s.lastX, _s.lastY);
				}, 150);
			}
			
			if(_s.isMbl) window.removeEventListener("touchmove", _s.disableFullScreenOnMobileHandler);
			_s.dispatchEvent(FWDUVPlayer.GO_NORMALSCREEN);
		};
		
		_s.onFullScreenChange = function(e){
			if(!(document.fullScreen || document.msFullscreenElement  || document.mozFullScreen || document.webkitIsFullScreen || document.msieFullScreen)){
				_s.controller_do.showNormalScreenButton();
				_s.addMainDoToTheOriginalParent();
				_s.isFullScreen_bl = false;
			}
		};
		
		_s.loadPlaylist = function(id){
			if(!_s.isAPIReady_bl) return;
			if(_s._d.prevId == id) return;
			
			if(_s._d.playlist_ar && _s._d.playlist_ar[_s.id]){
				_s.videoNameGa = _s._d.playlist_ar[_s.id]["gaStr"]
				_s.videoCat = _s._d.cats_ar[_s.catId]["playlistName"];
			}
			
			_s.catId = id;
			_s.id = 0;
			
			if(_s.catId < 0){
				_s.catId = 0;
			}else if(_s.catId > _s._d.totalPlaylists - 1){
				_s.catId = _s._d.totalPlaylists - 1;
			};
			
			if(_s.useDeepLinking_bl){
				FWDUVPDL.setValue("?playlistId=" + _s.catId + "&videoId=" + _s.id);
			}else{
				_s.loadInternalPlaylist();
			}
		};
		
		_s.playNext = function(){	
			if(!_s.isAPIReady_bl || !_s.isPlaylistLoaded_bl) return;
			
			if(_s._d.playlist_ar){
				_s.videoNameGa = _s._d.playlist_ar[_s.id]["gaStr"]
				_s.videoCat = _s._d.cats_ar[_s.catId]["playlistName"];
			}
		
			_s.id ++;
			_s.executePlayNextPrevOrShuffle();
		};
		
		_s.playPrev = function(){
			if(!_s.isAPIReady_bl || !_s.isPlaylistLoaded_bl) return;
			
			if(_s._d.playlist_ar){
				_s.videoNameGa = _s._d.playlist_ar[_s.id]["gaStr"]
				_s.videoCat = _s._d.cats_ar[_s.catId]["playlistName"];
			}
			
			_s.id --;	
			_s.executePlayNextPrevOrShuffle();
		};
		
		_s.playShuffle = function(){
			if(!_s.isAPIReady_bl || !_s.isPlaylistLoaded_bl) return;
			
			if(_s._d.playlist_ar){
				_s.videoNameGa = _s._d.playlist_ar[_s.id]["gaStr"]
				_s.videoCat = _s._d.cats_ar[_s.catId]["playlistName"];
			}
			
			var tempId = parseInt(Math.random() * _s.totaadsIdeos);
			while(tempId == _s.id) tempId = parseInt(Math.random() * _s.totaadsIdeos);
			
			_s.id = tempId;	
			_s.executePlayNextPrevOrShuffle();
		};
		
		_s.executePlayNextPrevOrShuffle = function(){
			_s._d.isVastXMLParsed_bl = false;
			_s.totalDuration = 0;
			if(_s.id < 0){
				_s.id = _s.totaadsIdeos - 1;
			}else if(_s.id > _s.totaadsIdeos - 1){
				_s.id = 0;
			}
			if(_s.useDeepLinking_bl){
				FWDUVPDL.setValue("?playlistId=" + _s.catId + "&videoId=" + _s.id);
			}else{
				_s.isThumbClick_bl = true;
				_s.updateAds(0, true);
			}
		}
		
		_s.playVideo = function(videoId){	
			if(!_s.isAPIReady_bl || !_s.isPlaylistLoaded_bl) return;
			
			if(_s._d.playlist_ar){
				_s.videoNameGa = _s._d.playlist_ar[_s.id]["gaStr"]
				_s.videoCat = _s._d.cats_ar[_s.catId]["playlistName"];
			}
			
			_s.id = videoId;
			
			if(_s.id < 0){
				_s.id = _s.totaadsIdeos - 1;
			}else if(_s.id > _s.totaadsIdeos - 1){
				_s.id = 0;
			}
			
			if(_s.useDeepLinking_bl){
				FWDUVPDL.setValue("?playlistId=" + _s.catId + "&videoId=" + _s.id);
			}else{
				_s.updateAds(0, true);
				if(_s.isMbl && _s.videoType_str == FWDUVPlayer.VIDEO) _s.play();
				if(!_s.isMbl){
					_s.play();
				}
			}
		};
		
		_s.setVideoSource =  function(source, is360, isLive){
			_s.isAdd_bl = false;
			var s360_str = "no";
			if(is360) s360_str = "yes";
			_s.isLive = isLive;
			_s.setSource(source, false, is360);
		};
	
		
		_s.downloadVideo = function(pId){

			var check = _s.checkPassWindow();
			if(!check) return;

			_s.hasPassedPassowrd_bl = true;
			
			if(pId ==  undefined) pId = _s.id;
			
			var sourceName;
			var source = _s._d.playlist_ar[pId].videoSource[_s._d.playlist_ar[_s.id].startAtVideo]["source"];
			if(String(source.indexOf("encrypt:")) != -1){
				source = atob(source.substr(8));
			}
			if(source.indexOf("/") != -1){
				sourceName = source.substr(source.lastIndexOf("/") + 1);
			}else{
				sourceName = source;
			}
			
			if(_s.gtag){
				if(_s._d.playlist_ar){
					_s.videoNameGa = _s._d.playlist_ar[_s.id]["gaStr"]
				}
				
				var params = {
					'video_name': _s.videoNameGa,
					'video_url': source,
				}
				_s.gtag('event', 'download', params);
			}
	
			_s._d.downloadVideo(source, sourceName);
		};
		
		_s.share = function(){
			if(!_s.isAPIReady_bl) return;
			_s.controllerShareHandler();
		};	
		
		_s.getVideoSource = function(){
			if(!_s.isAPIReady_bl) return;
			return _s.finalVideoPath_str;
		};
		
		_s.getPosterSource = function(){
			if(!_s.isAPIReady_bl) return;
			return _s.posterPath_str;
		};
		
		_s.getPlaylistId = function(){
			return _s.catId;
		};
		
		_s.getVideoId = function(){
			return _s.id;
		};
		
		_s.getCurrentTime = function(format){
			if(!format) format = 'text';
			var tm;
			if(format == 'milliseconds'){
				if(!_s.curTimeInmilliseconds){
					tm = 0;
				}else{
					tm = _s.curTimeInmilliseconds;
				}
				if(_s.isCasting) tm = _s.cc.getCurrentTime();
			}else if(format == 'seconds'){
				if(!_s.curTimeInSecond){
					tm = 0;
				}else{
					tm = _s.curTimeInSecond;
				}
				if(_s.isCasting) tm = _s.cc.getCurrentTime();
			}else{
				if(!_s.curTime){
					tm = "00:00";
				}else{
					tm = _s.curTime;
				}
				if(_s.isCasting) tm = FWDUVPUtils.formatTime(_s.cc.getCurrentTime());
			}
			return tm;
		};
		
		_s.getTotalTime = function(format){
			if(!format) format = 'text';
			var tm;
			if(format == 'milliseconds'){
				if(!_s.totalTimeInMilliseconds){
					tm = 0;
				}else{
					tm = _s.totalTimeInMilliseconds;
				}
				if(_s.isCasting) tm = _s.cc.getCurrentTime();
			}else if(format == 'seconds'){
				tm = Math.round(_s.totalTimeInSeconds);
				if(_s.isCasting) tm = _s.cc.getDuration();
			}else{
				if(!_s.totalTime){
					tm = "00:00";
				}else{
					tm = _s.totalTime;
				}
				if(_s.isCasting) tm = FWDUVPUtils.formatTime(_s.cc.getDuration());
			}
			return tm;
		};
	
		
		_s.setPlaybackRate = function(rate){
			if(!_s.isAPIReady_bl) return;
			if( _s.videoScreen_do && _s.videoType_str == FWDUVPlayer.VIDEO
			 || _s.videoType_str == FWDUVPlayer.HLS_JS
			 || _s.videoType_str == FWDUVPlayer.DASH){
				_s.videoScreen_do.setPlaybackRate(rate);
			}else if(_s.videoType_str == FWDUVPlayer.YOUTUBE){
				_s.ytb_do.setPlaybackRate(rate);
			}else if(_s.videoType_str == FWDUVPlayer.MP3){
				_s.audioScreen_do.setPlaybackRate(rate);
			}
		}
		
		_s.showLightbox = function(){
			if(_s.lightBox_do) _s.lightBox_do.show();
		}
		
		_s.fillEntireVideoScreen = function(param){
			_s.fillEntireVideoScreen_bl = param;
			_s.resizeHandler();
		};

		
		//###########################################//
		/* Hide / show cursor */
		//###########################################//
		_s.hideCursor = function(){
			document.documentElement.style.cursor = "none";
			document.getElementsByTagName("body")[0].style.cursor = "none";
			if(!_s.isAdd_bl) _s.dClk_do.getStyle().cursor = "none";
		};
		
		_s.showCursor = function(){
			document.documentElement.style.cursor = "auto";
			document.getElementsByTagName("body")[0].style.cursor = "auto";
			if(_s.isAdd_bl){
				_s.dClk_do.setButtonMode(true);
			}else{
				if(_s.is360){
					_s.dClk_do.getStyle().cursor = 'url(' + _s._d.handPath_str + '), default';
				}else{
					_s.dClk_do.getStyle().cursor = "auto";
				}
			}
		};
		
		_s.showPlayer = function(){
			if(!_s.isAPIReady_bl) return;
			_s.isShowed_bl = true;
			_s.opener_do.showCloseButton();
			_s.setStageContainerFinalHeightAndPosition(_s.animate_bl);
			if(_s.isMin){
				_s.isMinShowed = true;
				_s.positionOnMin(true);
			}
		};
		
		_s.hidePlayer = function(){
			if(!_s.isAPIReady_bl) return;
			_s.isShowed_bl = false;
			_s.opener_do.showOpenButton();
			_s.setStageContainerFinalHeightAndPosition(_s.animate_bl);
			if(_s.isMin){
				_s.isMinShowed = false;
				_s.positionOnMin(true);
			}
		};
		
		_s.getStartTimeStamp = function(str){

			var ts  = window.location.href;
			ts = ts.substr(ts.indexOf(str + "=") + 2);

			if(ts.indexOf("&") != -1){
				ts = ts.substr(0, ts.indexOf("&"));
			}

			if(ts.indexOf("s&") != -1){
				ts = ts.substr(0, ts.indexOf("s&") + 1);
			}

			if(ts.length > 10) return;
		
			var pattern = /\d+h/g;
			var hours = ts.match(pattern);
			try{ hours = ts.match(pattern)[0] }catch(e){}
			if(hours){
				hours = hours.substr(0, hours.length -1);
				if(hours.length == 1 && parseInt(hours) < 10){
					hours = "0" + hours;
				}
				if(parseInt(hours) > 59) hours = 59;
			}
			hours = hours ? hours : "00";
			
			var pattern = /h\d+m/g;
			var minutes = ts.match(pattern);
			try{ minutes = ts.match(pattern)[0].substr(1) }catch(e){}
			
			if(minutes){
				minutes = minutes.substr(0, minutes.length -1);
				if(minutes.length == 1 && parseInt(minutes) < 10){
					minutes = "0" + minutes;
				}
				if(parseInt(minutes) > 59) minutes = 59;
			}
			minutes = minutes ? minutes : "00";
			
			var pattern = /\d+s/g;
			var seconds = ts.match(pattern);
			try{ seconds = ts.match(pattern)[0] }catch(e){}
			if(seconds){
				seconds = seconds.substr(0, seconds.length -1);
				if(seconds.length == 1 && parseInt(seconds) < 10){
					seconds = "0" + seconds;
				}
				if(parseInt(seconds) > 59) seconds = 59;
			}
			seconds = seconds ? seconds : "00";
		
			return hours + ":" + minutes + ":" + seconds;
		}
		
		_s.setVastSource =  function(source){
			if(!_s.isAPIReady_bl) return;
			_s.isAdd_bl = false;
			_s.adDone_bl = false;
			_s.stop();
			_s.prevDuration = -1;
			_s._d.vastXML = source;
			_s._d.isVastXMLParsed_bl = false;
			_s._d.vast.id = -1;
			_s.updateAds();
		}


		//###########################################//
		/* event dispatcher */
		//###########################################//
		_s.addListener = function (type, listener){
	    	if(type == undefined) throw Error("type is required.");
	    	if(typeof type === "object") throw Error("type must be of type String.");
	    	if(typeof listener != "function") throw Error("listener must be of type Function.");
	    	
	        var event = {};
	        event.type = type;
	        event.listener = listener;
	        event.target = _s;
	        _s.listeners.events_ar.push(event);
	    };
	    
	    _s.dispatchEvent = function(type, props){
	    	if(_s.listeners == null) return;
	    	if(type == undefined) throw Error("type is required.");
	    	if(typeof type === "object") throw Error("type must be of type String.");
	    	
	        for (var i=0, len=_s.listeners.events_ar.length; i < len; i++){
	        	if(_s.listeners.events_ar[i].target === _s && _s.listeners.events_ar[i].type === type){		
	    	        if(props){
	    	        	for(var prop in props){
	    	        		_s.listeners.events_ar[i][prop] = props[prop];
	    	        	}
	    	        }
	        		_s.listeners.events_ar[i].listener.call(_s, _s.listeners.events_ar[i]);
	        	}
	        }
	    };
	    
	   _s.removeListener = function(type, listener){
	    	
	    	if(type == undefined) throw Error("type is required.");
	    	if(typeof type === "object") throw Error("type must be of type String.");
	    	if(typeof listener != "function") throw Error("listener must be of type Function." + type);
	    	
	        for (var i=0, len=_s.listeners.events_ar.length; i < len; i++){
	        	if(_s.listeners.events_ar[i].target === _s 
	        			&& _s.listeners.events_ar[i].type === type
	        			&& _s.listeners.events_ar[i].listener ===  listener
	        	){
	        		_s.listeners.events_ar.splice(i,1);
	        		break;
	        	}
	        }  
	    };
		
		//#############################################//
		/* Tracking vast events */
		//#############################################//
		_s.callVastEvent = function(eventName){
			
			if(!_s.TrackingEvents) return;
			var URI;
			
			for(var i=0; i<_s.TrackingEvents.length; i++){
				if(eventName == _s.TrackingEvents[i]["event"]){
					URI = _s.TrackingEvents[i]["URI"];
				}
			}
		
			if(!URI) return;
			_s.executeVastEvent(URI);
		}
		
		_s.executeVastEvent = function(URI){
			if(!URI) return;
			var img = new Image();
			img.src = URI;
		}
	    
	  	//#############################################//
		/* clean main events */
		//#############################################//
		_s.cleanMainEvents = function(){
			if(window.removeEventListener){
				window.removeEventListener("resize", _s.onResizeHandler);
			}else if(window.detachEvent){
				window.detachEvent("onresize", _s.onResizeHandler);
			}
		
			clearTimeout(_s.resizeHandlerId_to);
			clearTimeout(_s.resizeHandler2Id_to);
			clearTimeout(_s.hidePreloaderId_to);
			clearTimeout(_s.orientationChangeId_to);
		};
	
		
		var args = FWDUVPUtils.getUrlArgs(window.location.search);
		var embedTest = args.UVPInstanceName;
		var instanceName = args.UVPInstanceName;
		
		if(embedTest){
			_s.isEmbedded_bl = props.instanceName == instanceName;
		}
	
		if(_s.isEmbedded_bl){
			var ws = FWDUVPUtils.getViewportSize();
			
			_s.embeddedPlaylistId = parseInt(args.UVPPlaylistId);
			_s.embeddedVideoId = parseInt(args.UVPVideoId);
			
			var dumy_do = new FWDUVPDisplayObject("div");
			dumy_do.setBkColor(props.backgroundColor);
			dumy_do.setWidth(ws.w);
			dumy_do.setHeight(ws.h);
			
			document.documentElement.style.overflow = "hidden";
			document.getElementsByTagName("body")[0].style.overflow = "hidden";
			
			if(FWDUVPUtils.isIEAndLessThen9){
				document.getElementsByTagName("body")[0].appendChild(dumy_do.screen);
			}else{
				document.documentElement.appendChild(dumy_do.screen);
			}
		}
		_s.init();
	};

	
	/* set prototype */
	FWDUVPlayer.setPrototype =  function(){
		FWDUVPlayer.prototype = new FWDUVPEventDispatcher();
	};
		
	
	FWDUVPlayer.stopAllVideos = function(pVideo){
		var tt = FWDUVPlayer.instaces_ar.length;
		var video;
		for(var i=0; i<tt; i++){
			video = FWDUVPlayer.instaces_ar[i];
			if(video != pVideo){
				video.stop();
			}
		};
	};
	
	FWDUVPlayer.pauseAllVideos = function(pVideo){
		var tt = FWDUVPlayer.instaces_ar.length;
		var video;
		for(var i=0; i<tt; i++){
			video = FWDUVPlayer.instaces_ar[i];
			if(video != pVideo){
				video.pause();
			}
		};
	};
	
	FWDUVPlayer.hasHTML5Video = true;
	FWDUVPlayer.hasCanvas = (function(){
		return Boolean(document.createElement("canvas"));
	})();
	
	FWDUVPlayer.instaces_ar = [];
	
	FWDUVPlayer.hasHTMLHLS = (function(){
		return navigator.userAgent.match(/(iPhone|iPod)/g);
	}());
	
	
	FWDUVPlayer.areMainInstancesInitialized_bl = false;
	FWDUVPlayer.curInstance = null;
	FWDUVPlayer.keyboardCurInstance = null;
	FWDUVPlayer.isYoutubeAPICreated_bl = false;
	
	FWDUVPlayer.HLS_JS = "HLS";
	FWDUVPlayer.DASH = 'DASH';
	FWDUVPlayer.PAUSE_ALL_VIDEOS = "pause";
	FWDUVPlayer.STOP_ALL_VIDEOS = "stop";
	FWDUVPlayer.DO_NOTHING = "none";
	FWDUVPlayer.YOUTUBE = "youtube";
	FWDUVPlayer.VIMEO = "vimeo";
	FWDUVPlayer.VIDEO = "video";
	FWDUVPlayer.IFRAME = "iframe";
	FWDUVPlayer.atLeastOnePlayerHasDeeplinking_bl = false;
	FWDUVPlayer.MP3 = "mp3";
	
	FWDUVPlayer.CENTER = "center";
	FWDUVPlayer.RIGHT = "right";
	FWDUVPlayer.LEFT = "left";
	FWDUVPlayer.POSITION_BOTTOM = "bottom";
	FWDUVPlayer.POSITION_TOP = "top";
	FWDUVPlayer.HIDE_LIGHTBOX_COMPLETE = "lightboxHideComplete";
	FWDUVPlayer.START_TO_LOAD_PLAYLIST = "startToLoadPlaylist";
	FWDUVPlayer.LOAD_PLAYLIST_COMPLETE = "loadPlaylistComplete";
	FWDUVPlayer.READY = "ready";
	FWDUVPlayer.STOP = "stop";
	FWDUVPlayer.PLAY = "play";
	FWDUVPlayer.PAUSE = "pause";
	FWDUVPlayer.UPDATE = "update";
	FWDUVPlayer.UPDATE_TIME = "updateTime";
	FWDUVPlayer.UPDATE_VIDEO_SOURCE = "updateVideoSource";
	FWDUVPlayer.UPDATE_POSTER_SOURCE = "udpatePosterSource";
	FWDUVPlayer.ERROR = "error";
	FWDUVPlayer.PLAY_COMPLETE = "playComplete";
	FWDUVPlayer.VOLUME_SET = "volumeSet";
	FWDUVPlayer.GO_FULLSCREEN = "goFullScreen";
	FWDUVPlayer.GO_NORMALSCREEN = "goNormalScreen";
	FWDUVPlayer.IMAGE = "image";
	FWDUVPlayer.HLS_JS = "hls_flash"
	FWDUVPlayer.SAFE_TO_SCRUB = "safeToScrub";
	
	FWDUVPlayer.LIGHTBOX = "lightbox";
	FWDUVPlayer.STICKY = "sticky";
	FWDUVPlayer.RESPONSIVE = "responsive";
	FWDUVPlayer.FULL_SCREEN = "fullscreen";
	FWDUVPlayer.AFTER_PARENT = "afterparent";
	
	window.FWDUVPlayer = FWDUVPlayer;
	
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Lightbox.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){

	'use strict';
	
	var FWDUVPLightBox = function(
			prt,
			mainBackgroundColor_str,
			holderBackgroundColor_str,
			lightBoxBackgroundOpacity,
			lightBoxWidth,
			lightBoxHeight
		){
		
		var _s  = this;
		var prototype = FWDUVPLightBox.prototype;

		_s.mainBackgroundColor_str = mainBackgroundColor_str;
		_s.holderBackgroundColor_str = holderBackgroundColor_str;
		
		_s.lightBoxBackgroundOpacity = lightBoxBackgroundOpacity;
		_s.lightBoxWidth = lightBoxWidth;
		_s.lightBoxHeight = lightBoxHeight;
		
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		_s.closeButtonIsTweening_bl = true;
	
		_s.init = function(){
			_s.getStyle().zIndex = 9999999;
			_s.setupMainContainers();
		};

		
		//#############################################//
		/* setup main containers */
		//#############################################//
		_s.setupMainContainers = function(){
			
			if(_s.isMbl && _s.hasPointerEvent_bl) _s.getStyle().msTouchAction = "none";
			
			_s.lightBoxBackground_sdo = new FWDUVPDisplayObject("div"); 
			_s.lightBoxBackground_sdo.setResizableSizeAfterParent();
			_s.lightBoxBackground_sdo.setBkColor(_s.mainBackgroundColor_str);
			_s.lightBoxBackground_sdo.screen.addEventListener('click', _s.closeButtonOnStartHandler);
			_s.addChild(_s.lightBoxBackground_sdo);
			
			_s.mainLightBox_do = new FWDUVPDisplayObject("div");
			_s.mainLightBox_do.setBkColor(_s.holderBackgroundColor_str);
			_s.mainLightBox_do.setWidth(1);
			_s.mainLightBox_do.setHeight(1);

			_s.addChild(_s.mainLightBox_do);
			
			document.documentElement.appendChild(_s.screen);
			
			_s.setX(-10000);
			_s.setY(-10000);
			_s.setWidth(0);
			_s.setHeight(0);
		};
		
		_s.show = function(){
			
			if(_s.isShowed_bl) return;
			if(_s.clsBtn){
				_s.hideCloseButton(false);
				_s.showCloseButton(true);
				_s.clsBtn.setX(-200);
			}else{
				_s.loadClsoeButtonImage();
			}
			
			var viewportSize = FWDUVPUtils.getViewportSize();
			var scrollOffsets = FWDUVPUtils.getScrollOffsets();
			
			_s.setWidth(viewportSize.w);
			_s.setHeight(viewportSize.h);
			_s.setX(scrollOffsets.x);
			_s.setY(scrollOffsets.y);
			
			_s.lightBoxBackground_sdo.setAlpha(0);
			FWDAnimation.to(_s.lightBoxBackground_sdo, .8, {alpha:_s.lightBoxBackgroundOpacity});
			_s.setX(scrollOffsets.x);
			_s.setY(scrollOffsets.y);
			
			_s.mainLightBox_do.setX(parseInt(viewportSize.w/2));
			_s.mainLightBox_do.setY(parseInt(viewportSize.h/2));
			
			if(_s.lightBoxWidth > viewportSize.w){
				_s.finalLightBoxWidth = viewportSize.w;
				_s.finalLightBoxHeight = parseInt(_s.lightBoxHeight * (viewportSize.w/_s.lightBoxWidth));
			}else{
				_s.finalLightBoxWidth = _s.lightBoxWidth;
				_s.finalLightBoxHeight = _s.lightBoxHeight;
			}
			
			FWDAnimation.to(_s.mainLightBox_do, .8, {
				w:_s.finalLightBoxWidth, 
				h:_s.finalLightBoxHeight,
				x:parseInt((viewportSize.w - _s.finalLightBoxWidth)/2),
				y:parseInt((viewportSize.h - _s.finalLightBoxHeight)/2),
				delay:.4,
				onComplete:_s.showComplete,
				ease:Expo.easeInOut});

			if(prt.main_do){
				prt.main_do.setX(-5000);
			}
			_s.dispatchEvent(FWDUVPLightBox.SHOW);
		}
		
		_s.showComplete = function(){
			_s.isShowed_bl = true;
			_s.clsBtn.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.closeButtonOnStartHandler);
			_s.addKeyboardSupport();
			prt.startResizeHandler();
			console.log('complete ' + _s.wasAutoPlay)
			if(prt.isPlaylistLoaded_bl &&  (prt._d.autoPlay_bl || _s.wasAutoPlay)){
				if(!_s.setWAP) _s.wasAutoPlay = prt._d.autoPlay_bl;
				_s.setWAP = true;
				prt.play();
			}
		}
		
		
		//####################################//
		/* Add keyboard support */
		//#####################################//
		_s.addKeyboardSupport = function(){
			document.addEventListener("keydown",  _s.onKeyDownHandler);	
		}
		
		_s.onKeyDownHandler = function(e){
			if(e.keyCode == 27) _s.closeButtonOnStartHandler();
		}
		

		//#############################################//
		/* setup lightbox close button */
		//#############################################//
		_s.loadClsoeButtonImage = function(){
			_s.closeN_img = new Image();
			_s.closeN_img.onload = _s.setupCloseButton;
			_s.closeN_img.src = prt.mainFolderPath_str + prt.sknPth + "embed-close-button.png";
			_s.closeSPath_str = prt.mainFolderPath_str + prt.sknPth + "embed-close-button-over.png";
		}
		
		_s.setupCloseButton = function(e){
			var viewportSize = FWDUVPUtils.getViewportSize();
			FWDUVPSimpleButton.setPrototype();
			_s.clsBtn = new FWDUVPSimpleButton(_s.closeN_img, _s.closeSPath_str, undefined, true);
			
			_s.hideCloseButton(false);
			_s.showCloseButton(true);
			_s.clsBtn.setX(viewportSize.w - _s.clsBtn.w - 15);
			_s.clsBtn.setY(15);
			_s.addChild(_s.clsBtn);
		};
		
		_s.showCloseButtonComplete = function(){
			_s.closeButtonIsTweening_bl = false;
		}
		
		_s.hideCloseButton = function(animate){
			FWDAnimation.killTweensOf(_s.clsBtn);
			if(!animate){
				_s.clsBtn.setAlpha(0);
			}else{
				FWDAnimation.to(_s.clsBtn, .9, {alpha:0});	
			}
		}
		
		_s.showCloseButton = function(animate){
			FWDAnimation.killTweensOf(_s.clsBtn);
			if(!animate){
				_s.clsBtn.setAlpha(1);
			}else{
				FWDAnimation.to(_s.clsBtn, .9, {alpha:1, delay:.8});	
			}
		}
		
		_s.mouseDummyHandler = function(e){
			if(e.preventDefault){
				e.preventDefault();
			}else{
				return false;
			}
		};
			
		_s.closeButtonOnStartHandler = function(e){
			if(!_s.isShowed_bl) return;
			_s.isShowed_bl = false;
			var viewportSize = FWDUVPUtils.getViewportSize();
			
			_s.clsBtn.removeListener(FWDUVPSimpleButton.MOUSE_UP, _s.closeButtonOnStartHandler);
			
			FWDAnimation.to(_s.clsBtn, .9, {alpha:0});
			FWDAnimation.to(_s.mainLightBox_do, .8, {
				w:0, 
				h:0,
				x:parseInt(viewportSize.w/2),
				y:parseInt(viewportSize.h/2),
				delay:.4,
				ease:Expo.easeInOut});
			
			FWDAnimation.to(_s.lightBoxBackground_sdo, .8, {alpha:0, delay:.8});
			FWDAnimation.to(prt.main_do, .8, {x:-prt.main_do.w/2, y:-prt.main_do.h/2 , ease:Expo.easeInOut, delay:.4});
			_s.lighboxAnimDoneId_to = setTimeout(_s.lighboxHideAnimationDone, 1600);
			
			_s.dispatchEvent(FWDUVPLightBox.CLOSE);
		};
		
		_s.lighboxHideAnimationDone = function(){
			_s.setX(-10000);
			_s.setY(-10000);
			_s.setWidth(0);
			_s.setHeight(0);
			_s.dispatchEvent(FWDUVPLightBox.HIDE_COMPLETE);
		};
			
		_s.init();
	};

	
	/* set prototype */
    FWDUVPLightBox.setPrototype = function(){
    	FWDUVPLightBox.prototype = new FWDUVPDisplayObject("div");
    };
    
    FWDUVPLightBox.CLOSE = "ligtBoxClose";
    FWDUVPLightBox.SHOW = "show";
    FWDUVPLightBox.HIDE_COMPLETE = "hideComplete";
    
    FWDUVPLightBox.prototype = null;
	window.FWDUVPLightBox = FWDUVPLightBox;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Logo.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){

	'use strict';
	
	var FWDUVPLogo = function(
			prt, 
			source,
			position,
			margins,
			logoTarget
		){
		
		var _s  = this;
		var prototype = FWDUVPLogo.prototype;

		_s.position_str = position;
		_s.source_str = source;
		_s.logoLink_str = prt._d.logoLink_str;
		
		_s.margins = margins;
		_s.logoTarget = logoTarget;
		
		_s.isShowed_bl = true;
		_s.allowToShow_bl = true;
	
		_s.init = function(){
			
			if(_s.logoLink_str == "none"){
				_s.getStyle().pointerEvents = "none";
			}else{
				_s.setButtonMode(true);
				_s.screen.onclick = function(){
					if(_s.logoTarget == '_self'){
						location.href = _s.logoLink_str;
					}else{
						window.open(_s.logoLink_str, "_blank");
					}
				};
			}
			
			_s.logoImage_do = new FWDUVPDisplayObject("img");
			
			_s.img_img = new Image();
			_s.img_img.onerror = null;
			_s.img_img.onload = _s.loadDone;
			_s.img_img.src = _s.source_str + "?" + new Date().getTime();
			_s.hide();
		};
		
		_s.loadDone = function(){
			_s.setWidth(_s.img_img.width);
			_s.setHeight(_s.img_img.height);
			_s.logoImage_do.setScreen(_s.img_img);
			_s.addChild(_s.logoImage_do);
			_s.logoImage_do.setWidth(_s.img_img.width);
			_s.logoImage_do.setHeight(_s.img_img.height);
			
			_s.positionAndResize();
		};
		
		_s.positionAndResize = function(){
			
			if(!prt.tempVidStageWidth) return;
			
			if(_s.position_str == "topleft"){
				_s.finalX = _s.margins;
				_s.finalY = _s.margins;
			}else if(_s.position_str == "topright"){
				_s.finalX = prt.tempVidStageWidth - _s.w - _s.margins;
				_s.finalY = _s.margins;
			}else if(_s.position_str == "bottomright"){
				_s.finalX = prt.tempVidStageWidth - _s.w - _s.margins;
				_s.finalY = prt.tempVidStageHeight - _s.h - _s.margins;
			}else if(_s.position_str == "bottomleft"){
				_s.finalX = _s.margins;
				_s.finalY = prt.tempVidStageHeight - _s.h - _s.margins;
			}
		
			_s.setX(_s.finalX);
			_s.setY(_s.finalY);
		};
		

		//################################//
		/* show / hide */
		//################################//
		_s.show = function(animate){
			if(_s.isShowed_bl) return;
			_s.isShowed_bl = true;
			_s.setVisible(true);
			FWDAnimation.killTweensOf(_s);
			if(animate){
				FWDAnimation.to(_s, .8, {alpha:1, ease:Expo.easeInOut});
			}else{
				_s.setAlpha(1);
			}
		};
		
		_s.hide = function(animate, overwrite){
			if(!_s.isShowed_bl && !overwrite) return;
			_s.isShowed_bl = false;
			FWDAnimation.killTweensOf(_s);
			if(animate){
				FWDAnimation.to(_s, .8, {alpha:0, ease:Expo.easeInOut, onComplete:function(){
					_s.setVisible(false);
				}});
			}else{
				_s.setAlpha(0);
				_s.setVisible(false);
			}
		};
		
		
		_s.init();
	};
	
	/* set prototype */
    FWDUVPLogo.setPrototype = function(){
    	FWDUVPLogo.prototype = new FWDUVPDisplayObject("div");
    };
    
    FWDUVPLogo.prototype = null;
	window.FWDUVPLogo = FWDUVPLogo;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Sticky display opener.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (){
	var FWDUVPOpener = function(_d, position_str, playerIsShowed_bl){
		
		'use strict';

		var _s = this;
		
		_s.animation_img = _d.openerAnimation_img;
		
		if(position_str ==  FWDUVPlayer.POSITION_TOP){
			_s.openN_img = _d.openTopN_img;
			_s.openSPath_str = _d.openTopSPath_str;		
		}else{
			_s.openN_img = _d.openBottomN_img;
			_s.openSPath_str = _d.openBottomSPath_str;
		}
	
		_s.openerPauseN_img = _d.openerPauseN_img;
		_s.openerPlayN_img = _d.openerPlayN_img;
		_s.closeN_img = _d.closeN_img;
		
		_s.useHEX = _d.useHEX; 
		_s.nBC = _d.nBC;
		_s.sBC = _d.sBC;
		
		_s.openerPauseS_str = _d.openerPauseS_str;
		_s.openerPlaySPath_str = _d.openerPlayS_str;
		_s.closeSPath_str = _d.closeSPath_str;
		_s.animationPath_img = _d.animationPath_img;
		
		try{
			_s.totalWidth = _s.openN_img.width;
			_s.totalHeight = _s.openN_img.height;
		}catch(e){}
		
		_s.position_str = position_str;
		_s.alignment_str = _d.openerAlignment_str;
		
		_s.openerEqulizerOffsetLeft = _d.openerEqulizerOffsetLeft; 
		_s.openerEqulizerOffsetTop = _d.openerEqulizerOffsetTop;
		
		_s.showFirstTime_bl = true;
		_s.playerIsShowed_bl = playerIsShowed_bl;
		_s.showOpenerPlayPauseButton_bl = _d.showOpenerPlayPauseButton_bl;
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		
		_s.init = function(){
			
			if(_d.sknPth.indexOf("hex_white") != -1){
				_s.sBC = "#FFFFFF";
			}else{
				_s.sBC = _d.sBC;
			}
			_s.hasTransform3d_bl = false;
			_s.hasTransform2d_bl = false;
			_s.setBackfaceVisibility();
			_s.getStyle().msTouchAction = "none";
			_s.getStyle().webkitTapHighlightColor = "rgba(0, 0, 0, 0)";
			_s.setupStuff();
			if(_s.showOpenerPlayPauseButton_bl) _s.setupPlayPauseButton();
		
			if(_s.playerIsShowed_bl) _s.showCloseButton();
			if(_s.showOpenerPlayPauseButton_bl){
				_s.setWidth(_s.totalWidth + _s.openerPauseN_img.width + 1);
			}else{
				_s.setWidth(_s.totalWidth);
			}
			_s.setHeight(_s.totalHeight);
		};
	

		//######################################//
		/* setup main stuff */
		//######################################//
		_s.setupStuff = function(e){
			
			_s.mainHld = new FWDUVPDisplayObject("div");
			_s.mainHld.hasTransform3d_bl = false;
			_s.mainHld.hasTransform2d_bl = false;
			_s.mainHld.setBackfaceVisibility();
			
			if(_s.showOpenerPlayPauseButton_bl){
				_s.mainHld.setWidth(_s.totalWidth + _s.openerPauseN_img.width + 1);
			}else{
				_s.mainHld.setWidth(_s.totalWidth);
			}
			_s.mainHld.setHeight(_s.totalHeight);
			
			if(_s.useHEX){
				
				_s.openN_do = new FWDUVPDisplayObject("div");
				_s.openN_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.openN_img, _s.nBC).canvas;
				_s.openN_do.screen.appendChild(_s.openN_canvas);
			}else{
				_s.openN_do = new FWDUVPDisplayObject("img");
				_s.openN_do.setScreen(_s.openN_img);
			}
			_s.openN_do.setWidth(_s.openN_img.width);
			_s.openN_do.setHeight(_s.openN_img.height);
			
			_s.openS_img = new Image();
			_s.openS_img.src = _s.openSPath_str;	
			if(_s.useHEX){
				_s.openS_do = new FWDUVPDisplayObject("div");
				_s.openS_img.onload = function(){		
					_s.openS_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.openS_img, _s.sBC).canvas;
					_s.openS_do.setWidth(_s.openS_img.width);
					_s.openS_do.setHeight(_s.openS_img.height);
					_s.openS_do.screen.appendChild(_s.openS_canvas);
				}					
			}else{
				_s.openS_do = new FWDUVPDisplayObject("img"); 
				_s.openS_do.setScreen(_s.openS_img);
			}
			_s.openS_do.setWidth(_s.openN_do.w);
			_s.openS_do.setHeight(_s.openN_do.h);
			_s.openS_do.setAlpha(0);
			
			if(_s.useHEX){
				_s.closeN_do = new FWDUVPDisplayObject("div");
				_s.closeN_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.closeN_img, _s.nBC).canvas;
				_s.closeN_do.screen.appendChild(_s.closeN_canvas);
			}else{
				_s.closeN_do = new FWDUVPDisplayObject("img");
				_s.closeN_do.setScreen(_s.closeN_img);
			}
			_s.closeN_do.setWidth(_s.closeN_img.width);
			_s.closeN_do.setHeight(_s.closeN_img.height);
			
			_s.closeN_do.hasTransform3d_bl = false;
			_s.closeN_do.hasTransform2d_bl = false;
			_s.closeN_do.setBackfaceVisibility();
			
			_s.closeS_img = new Image();
			_s.closeS_img.src = _s.closeSPath_str;	
			if(_s.useHEX){
				_s.closeS_do = new FWDUVPDisplayObject("div");
				_s.closeS_img.onload = function(){		
					_s.closeS_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.closeS_img, _s.sBC).canvas;
					_s.closeS_do.setWidth(_s.closeN_img.width);
					_s.closeS_do.setHeight(_s.closeN_img.height);
					_s.closeS_do.screen.appendChild(_s.closeS_canvas);
				}					
			}else{
				_s.closeS_do = new FWDUVPDisplayObject("img"); 
				_s.closeS_do.setScreen(_s.closeS_img);
			}
			
			_s.closeS_do.setWidth(_s.closeN_img.width);
			_s.closeS_do.setHeight(_s.closeN_img.height);
			
			_s.closeS_do.setAlpha(0);
			_s.closeS_do.hasTransform3d_bl = false;
			_s.closeS_do.hasTransform2d_bl = false;
			
			FWDUVPPreloader2.setPrototype();
			_s.animation_do = new FWDUVPPreloader2(_s.animationPath_img, 29, 22, 31, 80, true);
			_s.animation_do.setY(_s.openerEqulizerOffsetTop);
			_s.animation_do.show(false);
			_s.animation_do.stop();
			
			_s.dumy_do = new FWDUVPDisplayObject("div");
			_s.dumy_do.setWidth(_s.totalWidth);
			_s.dumy_do.setHeight(_s.totalHeight);
			_s.dumy_do.getStyle().zIndex = 2;
			_s.dumy_do.hasTransform3d_bl = false;
			_s.dumy_do.hasTransform2d_bl = false;
			_s.dumy_do.setBackfaceVisibility();
			_s.dumy_do.setButtonMode(true);
			
			if(FWDUVPUtils.isIE || FWDUVPUtils.isAndroid){
				_s.dumy_do.setBkColor("#FF0000");
				_s.dumy_do.setAlpha(.01);
			}
		
			if(_s.hasPointerEvent_bl){
				_s.mainHld.screen.addEventListener("pointerup", _s.onMouseUp);
				_s.mainHld.screen.addEventListener("pointerover", _s.onMouseOver);
				_s.mainHld.screen.addEventListener("pointerout", _s.onMouseOut);
			}else if(_s.screen.addEventListener){	
				if(!_s.isMbl){
					_s.mainHld.screen.addEventListener("mouseover", _s.onMouseOver);
					_s.mainHld.screen.addEventListener("mouseout", _s.onMouseOut);
					_s.mainHld.screen.addEventListener("mouseup", _s.onMouseUp);
				}
				_s.screen.addEventListener("touchend", _s.onMouseUp);
			}
			
			_s.mainHld.addChild(_s.openN_do);
			_s.mainHld.addChild(_s.openS_do);
			
			_s.mainHld.addChild(_s.closeN_do);
			_s.mainHld.addChild(_s.closeS_do);
			_s.mainHld.addChild(_s.animation_do);
			_s.mainHld.addChild(_s.dumy_do);
			_s.addChild(_s.mainHld);
			
		};
		
		_s.showOpener = function(animate){}
		
		_s.onMouseOver = function(e, animate){
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE || e.pointerType == "mouse"){
				_s.setSelectedState();
			}
		};
			
		_s.onMouseOut = function(e){
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE || e.pointerType == "mouse"){
				_s.setNormalState();
			}
		};
		
		_s.onMouseUp = function(e){
			if(e.preventDefault) e.preventDefault();
			if(_s.playerIsShowed_bl){
				_s.playerIsShowed_bl = false;
				_s.dispatchEvent(FWDUVPOpener.HIDE);
			}else{
				_s.playerIsShowed_bl = true;
				_s.dispatchEvent(FWDUVPOpener.SHOW);
			}
		};

		
		//################################################//
		/* Setup play button */
		//################################################//
		_s.setupPlayPauseButton = function(){
			FWDUVPComplexButton.setPrototype();
			_s.playPauseButton_do = new FWDUVPComplexButton(
					_s.openerPlayN_img,
					_s.openerPlaySPath_str,
					_s.openerPauseN_img,
					_s.openerPauseS_str,
					true,
					_s.useHEX,
					_s.nBC,
					_s.sBC
			);
			_s.playPauseButton_do.addListener(FWDUVPComplexButton.MOUSE_UP, _s.playButtonMouseUpHandler);
			_s.addChild(_s.playPauseButton_do);
		};
		
		_s.showPlayButton = function(){
			if(_s.playPauseButton_do) _s.playPauseButton_do.setButtonState(1);
			_s.animation_do.stop();
		};
		
		_s.showPauseButton = function(){
			if(_s.playPauseButton_do) _s.playPauseButton_do.setButtonState(0);
			_s.animation_do.start(0);
		};
		
		_s.playButtonMouseUpHandler = function(){
			if(_s.playPauseButton_do.currentState == 0){
				_s.dispatchEvent(FWDUVPController.PAUSE);
			}else{
				_s.dispatchEvent(FWDUVPController.PLAY);
			}
		};

		
		//###############################//
		/* set normal / selected state */
		//################################//
		_s.setNormalState = function(){
			if(_s.isMbl && !_s.hasPointerEvent_bl) return;
			FWDAnimation.killTweensOf(_s.openS_do);
			FWDAnimation.killTweensOf(_s.closeS_do);
			FWDAnimation.to(_s.openS_do, .5, {alpha:0, ease:Expo.easeOut});	
			FWDAnimation.to(_s.closeS_do, .5, {alpha:0, ease:Expo.easeOut});
		};
		
		_s.setSelectedState = function(animate){
			FWDAnimation.killTweensOf(_s.openS_do);
			FWDAnimation.killTweensOf(_s.closeS_do);
			FWDAnimation.to(_s.openS_do, .5, {alpha:1, ease:Expo.easeOut});	
			FWDAnimation.to(_s.closeS_do, .5, {alpha:1, ease:Expo.easeOut});
		};
		

		//######################################//
		/* show /hide close / open */
		//######################################//
		_s.showOpenButton = function(){
			_s.playerIsShowed_bl = false;
			_s.closeN_do.setX(150);
			_s.closeS_do.setX(150);
			
			if(_s.playPauseButton_do){
				if(_s.alignment_str == "right"){
					_s.playPauseButton_do.setX(0);
					_s.openN_do.setX(_s.playPauseButton_do.w + 1);
					_s.openS_do.setX(_s.playPauseButton_do.w + 1);
					_s.dumy_do.setX(_s.playPauseButton_do.w + 1);
					_s.dumy_do.setWidth(_s.totalWidth);
					_s.animation_do.setX(_s.playPauseButton_do.w + 1 + _s.openerEqulizerOffsetLeft);
				}else{
					_s.playPauseButton_do.setX(_s.openN_do.w + 1);
					_s.openN_do.setX(0);
					_s.openS_do.setX(0);
					_s.dumy_do.setX(0);
					_s.dumy_do.setWidth(_s.totalWidth);
					_s.animation_do.setX(_s.openerEqulizerOffsetLeft);
				}
			}else{
				_s.openN_do.setX(0);
				_s.openS_do.setX(0);
				_s.dumy_do.setX(0);
				_s.dumy_do.setWidth(_s.totalWidth);
				_s.animation_do.setX(_s.openerEqulizerOffsetLeft);
			}
			_s.animation_do.setVisible(true);
		};
		
		_s.showCloseButton = function(){
			_s.playerIsShowed_bl = true;
			_s.openN_do.setX(150);
			_s.openS_do.setX(150);
			_s.dumy_do.setWidth(_s.closeN_do.w);
			if(_s.alignment_str == "right"){
				if(_s.playPauseButton_do){
					_s.closeN_do.setX(_s.totalWidth + 1);
					_s.closeS_do.setX(_s.totalWidth + 1);
					_s.dumy_do.setX(_s.totalWidth + 1);
				}else{
					_s.closeN_do.setX(_s.totalWidth - _s.closeN_do.w);
					_s.closeS_do.setX(_s.totalWidth - _s.closeN_do.w);
					_s.dumy_do.setX(_s.totalWidth - _s.closeN_do.w);
				}
			}else{
				_s.closeN_do.setX(0);
				_s.closeS_do.setX(0);
				_s.dumy_do.setX(0);
			}
			
			if(_s.playPauseButton_do) _s.playPauseButton_do.setX(150);
			_s.animation_do.setX(150);
			_s.animation_do.setVisible(false);
		};
		
		_s.hide = function(){
			_s.mainHld.setX(150);
		};
		
		_s.show = function(){
			_s.mainHld.setX(0);
		};
		

		//##########################################//
		/* Update HEX color of a canvaas */
		//##########################################//
		_s.updateHEXColors = function(nBC, sBC){
			
			_s.nBC = nBC;
			_s.sBC = sBC;
			_s.playPauseButton_do.updateHEXColors(nBC, sBC);
			FWDUVPUtils.changeCanvasHEXColor(_s.openN_img, _s.openN_canvas, nBC);
			FWDUVPUtils.changeCanvasHEXColor(_s.closeN_img, _s.closeN_canvas, nBC);
			
			FWDUVPUtils.changeCanvasHEXColor(_s.openS_img, _s.openS_canvas, sBC);
			FWDUVPUtils.changeCanvasHEXColor(_s.closeS_img, _s.closeS_canvas, sBC);
		}
		
		_s.init();
	};

	
	/* set prototype */
	FWDUVPOpener.setPrototype = function(){
		FWDUVPOpener.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPOpener.SHOW = "show";
	FWDUVPOpener.HIDE = "hise";
	FWDUVPOpener.PLAY = "play";
	FWDUVPOpener.PAUSE = "pause";
	
	
	FWDUVPOpener.prototype = null;
	window.FWDUVPOpener = FWDUVPOpener;
	
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Popup window.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPOPWindow = function(_d, prt){
		
		'use strict';

		var _s = this;
		var prototype = FWDUVPOPWindow.prototype;
		
		_s.buttons_ar = [];
		
		_s.maxWidth = _d.aopwWidth;
		_s.maxHeight = _d.aopwHeight + _d.popwColseN_img.height + 1; 
		_s.sW = 0;
		_s.sH = 0;
		_s.aopwSource = _d.aopwSource;
		_s.aopwTitle = _d.aopwTitle;
		_s.aopwTitleColor_str = _d.aopwTitleColor_str;
		_s.aopwBorderSize = _d.aopwBorderSize;

		_s.isMbl = FWDUVPUtils.isMobile;
	

		//#################################//
		/* init */
		//#################################//
		_s.init = function(){
			_s.setBackfaceVisibility();
			
			_s.mainBar_do = new FWDUVPDisplayObject("div");
			
			_s.bar_do = new FWDUVPDisplayObject("div");
			_s.bar_do.getStyle().background = "url('" + _d.popwBarBackgroundPath_str + "')";
			
			_s.adHolder_do = new FWDUVPDisplayObject("div");
		
			_s.adBk_do = new FWDUVPDisplayObject("div");
			_s.adBk_do.getStyle().background = "url('" + _d.popwWindowBackgroundPath_str + "')";
				
			//setup close button
			FWDUVPSimpleButton.setPrototype();
			_s.clsBtn = new FWDUVPSimpleButton(_d.popwColseN_img, _d.popwColseSPath_str, undefined,
					true,
					_d.useHEX,
					_d.nBC,
					_d.sBC,
					false, false, false, false, true);
			_s.clsBtn.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.closeButtonOnMouseUpHandler);
			
			_s.title_do = new FWDUVPDisplayObject("div");
			_s.title_do.getStyle().width = "100%";
			_s.title_do.getStyle().textAlign = "left";
			_s.title_do.getStyle().fontFamily = "Arial";
			_s.title_do.getStyle().fontSize= "14px";
			_s.title_do.getStyle().fontWeight = "100";
			_s.title_do.getStyle().color = _s.aopwTitleColor_str;
			_s.title_do.setInnerHTML(_s.aopwTitle);
			_s.bar_do.addChild(_s.title_do);
			
			_s.addChild(_s.adBk_do);
			_s.mainBar_do.addChild(_s.bar_do);
			_s.mainBar_do.addChild(_s.clsBtn); 
			_s.mainBar_do.setHeight(_s.clsBtn.h);
			_s.addChild(_s.mainBar_do);
			_s.addChild(_s.adHolder_do);
			_s.bar_do.setHeight(_s.mainBar_do.h);
		};
		
		_s.closeButtonOnMouseUpHandler = function(){
			if(!_s.isShowed_bl) return;
			_s.hide();
			prt.play();
		};
		
		_s.positionAndResize = function(){
			_s.sW = Math.min(prt.tempVidStageWidth, _s.maxWidth);
			_s.sH = Math.min(prt.tempVidStageHeight, _s.maxHeight);
			var totalScale = 1;
			var scaleX = prt.tempVidStageWidth/_s.maxWidth;
			var scaleY = prt.tempVidStageHeight/_s.maxHeight;
			if(scaleX < scaleY){
				totalScale = scaleX;
			}else if(scaleX > scaleY){
				totalScale = scaleY;
			}
			if(totalScale > 1) totalScale = 1;
			
			_s.sW = totalScale * _s.maxWidth;
			_s.sH = totalScale * _s.maxHeight;
			
			_s.setWidth(_s.sW);
			_s.setHeight(_s.sH);
	
			_s.setHeight(_s.sH);
			_s.setX(Math.round((prt.tempVidStageWidth - _s.sW)/2));
			_s.setY(Math.round((prt.tempVidStageHeight - _s.sH)/2));
			
			_s.mainBar_do.setWidth(_s.sW);
			_s.clsBtn.setX(_s.sW - _s.clsBtn.w);
			_s.bar_do.setWidth(_s.sW - _s.clsBtn.w - 1);
			
			_s.adBk_do.setWidth(_s.sW);
			_s.adBk_do.setHeight(_s.sH - _s.mainBar_do.h - 1);
			_s.adBk_do.setY(_s.mainBar_do.h + 1);
			
			_s.adHolder_do.setWidth(_s.sW - _s.aopwBorderSize * 2);
			_s.adHolder_do.setX(_s.aopwBorderSize);
			_s.adHolder_do.setY(_s.mainBar_do.h + _s.aopwBorderSize + 1);
			_s.adHolder_do.setHeight(_s.sH - _s.mainBar_do.h - _s.aopwBorderSize * 2 - 1);
		};
		
		
		//###########################################//
		/* show / hide */
		//###########################################//
		_s.show = function(aopwSource){
			if(_s.isShowed_bl) return;
			_s.isShowed_bl = true;
			if(aopwSource) _s.aopwSource = aopwSource;
			prt.main_do.addChild(_s);
			_s.adHolder_do.setInnerHTML("<iframe width='100%' height='100%' scrolling='no' frameBorder='0' src=" + _s.aopwSource + "></iframe>");
			_s.positionAndResize();
			
			_s.title_do.setX(8);
			_s.title_do.setY(Math.round((_s.bar_do.h - _s.title_do.getHeight())/2));
		};
		
		_s.showCompleteHandler = function(){};
		
		_s.hide = function(){
			if(!_s.isShowed_bl) return;
			_s.isShowed_bl = false;
			if(prt.main_do.contains(_s)) prt.main_do.removeChild(_s);
		};
		
		_s.hideCompleteHandler = function(){
			prt.main_do.removeChild(_s);
			_s.dispatchEvent(FWDUVPOPWindow.HIDE_COMPLETE);
		};
		

		//##########################################//
		/* Update HEX color of a canvaas */
		//##########################################//
		_s.updateHEXColors = function(nBC, sBC){
			_s.clsBtn.updateHEXColors(nBC, sBC);
		}
	
		_s.init();
	};
		
		
	/* set prototype */
	FWDUVPOPWindow.setPrototype = function(){
		FWDUVPOPWindow.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPOPWindow.HIDE_COMPLETE = "hideComplete";
	
	FWDUVPOPWindow.prototype = null;
	window.FWDUVPOPWindow = FWDUVPOPWindow;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Password window.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPPassword = function(_d, prt, lg){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPPassword.prototype;
			
		_s.passColoseN_img = _d.passColoseN_img;
		_s.privateVideoPassword_str = _d.privateVideoPassword_str;
		_s.embedWindowBackground_str = _d.embedWindowBackground_str;
		
		_s.secondaryLabelsColor_str = _d.secondaryLabelsColor_str;
		_s.inputColor_str = _d.inputColor_str;
		_s.mainLabelsColor_str = _d.mainLabelsColor_str;
		_s.passButtonNPath_str = _d.passButtonNPath_str;
		_s.passButtonSPath_str = _d.passButtonSPath_str;
		_s.inputBackgroundColor_str = _d.inputBackgroundColor_str;
		_s.borderColor_str = _d.borderColor_str;
		
		_s.maxTextWidth = 0;
		_s.totalWidth = 0;
		_s.sW = 0;
		_s.sH = 0;
		_s.buttonWidth = 28;
		_s.buttonHeight = 19;
		_s.embedWindowCloseButtonMargins = _d.embedWindowCloseButtonMargins;
		_s.finalEmbedPath_str = null;
		
		_s.useVectorIcons_bl = _d.useVectorIcons_bl;
		_s.isMobile_bl = FWDUVPUtils.isMobile;

	
		//#################################//
		/* init */
		//#################################//
		_s.init = function(){
			if(_s.clsBtn) return;
			_s.setBackfaceVisibility();
			_s.mainHld = new FWDUVPDisplayObject("div");
			_s.mainHld.hasTransform3d_bl = false;
			_s.mainHld.hasTransform2d_bl = false;
			_s.mainHld.setBackfaceVisibility();
			
			_s.bk_do = new FWDUVPDisplayObject("div");
			_s.bk_do.getStyle().width = "100%";
			_s.bk_do.getStyle().height = "100%";
			_s.bk_do.setAlpha(.9);
			_s.bk_do.getStyle().background = "url('" + _s.embedWindowBackground_str + "')";
		
			_s.passMainHolder_do =  new FWDUVPDisplayObject("div");
			
			_s.passMainHldBk = new FWDUVPDisplayObject("div");
			_s.passMainHldBk.getStyle().background = "url('" + _s.embedWindowBackground_str + "')";
			_s.passMainHldBk.getStyle().borderStyle = "solid";
			_s.passMainHldBk.getStyle().borderWidth = "1px";
			_s.passMainHldBk.getStyle().borderColor =  _s.borderColor_str;
			
			_s.passMainLabel_do = new FWDUVPDisplayObject("div");
			_s.passMainLabel_do.screen.className = 'UVP-main-label';
			_s.passMainLabel_do.setBackfaceVisibility();
			_s.passMainLabel_do.screen.className = 'fwdeap-main-label'
			_s.passMainLabel_do.getStyle().fontFamily = "Arial";
			_s.passMainLabel_do.getStyle().fontSize= "12px";
			_s.passMainLabel_do.getStyle().color = _s.mainLabelsColor_str;
			_s.passMainLabel_do.getStyle().whiteSpace= "nowrap";
			_s.passMainLabel_do.getStyle().padding = "0px";
			_s.passMainLabel_do.setInnerHTML("PRIVATE VIDEO");	
			
			_s.passLabel_do = new FWDUVPDisplayObject("div");
			_s.passMainLabel_do.screen.className = 'UVP-main-label';
			_s.passLabel_do.setBackfaceVisibility();
			_s.passLabel_do.screen.className = 'fwdeap-label';
			_s.passLabel_do.getStyle().fontFamily = "Arial";
			_s.passLabel_do.getStyle().fontSize= "12px";
			_s.passLabel_do.getStyle().color = _s.secondaryLabelsColor_str;
			_s.passLabel_do.getStyle().whiteSpace= "nowrap";
	
			_s.passLabel_do.getStyle().padding = "0px";
			_s.passLabel_do.setInnerHTML("Please enter password:");
			
			_s.passInput_do = new FWDUVPDisplayObject("input");
			_s.passInput_do.screen.className = 'UVP-embed-inpt';
			_s.passInput_do.setBackfaceVisibility();
			_s.passInput_do.getStyle().fontFamily = "Arial";
			_s.passInput_do.getStyle().fontSize= "12px";
			_s.passInput_do.getStyle().backgroundColor = _s.inputBackgroundColor_str;
			_s.passInput_do.getStyle().color = _s.inputColor_str;
			_s.passInput_do.getStyle().outline = 0;
			_s.passInput_do.getStyle().whiteSpace= "nowrap";
			_s.passInput_do.getStyle().padding = "6px";
			_s.passInput_do.getStyle().paddingTop = "4px";
			_s.passInput_do.getStyle().paddingBottom = "4px";
			_s.passInput_do.screen.setAttribute("type", "password");
			
			if(!lg){
				FWDUVPSimpleSizeButton.setPrototype();
				_s.passBtn = new FWDUVPSimpleSizeButton(
						_s.passButtonNPath_str, 
						_s.passButtonSPath_str,
						_s.buttonWidth,
						_s.buttonHeight,
						_d.useHEX,
						_d.nBC,
						_d.sBC,
						true
						);
				_s.passBtn.getStyle().position = 'absolute';
				_s.passMainLabel_do.screen.className = 'fwduvp-ok-button';
				_s.passBtn.addListener(FWDUVPSimpleSizeButton.CLICK, _s.passClickHandler);
			
				//setup close button
				FWDUVPSimpleButton.setPrototype();
				if(_s.useVectorIcons_bl){
					_s.clsBtn = new FWDUVPSimpleButton(
							0, 0, 0, true, 0, 0, 0,
							"<div class='table-fwduvp-button'><span class='table-cell-fwduvp-button fwdicon-close'></span></div>",
							undefined,
							"UVPCloseButtonNormalState",
							"UVPCloseButtonSelectedState"
					);
					_s.clsBtn.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.closeButtonOnMouseUpHandler);
					_s.mainHld.addChild(_s.clsBtn); 
				
				}else{
					FWDUVPSimpleButton.setPrototype();
					_s.clsBtn = new FWDUVPSimpleButton(
						_s.passColoseN_img, 
						_d.embedWindowClosePathS_str, 
						0,
						true,
						_d.useHEX,
						_d.nBC,
						_d.sBC,
						0, 0, 0, 0, true);
				}
				_s.clsBtn.screen.className = 'fwduvp-close-button';
				_s.clsBtn.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.closeButtonOnMouseUpHandler);
				
				_s.addChild(_s.mainHld);
				_s.mainHld.addChild(_s.bk_do);
				
				_s.passMainHolder_do.addChild(_s.passMainHldBk);
				_s.passMainHolder_do.addChild(_s.passMainLabel_do);
				_s.passMainHolder_do.addChild(_s.passLabel_do);
				_s.passMainHolder_do.addChild(_s.passInput_do);
				_s.passMainHolder_do.addChild(_s.passBtn);
				_s.mainHld.addChild(_s.passMainHolder_do);
				_s.mainHld.addChild(_s.clsBtn); 
			}else{
				_s.addChild(_s.mainHld);
				_s.mainHld.addChild(_s.bk_do);
				_s.mainHld.addChild(_s.passLabel_do);
				_s.passLabel_do.getStyle().whiteSpace = "normal";
				_s.passLabel_do.getStyle().width = "calc(100% - 40px)";
				_s.passLabel_do.getStyle().textAlign = 'center';
				_s.passLabel_do.setInnerHTML(_d.playIfLoggedInMessage);

				var clsn = 'fwduvp-loggedin-message-white';
				if(_d.isDark){
					clsn = 'fwduvp-loggedin-message-dark';
				}
				_s.passLabel_do.screen.className = clsn;
				_s.passLabel_do.setOverflow('visible');

				FWDUVPSimpleButton.setPrototype();
				if(_s.useVectorIcons_bl){
					_s.clsBtn = new FWDUVPSimpleButton(
							0, 0, 0, true, 0, 0, 0,
							"<div class='table-fwduvp-button'><span class='table-cell-fwduvp-button fwdicon-close'></span></div>",
							undefined,
							"UVPCloseButtonNormalState",
							"UVPCloseButtonSelectedState"
					);
					_s.clsBtn.screen.className = 'fwduvp-close-button';
					_s.clsBtn.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.closeButtonOnMouseUpHandler);
					_s.mainHld.addChild(_s.clsBtn); 
				}else{

					var clsNImg = new Image();
					clsNImg.src = _s.passColoseN_img.src;
					clsNImg.onload = function(){
						//setup close button.
						FWDUVPSimpleButton.setPrototype();
						_s.clsBtn = new FWDUVPSimpleButton(
								clsNImg, 
								_d.embedWindowClosePathS_str, 
								undefined,
								true,
								_d.useHEX,
								_d.nBC,
								_d.sBC, 
								0, 0, 0, 0, true);
						_s.clsBtn.screen.className = 'fwduvp-close-button';
						_s.clsBtn.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.closeButtonOnMouseUpHandler);
						_s.mainHld.addChild(_s.clsBtn); 
						clsNImg.onload = null;
						_s.posClsBtn();
					}
				}
			}		

			_s.posClsBtn();
		};
	
		_s.closeButtonOnMouseUpHandler = function(){
			if(!_s.isShowed_bl) return;
			_s.hide();
		};
		
	
		function selectText(){
			if(window.top != window && FWDUVPUtils.isIE) return;
			var range, selection;
			if (document.body.createTextRange) {
				range = document.body.createTextRange();
			    range.moveToElementText(this);
			    range.select();
			}else if(window.getSelection && document.createRange) {
			    selection = window.getSelection();
			    range = document.createRange();
			    range.selectNodeContents(this);
			    selection.removeAllRanges();
			    selection.addRange(range);
			}
		};
		
		_s.positionAndResize = function(){
			_s.sW = prt.sW;
			_s.sH = prt.sH;
			
			_s.maxTextWidth = Math.min(_s.sW - 150, 300);
			_s.totalWidth = _s.maxTextWidth + _s.buttonWidth;
			
			_s.positionFinal();
			
			_s.setWidth(_s.sW);
			_s.setHeight(_s.sH);
			_s.mainHld.setWidth(_s.sW);
			_s.mainHld.setHeight(_s.sH);
		};

		_s.posClsBtn = function(){
			if(_s.clsBtn){
				_s.clsBtn.getStyle().left = 'auto';
				_s.clsBtn.getStyle().right = _s.embedWindowCloseButtonMargins + 'px';
				_s.clsBtn.getStyle().top = _s.embedWindowCloseButtonMargins + 'px';
			}
		}

		_s.positionFinal = function(){			
			var totalHeight;
			var textLableHeight = _s.passLabel_do.getHeight();
			var passMainLabelHeight;
			
			passMainLabelHeight = _s.passMainLabel_do.getHeight();

			if(!lg){
				_s.passMainLabel_do.setX(14);
				_s.passLabel_do.setX(14);
				_s.passLabel_do.setY(passMainLabelHeight + 14);
				
				_s.passInput_do.setX(10);
				_s.passInput_do.setWidth(parseInt(_s.totalWidth - 40 - _s.buttonWidth));
				_s.passInput_do.setY(_s.passLabel_do.y + textLableHeight + 5);
				_s.passBtn.setX(10 + _s.passInput_do.w + 20);
				_s.passBtn.setY(_s.passLabel_do.y + textLableHeight + 7);
				
				_s.passMainHldBk.setY(_s.passLabel_do.y - 9);
				_s.passMainHldBk.setWidth(_s.totalWidth - 2);
				_s.passMainHldBk.setHeight(_s.passBtn.y + _s.passBtn.h - 9);
				_s.passMainHolder_do.setWidth(_s.totalWidth);
				_s.passMainHolder_do.setHeight(_s.passBtn.y + _s.passBtn.h + 14);

				_s.passMainHolder_do.setX(Math.round((_s.sW - _s.totalWidth)/2));
				totalHeight = _s.passMainHldBk.getHeight();
				_s.passMainHolder_do.setY(Math.round((_s.sH - totalHeight)/2) - 10);
			}else{
				_s.passLabel_do.setX(Math.round((_s.sW - _s.passLabel_do.getWidth())/2));
				_s.passLabel_do.setY(Math.round((_s.sH - _s.passLabel_do.getHeight())/2));
			}
		};

		
		//##############################################//
		/* Send email */
		//##############################################//
		_s.passClickHandler = function(){
			
			var allow = true;
			var vidPass = prt._d.playlist_ar[prt.id]['privateVideoPassword_str'];
			var playlistPass = prt.playlistPass;

			if(playlistPass){
				if(playlistPass != FWDUVPUtils.MD5(_s.passInput_do.screen.value)){
					allow = false;
				}else{
					prt.plPassPassed = true;
				}
			}else if(vidPass){
				if(vidPass != FWDUVPUtils.MD5(_s.passInput_do.screen.value)){
					allow = false;
				}
			}else{
				if(_s.privateVideoPassword_str != FWDUVPUtils.MD5(_s.passInput_do.screen.value)){
					allow = false;
				}
			}
			if(!allow){
				if(!FWDAnimation.isTweening(_s.passInput_do.screen)) FWDAnimation.to(_s.passInput_do.screen, .1, {css:{backgroundColor:'#FF0000'}, yoyo:true, repeat:3});
				return;
			}
		
			_s.dispatchEvent(FWDUVPPassword.CORRECT);
		};
		

		//##########################################//
		/* Update HEX color of a canvaas */
		//##########################################//
		_s.updateHEXColors = function(nBC, sBC){
			_s.passBtn.updateHEXColors(nBC, sBC);
			_s.clsBtn.updateHEXColors(nBC, sBC);
		}
		

		/* show hide info */
		//#########################################//
		_s.showInfo = function(text, hasError){
				
			_s.infoText_do.setInnerHTML(text);
			_s.passMainHolder_do.addChild(_s.infoText_do);
			_s.infoText_do.setWidth(_s.buttonWidth);
			_s.infoText_do.setHeight(_s.buttonHeight - 4);
			_s.infoText_do.setX(_s.passBtn.x);
			_s.infoText_do.setY(_s.passBtn.y - 23);

			_s.infoText_do.setAlpha(0);
			if(hasError){
				_s.infoText_do.getStyle().color = "#FF0000";
			}else{
				_s.infoText_do.getStyle().color = _s.mainLabelsColor_str;
			}
			FWDAnimation.killTweensOf(_s.infoText_do);
			FWDAnimation.to(_s.infoText_do, .16, {alpha:1, yoyo:true, repeat:7});
		};

		
		//###########################################//
		/* show / hide */
		//###########################################//
		_s.show = function(id){
			if(_s.isShowed_bl) return;
			_s.isShowed_bl = true;
			prt.main_do.addChild(_s);
			_s.init();
			
			if(_s.passBtn){
				_s.passBtn.setSelectedState();
				_s.passInput_do.setInnerHTML("");
			}
			if(!FWDUVPUtils.isMobile || (FWDUVPUtils.isMobile && FWDUVPUtils.hasPointerEvent)) prt.main_do.setSelectable(true);
			_s.positionAndResize();
			
			clearTimeout(_s.hideCompleteId_to);
			clearTimeout(_s.showCompleteId_to);
			_s.mainHld.setY(- _s.sH);
			if(_s.passBtn){
				_s.passBtn.setNormalState();
			}
			_s.showCompleteId_to = setTimeout(_s.showCompleteHandler, 900);
			setTimeout(function(){
				_s.positionAndResize();
				FWDAnimation.to(_s.mainHld, .8, {y:0, delay:.1, ease:Expo.easeInOut});
			}, 100);
		};
		
		_s.showCompleteHandler = function(){};
		
		_s.hide = function(){
			if(!_s.isShowed_bl) return;
			_s.isShowed_bl = false;
			
			if(prt.customContextMenu_do) prt.customContextMenu_do.enable();
			_s.positionAndResize();
			
			clearTimeout(_s.hideCompleteId_to);
			clearTimeout(_s.showCompleteId_to);
			
			if(!FWDUVPUtils.isMobile || (FWDUVPUtils.isMobile && FWDUVPUtils.hasPointerEvent)) prt.main_do.setSelectable(false);
			_s.hideCompleteId_to = setTimeout(_s.hideCompleteHandler, 800);
			FWDAnimation.killTweensOf(_s.mainHld);
			FWDAnimation.to(_s.mainHld, .8, {y:-_s.sH, ease:Expo.easeInOut});
		};
		
		_s.hideCompleteHandler = function(){
			prt.main_do.removeChild(_s);
			_s.dispatchEvent(FWDUVPPassword.HIDE_COMPLETE);
		};
	
		if(_d.useHEX){
			_s.init();
		}
	};
	
		
	/* set prototype */
	FWDUVPPassword.setPrototype = function(){
		FWDUVPPassword.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPPassword.ERROR = "error";
	FWDUVPPassword.CORRECT = "correct";
	FWDUVPPassword.HIDE_COMPLETE = "hideComplete";
	
	FWDUVPPassword.prototype = null;
	window.FWDUVPPassword = FWDUVPPassword;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Playlist.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPPlaylist = function(
			prt, 
			_d
		){

		'use strict';
		
		var _s  = this;
		var prototype = FWDUVPPlaylist.prototype;
		
		_s.prt = prt;
		_s._d = _d;
		_s.prevN_img = _d.prevN_img;
		_s.nextN_img = _d.nextN_img;
		_s.replayN_img = _d.replayN_img;
		_s.shuffleN_img = _d.shuffleN_img;
		_s.scrBkTop_img = _d.scrBkTop_img;
		_s.scrDragTop_img = _d.scrDragTop_img;
		_s.scrLinesN_img = _d.scrLinesN_img;
		_s.buttons_ar = [];

		_s.useHEX = _d.useHEX; 
		_s.nBC = _d.nBC;
		_s.sBC = _d.sBC;
		
		_s.bkPath_str = _d.controllerBkPath_str;
		_s.position_str = prt.playlistPosition_str;
		_s.playlistBackgroundColor_str = _d.playlistBackgroundColor_str;
		_s.inputBackgroundColor_str = _d.searchInputBackgroundColor_str;
		_s.inputColor_str = _d.searchInputColor_str;
		_s.prevInputValue_str = "none";
		
		_s.showOnlyThmb = _d.showOnlyThumbnail;
		_s.scrWidth = _s.scrBkTop_img.width;
		_s.mouseX = 0;
		_s.mouseY = 0;
		_s.catId = -1;
		_s.dif = 0;
		_s.countLoadedThumbs = 0;
		_s.curId = -1;
		_s.finalX = 0;
		_s.finalY = 0;
		_s.controlBarHeight = _d.controllerHeight;
		_s.totalThumbs = 0;
		_s.totalWidth = prt.playlistWidth;
		_s.totalHeight = prt.playlistHeight;
		_s.dThumbW = _s.thumbImageW = _d.thumbnailWidth;
		_s.dThumbH = _s.thumbImageH = _d.thumbnailHeight;
		_s.thumbInPadding = 3;
		_s.spaceBetweenThumbnails = _d.spaceBetweenThumbnails;
		_s.startSpaceBetweenButtons = _d.startSpaceBetweenButtons;
		_s.spaceBetweenButtons = _d.spaceBetweenButtons;
	
		_s.totalButtons = 0;
		_s.buttonsToolTipHideDelay = _d.buttonsToolTipHideDelay;
		_s.removeFromThumbsHolderHeight = 0;
		_s.totalThumbsHeight = 0;
		_s.scrollBarHandlerFinalY = 0;
		_s.sW = _s.totalWidth;
		_s.sH = _s.totalHeight;
		_s.scrollbarOffestWidth = _d.scrollbarOffestWidth;
		_s.lastThumbnailFinalY = -1;
		_s.thumbsFinalY = 0;
		_s.scollbarSpeedSensitivity = _d.scollbarSpeedSensitivity;
		_s.vy = 0;
		_s.vy2 = 0;
		_s.friction = .9;
		
		_s.showThumbnail_bl = _d.showThumbnail_bl;

		_s.showPlaylistName_bl = _d.showPlaylistName_bl;
		_s.showController_bl = _d.showSearchInpt || _d.showNextAndPrevButtons_bl || _d.showLoopButton_bl || _d.showShuffleButton_bl;
		_s.loop_bl = _d.loop_bl;
		_s.shuffle_bl = _d.shuffle_bl;
		_s.showSearchInpt = _d.showSearchInpt;
		_s.allowToScrollAndScrollBarIsActive_bl = true;
		_s.showPlaylistToolTips_bl = _d.showPlaylistToolTips_bl;
		_s.showPlaylistByDefault_bl = _d.showPlaylistByDefault_bl;
		_s.repeatBackground_bl =  _d.repeatBackground_bl;
		_s.addMouseWheelSupport_bl = _d.addMouseWheelSupport_bl;
		_s.showNextAndPrevButtons_bl = _d.showNextAndPrevButtons_bl;
		_s.showShuffleButton_bl = _d.showShuffleButton_bl;
		_s.showLoopButton_bl = _d.showLoopButton_bl;
		_s.showButtonsToolTip_bl = _d.showButtonsToolTip_bl;
		_s.isShowed_bl = true;
		_s.usePlaylistsSelectBox_bl = _d.usePlaylistsSelectBox_bl;
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.addScrOnMM_bl = _d.addScrOnMM_bl;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		_s.useVectorIcons_bl = _d.useVectorIcons_bl;
		
		_s.init = function(){
			_s.setOverflow('hidden');
			_s.screen.className = 'fwduvp-playlist';

			_s.mainHld = new FWDUVPDisplayObject("div");
			_s.mainHld.screen.className = 'fwduvp-playlist-background';

			if(_d.isWhite){
				_s.mainHld.screen.className = 'fwduvp-playlist-background white';
			}

			_s.mainHld.setBkColor(_s.playlistBackgroundColor_str);
			
			_s.mainThumbsHolder_do = new FWDUVPDisplayObject("div");
			_s.mainThumbsHolder_do.screen.className = 'fwduvp-playlist-thumbs-holder';
			_s.mainThumbsHolder_do.setBkColor(_s.playlistBackgroundColor_str);
			
			_s.thumbsHolder_do = new FWDUVPDisplayObject("div");
			_s.thumbsHolder_do.setOverflow("visible");
			_s.mainThumbsHolder_do.addChild(_s.thumbsHolder_do);
			_s.mainHld.addChild(_s.mainThumbsHolder_do);
			_s.addChild(_s.mainHld);

			
			if(_s.showController_bl){
				_s.controllBar_do = new FWDUVPDisplayObject("div");
				
				if(_s.repeatBackground_bl){
					_s.controllerBk_do =  new FWDUVPDisplayObject("div");
					_s.controllerBk_do.getStyle().background = "url('" + _s.bkPath_str +  "')";
				}else{
					_s.controllerBk_do = new FWDUVPDisplayObject("img");
					var imageBk_img = new Image();
					imageBk_img.src = _s.bkPath_str;
					_s.controllerBk_do.setScreen(imageBk_img);
				}
				
				_s.controllerBk_do.setHeight(_s.controlBarHeight);
				_s.controllerBk_do.getStyle().width = "100%";
				
				_s.controllBar_do.addChild(_s.controllerBk_do);
				_s.controllBar_do.setHeight(_s.controlBarHeight);
				_s.mainHld.addChild(_s.controllBar_do);
			}
			
			if(_s.showShuffleButton_bl) _s.setupShuffleButton();
			if(_s.showLoopButton_bl) _s.setupLoopButton();
			if(_s.showNextAndPrevButtons_bl){
				_s.setupPrevButton();
				_s.setupNextButton();
			}
			
			if(_s.showButtonsToolTip_bl) _s.setupToolTips();
			_s.totalButtons = _s.buttons_ar.length;
		
			if(_s.showSearchInpt && _s.showController_bl) _s.setupInput();
			
			if(_s.showController_bl){
				_s.removeFromThumbsHolderHeight = _s.controllBar_do.h + _s.spaceBetweenThumbnails;
			}
			
			_s.setupMobileScrollbar();
			if(!_s.isMbl) _s.setupScrollbar();
			if(_s.addMouseWheelSupport_bl) _s.addMouseWheelSupport();
			
			if(_s.showPlaylistName_bl){
				_s.setupPlaylistName();
				_s.removeFromThumbsHolderHeight += _s.controlBarHeight + _s.spaceBetweenThumbnails;
				_s.mainThumbsHolder_do.setY(_s.controlBarHeight + _s.spaceBetweenThumbnails);
				if(_s.scrMainHolder_do) _s.scrMainHolder_do.setY(_s.mainThumbsHolder_do.y);
			}

			var ec = prt.ec;
			if(ec){
				_s.ec = new FWDUVPDisplayObject("div", 'relative');
				_s.ec.setInnerHTML(ec.innerHTML);
				prt.main_do.addChild(_s.ec);
				_s.positionEc();
			}
			
			if(!_s.showPlaylistByDefault_bl){
				_s.hide();
			}
		};

		_s.positionEc =  function(){
			if(_s.ec){
				_s.ec.setWidth(_s.sW);
				_s.ec.setX(prt.sW - _s.sW);
				_s.ec.setY(0);
			}
		}
		
		
		//#####################################//
		/* resize and position */
		//#####################################//
		_s.resizeAndPosition = function(resizePlaylistWithAnim){
			
			if(!prt.sW) return;
			
			var offset = 0;
			if(_s.ec){
				offset = Math.round(_s.ec.getHeight());
				_s.positionEc();
			}
			
			if(_s.position_str == "bottom"){
				_s.sW = prt.sW;
				_s.sH = prt.playlistHeight;
				if(_s.showOnlyThmb){
					_s.thumbImageW = _s.sW - _s.scrWidth;
				}
				_s.finalX = 0;
				_s.finalY = prt.tempVidStageHeight + prt.spaceBetweenControllerAndPlaylist;
			}else{
				_s.sW = _s.totalWidth;
				if(_s.showOnlyThmb){
					_s.thumbImageW = _s.sW - _s.scrWidth;
				}
				_s.sH = prt.sH - offset;
				_s.finalX = prt.sW - _s.totalWidth;
				_s.finalY = 0;
			}
			
			if(_s.comboBox_do) _s.comboBox_do.resizeAndPosition();
			
			if(_s.bk_do){
				_s.bk_do.setWidth(_s.sW);
				_s.bk_do.setHeight(_s.sH);
			}
			
			_s.positionThumbs(resizePlaylistWithAnim);
			
			if(_s.allowToScrollAndScrollBarIsActive_bl && _s.scrMainHolder_do){
				_s.mainThumbsHolder_do.setWidth(_s.sW - _s.scrollbarOffestWidth + 1);
			}else{
				_s.mainThumbsHolder_do.setWidth(_s.sW);
			}
			_s.mainThumbsHolder_do.setHeight(_s.sH - _s.removeFromThumbsHolderHeight);
			if(_s.scrHandler_do)  _s.updateScrollBarSizeActiveAndDeactivate();
			
			if(_s.controllBar_do) _s.positionControllBar();
			_s.updateScrollBarHandlerAndContent(resizePlaylistWithAnim);

			
			_s.setWidth(_s.sW);
			_s.setHeight(_s.sH + offset);
			_s.setX(_s.finalX);
			_s.setY(_s.finalY + offset);
			_s.mainHld.setWidth(_s.sW);
			_s.mainHld.setHeight(_s.sH);
		};

		
		//#################################//
		/* update playlist */
		//#################################//
		_s.updatePlaylist = function(playlist, catId, id, playlistName){
			
			clearTimeout(_s.populateNextItemId_to);
			_s.hasPlaylist_bl = true;
			_s.catId = catId;
			_s.curId = id;
			
			_s.playlist_ar = playlist;	
			_s.countLoadedThumbs = 0;
			_s.allowToScrollAndScrollBarIsActive_bl = false;
				
			if(_s.input_do){
				_s.hasInputFocus_bl = false;
				_s.input_do.screen.value = "Search";
			}
				
			_s.setupThumbnails();
			_s.updatePlaylistName(playlistName);
			if(_s.showThumbnail_bl) _s.loadImages();
			if(_s.comboBox_do) _s.comboBox_do.setButtonsStateBasedOnId(_s.catId);

			_s.hideAndShow(true);
			_s.thumbsHolder_do.setY(0);
			_s.resizeAndPosition();

			if(_s.scrHandler_do){
				_s.updateScrollBarSizeActiveAndDeactivate();
				_s.updateScrollBarHandlerAndContent(false, true);
			}
		};
		
	
		_s.destroyPlaylist = function(){
			if(!_s.thumbs_ar) return;
			var thumb;

			_s.stopToUpdateDrag();

			_s.hasPlaylist_bl = false;
			if(_s.image_img){
				_s.image_img.onerror = null;
				_s.image_img.onload = null;
			}
			
			FWDAnimation.killTweensOf(_s.mainHld);
			if(_s.position_str == "bottom"){
				_s.mainHld.setY(-_s.sH - 5);
			}else{
				_s.mainHld.setX(-_s.sW - 5);
			}

			if(_s.ec){
				_s.ec.setX(-5000);
			}
			
			clearTimeout(_s.loadWithDelayId_to);
			for(var i=0; i<_s.totalThumbs; i++){
				thumb = _s.thumbs_ar[i];
				_s.thumbsHolder_do.removeChild(thumb);
				thumb.destroy();
			}
			_s.thumbs_ar = null;
		};

		
		//#################################################//
		/* Setup combo-box */
		//#################################################//
		_s.setupcomboBox = function(){
			_s.labels_ar = [];
			for (var i=0; i<_d.cats_ar.length; i++){
				_s.labels_ar[i] = _d.cats_ar[i].playlistName;
			}

			var settingsObj ={
				categories_ar:_s.labels_ar,
				selectorLabel:_s.labels_ar[0],
				selectorBackgroundNormalColor:_d.mainSelectorBackgroundSelectedColor,
				selectorTextNormalColor:_d.mainSelectorTextNormalColor,
				selectorTextSelectedColor:_d.mainSelectorTextSelectedColor,
				buttonBackgroundNormalColor:_d.mainButtonBackgroundNormalColor,
				buttonBackgroundSelectedColor:_d.mainButtonBackgroundSelectedColor,
				buttonTextNormalColor:_d.mainButtonTextNormalColor,
				buttonTextSelectedColor:_d.mainButtonTextSelectedColor,
				buttonHeight:_s.controlBarHeight,
				arrowN_str:_d.arrowN_str,
				arrowS_str:_d.arrowS_str,
				arrowW:11,
				arrowH:6
			}
			
			FWDUVPComboBox.setPrototype();
			_s.comboBox_do = new FWDUVPComboBox(_s, settingsObj);
			_s.comboBox_do.addListener(FWDUVPComboBox.BUTTON_PRESSED, _s.changePlaylistOnClick);
			_s.mainHld.addChild(_s.comboBox_do);
		}
		
		_s.changePlaylistOnClick = function(e){
			_s.dispatchEvent(FWDUVPPlaylist.CHANGE_PLAYLIST, {id:e.id});
		}

		
		//#################################################//
		/* Setup playlist name */
		//#################################################//
		_s.setupPlaylistName = function(){
			
			_s.playlistNameHolder_do =  new FWDUVPDisplayObject("div");
			_s.playlistNameHolder_do.setHeight(_s.controlBarHeight);
			_s.playlistNameHolder_do.getStyle().width = "100%";
	
			if(_s.repeatBackground_bl){
				_s.playlistNameBk_do =  new FWDUVPDisplayObject("div");
				_s.playlistNameBk_do.getStyle().background = "url('" + _s.bkPath_str +  "')";
			}else{
				_s.playlistNameBk_do = new FWDUVPDisplayObject("img");
				var imageBk_img = new Image();
				imageBk_img.src = _s.bkPath_str;
				_s.playlistNameBk_do.setScreen(imageBk_img);
			}
			
			_s.playlistNameBk_do.getStyle().width = "100%";
			_s.playlistNameBk_do.getStyle().height = "100%"

			_s.playlistName_do = new FWDUVPDisplayObject("div");
			_s.playlistName_do.getStyle().width = "100%";
			_s.playlistName_do.screen.className = 'fwduvp-playlist-name';
			_s.playlistName_do.getStyle().textAlign = "center";
			_s.playlistName_do.getStyle().fontSmoothing = "antialiased";
			_s.playlistName_do.getStyle().webkitFontSmoothing = "antialiased";
			_s.playlistName_do.getStyle().textRendering = "optimizeLegibility";
			_s.playlistName_do.getStyle().fontFamily = "Arial";
			_s.playlistName_do.getStyle().fontSize= "14px";
			_s.playlistName_do.getStyle().color = _d.playlistNameColor_str;
			
			_s.playlistNameHolder_do.addChild(_s.playlistNameBk_do);	
			
			if(!_s.usePlaylistsSelectBox_bl){
				_s.playlistNameHolder_do.addChild(_s.playlistName_do);
			}
			_s.mainHld.addChild(_s.playlistNameHolder_do);
			if(_s.usePlaylistsSelectBox_bl){
				_s.setupcomboBox();
				if(_s.controllBar_do){
					_s.mainHld.addChild(_s.controllBar_do);
				}
			} 
		};
		
		_s.updatePlaylistName = function(label){
			
			if(!_s.playlistName_do) return;
			_s.playlistName_do.setInnerHTML(label);
			
			setTimeout(function(){
				_s.playlistName_do.setY(parseInt((_s.playlistNameHolder_do.h - _s.playlistName_do.getHeight())/2) + 1);
			}, 50);
		};

		
		//################################################//
		/* setup input */
		//################################################//
		_s.setupInput = function(){
			
			_s.input_do = new FWDUVPDisplayObject("input");
			_s.input_do.screen.maxLength = 20;
			_s.input_do.screen.className = 'fwduvp-search';
			_s.input_do.getStyle().textAlign = "left";
			_s.input_do.getStyle().outline = "none";
			_s.input_do.getStyle().boxShadow  = "none";
			_s.input_do.getStyle().fontFamily = "Arial";
			_s.input_do.getStyle().fontSize= "12px";
			_s.input_do.getStyle().padding =  '7px 10px 7px';
			_s.input_do.getStyle().boxSizing = 'border-box';
			if(!FWDUVPUtils.isIEAndLessThen9) _s.input_do.getStyle().paddingRight = "-6px";
			_s.input_do.getStyle().backgroundColor = _s.inputBackgroundColor_str;
			_s.input_do.getStyle().color = _s.inputColor_str;
			_s.input_do.screen.value = "Search";
			
			_s.noSearchFound_do = new FWDUVPDisplayObject("div");
			_s.noSearchFound_do.setX(0);
			_s.noSearchFound_do.screen.className = 'fwduvp-search-not-found';
			_s.noSearchFound_do.getStyle().textAlign = "center";
			_s.noSearchFound_do.getStyle().width = "100%";
			_s.noSearchFound_do.getStyle().fontFamily = "Arial";
			_s.noSearchFound_do.getStyle().fontSize= "12px";
			_s.noSearchFound_do.getStyle().color = _s.inputColor_str;
			_s.noSearchFound_do.setInnerHTML("NOTHING FOUND!");
			_s.noSearchFound_do.setVisible(false);
			_s.mainHld.addChild(_s.noSearchFound_do);
			
			if(_s.hasPointerEvent_bl){
				_s.input_do.screen.addEventListener("pointerdown", _s.inputFocusInHandler);
			}else if(_s.input_do.screen.addEventListener){
				_s.input_do.screen.addEventListener("mousedown", _s.inputFocusInHandler);
				_s.input_do.screen.addEventListener("touchstart", _s.inputFocusInHandler);
			}
			
			_s.input_do.screen.addEventListener("keyup", _s.keyUpHandler);
			
			var inputArrow_img = new Image();
			inputArrow_img.src = _d.inputArrowPath_str;
			_s.inputArrow_do = new FWDUVPDisplayObject("img"); 
			_s.inputArrow_do.setScreen(inputArrow_img);
			_s.inputArrow_do.setWidth(12);
			_s.inputArrow_do.setHeight(12);
			
			_s.controllBar_do.addChild(_s.input_do);
			_s.controllBar_do.addChild(_s.inputArrow_do);
		};
		
		_s.inputFocusInHandler = function(){
			
			if(_s.hasInputFocus_bl) return;
			
			_s.hasInputFocus_bl = true;
			
			if(_s.input_do.screen.value == "Search"){
				_s.input_do.screen.value = "";
			}
			
			_s.input_do.screen.focus();
			
			setTimeout(function(){
				if(_s.hasPointerEvent_bl){
					window.addEventListener("pointerdown", _s.inputFocusOutHandler);
				}else if(window.addEventListener){
					window.addEventListener("mousedown", _s.inputFocusOutHandler);
					window.addEventListener("touchstart", _s.inputFocusOutHandler);
				}
				FWDUVPlayer.isSearchedFocused_bl = true;
			}, 50);
		};
		
		_s.inputFocusOutHandler = function(e){
			
			FWDUVPlayer.isSearchedFocused_bl = false;
			if(!_s.hasInputFocus_bl) return;
			
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			if(!FWDUVPUtils.hitTest(_s.input_do.screen, vc.screenX, vc.screenY)){
				_s.hasInputFocus_bl = false;
				if(_s.input_do.screen.value == ""){
					_s.input_do.screen.value = "Search";
					if(_s.hasPointerEvent_bl){
						window.removeEventListener("pointerdown", _s.inputFocusOutHandler);
					}else if(window.removeEventListener){
						window.removeEventListener("mousedown", _s.inputFocusOutHandler);
						window.removeEventListener("touchstart", _s.inputFocusOutHandler);
					}
				}
				return;
			}
		};
		
		_s.keyUpHandler = function(e){
			if(e.stopPropagation) e.stopPropagation();
			if(_s.prevInputValue_str != _s.input_do.screen.value){
				if(_s.isMbl){
					_s.positionThumbs(false);
					_s.thumbsFinalY = Math.round((_s.curId/(_s.totalThumbs - 1)) * (_s.totalThumbsHeight - _s.mainThumbsHolder_do.h)) * -1;
				}else{
					_s.positionThumbs(true);
				}
			}
			
			_s.prevInputValue_str = _s.input_do.screen.value;
			
			if(_s.scrHandler_do){
				_s.updateScrollBarSizeActiveAndDeactivate();
				_s.updateScrollBarHandlerAndContent(true, true);
			}
		};
		
		_s.showNothingFound = function(){
			if(_s.isShowNothingFound_bl) return;
			_s.isShowNothingFound_bl = true;
			
			_s.noSearchFound_do.setVisible(true);
			_s.noSearchFound_do.setY(parseInt((_s.sH - _s.noSearchFound_do.getHeight())/2));
			_s.noSearchFound_do.setAlpha(0);
			FWDAnimation.to(_s.noSearchFound_do, .1, {alpha:1, yoyo:true, repeat:4});
		};
		
		_s.hideNothingFound = function(){
			if(!_s.isShowNothingFound_bl) return;
			_s.isShowNothingFound_bl = false;
			
			FWDAnimation.killTweensOf(_s.noSearchFound_do);
			_s.noSearchFound_do.setVisible(false);
		};
		

		//##########################################//
		/* position controllbar */
		//##########################################//
		_s.positionControllBar = function(){
			
			var inputWidth;
			var button;
			var prevButton;
			
			if(_s.input_do && _s.sW <= 340){
				inputWidth = _s.sW - (_s.startSpaceBetweenButtons * 2);
				
				if(_s.nextButton_do) inputWidth -= _s.nextButton_do.w + _s.spaceBetweenButtons;
				if(_s.prevButton_do) inputWidth -= _s.prevButton_do.w + _s.spaceBetweenButtons;
				if(_s.shuffleButton_do) inputWidth -= _s.shuffleButton_do.w + _s.spaceBetweenButtons;
				if(_s.loopButton_do) inputWidth -= _s.loopButton_do.w + _s.spaceBetweenButtons;
				
				for(var i=0; i<_s.totalButtons; i++){
					button = _s.buttons_ar[_s.totalButtons - 1 - i];
					prevButton = _s.buttons_ar[_s.totalButtons - i];
					if(i == 0){
						button.setX(_s.sW - button.w - _s.startSpaceBetweenButtons);
					}else{
						button.setX(prevButton.x - prevButton.w - _s.spaceBetweenButtons);
					}
					
					button.setY(parseInt((_s.controllBar_do.h - button.h)/2));
				}
			}else if(_s.input_do && _s.sW > 340){
				inputWidth = _s.sW - (_s.startSpaceBetweenButtons * 2) + _s.spaceBetweenButtons - 2;
				if(inputWidth > 350) inputWidth = 350;
				
				if(_s.nextButton_do)inputWidth -= _s.nextButton_do.w + _s.spaceBetweenButtons;
				if(_s.prevButton_do)inputWidth -= _s.prevButton_do.w + _s.spaceBetweenButtons;
				if(_s.shuffleButton_do) inputWidth -= _s.shuffleButton_do.w + _s.spaceBetweenButtons;
				if(_s.loopButton_do) inputWidth -= _s.loopButton_do.w + _s.spaceBetweenButtons;
				
				for(var i=0; i<_s.totalButtons; i++){
					button = _s.buttons_ar[_s.totalButtons - 1 - i];
					prevButton = _s.buttons_ar[_s.totalButtons - i];
					if(i == 0){
						button.setX(_s.sW - button.w - _s.startSpaceBetweenButtons);
					}else{
						button.setX(prevButton.x - prevButton.w - _s.spaceBetweenButtons);
					}
					
					button.setY(parseInt((_s.controllBar_do.h - button.h)/2));
				}
			}else{
				if(_s.shuffleButton_do){
					_s.shuffleButton_do.setX(_s.spaceBetweenButtons);
					_s.shuffleButton_do.setY(parseInt((_s.controllBar_do.h - _s.shuffleButton_do.h)/2));
					if(_s.loopButton_do){
						_s.loopButton_do.setX(_s.shuffleButton_do.x + _s.shuffleButton_do.w + _s.spaceBetweenButtons);
						_s.loopButton_do.setY(parseInt((_s.controllBar_do.h - _s.shuffleButton_do.h)/2));
					}
				}else if(_s.loopButton_do){
					_s.loopButton_do.setX(_s.spaceBetweenButtons);
					_s.loopButton_do.setY(parseInt((_s.controllBar_do.h - _s.loopButton_do.h)/2));
				}
				
				if(_s.nextButton_do){
					_s.nextButton_do.setX(_s.sW - _s.nextButton_do.w - _s.startSpaceBetweenButtons);
					_s.nextButton_do.setY(parseInt((_s.controllBar_do.h - _s.nextButton_do.h)/2));
					
					_s.prevButton_do.setX(_s.nextButton_do.x - _s.nextButton_do.w - _s.spaceBetweenButtons);
					_s.prevButton_do.setY(parseInt((_s.controllBar_do.h - _s.prevButton_do.h)/2));
				}
			}
			
			if(_s.input_do){
				_s.input_do.setWidth(inputWidth);
				_s.input_do.setX(_s.startSpaceBetweenButtons);
				_s.input_do.setY(parseInt((_s.controllBar_do.h - _s.input_do.getHeight())/2));
				_s.inputArrow_do.setX(parseInt(_s.input_do.x + _s.input_do.getWidth()) - _s.inputArrow_do.w - 7);
				_s.inputArrow_do.setY(parseInt((_s.controllBar_do.h - _s.inputArrow_do.h)/2));
			}
		
			_s.controllBar_do.setWidth(_s.sW);
			_s.controllBar_do.setY(_s.sH - _s.controllBar_do.h);
		};

		
		//################################################//
		/* Setup prev button */
		//################################################//
		_s.setupPrevButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.prevButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-FF-left'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.prevButton_do = new FWDUVPSimpleButton(_s.prevN_img, _d.prevSPath_str, undefined, true, 
				_d.useHEX,
				_d.nBC,
				_d.sBC);
			}

			_s.prevButton_do.screen.className = 'fwduvp-prev-button';
			_s.prevButton_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.prevButtonShowTooltipHandler);
			_s.prevButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.prevButtonOnMouseUpHandler);
			_s.buttons_ar.push(_s.prevButton_do);
			_s.controllBar_do.addChild(_s.prevButton_do); 
		};
		
		_s.prevButtonShowTooltipHandler = function(e){
			_s.showToolTip(_s.prevButton_do, _s.prevButtonToolTip_do, e.e);
		};
		
		_s.prevButtonOnMouseUpHandler = function(){
			_s.dispatchEvent(FWDUVPPlaylist.PLAY_PREV_VIDEO);
		};
		

		//################################################//
		/* Setup next button */
		//################################################//
		_s.setupNextButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.nextButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-FF-right'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.nextButton_do = new FWDUVPSimpleButton(_s.nextN_img, _d.nextSPath_str, undefined, true, 
				_d.useHEX,
				_d.nBC,
				_d.sBC);
			}

			_s.nextButton_do.screen.className = 'fwduvp-next-button';
			_s.nextButton_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.nextButtonShowTooltipHandler);
			_s.nextButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.nextButtonOnMouseUpHandler);
			_s.buttons_ar.push(_s.nextButton_do);
			_s.controllBar_do.addChild(_s.nextButton_do);
		};
		
		_s.nextButtonShowTooltipHandler = function(e){
			_s.showToolTip(_s.nextButton_do, _s.nextButtonToolTip_do, e.e);
		};
		
		_s.nextButtonOnMouseUpHandler = function(){
			_s.dispatchEvent(FWDUVPPlaylist.PLAY_NEXT_VIDEO);
		};
		

		//##########################################//
		/* Setup shuffle button */
		//#########################################//
		_s.setupShuffleButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.shuffleButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-shuffle'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.shuffleButton_do = new FWDUVPSimpleButton(_s.shuffleN_img, _d.shufflePathS_str, undefined, true, 
				_d.useHEX,
				_d.nBC,
				_d.sBC);
			}

			_s.shuffleButton_do.screen.className = 'fwduvp-shuffle-button';
			_s.shuffleButton_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.shuffleButtonShowToolTipHandler);
			_s.shuffleButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.shuffleButtonOnMouseUpHandler);
			_s.buttons_ar.push(_s.shuffleButton_do);
			_s.controllBar_do.addChild(_s.shuffleButton_do); 
			if(!_s.loop_bl && _s.shuffle_bl) _s.setShuffleButtonState("selected");
		};
		
		_s.shuffleButtonShowToolTipHandler = function(e){
			_s.showToolTip(_s.shuffleButton_do, _s.shuffleButtonToolTip_do, e.e);
		};
		
		_s.shuffleButtonOnMouseUpHandler = function(){
			if(_s.shuffleButton_do.isSelectedFinal_bl){
				_s.dispatchEvent(FWDUVPPlaylist.DISABLE_SHUFFLE);
			}else{
				_s.dispatchEvent(FWDUVPPlaylist.ENABLE_SHUFFLE);
			}
		};
		
		_s.setShuffleButtonState = function(state){	
			if(!_s.shuffleButton_do) return;
			if(state == "selected"){
				_s.shuffleButton_do.setSelected();
			}else if(state == "unselected"){
				_s.shuffleButton_do.setUnselected();
			}
		};
		

		//##########################################//
		/* Setup loop button */
		//#########################################//
		_s.setupLoopButton = function(){
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.loopButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='fwdicon fwdicon-loop'></span>",
						undefined,
						"UVPMainButtonsNormalState",
						"UVPMainButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.loopButton_do = new FWDUVPSimpleButton(_s.replayN_img, _d.replaySPath_str, undefined, true, 
				_d.useHEX,
				_d.nBC,
				_d.sBC);
			}

			_s.loopButton_do.screen.className = 'fwduvp-loop-button';
			_s.loopButton_do.addListener(FWDUVPSimpleButton.SHOW_TOOLTIP, _s.loopButtonShowTooltipHandler);
			_s.loopButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.loopButtonOnMouseUpHandler);
			_s.buttons_ar.push(_s.loopButton_do);
			_s.controllBar_do.addChild(_s.loopButton_do); 
			if(_s.loop_bl) _s.setLoopStateButton("selected");
		};
		
		
		_s.loopButtonShowTooltipHandler = function(e){
			_s.showToolTip(_s.loopButton_do, _s.loopButtonToolTip_do, e.e);
		};
		
		_s.loopButtonOnMouseUpHandler = function(){
			if(_s.loopButton_do.isSelectedFinal_bl){
				_s.dispatchEvent(FWDUVPPlaylist.DISABLE_LOOP);
			}else{
				_s.dispatchEvent(FWDUVPPlaylist.ENABLE_LOOP);
			}
		};
		
		
		_s.setLoopStateButton = function(state){
			if(!_s.loopButton_do) return;
			if(state == "selected"){
				_s.loopButton_do.setSelected();
			}else if(state == "unselected"){
				_s.loopButton_do.setUnselected();
			}
		};
		

		//################################//
		/* Setup tooltips */
		//################################//		
		_s.setupToolTips = function(){
			
			if(_s.showNextAndPrevButtons_bl){
				FWDUVPToolTip.setPrototype();
				_s.prevButtonToolTip_do = new FWDUVPToolTip(_s.prevButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "previous video", _d.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.prevButtonToolTip_do.screen);
				
				FWDUVPToolTip.setPrototype();
				_s.nextButtonToolTip_do = new FWDUVPToolTip(_s.nextButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "next video", _d.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.nextButtonToolTip_do.screen);
			}
		
			if(_s.showShuffleButton_bl){
				FWDUVPToolTip.setPrototype();
				_s.shuffleButtonToolTip_do = new FWDUVPToolTip(_s.shuffleButton_do, _d.toopTipBk_str, _d.toopTipPointer_str,  "shuffle", _d.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.shuffleButtonToolTip_do.screen);
			}
			
			if(_s.showLoopButton_bl){
				FWDUVPToolTip.setPrototype();
				_s.loopButtonToolTip_do = new FWDUVPToolTip(_s.loopButton_do, _d.toopTipBk_str, _d.toopTipPointer_str, "loop", _d.buttonsToolTipFontColor_str, _s.buttonsToolTipHideDelay);
				document.documentElement.appendChild(_s.loopButtonToolTip_do.screen);
			}
		};
		
		_s.showToolTip = function(button, toolTip, e){
			if(!_s.showButtonsToolTip_bl) return;
			var ws = FWDUVPUtils.getViewportSize();
			var wc = FWDUVPUtils.getViewportMouseCoordinates(e);
			var localX;
			var localY;
			
			if(button.screen.offsetWidth < 3){
				localX = parseInt(button.getGlobalX() * 100 + button.w/2 - toolTip.w/2);
				localY = parseInt(button.getGlobalY() * 100 - toolTip.h - 8);
			}else{
				localX = parseInt(button.getGlobalX() + button.w/2 - toolTip.w/2);
				localY = parseInt(button.getGlobalY() - toolTip.h - 8);
			}
			
			var offseX = 0;
		
			if(localX < 0){
				offseX = localX;
				localX = 0;
			}else if(localX + toolTip.w > ws.w){
				offseX = (ws.w - (localX + toolTip.w)) * -1;
				localX = localX + (offseX * -1);
			}
			
			toolTip.positionPointer(offseX, false);
			
			toolTip.setX(localX);
			toolTip.setY(localY);
			toolTip.show();
		};
		
		_s.setupThumbnails = function(){
			_s.totalThumbs = _s.playlist_ar.length;
			_s.thumbs_ar = [];
			var thumb;
			var nClr = _d.thumbnailNormalBackgroundColor_str;
			var sClr = _d.thumbnailHoverBackgroundColor_str;
			var dClr = _d.thumbnailDisabledBackgroundColor_str;
			
			if(window['isWhite']){
				nClr = '#FFFFFF';
				sClr = dClr = '#EEEEEE';
			}

			for(var i=0; i<_s.totalThumbs; i++){
				FWDUVPPlaylistThumb.setPrototype();
				thumb = new FWDUVPPlaylistThumb(
						_s, 
						i, 
						_d.playlistThumbnailsBkPath_str,
						nClr,
						sClr,
						dClr,
						_s.thumbImageW,
						_s.thumbImageH,
						_s.thumbInPadding,
						_s.playlist_ar[i].title,
						_s.playlist_ar[i].titleText,
						_s.showThumbnail_bl);
				
				_s.thumbs_ar[i] = thumb;
			
				thumb.addListener(FWDUVPPlaylistThumb.MOUSE_UP, _s.thumbMouseUpHandler);
				_s.thumbsHolder_do.addChild(thumb);
			}
		};
		
		_s.thumbMouseUpHandler = function(e){
			if(_s.disableThumbs_bl) return;
			_s.disableForAWhileAfterThumbClick_bl = true;
			clearTimeout(_s.disableForAWhileAfterThumbClickId_to);
			_s.disableForAWhileAfterThumbClickId_to = setTimeout(function(){
				_s.disableForAWhileAfterThumbClick_bl = false;
			}, 200);
			_s.dispatchEvent(FWDUVPPlaylist.THUMB_MOUSE_UP, {id:e.id});
		};
		

		//#############################################//
		/* load thumbnail images */
		//#############################################//
		_s.loadImages = function(){
			if(!_s.playlist_ar[_s.countLoadedThumbs]) return;
			if(_s.image_img){
				_s.image_img.onload = null;
				_s.image_img.onerror = null;
			}
			
			_s.image_img = new Image();
			_s.image_img.onerror = _s.onImageLoadError;
			_s.image_img.onload = _s.onImageLoadComplete;
			
			_s.image_img.src = _s.playlist_ar[_s.countLoadedThumbs].thumbSource;
		};
		
		_s.onImageLoadError = function(e){};
		
		_s.onImageLoadComplete = function(e){
			var thumb = _s.thumbs_ar[_s.countLoadedThumbs];
			thumb.setImage(_s.image_img);
			_s.countLoadedThumbs++;
			_s.loadWithDelayId_to = setTimeout(_s.loadImages, 40);	
		};
		

		//#####################################//
		/* enable disable thumbs based on id */
		//#####################################//
		_s.checkThumbsState = function(){
			if(!_s.thumbs_ar) return;
			var thumb;
			for(var i=0; i< _s.totalThumbs; i++){
				thumb = _s.thumbs_ar[i];
				if(i == _s.curId){
					thumb.disable();
				}else{
					thumb.enable();
				}
			};
		};
		
		_s.positionThumbs = function(animate){
			if(!_s.thumbs_ar) return;
			var thumb;
			var curX;
			var curY;
			var inputValue;
			var tmpSpaceBetwThmbs = _s.spaceBetweenThumbnails;
			var copy_ar = [].concat(_s.thumbs_ar);
			_s.isSearched_bl = false;
		
			if(_s.input_do){
				inputValue = _s.input_do.screen.value.toLowerCase();
				if(inputValue.toLowerCase() != "Search".toLowerCase()){
					for(var i=0; i<copy_ar.length; i++){
						thumb = copy_ar[i];
						
						if(thumb.htmlText_str.indexOf(inputValue) == -1){
							FWDAnimation.killTweensOf(thumb);
							thumb.setX(-thumb.w - 20);
							copy_ar.splice(i, 1);
							i--;
						}
					}
				}
			}
		
			var totalThumbs = copy_ar.length;
			if(_s.totalThumbs != totalThumbs) _s.isSearched_bl = true;
		
			for(var i=0; i<totalThumbs; i++){
				thumb = copy_ar[i];
				thumb.thumbImageWidth = _s.thumbImageW;
				thumb.thumbImageHeight = _s.thumbImageH;
				thumb.finalW = _s.sW;
				thumb.finalX = 0;
				thumb.finalY = i * (thumb.finalH + tmpSpaceBetwThmbs);
				thumb.resizeAndPosition(animate);
			}
			
			if(totalThumbs == 0){
				_s.showNothingFound();
			}else{
				_s.hideNothingFound();
			}
			
			if(thumb){
				_s.totalThumbsHeight = Math.max(0, totalThumbs * (thumb.h + _s.spaceBetweenThumbnails) - _s.spaceBetweenThumbnails);
				
				if(_s.totalThumbsHeight > _s.sH - _s.removeFromThumbsHolderHeight){
					_s.allowToScrollAndScrollBarIsActive_bl = true;
				}else{
					_s.allowToScrollAndScrollBarIsActive_bl = false;
				}
			}
		};
		
		
		//##########################################//
		/* setup mobile scrollbar */
		//##########################################//
		_s.setupMobileScrollbar = function(){
			if(!_s.isMbl) return;
			if(_s.hasPointerEvent_bl){
				_s.mainThumbsHolder_do.screen.addEventListener("pointerdown", _s.scrollBarTouchStartHandler);
			}else{
				_s.mainThumbsHolder_do.screen.addEventListener("touchstart", _s.scrollBarTouchStartHandler);
			}
		};
		
		_s.scrollBarTouchStartHandler = function(e){
			_s.isScrollingOnMove_bl = false;
			FWDAnimation.killTweensOf(_s.thumbsHolder_do);

			var vmc = FWDUVPUtils.getViewportMouseCoordinates(e);		
			_s.isDragging_bl = true;
			_s.thumbsFinalY = _s.lastThumbsFinalY = _s.thumbsHolder_do.y;
			_s.lastPresedY = _s.lastPresedY2 = vmc.screenY;
			_s.startToUpdateDrag();
		
			if(_s.hasPointerEvent_bl){
				window.addEventListener("pointerup", _s.scrollBarTouchEndHandler);
				window.addEventListener("pointermove", _s.scrollBarTouchMoveHandler);
			}else{
				window.addEventListener("touchend", _s.scrollBarTouchEndHandler);
				window.addEventListener("touchmove", _s.scrollBarTouchMoveHandler, {passive:false});
			}
		};
		
		_s.scrollBarTouchMoveHandler = function(e){
			if(e.preventDefault) e.preventDefault();
			e.stopImmediatePropagation();
			
			if(_s.totalThumbsHeight < _s.mainThumbsHolder_do.h) return;
			if(_s.comboBox_do && _s.comboBox_do.isShowed_bl) return;
			
			var vmc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			var toAdd = vmc.screenY - _s.lastPresedY;
			_s.thumbsFinalY += toAdd;
			_s.thumbsFinalY = Math.round(_s.thumbsFinalY);
			var dy = vmc.screenY - _s.lastPresedY2;
			_s.lastPresedY = vmc.screenY;

			if(Math.abs(dy) > 5){
				prt.showDisable();
			}
			FWDAnimation.killTweensOf(_s.thumbsHolder_do)
			_s.thumbsHolder_do.setY(_s.thumbsFinalY);
		};
		
		_s.scrollBarTouchEndHandler = function(e){
			_s.isDragging_bl = false;
			
			clearTimeout(_s.disableOnMoveId_to);
			_s.disableOnMoveId_to = setTimeout(function(){
				prt.hideDisable();
			},50);
			if(_s.hasPointerEvent_bl){
				window.removeEventListener("pointerup", _s.scrollBarTouchEndHandler);
				window.removeEventListener("pointermove", _s.scrollBarTouchMoveHandler);
			}else{
				window.removeEventListener("touchend", _s.scrollBarTouchEndHandler);
				window.removeEventListener("touchmove", _s.scrollBarTouchMoveHandler);
			}
		};
		
		_s.stopToUpdateDrag = function(){
			FWDAnimation.killTweensOf(_s.thumbsHld_do)
			cancelAnimationFrame(_s.updateMov_af);
		}

		_s.startToUpdateDrag = function(){
			_s.stopToUpdateDrag();
			_s.updateDrag();

		}

		_s.updateDrag = function(animate){
			_s.updateMov_af = requestAnimationFrame(_s.updateDrag);

			if(_s.isDragging_bl){
				_s.vy = _s.thumbsFinalY - _s.lastThumbsFinalY;
				_s.lastThumbsFinalY = _s.thumbsFinalY;	
				if(Math.abs(_s.vy) < 20){
					_s.vy = 0;
				}
			}else{
				_s.vy *= _s.friction;		
				_s.thumbsFinalY += _s.vy;
				if(_s.mainThumbsHolder_do.h <= _s.totalThumbsHeight){
					if(_s.thumbsFinalY > 0){
						_s.vy2 = (0 - _s.thumbsFinalY) * .3;
						_s.vy *= _s.friction;
						_s.thumbsFinalY += _s.vy2;
					}else if(_s.thumbsFinalY <= _s.mainThumbsHolder_do.h - _s.totalThumbsHeight){
						_s.vy2 = (_s.mainThumbsHolder_do.h - _s.totalThumbsHeight - _s.thumbsFinalY) * .3;
						_s.vy *= _s.friction;
						_s.thumbsFinalY += _s.vy2;
					}
				}

				_s.thumbsFinalY = parseFloat(_s.thumbsFinalY.toFixed(2));				
				if(_s.prevThumbsFinalY == _s.thumbsFinalY){
					_s.stopToUpdateDrag();
					_s.thumbsFinalY = Math.round(_s.thumbsFinalY);
				}

				FWDAnimation.killTweensOf(_s.thumbsHolder_do);
				_s.thumbsHolder_do.setY(_s.thumbsFinalY);
				_s.prevThumbsFinalY = _s.thumbsFinalY;
			}
		};
		
		//#################################//
		/* setup mouse scrollbar */
		//#################################//
		_s.setupScrollbar = function(){
			_s.scrMainHolder_do = new FWDUVPDisplayObject("div");
			_s.scrMainHolder_do.setWidth(_s.scrWidth);
			
			//track
			_s.scrTrack_do = new FWDUVPDisplayObject("div");
			_s.scrTrack_do.setWidth(_s.scrWidth);
			_s.scrTrackTop_do = new FWDUVPDisplayObject("img");
			_s.scrTrackTop_do.setScreen(_s.scrBkTop_img);
			_s.scrTrackMiddle_do = new FWDUVPDisplayObject("div");
			_s.scrTrackMiddle_do.getStyle().background = "url('" + _d.scrBkMiddlePath_str + "')";
			_s.scrTrackMiddle_do.setWidth(_s.scrWidth);
			_s.scrTrackMiddle_do.setY(_s.scrTrackTop_do.h);
			var scrTrackBottomImage_img = new Image();
			scrTrackBottomImage_img.src = _d.scrBkBottomPath_str;
			_s.scrTrackBottom_do = new FWDUVPDisplayObject("img");
			_s.scrTrackBottom_do.setScreen(scrTrackBottomImage_img);
			_s.scrTrackBottom_do.setWidth(_s.scrTrackTop_do.w);
			_s.scrTrackBottom_do.setHeight(_s.scrTrackTop_do.h);
			
			//handler
			_s.scrHandler_do = new FWDUVPDisplayObject("div");
			_s.scrHandler_do.setWidth(_s.scrWidth);
			
			_s.scrHandlerTop_do = new FWDUVPDisplayObject("img");
			if(_s.useHEX){
				_s.scrHandlerTop_do = new FWDUVPDisplayObject("div");
				_s.scrHandlerTop_do.setWidth(_s.scrDragTop_img.width);
				_s.scrHandlerTop_do.setHeight(_s.scrDragTop_img.height);
				_s.mainScrubberDragTop_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.scrDragTop_img, _s.nBC).canvas;
				_s.scrHandlerTop_do.screen.appendChild(_s.mainScrubberDragTop_canvas);	
			}else{
				_s.scrHandlerTop_do = new FWDUVPDisplayObject("img");
				_s.scrHandlerTop_do.setScreen(_s.scrDragTop_img);
			}
		
			_s.scrHandlerMiddle_do = new FWDUVPDisplayObject("div");
			_s.middleImage = new Image();
			_s.middleImage.src = _d.scrDragMiddlePath_str;
			if(_s.useHEX){
				_s.middleImage.onload = function(){
					_s.scrubberDragMiddle_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.middleImage, _s.nBC, true);
					_s.scrubberDragImage_img = _s.scrubberDragMiddle_canvas.image;
					_s.scrHandlerMiddle_do.getStyle().background = "url('" + _s.scrubberDragImage_img.src + "') repeat-y";
				}
			}else{
				_s.scrHandlerMiddle_do.getStyle().background = "url('" + _d.scrDragMiddlePath_str + "')";
			}
			_s.scrHandlerMiddle_do.setWidth(_s.scrWidth);
			_s.scrHandlerMiddle_do.setY(_s.scrHandlerTop_do.h);
			
			_s.scrHandlerBottom_do = new FWDUVPDisplayObject("div");
			_s.bottomImage = new Image();
			_s.bottomImage.src = _d.scrDragMiddlePath_str;
			if(_s.useHEX){
				_s.bottomImage.onload = function(){
					_s.scrubberDragBottom_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.bottomImage, _s.nBC, true);
					_s.scrubberDragBottomImage_img = _s.scrubberDragBottom_canvas.image;
					_s.scrHandlerBottom_do.getStyle().background = "url('" + _s.scrubberDragBottomImage_img.src + "') repeat-y";
					
				}
			}else{
				_s.scrHandlerBottom_do.getStyle().background = "url('" + _d.scrDragBottomPath_str + "')";
			}
			_s.scrHandlerBottom_do.setWidth(_s.scrWidth);
			_s.scrHandlerBottom_do.setY(_s.scrHandlerTop_do.h);
			
			_s.scrHandlerBottom_do.setWidth(_s.scrHandlerTop_do.w);
			_s.scrHandlerBottom_do.setHeight(_s.scrHandlerTop_do.h);
			
			if(_s.useHEX){
				_s.scrHandlerLinesN_do = new FWDUVPDisplayObject("div");
				_s.scrHandlerLinesN_do.setWidth(_s.scrLinesN_img.width);
				_s.scrHandlerLinesN_do.setHeight(_s.scrLinesN_img.height);
				_s.mainhandlerN_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.scrLinesN_img, _s.sBC).canvas;
				_s.scrHandlerLinesN_do.screen.appendChild(_s.mainhandlerN_canvas);	
			}else{
				_s.scrHandlerLinesN_do = new FWDUVPDisplayObject("img");
				_s.scrHandlerLinesN_do.setScreen(_s.scrLinesN_img);
			}
			
			_s.scrHandlerLinesS_img = new Image();
			_s.scrHandlerLinesS_img.src = _d.scrLinesSPath_str;
			if(_s.useHEX){
				_s.scrHandlerLinesS_do = new FWDUVPDisplayObject("div");
				_s.scrHandlerLinesS_img.onload = function(){
					_s.scrHandlerLinesS_do.setWidth(_s.scrHandlerLinesN_do.w);
					_s.scrHandlerLinesS_do.setHeight(_s.scrHandlerLinesN_do.h);
					_s.scrubberLines_s_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.scrHandlerLinesS_img, _s.sBC, true);
					_s.scrubbelinesSImage_img = _s.scrubberLines_s_canvas.image;
					_s.scrHandlerLinesS_do.getStyle().background = "url('" + _s.scrubbelinesSImage_img.src + "') repeat-y";
				}
			}else{
				_s.scrHandlerLinesS_do = new FWDUVPDisplayObject("img");
				_s.scrHandlerLinesS_do.setScreen(_s.scrHandlerLinesS_img);
				_s.scrHandlerLinesS_do.setWidth(_s.scrHandlerLinesN_do.w);
				_s.scrHandlerLinesS_do.setHeight(_s.scrHandlerLinesN_do.h);
			}
			_s.scrHandlerLinesS_do.setAlpha(0);
			
			_s.scrHandlerLines_do = new FWDUVPDisplayObject("div");
			_s.scrHandlerLines_do.setWidth(_s.scrHandlerLinesN_do.w);
			_s.scrHandlerLines_do.setHeight(_s.scrHandlerLinesN_do.h);
		
			_s.scrTrack_do.addChild(_s.scrTrackTop_do);
			_s.scrTrack_do.addChild(_s.scrTrackMiddle_do);
			_s.scrTrack_do.addChild(_s.scrTrackBottom_do);
			_s.scrHandler_do.addChild(_s.scrHandlerTop_do);
			_s.scrHandler_do.addChild(_s.scrHandlerMiddle_do);
			_s.scrHandler_do.addChild(_s.scrHandlerBottom_do);
			_s.scrHandlerLines_do.addChild(_s.scrHandlerLinesN_do);
			_s.scrHandlerLines_do.addChild(_s.scrHandlerLinesS_do);
			_s.scrMainHolder_do.addChild(_s.scrTrack_do);
			_s.scrMainHolder_do.addChild(_s.scrHandler_do);
			_s.scrMainHolder_do.addChild(_s.scrHandlerLines_do);
			_s.mainHld.addChild(_s.scrMainHolder_do);
			
			_s.scrHandler_do.screen.addEventListener("mouseover", _s.scrollBarHandlerOnMouseOver);
			_s.scrHandler_do.screen.addEventListener("mouseout", _s.scrollBarHandlerOnMouseOut);
			_s.scrHandler_do.screen.addEventListener("mousedown", _s.scrollBarHandlerOnMouseDown);
			_s.scrHandlerLines_do.screen.addEventListener("mouseover", _s.scrollBarHandlerOnMouseOver);
			_s.scrHandlerLines_do.screen.addEventListener("mouseout", _s.scrollBarHandlerOnMouseOut);
			_s.scrHandlerLines_do.screen.addEventListener("mousedown", _s.scrollBarHandlerOnMouseDown);
			
			if(_s.addScrOnMM_bl){
				window.addEventListener('mousemove', _s.scrOnMM);
			}
		};

		_s.scrOnMM = function(e){
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			if(FWDUVPUtils.hitTest(_s.mainThumbsHolder_do.screen, vc.screenX, vc.screenY)){
				_s.isDragging_bl = true;
				_s.scrollBarHandlerMoveHandler(e);
			}else{
				_s.isDragging_bl = false;
			}
		}
		
		_s.scrollBarHandlerOnMouseOver = function(e){
			if(!_s.allowToScrollAndScrollBarIsActive_bl || _s.addScrOnMM_bl) return; 
			FWDAnimation.killTweensOf(_s.scrHandlerLinesN_do);
			FWDAnimation.killTweensOf(_s.scrHandlerLinesS_do);
			FWDAnimation.to(_s.scrHandlerLinesN_do, .8, {alpha:0, ease:Expo.easeOut});
			FWDAnimation.to(_s.scrHandlerLinesS_do, .8, {alpha:1, ease:Expo.easeOut});
		};
		
		_s.scrollBarHandlerOnMouseOut = function(e){
			if(_s.isDragging_bl || !_s.allowToScrollAndScrollBarIsActive_bl) return;
			FWDAnimation.killTweensOf(_s.scrHandlerLinesN_do);
			FWDAnimation.killTweensOf(_s.scrHandlerLinesS_do);
			FWDAnimation.to(_s.scrHandlerLinesN_do, .8, {alpha:1, ease:Expo.easeOut});
			FWDAnimation.to(_s.scrHandlerLinesS_do, .8, {alpha:0, ease:Expo.easeOut});
		};
		
		_s.scrollBarHandlerOnMouseDown = function(e){
			if(!_s.allowToScrollAndScrollBarIsActive_bl || _s.addScrOnMM_bl) return;
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);		
			_s.isDragging_bl = true;
			_s.yPositionOnPress = _s.scrHandler_do.y;
			_s.lastPresedY = vc.screenY;
			FWDAnimation.killTweensOf(_s.scrHandler_do);
			prt.showDisable();
			
			if(window.addEventListener){
				window.addEventListener("mousemove", _s.scrollBarHandlerMoveHandler);
				window.addEventListener("mouseup", _s.scrollBarHandlerEndHandler);	
			}
		};
		
		_s.scrollBarHandlerMoveHandler = function(e){
			if(e.preventDefault) e.preventDefault();
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			var linesY = _s.scrollBarHandlerFinalY + parseInt((_s.scrHandler_do.h - _s.scrHandlerLines_do.h)/2);
			if(_s.addScrOnMM_bl){
				_s.scrollBarHandlerFinalY = Math.round(vc.screenY - _s.mainThumbsHolder_do.getGlobalY() - _s.scrHandler_do.h/2);
			}else{
				_s.scrollBarHandlerFinalY = Math.round(_s.yPositionOnPress + vc.screenY - _s.lastPresedY);
			}
			
			if(_s.scrollBarHandlerFinalY >= _s.scrTrack_do.h - _s.scrHandler_do.h){
				_s.scrollBarHandlerFinalY = _s.scrTrack_do.h -  _s.scrHandler_do.h;
			}else if(_s.scrollBarHandlerFinalY <= 0){
				_s.scrollBarHandlerFinalY = 0;
			}
			
			_s.scrHandler_do.setY(_s.scrollBarHandlerFinalY);
			FWDAnimation.killTweensOf(_s.scrHandler_do);
			FWDAnimation.to(_s.scrHandlerLines_do, .8, {y:linesY, ease:Quart.easeOut});
			_s.updateScrollBarHandlerAndContent(true);
		};
		
		_s.scrollBarHandlerEndHandler = function(e){
			var vc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			_s.isDragging_bl = false;
			
			if(!FWDUVPUtils.hitTest(_s.scrHandler_do.screen, vc.screenX, vc.screenY)){
				FWDAnimation.killTweensOf(_s.scrHandlerLinesN_do);
				FWDAnimation.killTweensOf(_s.scrHandlerLinesS_do);
				FWDAnimation.to(_s.scrHandlerLinesN_do, .8, {alpha:1, ease:Expo.easeOut});
				FWDAnimation.to(_s.scrHandlerLinesS_do, .8, {alpha:0, ease:Expo.easeOut});
			}
		
			prt.hideDisable();
			FWDAnimation.killTweensOf(_s.scrHandler_do);
			FWDAnimation.to(_s.scrHandler_do, .4, {y:_s.scrollBarHandlerFinalY, ease:Quart.easeOut});
			
			if(window.removeEventListener){
				window.removeEventListener("mousemove", _s.scrollBarHandlerMoveHandler);
				window.removeEventListener("mouseup", _s.scrollBarHandlerEndHandler);	
			}
		};
		
		_s.updateScrollBarSizeActiveAndDeactivate = function(){
			if(_s.disableForAWhileAfterThumbClick_bl) return;
			if(_s.allowToScrollAndScrollBarIsActive_bl){
				_s.allowToScrollAndScrollBarIsActive_bl = true;
				_s.scrMainHolder_do.setX(_s.sW - _s.scrMainHolder_do.w);
				_s.scrMainHolder_do.setHeight(_s.sH - _s.removeFromThumbsHolderHeight);
				_s.scrTrack_do.setHeight(_s.scrMainHolder_do.h);
				_s.scrTrackMiddle_do.setHeight(_s.scrTrack_do.h - (_s.scrTrackTop_do.h * 2));
				_s.scrTrackBottom_do.setY(_s.scrTrackMiddle_do.y + _s.scrTrackMiddle_do.h);
				_s.scrMainHolder_do.setAlpha(1);
				if(!_s.addScrOnMM_bl){
					_s.scrHandler_do.setButtonMode(true);
					_s.scrHandlerLines_do.setButtonMode(true);
				}
			}else{
				_s.allowToScrollAndScrollBarIsActive_bl = false;
				_s.scrMainHolder_do.setX(_s.sW - _s.scrMainHolder_do.w);
				_s.scrMainHolder_do.setHeight(_s.sH - _s.removeFromThumbsHolderHeight);
				_s.scrTrack_do.setHeight(_s.scrMainHolder_do.h);
				_s.scrTrackMiddle_do.setHeight(_s.scrTrack_do.h - (_s.scrTrackTop_do.h * 2));
				_s.scrTrackBottom_do.setY(_s.scrTrackMiddle_do.y + _s.scrTrackMiddle_do.h);
				_s.scrMainHolder_do.setAlpha(.5);
				_s.scrHandler_do.setY(0);
				_s.scrHandler_do.setButtonMode(false);
				_s.scrHandlerLines_do.setButtonMode(false);
			}
			
			_s.scrHandler_do.setHeight(Math.max(120, Math.round(Math.min(1,(_s.scrMainHolder_do.h/_s.totalThumbsHeight)) * _s.scrMainHolder_do.h)));
			_s.scrHandlerMiddle_do.setHeight(_s.scrHandler_do.h - (_s.scrHandlerTop_do.h * 2));
			_s.scrHandlerBottom_do.setY(_s.scrHandlerMiddle_do.y + _s.scrHandlerMiddle_do.h);
			FWDAnimation.killTweensOf(_s.scrHandlerLines_do);
			_s.scrHandlerLines_do.setY(_s.scrollBarHandlerFinalY + parseInt((_s.scrHandler_do.h - _s.scrHandlerLines_do.h)/2));
			_s.scrHandlerBottom_do.setY(_s.scrHandler_do.h - _s.scrHandlerBottom_do.h);
		};
		
		_s.updateScrollBarHandlerAndContent = function(animate, overwrite){

			if(_s.isMbl && _s.disableForAWhileAfterThumbClick_bl) return;
			if(!_s.allowToScrollAndScrollBarIsActive_bl && !overwrite) return;

			var percentScrolled = 0;
			var thumb;
			
			if(_s.isDragging_bl && !_s.isMbl){
				percentScrolled = (_s.scrollBarHandlerFinalY/(_s.scrMainHolder_do.h - _s.scrHandler_do.h));
				if(percentScrolled == "Infinity"){
					percentScrolled = 0;
				}else if(percentScrolled >= 1){
					percentScrolled = 1;
				}
				_s.thumbsFinalY = Math.round(percentScrolled * (_s.totalThumbsHeight - _s.mainThumbsHolder_do.h)) * -1;
			}else{
				if(_s.isSearched_bl){
					_s.percentScrolled = 0;
					percentScrolled = 0;
				}else{
					percentScrolled = _s.curId/(_s.totalThumbs - 1);
				}
				
				_s.thumbsFinalY = Math.min(0, Math.round(percentScrolled * (_s.totalThumbsHeight - _s.mainThumbsHolder_do.h)) * -1);
				
				if(_s.scrMainHolder_do){
					_s.scrollBarHandlerFinalY = Math.round((_s.scrMainHolder_do.h - _s.scrHandler_do.h) * percentScrolled);
					
					if(_s.scrollBarHandlerFinalY < 0){
						_s.scrollBarHandlerFinalY = 0;
					}else if(_s.scrollBarHandlerFinalY > _s.scrMainHolder_do.h - _s.scrHandler_do.h - 1){
						_s.scrollBarHandlerFinalY = _s.scrMainHolder_do.h - _s.scrHandler_do.h - 1;
					}
					
					FWDAnimation.killTweensOf(_s.scrHandler_do);
					FWDAnimation.killTweensOf(_s.scrHandlerLines_do);
					if(animate){
						FWDAnimation.to(_s.scrHandler_do, .4, {y:_s.scrollBarHandlerFinalY, ease:Quart.easeOut});
						FWDAnimation.to(_s.scrHandlerLines_do, .8, {y:_s.scrollBarHandlerFinalY + parseInt((_s.scrHandler_do.h - _s.scrHandlerLinesN_do.h)/2), ease:Quart.easeOut});
					}else{
						_s.scrHandler_do.setY(_s.scrollBarHandlerFinalY);
						_s.scrHandlerLines_do.setY(_s.scrollBarHandlerFinalY + parseInt((_s.scrHandler_do.h - _s.scrHandlerLinesN_do.h)/2));
					}
				}
			}
			
			if(_s.lastThumbnailFinalY != _s.thumbsFinalY){
				FWDAnimation.killTweensOf(_s.thumbsHolder_do);
				if(animate){
					FWDAnimation.to(_s.thumbsHolder_do, .5, {y:_s.thumbsFinalY, ease:Quart.easeOut});
				}else{
					_s.thumbsHolder_do.setY(_s.thumbsFinalY);
				}
			}
			
			_s.lastThumbnailFinalY = _s.thumbsFinalY;
		};

		
		//###########################################//
		/* Add mousewheel support */
		//###########################################//
		_s.addMouseWheelSupport = function(){
			if(_s.screen.addEventListener){
				_s.screen.addEventListener('DOMMouseScroll', _s.mouseWheelHandler);
				_s.screen.addEventListener ("mousewheel", _s.mouseWheelHandler);
			}
		};
		
		_s.mouseWheelHandler = function(e){
			if(e.preventDefault) e.preventDefault();
			if(_s.disableMouseWheel_bl || _s.isDragging_bl) return false;
			if(_s.comboBox_do && _s.comboBox_do.isShowed_bl) return;
			
			var dir = e.detail || e.wheelDelta;	
			if(e.wheelDelta) dir *= -1;
		
			if(dir > 0){
				_s.scrollBarHandlerFinalY += Math.round((160 * _s.scollbarSpeedSensitivity)  * (_s.mainThumbsHolder_do.h/_s.totalThumbsHeight));
			}else if(dir < 0){
				_s.scrollBarHandlerFinalY -= Math.round((160 * _s.scollbarSpeedSensitivity)  * (_s.mainThumbsHolder_do.h/_s.totalThumbsHeight));
			}
			
			if(_s.scrollBarHandlerFinalY >= _s.scrTrack_do.h - _s.scrHandler_do.h){
				_s.scrollBarHandlerFinalY = _s.scrTrack_do.h -  _s.scrHandler_do.h;
			}else if(_s.scrollBarHandlerFinalY <= 0){
				_s.scrollBarHandlerFinalY = 0;
			}
			
			var linesY = _s.scrollBarHandlerFinalY + parseInt((_s.scrHandler_do.h - _s.scrHandlerLines_do.h)/2);
			FWDAnimation.killTweensOf(_s.scrHandler_do);
			FWDAnimation.killTweensOf(_s.scrHandlerLines_do);
			FWDAnimation.to(_s.scrHandlerLines_do, .8, {y:linesY, ease:Quart.easeOut});
			FWDAnimation.to(_s.scrHandler_do, .5, {y:_s.scrollBarHandlerFinalY, ease:Quart.easeOut});
			_s.isDragging_bl = true;
			_s.updateScrollBarHandlerAndContent(true);
			_s.isDragging_bl = false;
		
			if(e.preventDefault){
				e.preventDefault();
			}else{
				return false;
			}
		};

		
		//################################//
		/* show / hide */
		//################################//
		_s.hideAndShow = function(animate){
			if(_s.position_str == "bottom"){
				_s.mainHld.setY(-_s.sH);
				FWDAnimation.to(_s.mainHld, .8, {y:0, delay: .3, ease:Expo.easeInOut});
			}else{
				_s.mainHld.setX(-_s.sW - 2);
				FWDAnimation.to(_s.mainHld, .8, {x:0, delay: .3, ease:Expo.easeInOut});
				if(_s.ec){
					_s.positionEc();
					_s.ec.setAlpha(0);
					FWDAnimation.to(_s.ec, .8, {alpha:1, delay: .3, ease:Expo.easeInOut});
				}
			}
		};
		
		_s.hide = function(animate){
		
			_s.isShowed_bl = false;
			if(animate){
				if(_s.position_str == "bottom"){
					FWDAnimation.to(_s.mainHld, .8, {y: -_s.sH, ease:Expo.easeInOut});
				}
			}else{
				FWDAnimation.killTweensOf(_s.mainHld);
				if(_s.position_str == "bottom"){
					_s.mainHld.setY(-_s.sH);
				}
			}
		};
		
		_s.show = function(animate){

			_s.isShowed_bl = true;
			if(!FWDAnimation.isTweening(_s.mainHld)) _s.hide(false);
			if(animate){
				if(_s.position_str == "bottom"){
					FWDAnimation.to(_s.mainHld, .8, {y:0, ease:Expo.easeInOut});
				}else{
					_s.mainHld.setY(0);
				}
			}else{
				FWDAnimation.killTweensOf(_s.mainHld);
				_s.mainHld.setX(0);
				_s.mainHld.setY(0);
				clearTimeout(_s.disableThumbsId_to);
				_s.disableThumbsId_to =  setTimeout(function(){_s.disableThumbs_bl = false;}, 200);
				_s.disableThumbs_bl = true;
			}
		};
	
		_s.init();
	};
	
	
	/* set prototype */
    FWDUVPPlaylist.setPrototype = function(){
    	FWDUVPPlaylist.prototype = new FWDUVPDisplayObject("div", "absolute", "visible");
    };
    
    FWDUVPPlaylist.THUMB_MOUSE_UP = "thumbMouseOut";
    FWDUVPPlaylist.PLAY_PREV_VIDEO = "playPrevVideo";
	FWDUVPPlaylist.PLAY_NEXT_VIDEO = "playNextVideo";
	FWDUVPPlaylist.DISABLE_LOOP = "disableLoop";
	FWDUVPPlaylist.ENABLE_LOOP = "enableLoop";
	FWDUVPPlaylist.DISABLE_SHUFFLE = "disableShuffle";
	FWDUVPPlaylist.ENABLE_SHUFFLE = "enableShuffle";
	FWDUVPPlaylist.CHANGE_PLAYLIST = "changePlaylist";
    
    FWDUVPPlaylist.prototype = null;
	window.FWDUVPPlaylist = FWDUVPPlaylist;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Playlist thumb.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	var FWDUVPPlaylistThumb = function(
			prt,
			pId, 
			backgroundImagePath,
			thumbnailNormalBackgroundColor,
			thumbnailHoverBackgroundColor,
			thumbnailDisabledBackgroundColor,
			thumbImageWidth,
			thumbImageHeight,
			padding,
			htmlContent,
			htmlText,
			showThumbnail_bl
		){
		
		'use strict';

		var _s = this;
		var prototype = FWDUVPPlaylistThumb.prototype;
	
		_s.backgroundImagePath_str = backgroundImagePath;
		_s.thumbnailNormalBackgroundColor_str = thumbnailNormalBackgroundColor;
		_s.thumbnailHoverBackgroundColor_str = thumbnailHoverBackgroundColor;
		_s.thumbnailDisabledBackgroundColor_str = thumbnailDisabledBackgroundColor;
		_s.htmlContent_str = htmlContent;
		_s.htmlText_str = htmlText.toLowerCase();
		_s.curStt = "none";
	
		_s.id = pId;
		_s.padding = padding;
		_s.thumbImageWidth = thumbImageWidth;
		_s.thumbImageHeight = thumbImageHeight;
		_s.finalH = _s.padding * 2 + _s.thumbImageHeight;
	
		_s.isDark = true;
		if(backgroundImagePath.indexOf('dark') == -1){
			_s.isDark = false;
		}
	
		_s.hasCanvas_bl = FWDUVPlayer.hasCanvas;
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		_s.showThumbnail_bl = showThumbnail_bl;


		//#################################//
		/* initialize */
		//#################################//
		_s.init = function(){
			_s.setupMainContainers();
			
			_s.setButtonMode(true);
			_s.setNormalState();
			
			if(_s.hasPointerEvent_bl){
				_s.screen.addEventListener("pointerover", _s.onMouseOver);
				_s.screen.addEventListener("pointerout", _s.onMouseOut);
				_s.screen.addEventListener("pointerup", _s.onMouseUp);
			}else if(_s.screen.addEventListener){	
				_s.screen.addEventListener("mouseover", _s.onMouseOver);
				_s.screen.addEventListener("mouseout", _s.onMouseOut);
				_s.screen.addEventListener("click", _s.onMouseUp);
			}
		};
		
		_s.onMouseUp = function(e){
			if(_s.isDisabled_bl || e.button == 2) return;
			if(e.preventDefault) e.preventDefault();
			_s.dispatchEvent(FWDUVPPlaylistThumb.MOUSE_UP, {id:_s.id});
		};
		
		_s.onMouseOver = function(e){
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE){
				if(_s.isDisabled_bl) return;
				_s.setSelectedState(true);
			}
		};
			
		_s.onMouseOut = function(e){
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE){
				if(_s.isDisabled_bl) return;
				_s.setNormalState(true);
			}
		};
		

		//#################################//
		/* set image */
		//#################################//
		_s.setupMainContainers = function(){

			_s.mainImgHld = new FWDUVPDisplayObject("div");
			_s.mainImgHld.screen.className = 'fwduvp-playlist-thumbnail';
			_s.mainImgHld.getStyle().background = "url('" + _s.backgroundImagePath_str + "')";
			_s.mainImgHld.setX(_s.padding);
			_s.mainImgHld.setY(_s.padding);
			_s.mainImgHld.setWidth(_s.thumbImageWidth);
			_s.mainImgHld.setHeight(_s.thumbImageHeight);
			_s.imageHolder_do = new FWDUVPDisplayObject("div");
			
			_s.txt = new FWDUVPDisplayObject("div");
			var cls = 'fwduvp-playlist-thumbnail-white-text';
			if(_s.isDark){
				cls = 'fwduvp-playlist-thumbnail-dark-text';
			}
			_s.txt.screen.className = cls;
			_s.txt.hasTransform3d_bl = false;
			_s.txt.hasTransform2d_bl = false;
			_s.txt.setHeight(_s.finalH - 6);
			_s.txt.setBackfaceVisibility();
			_s.txt.getStyle().fontFamily = "Arial";
			_s.txt.getStyle().fontSize= "12px";
			_s.txt.getStyle().color = _s.fontColor_str;
			_s.txt.getStyle().fontSmoothing = "antialiased";
			_s.txt.getStyle().webkitFontSmoothing = "antialiased";
			_s.txt.getStyle().textRendering = "optimizeLegibility";
			
			_s.slTitle = _s.txt.screen.className;
			
			if(_s.showThumbnail_bl){
				_s.txt.setX((_s.padding * 2) + _s.thumbImageWidth + 4);
			}else{
				_s.txt.setX((_s.padding * 2));
			}
		
			_s.txt.setInnerHTML(_s.htmlContent_str);	
			if(!prt.showOnlyThmb) _s.addChild(_s.txt);
			
			_s.dumy_do = new FWDUVPDisplayObject("div");
			_s.dumy_do.getStyle().width = "100%";
			_s.dumy_do.getStyle().height = "100%";
			if(FWDUVPUtils.isIE){
				_s.dumy_do.setBkColor("#FF0000");
				_s.dumy_do.setAlpha(0.01);
			}
		
			if(_s.showThumbnail_bl) _s.addChild(_s.mainImgHld); 	
			_s.mainImgHld.addChild(_s.imageHolder_do);
			_s.addChild(_s.dumy_do);
		};
		
		_s.updateText = function(htmlContent_str){
			try{
				_s.htmlContent_str = htmlContent_str;
				_s.txt.setInnerHTML(_s.htmlContent_str);
			}catch(e){}
		}

	
		//#################################//
		/* set image */
		//#################################//
		_s.setImage = function(image){
			_s.normalImage_do = new FWDUVPDisplayObject("img");
			_s.normalImage_do.setScreen(image);
			
			_s.imageOriginalW = _s.normalImage_do.w;
			_s.imageOriginalH = _s.normalImage_do.h;
		
			_s.resizeImage();
			
			_s.imageHolder_do.setX(parseInt(_s.thumbImageWidth/2));
			_s.imageHolder_do.setY(parseInt(_s.thumbImageHeight/2));
			_s.imageHolder_do.setWidth(0);
			_s.imageHolder_do.setHeight(0);
			
			_s.normalImage_do.setX(- parseInt(_s.normalImage_do.w/2));
			_s.normalImage_do.setY(- parseInt(_s.normalImage_do.h/2));
		
			FWDAnimation.to(_s.imageHolder_do, .8, {
				x:0, 
				y:0,
				w:_s.thumbImageWidth,
				h:_s.thumbImageHeight, 
				ease:Expo.easeInOut});
			_s.normalImage_do.setAlpha(0);
			
			if(_s.isMbl){
				var curAlpha;
				if(_s.id == prt.curId){
					curAlpha = .3;
				}else{
					curAlpha = 1;
				}
			
				FWDAnimation.to(_s.normalImage_do, .8, {
					alpha:curAlpha,
					x:_s.imageFinalX, 
					y:_s.imageFinalY, 
					ease:Expo.easeInOut});
				
			}else{
				FWDAnimation.to(_s.normalImage_do, .8, {
					alpha:1,
					x:_s.imageFinalX, 
					y:_s.imageFinalY, 
					ease:Expo.easeInOut});
			}
			
			_s.imageHolder_do.addChild(_s.normalImage_do);
			_s.hasImage_bl = true;
		};
		

		//#################################//
		/* resize thumbnail*/
		//#################################//
		_s.resizeAndPosition = function(animate){
			if(_s.showThumbnail_bl){
				_s.txt.setWidth(_s.finalW - ((_s.padding * 2) + _s.thumbImageWidth) - 16);
			}else{
				_s.txt.setWidth(_s.finalW - ((_s.padding * 2)) - 16);
			}
			_s.setWidth(_s.finalW);
			_s.setHeight(_s.finalH);
			
			if(animate){
				FWDAnimation.to(_s, .6, {x:_s.finalX, y:_s.finalY, ease:Expo.easeInOut});
			}else{
				FWDAnimation.killTweensOf(_s);
				_s.setX(_s.finalX);
				_s.setY(_s.finalY);
			}
			
			_s.resizeImage();
		};
	

		//#################################//
		/* resize image*/
		//#################################//
		_s.resizeImage = function(animate){
			if(prt.showOnlyThmb){
				_s.mainImgHld.setWidth(_s.thumbImageWidth);
				_s.mainImgHld.setHeight(_s.thumbImageHeight);
				_s.imageHolder_do.setWidth(_s.thumbImageWidth);
				_s.imageHolder_do.setHeight(_s.thumbImageHeight);
			}

			if(!_s.normalImage_do) return;
			
			if(_s.isMbl){	
				if(_s.normalImage_do.alpha != 1 && !_s.isDisabled_bl) _s.normalImage_do.setAlpha(1);
			}else{
				if(_s.imageHolder_do.alpha != 1 && !_s.isDisabled_bl) _s.imageHolder_do.setAlpha(1);
			}

			var scX = _s.thumbImageWidth/_s.imageOriginalW;
			var scY = _s.thumbImageHeight/_s.imageOriginalH;
			var ttsc;
			
			if(scX >= scY){
				ttsc = scX;
			}else{
				ttsc = scY;
			}
			
			_s.imageFinalW = Math.ceil(ttsc * _s.imageOriginalW);
			_s.imageFinalH = Math.ceil(ttsc * _s.imageOriginalH);
			_s.imageFinalX = Math.round((_s.thumbImageWidth - _s.imageFinalW)/2);
			_s.imageFinalY = Math.round((_s.thumbImageHeight - _s.imageFinalH)/2);
		
			_s.normalImage_do.setX(_s.imageFinalX);
			_s.normalImage_do.setY(_s.imageFinalY);
			_s.normalImage_do.setWidth(_s.imageFinalW);
			_s.normalImage_do.setHeight(_s.imageFinalH);
		};
		

		//#######################################//
		/* Set selected/normal/disable states */
		//######################################//
		_s.setNormalState = function(animate){
			if(_s.curStt == "normal") return;
			_s.curStt = "normal";

			if(_s.slTitle){
				_s.txt.screen.className = _s.slTitle;
			}

			if(animate){
				FWDAnimation.to(_s.screen, .8, {css:{backgroundColor:_s.thumbnailNormalBackgroundColor_str},ease:Expo.easeOut});
			}else{
				FWDAnimation.killTweensOf(_s.screen);
				_s.getStyle().backgroundColor = _s.thumbnailNormalBackgroundColor_str;
			}
		};
		
		_s.setSelectedState = function(animate){
			if(_s.curStt == "selected") return;
			_s.curStt = "selected";
		
			_s.setTitleSelectedClass();
			if(animate){
				FWDAnimation.to(_s.screen, .8, {css:{backgroundColor:_s.thumbnailHoverBackgroundColor_str},ease:Expo.easeOut});
			}else{
				FWDAnimation.killTweensOf(_s.screen);
				_s.getStyle().backgroundColor = _s.thumbnailNormalBackgroundColor_str;
			}
		};
		
		_s.setDisabledState = function(animate){
			if(_s.curStt == "disabled") return;
			_s.curStt = "disabled";

			_s.setTitleSelectedClass();
			if(animate){
				FWDAnimation.to(_s.screen, .8, {css:{backgroundColor:_s.thumbnailDisabledBackgroundColor_str},ease:Expo.easeOut});
			}else{
				FWDAnimation.killTweensOf(_s.screen);
				_s.getStyle().backgroundColor = _s.thumbnailNormalBackgroundColor_str;
			}
		};

		_s.setTitleSelectedClass = function(){
			if(_s.slTitle){
				_s.txt.screen.className = _s.slTitle  + ' active';
			}
		}
		

		//###############################//
		/* enable / disable */
		//##############################//
		_s.enable = function(){
			if(!_s.isDisabled_bl) return;
			_s.isDisabled_bl = false;
			_s.setButtonMode(true);
			_s.setNormalState(true);
			
			if(_s.isMbl){
				if(_s.normalImage_do) _s.normalImage_do.setAlpha(1);
			}else{
				FWDAnimation.to(_s.imageHolder_do, .6, {alpha:1});
			}
		};
		
		_s.disable = function(){
			if(_s.isDisabled_bl) return;
			_s.disableForAWhile_bl = true;
			clearTimeout(_s.disableForAWhileId_to);
			_s.disableForAWhileId_to = setTimeout(function(){
				_s.disableForAWhile_bl = false;
			}, 200);
			_s.isDisabled_bl = true;
			_s.setButtonMode(false);
			_s.setDisabledState(true);
			
			if(_s.isMbl){
				if(_s.normalImage_do) _s.normalImage_do.setAlpha(.3);
			}else{
				FWDAnimation.to(_s.imageHolder_do, .6, {alpha:.3});
			}
		};

		
		//################################//
		/* Destroy */
		//################################//
		_s.destroy = function(){
			FWDAnimation.killTweensOf(_s);
			if(_s.normalImage_do){
				FWDAnimation.killTweensOf(_s.normalImage_do);
				_s.normalImage_do.destroy();
			}
			
			FWDAnimation.killTweensOf(_s.imageHolder_do);
			_s.imageHolder_do.destroy();
			_s.dumy_do.destroy();
			_s.txt.destroy();
			_s.backgroundImagePath_str = backgroundImagePath;
			_s.imageHolder_do = null;
			_s.normalImage_do = null;
			_s.dumy_do = null;
			_s.txt = null;
			_s.htmlContent_str = null;
			_s.htmlText_str = null;
			_s.curStt = null;
		};
	
		_s.init();
	};
	
	
	/* set prototype */
	FWDUVPPlaylistThumb.setPrototype = function(){
		FWDUVPPlaylistThumb.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPPlaylistThumb.SHOW_TOOL_TIP = "showToolTip";
	FWDUVPPlaylistThumb.HIDE_TOOL_TIP = "hideToolTip";
	FWDUVPPlaylistThumb.MOUSE_UP = "onMouseUp";
	
	FWDUVPPlaylistThumb.prototype = null;
	window.FWDUVPPlaylistThumb = FWDUVPPlaylistThumb;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Advertisement popup button.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (){
var FWDUVPPopupAddButton = function(
		    prt,
			imgSrc,
			start,
			end,
			link,
			target,
			isClsd,
			id,
			google_ad_client,
			google_ad_slot,
			google_ad_width,
			google_ad_height,
			tracking,
			poppAdClsNPth,
			poppAdClsSPth,
			shwPpoppAdClsBtn,
			useHEX,
			nBC,
			sBC
		){

		'use strict';
			
		var _s = this;
		var prototype = FWDUVPPopupAddButton.prototype;
		
		_s.clsBtn;
		_s.image_do;
		_s.imgSrc = imgSrc;
		_s.link = link;
		_s.target = target;
		_s.start = start;
		_s.end = end;
		_s.google_ad_client = google_ad_client;
		_s.google_ad_slot = google_ad_slot
		_s.originalW = _s.google_ad_width = google_ad_width;
		_s.originalH = _s.google_ad_height = google_ad_height;
		_s.tracking = tracking;
		
		_s.finalW = 0;
		_s.finalH = 0;
		
		if(Boolean(_s.google_ad_client)){
			_s.type = 'adsense';
		}else if(_s.imgSrc.match(/.png|.jpg|.jpeg/ig)){
			_s.type = 'image';
		}else{
			_s.type = 'iframe';
		}
	
		_s.id = id;
		
		_s.shwPpoppAdClsBtn = shwPpoppAdClsBtn;
		_s.poppAdClsNPth = poppAdClsNPth;
		_s.poppAdClsSPth = poppAdClsSPth;
		
		_s.isClsd = isClsd;
		_s.isLded = false;
		_s.isShowed_bl = false;

		

		//##########################################//
		/* initialize  */
		//##########################################//
		_s.init = function(){
			_s.setBkColor("rgba(0, 0, 0, 0.6)");
			_s.setX(-5000);

			var pth = _s.poppAdClsNPth;
			if(window['isWhite']){
				pth = 'content/hex_white/close-button-normal.png';
			}

			if(_s.shwPpoppAdClsBtn){
				FWDUVPSimpleSizeButton.setPrototype();
				_s.clsBtn = new FWDUVPSimpleSizeButton(
						pth, 
						_s.poppAdClsSPth,
						22,
						21,
						useHEX,
						nBC,
						sBC,
						true
						);

				_s.clsBtn.addListener(FWDUVPSimpleSizeButton.MOUSE_UP, _s.closeClickButtonCloseHandler);
			}
			
			if(_s.type == 'image'){
				_s.image = new Image();
				_s.image.src = _s.imgSrc;
				_s.image.onload = _s.onLoadHandler;
			}else{
				_s.isLded = true;
				_s.setWidth(_s.originalW);
				_s.setHeight(_s.originalH);
			}
			
			if(_s.clsBtn){
				_s.addChild(_s.clsBtn);
				_s.clsBtn.setX(-300);
			}
			
			if(_s.link){
				_s.setButtonMode(true);
			}
		};
		
		_s.closeClickButtonCloseHandler = function(){
			_s.hide();
			_s.isClsd = true;
			prt.popupAds_ar[_s.id].isClosed = true;
		};
		
		_s.clickHandler = function(){
			if(_s.link){
				prt.prt.pause();
				window.open(_s.link, _s.target);
			}
		};

		
		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.onLoadHandler = function(){
			_s.originalW = _s.image.width;
			_s.originalH = _s.image.height;
			_s.image_do = new FWDUVPDisplayObject("img");
			_s.image_do.setScreen(_s.image);
			_s.image_do.setWidth(_s.originalW);
			_s.image_do.setHeight(_s.originalH);
			_s.addChild(_s.image_do);
			_s.isLded = true;
			if(_s.clsBtn){
				_s.addChild(_s.clsBtn);
				_s.clsBtn.setX(-300);
			}
			if(_s.screen.addEventListener){
				_s.image_do.screen.addEventListener("click", _s.clickHandler);
			}else{
				_s.image_do.screen.attachEvent("onclick", _s.clickHandler);
			}
		};
		
		_s.hide = function(remove){
			if(!_s.isShowed_bl) return;
			_s.isShowed_bl = false;
			var scale = Math.min(1, prt.prt.tempVidStageWidth/(_s.originalW));			
			var finalH = parseInt(scale * _s.originalH);
			var finalY = parseInt(prt.prt.tempVidStageHeight);
			prt.setY(finalY);
			
			_s.setX(-5000);
			FWDAnimation.killTweensOf(prt);
			if(remove){
				prt.removeChild(_s);
				prt.setWidth(0);
				prt.setHeight(0);
			}else{
				_s.setWidth(0);
				_s.setHeight(0);
				prt.setVisible(false);
				_s.setVisible(false);
			}
		};
		
		_s.show = function(){
			
			if(_s.isShowed_bl || _s.isClsd || !_s.isLded) return;	
			_s.isShowed_bl = true;
			
			_s.setX(0);
			setTimeout(function(){
				FWDAnimation.killTweensOf(prt);
				prt.setVisible(true);
				_s.setVisible(true);

				if(_s.type == 'adsense' && !_s.isGooglAdCreated_bl){
					
					_s.isGooglAdCreated_bl = true;
					
					window.google_ad_client = _s.google_ad_client;
					window.google_ad_slot = _s.google_ad_slot;
					window.google_ad_width = _s.originalW;
					window.google_ad_height = _s.originalH;

					var script = document.createElement('script');
					script.type = 'text/javascript';
					script.async = true;
					script.crossorigin = "anonymous";
					//if(location.href.indexOf("https") != -1){
						script.src = 'https://pagead2.googlesyndication.com/pagead/show_ads.js?client=' + window.google_ad_client;
					// }else{
					// 	script.src = 'http://pagead2.googlesyndication.com/pagead/show_ads.js';
					// }
					document.head.appendChild(script);
					
					// container is where you want the ad to be inserted
					_s.container = new FWDUVPTransformDisplayObject("div");
					_s.container.setWidth(_s.originalW);
					_s.container.setHeight(_s.originalH);
					// Set attributes for the ad unit
				    _s.container.screen.setAttribute('data-ad-client', window.google_ad_client);
				    _s.container.screen.setAttribute('data-ad-slot', window.google_ad_slot);
					
					_s.addChild(_s.container);
				
					//var w = document.write;
					// document.write = function (content) {
					// 	_s.container.screen.innerHTML = content;
					// 	document.write = w;
					// };

					// Create a script to push the ad
				    var pushScript = document.createElement('script');
				    pushScript.text = '(adsbygoogle = window.adsbygoogle || []).push({});';

					
					
					if(_s.clsBtn){
						_s.addChild(_s.clsBtn);
						_s.clsBtn.setX(-300);
					}
				}else if(_s.type == 'iframe'){

					// container is where you want the ad to be inserted
					_s.container = new FWDUVPTransformDisplayObject("div");
					_s.container.setWidth(_s.originalW);
					_s.container.setHeight(_s.originalH);
					
					_s.ifr = new FWDUVPTransformDisplayObject("iframe");
					_s.ifr.screen.scrolling = 'no';
					_s.ifr.setWidth(_s.originalW);
					_s.ifr.setHeight(_s.originalH);
					_s.ifr.screen.src = _s.imgSrc;
					_s.container.addChild(_s.ifr);
				
					if(_s.link){
						_s.clicker = new FWDUVPDisplayObject('div');
						_s.clicker.screen.style.width = '100%';
						_s.clicker.screen.style.height = '100%';
						_s.container.addChild(_s.clicker);
						_s.container.addChild(_s.clicker);
						_s.container.screen.addEventListener("click", _s.clickHandler);
					}
					_s.addChild(_s.container);
					if(_s.clsBtn){
						_s.addChild(_s.clsBtn);
						_s.clsBtn.setX(-300);
					}
				}
				
				var scale = Math.min(1, prt.prt.tempVidStageWidth/(_s.originalW));			
				var finalH = parseInt(scale * _s.originalH) - 2;
				
				if(prt.prt.controller_do.isShowed_bl){
					var finalY = parseInt(prt.prt.tempVidStageHeight - prt.prt.controller_do.h - (_s.originalH * scale) + 2 + finalH);
				}else{
					var finalY = parseInt(prt.prt.tempVidStageHeight - (_s.originalH * scale) + 2 + finalH);
				}	
				prt.setY(finalY);
			
				_s.resizeAndPosition(true);
			}, 100);
		};
		
		
		
		//###############################//
		/* set final size */
		//###############################//
		_s.resizeAndPosition = function(animate){
			if(!_s.isLded || _s.isClsd || !_s.isShowed_bl) return;
	
			var finalY;
			var hasScale_bl = !FWDUVPUtils.isIEAndLessThen9;
			var scale = 1;
		
			scale = Math.min(1, prt.prt.tempVidStageWidth/(_s.originalW));			
		
			_s.finalW = parseInt(scale * _s.originalW);
			_s.finalH = parseInt(scale * _s.originalH);
			
			if(_s.finalW == _s.prevFinalW && _s.finalH == _s.prevFinalH) return;
		
			_s.setWidth(_s.finalW);
			_s.setHeight(_s.finalH);
		
			if(_s.type == 'image'){
				_s.image_do.setWidth(_s.finalW);
				_s.image_do.setHeight(_s.finalH);
			}else if(_s.container){
				_s.container.setScale2(scale);
				_s.container.setX((_s.finalW - _s.originalW)/2);
				_s.container.setY((_s.finalH - _s.originalH)/2);
			}
			
			if(prt.prt.controller_do){
				if(prt.prt.controller_do.isShowed_bl){
					finalY = parseInt(prt.prt.tempVidStageHeight - prt.prt.controller_do.h - (_s.originalH * scale) - 10);
				}else{
					finalY = parseInt(prt.prt.tempVidStageHeight - (_s.originalH * scale) - 10);
				}	
			}else{
				finalY = parseInt(prt.prt.tempVidStageHeight - (_s.originalH * scale));
			}
			
			prt.setX(parseInt((prt.prt.tempVidStageWidth - _s.finalW)/2));
			
			FWDAnimation.killTweensOf(prt);
			if(animate){
				FWDAnimation.to(prt, .8, {y:finalY, ease:Expo.easeInOut});
			}else{
				prt.setY(finalY);
			}
			
			if(_s.clsBtn){
				_s.clsBtn.setY(5);
				_s.clsBtn.setX(parseInt(_s.finalW - 21 - 5));
			}
			
			_s.prevFinalW = _s.finalW;
			_s.prevFinallH = _s.finalH;
			prt.setWidth(_s.finalW);
			prt.setHeight(_s.finalH);
		};

		_s.init();
	};
	

	/* set prototype */
	FWDUVPPopupAddButton.setPrototype = function(){
		FWDUVPPopupAddButton.prototype = new FWDUVPDisplayObject("div", "absolute", "visible");
	};
	
	FWDUVPPopupAddButton.MOUSE_OVER = "onMouseOver";
	FWDUVPPopupAddButton.MOUSE_OUT = "onMouseOut";
	FWDUVPPopupAddButton.CLICK = "onClick";
	
	FWDUVPPopupAddButton.prototype = null;
	window.FWDUVPPopupAddButton = FWDUVPPopupAddButton;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Poster.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPPoster = function(
			prt,
			showPoster,
			posterBackgroundColor_str
		){
		
		'use strict';

		var _s  = this;
		var prototype = FWDUVPPoster.prototype;
		
		_s.img_img = new Image();
		_s.img_do = null;
		_s.imgW = 0;
		_s.imgH = 0;
		_s.finalW = 0;
		_s.finalH = 0;
		_s.finalX = 0;
		_s.finalY = 0;
		
		_s.curPath_str;
		_s.posterBackgroundColor_str = posterBackgroundColor_str;
		
		_s.isTransparent_bl = false;
		_s.showPoster_bl = showPoster;
		_s.showOrLoadOnMobile_bl = false;
		_s.isShowed_bl = true;
		_s.allowToShow_bl = true;
		_s.isMbl = FWDUVPUtils.isMobile;
	
		_s.init = function(){
			_s.img_img = new Image();
			_s.img_do = new FWDUVPDisplayObject("img");
			_s.hide();
		};
		
		_s.positionAndResize = function(){
			if(!prt.vidStageWidth) return;
			_s.setWidth(prt.tempVidStageWidth);
			_s.setHeight(prt.tempVidStageHeight);
		
			if(!_s.imgW) return;
			var scX = prt.tempVidStageWidth/_s.imgW;
			var scY = prt.tempVidStageHeight/_s.imgH;
			var ttSc;
			
			if(scX <= scY){
				ttSc = scX;
			}else{
				ttSc = scY;
			}

			if(prt._d.fillEntireposterScreen_bl){
				if(scX >= scY){
					ttSc = scX;
				}else{
					ttSc = scY;
				}
			}
			
			_s.finalW = Math.round(ttSc * _s.imgW);
			_s.finalH = Math.round(ttSc * _s.imgH);
			_s.finalX = parseInt((prt.tempVidStageWidth - _s.finalW)/2);
			_s.finalY = parseInt((prt.tempVidStageHeight - _s.finalH)/2);
		
			_s.img_do.setX(_s.finalX);
			_s.img_do.setY(_s.finalY);
			_s.img_do.setWidth(_s.finalW);
			_s.img_do.setHeight(_s.finalH);		
		};
		
		_s.setPoster = function(path){
			
			if(_s.id == prt.id || !path) return;
			_s.id = prt.id;
			
			if(path && (FWDUVPUtils.trim(path) == "") || path =="none"){
				_s.showOrLoadOnMobile_bl = true;
				_s.isTransparent_bl = true;
				_s.show();
				return;
			}else if(path == "youtubemobile" && _s.isMbl){
				_s.isTransparent_bl = false;
				_s.showOrLoadOnMobile_bl = false;
				_s.img_img.src = null;
				_s.imgW = 0;
				return;
			}else if(path == _s.curPath_str){
				_s.isTransparent_bl = false;
				_s.showOrLoadOnMobile_bl = true;
			}else{
				_s.isTransparent_bl = false
			}
			
			if(_s.isTransparent_bl){
				_s.getStyle().backgroundColor = "transparent";
			}else{
				_s.getStyle().backgroundColor = _s.posterBackgroundColor_str;
			}
			
			_s.isTransparent_bl = false;
			_s.showOrLoadOnMobile_bl = true;
			_s.curPath_str = path;
			if(_s.allowToShow_bl) _s.isShowed_bl = false;
			
			try{
				_s.removeChild(_s.img_do);
			}catch(e){}
			_s.img_img = new Image();
			_s.img_img.onload = _s.posterLoadHandler;
			_s.img_img.src = _s.curPath_str;
		};
		
		_s.posterLoadHandler = function(e){
			_s.imgW = _s.img_img.width;
			_s.imgH = _s.img_img.height;
			_s.img_do.setScreen(_s.img_img);
			_s.addChild(_s.img_do);
			_s.positionAndResize();
			if(_s.isShowed_bl){
				_s.show();
			}
		};

		
		//################################//
		/* show / hide */
		//################################//
		_s.show = function(allowToShow_bl){
			if(!_s.allowToShow_bl || _s.isShowed_bl || !_s.showOrLoadOnMobile_bl) return;
			_s.isShowed_bl = true;
			
			if(_s.isTransparent_bl){
				if(_s.alpha != 0) _s.setAlpha(0);
			}else {
				if(_s.alpha != 1) _s.setAlpha(1);
			}
			
			_s.setVisible(true);

			if(!_s.isMbl && !_s.isTransparent_bl){
				FWDAnimation.killTweensOf(_s);
				_s.setAlpha(0);
				FWDAnimation.to(_s, .6, {alpha:1, delay:.4});
			}
			
			_s.positionAndResize();
		};
		
		_s.hide = function(overwrite){
			if(!_s.isShowed_bl && !overwrite) return;
			FWDAnimation.killTweensOf(_s);
			_s.isShowed_bl = false;
			_s.setVisible(false);
		};
		
		_s.init();
	};
	
	
	/* set prototype */
    FWDUVPPoster.setPrototype = function(){
    	FWDUVPPoster.prototype = new FWDUVPDisplayObject("div");
    };
    
    FWDUVPPoster.prototype = null;
	window.FWDUVPPoster = FWDUVPPoster;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Canvas preloader.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPPreloader = function(prt, preloaderPostion, radius, backgroundColor, fillColor, strokeSize, animDuration){

		'use strict';
		
		var _s  = this;
		var prototype = FWDUVPPreloader.prototype;
		_s.preloaderPostion = preloaderPostion;
		_s.backgroundColor = backgroundColor;
		_s.fillColor = fillColor;
		_s.radius = radius;
		_s.strokeSize = strokeSize;
		_s.animDuration = animDuration || 300;
		_s.strtAngle = 270;
		_s.countAnimation = 0;
		_s.isShowed_bl = true;
		_s.slideshowAngle = {n:0};
		

		//###################################//
		/* init */
		//###################################//
		_s.init = function(){
			_s.main_do = new FWDUVPDisplayObject("div");
			_s.main_do.setOverflow("visible");
			_s.main_do.setWidth(_s.radius * 2 + _s.strokeSize);
			_s.main_do.setHeight(_s.radius * 2 + _s.strokeSize);
			_s.addChild(_s.main_do);
			_s.setOverflow('visible');
			_s.setWidth((_s.radius * 2) + _s.strokeSize);
			_s.setHeight((_s.radius * 2) + _s.strokeSize);
			_s.bkCanvas =  new FWDUVPDisplayObject("canvas");
			_s.bkCanvasContext = _s.bkCanvas.screen.getContext('2d');
			_s.fillCircleCanvas = new FWDUVPDisplayObject("canvas");
			_s.fillCircleCanvasContext = _s.fillCircleCanvas.screen.getContext('2d');
			_s.main_do.screen.style.transformOrigin = "50% 50%";
		
			_s.main_do.addChild(_s.bkCanvas);
			_s.main_do.addChild(_s.fillCircleCanvas);
			_s.drawBackground();
			_s.drawFill();
			_s.hide();
		};


		/*
			Postion
		*/
		_s.positionAndResize = function(){

			if(_s.preloaderPostion == 'bottomleft'){
				_s.setX(prt.offsetPreloader);
				_s.setY(prt.sH - _s.h - prt.offsetPreloader);
			}else if(_s.preloaderPostion == 'bottomright'){
				_s.setX(prt.sW - _s.w - prt.offsetPreloader);
				_s.setY(prt.sH - _s.h - prt.offsetPreloader);
			}else if(_s.preloaderPostion == 'topright'){
				_s.setX(prt.sW - _s.w - prt.offsetPreloader);
				_s.setY(prt.offsetPreloader);
			}else if(_s.preloaderPostion == 'topleft'){
				_s.setX(prt.offsetPreloader);
				_s.setY(prt.offsetPreloader);
			}else if(_s.preloaderPostion == 'center'){
				_s.setX(Math.round(prt.sW - _s.w)/2);
				_s.setY(Math.round(Math.min(prt.sH, prt.viewportSize.h) - _s.h)/2);
			}
		}	


		/* draw background */
		_s.drawBackground = function(){
			_s.bkCanvas.screen.width = (_s.radius * 2) + _s.strokeSize * 2;
			_s.bkCanvas.screen.height = (_s.radius * 2) + _s.strokeSize * 2;
			_s.bkCanvasContext.lineWidth = _s.thicknessSize;
			_s.bkCanvasContext.translate(_s.strokeSize/2, _s.strokeSize/2);
			_s.bkCanvasContext.shadowColor = '#333333';
		    _s.bkCanvasContext.shadowBlur = 1;
		   
			_s.bkCanvasContext.lineWidth=_s.strokeSize;
			_s.bkCanvasContext.strokeStyle = _s.backgroundColor;
			_s.bkCanvasContext.beginPath();
			_s.bkCanvasContext.arc(_s.radius, _s.radius,  _s.radius, (Math.PI/180) * 0, (Math.PI/180) * 360, false);
			_s.bkCanvasContext.stroke();
			_s.bkCanvasContext.closePath();
		};
		

		/* draw fill */
		_s.drawFill = function(){	
			_s.fillCircleCanvas.screen.width = (_s.radius * 2) + _s.strokeSize * 2;
			_s.fillCircleCanvas.screen.height = (_s.radius * 2) + _s.strokeSize * 2;
			_s.fillCircleCanvasContext.lineWidth = _s.thicknessSize;
			_s.fillCircleCanvasContext.translate(_s.strokeSize/2, _s.strokeSize/2);
			_s.fillCircleCanvasContext.lineWidth=_s.strokeSize;
			_s.fillCircleCanvasContext.strokeStyle = _s.fillColor;
			_s.fillCircleCanvasContext.beginPath();
			_s.fillCircleCanvasContext.arc(_s.radius, _s.radius,  _s.radius, (Math.PI/180) * _s.strtAngle, (Math.PI/180) * (_s.strtAngle +  _s.slideshowAngle.n), false);
			_s.fillCircleCanvasContext.stroke();
			_s.fillCircleCanvasContext.closePath()
		};

		
		//###################################//
		/* start / stop preloader animation */
		//###################################//
		_s.startSlideshow = function(){
			if(_s == null) return;
			FWDAnimation.killTweensOf(_s.slideshowAngle);
			FWDAnimation.to(_s.slideshowAngle, _s.animDuration, {n:360, onUpdate:_s.drawFill, onComplete:_s.stopSlideshow});
		};
		
		_s.stopSlideshow = function(){
			FWDAnimation.killTweensOf(_s.slideshowAngle);
			FWDAnimation.to(_s.slideshowAngle, .8, {n:0, onupdate:_s.drawFill, onUpdate:_s.drawFill, ease:Expo.easiInOut});
		};
		
		_s.startPreloader = function(){
			_s.stopPreloader();
			_s.slideshowAngle = {n:0};
			FWDAnimation.to(_s.slideshowAngle, _s.animDuration, {n:360, onUpdate:_s.drawFill, repeat:100, yoyo:true, ease:Expo.easInOut});
			FWDAnimation.to(_s.main_do.screen, _s.animDuration, {rotation:360,  repeat:100});
		}

		_s.stopPreloader = function(){
			FWDAnimation.killTweensOf(_s.slideshowAngle);
			FWDAnimation.killTweensOf(_s.main_do.screen);
			FWDAnimation.to(_s.main_do.screen, 0.00001, {rotation:0});
		}
		
		
		//###################################//
		/* show / hide preloader animation */
		//###################################//
		_s.show = function(){
			if(_s.isShowed_bl) return;
			_s.setVisible(true);
			FWDAnimation.killTweensOf(_s);
			FWDAnimation.to(_s, 1, {alpha:1, delay:.2});
			_s.stopPreloader();
			_s.startPreloader();
			_s.isShowed_bl = true;
		};
		
		_s.hide = function(animate){

			if(!_s.isShowed_bl) return;
			FWDAnimation.killTweensOf(_s);
			if(animate){
				FWDAnimation.to(_s, .2, {alpha:0, onComplete:_s.onHideComplete});
			}else{
				_s.setVisible(false);
				_s.setAlpha(0);
			}
			_s.isShowed_bl = false;
		};
		
		_s.onHideComplete = function(){
			_s.setVisible(false);
			_s.stopPreloader();
			_s.dispatchEvent(FWDUVPPreloader.HIDE_COMPLETE);
		};
		
		_s.init();
	};
	
	
	/* set prototype */
    FWDUVPPreloader.setPrototype = function(){
    	FWDUVPPreloader.prototype = new FWDUVPDisplayObject("div");
    };
    
    FWDUVPPreloader.HIDE_COMPLETE = "hideComplete";
    
    FWDUVPPreloader.prototype = null;
	window.FWDUVPPreloader = FWDUVPPreloader;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Image preloader.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPPreloader2 = function(imageSource_img, segmentWidth, segmentHeight, totalSegments, animDelay){
		
		'use strict';

		var _s  = this;
		var prototype = FWDUVPPreloader2.prototype;
		
		_s.imageSource_img = imageSource_img;
		_s.segmentWidth = segmentWidth;
		_s.segmentHeight = segmentHeight;
		_s.totalSegments = totalSegments;
		_s.animDelay = animDelay || 300;
		_s.count = 0;
		
		_s.delayTimerId_int;
		_s.isShowed_bl = false;
		

		//###################################//
		/* init */
		//###################################//
		_s.init = function(){
			_s.setWidth(_s.segmentWidth);
			_s.setHeight(_s.segmentHeight);
		
			_s.image_sdo = new FWDUVPDisplayObject("img");
			_s.image_sdo.setScreen(_s.imageSource_img);
			_s.addChild(_s.image_sdo);
			
			_s.hide(false);
		};

		
		//###################################//
		/* start / stop preloader animation */
		//###################################//
		_s.start = function(){
			if(_s == null) return;
			clearInterval(_s.delayTimerId_int);
			_s.delayTimerId_int = setInterval(_s.updatePreloader, _s.animDelay);
		};
		
		_s.stop = function(){
			clearInterval(_s.delayTimerId_int);
		};
		
		_s.updatePreloader = function(){
			if(_s == null) return;
			_s.count++;
			if(_s.count > _s.totalSegments - 1) _s.count = 0;
			var posX = _s.count * _s.segmentWidth;
			_s.image_sdo.setX(-posX);
		};
		
		
		//###################################//
		/* show / hide preloader animation */
		//###################################//
		_s.show = function(){
			if(_s.isShowed_bl) return;
			_s.setVisible(true);
			_s.start();
			FWDAnimation.killTweensOf(_s);
			FWDAnimation.to(_s, 1, {alpha:1, delay:.2});
			_s.isShowed_bl = true;
		};
		
		_s.hide = function(animate){
			if(!_s.isShowed_bl) return;
			FWDAnimation.killTweensOf(_s);
			if(animate){
				FWDAnimation.to(_s, 1, {alpha:0, onComplete:_s.onHideComplete});
			}else{
				_s.setVisible(false);
				_s.setAlpha(0);
			}
			_s.isShowed_bl = false;
		};
		
		_s.onHideComplete = function(){
			_s.setVisible(false);
			_s.stop();
			_s.dispatchEvent(FWDUVPPreloader2.HIDE_COMPLETE);
		};
		
		_s.init();
	};
	
	
	/* set prototype */
    FWDUVPPreloader2.setPrototype = function(){
    	FWDUVPPreloader2.prototype = new FWDUVPDisplayObject("div");
    };
    
    FWDUVPPreloader2.HIDE_COMPLETE = "hideComplete";
    
    FWDUVPPreloader2.prototype = null;
	window.FWDUVPPreloader2 = FWDUVPPreloader2;
}(window));﻿/**
 * Ultimate Video Player PACKAGED v9.1
 * Popup advertisement.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
var FWDUVPPupupAds = function(prt, _d){
		
		'use strict';

		var _s = this;
		var prototype = FWDUVPPupupAds.prototype;
		
		_s.prt = prt;
		_s.totalAds = 0;
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		_s.showSubByDflt = _d.showSubByDflt;
		_s.nBC = _d.nBC;
		_s.sBC = _d.sBC;


		
		//##########################################//
		/* initialize  */
		//##########################################//
		_s.init = function(){
			if(_d.sknPth.indexOf("hex_white") != -1){
				_s.sBC = "#FFFFFF";
			} 
			_s.setOverflow("visible");
			_s.getStyle().cursor = "default";
			_s.setVisible(false);
		};
		

		//##########################################//
		/* Reset popup buttons ads */
		//##########################################//
		_s.resetPopups = function(popupAds_ar, id){
			if(_s.id == id) return;
			_s.hideAllPopupButtons(true);
			_s.popupAds_ar = popupAds_ar;
			_s.totalAds = _s.popupAds_ar.length;
		
			var popupAdButton;
			_s.popupAdsButtons_ar = [];
			
			for(var i=0; i<_s.totalAds; i++){
				FWDUVPPopupAddButton.setPrototype();
				popupAdButton = new FWDUVPPopupAddButton(
						_s,
						_s.popupAds_ar[i].source,
						_s.popupAds_ar[i].timeStart,
						_s.popupAds_ar[i].timeEnd,
						_s.popupAds_ar[i].link,
						_s.popupAds_ar[i].trget,
						_s.popupAds_ar[i].isClosed,
						i,
						_s.popupAds_ar[i].google_ad_client,
						_s.popupAds_ar[i].google_ad_slot,
						_s.popupAds_ar[i].google_ad_width,
						_s.popupAds_ar[i].google_ad_height,
						_s.popupAds_ar[i].tracking,
						_d.poppAdClsNPth,
						_d.poppAdClsSPth,
						_d.shwPpoppAdClsBtn,
						_d.useHEX,
						_s.nBC,
						_s.sBC
				);
				_s.popupAdsButtons_ar[i] = popupAdButton;
				_s.addChild(popupAdButton);
			}
		};

		
		//#####################################//
		/* Update text */
		//#####################################//
		_s.update = function(duration){
			if(_s.totalAds == 0) return;
			var popupAdButton;
			
			for(var i=0; i<_s.totalAds; i++){
				popupAdButton = _s.popupAdsButtons_ar[i];
				_s.curAdId = i;
				if(duration >= popupAdButton.start && duration < popupAdButton.end){
					popupAdButton.show();
				}else{
					popupAdButton.hide();
				}
			}	
		};
	
		_s.position = function(animate){
			if(_s.totalAds == 0) return;
			var popupAdButton;
			
			for(var i=0; i<_s.totalAds; i++){
				popupAdButton = _s.popupAdsButtons_ar[i];
				popupAdButton.resizeAndPosition(animate);
			}	
		};
		
		_s.hideAllPopupButtons = function(remove){
			if(_s.totalAds == 0) return;
			var popupAdButton;
			
			for(var i=0; i<_s.totalAds; i++){
				popupAdButton = _s.popupAdsButtons_ar[i];
				popupAdButton.hide(remove);
			}	
			if(remove){
				_s.popupAdsButtons_ar = null;
				_s.totalAds = 0;
			}
			_s.id = -1;
		};
		
		_s.resetId = function(){
			_s.id = -1;
		}
		
		_s.init();
	};

	
	/* set prototype */
	FWDUVPPupupAds.setPrototype = function(){
		FWDUVPPupupAds.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPPupupAds.LOAD_ERROR = "error";
	FWDUVPPupupAds.LOAD_COMPLETE = "complete";

	FWDUVPPupupAds.prototype = null;
	window.FWDUVPPupupAds = FWDUVPPupupAds;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Scrubbers tooltip.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
var FWDUVPScrubberToolip = function(
			buttonRef_do,
			bkColor,
			fontColor_str,
			toolTipLabel_str,
			toolTipsButtonsHideDelay
		){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPScrubberToolip.prototype;
		
		_s.buttonRef_do = buttonRef_do;
		_s.bkColor = bkColor;
		_s.fontColor_str = fontColor_str;
		_s.toolTipLabel_str = toolTipLabel_str;
		_s.toolTipsButtonsHideDelay = toolTipsButtonsHideDelay * 1000;
		_s.pointerWidth = 7;
		_s.pointerHeight = 4;
		
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.isShowed_bl = true;

	
		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.setOverflow("visible");
			_s.screen.className = 'UVP-tooltip-bk';
			_s.setupMainContainers();
			_s.setLabel("0");
			_s.hide();
			_s.setVisible(false);
			_s.getStyle().backgroundColor = _s.bkColor;
			_s.getStyle().zIndex = 9999999999999;
			_s.getStyle().pointerEvents = "none";

		};
		

		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.setupMainContainers = function(){
			_s.pointerHolder_do = new FWDUVPDisplayObject("div");
			_s.pointerHolder_do.setOverflow('visible');
			_s.addChild(_s.pointerHolder_do);

			_s.text_do = new FWDUVPDisplayObject("div");
			_s.text_do.screen.className = 'UVP-tooltip-text';
			_s.text_do.hasTransform3d_bl = false;
			_s.text_do.hasTransform2d_bl = false;
			_s.text_do.setBackfaceVisibility();
			_s.text_do.setDisplay("inline-block");
			_s.text_do.getStyle().fontFamily = "Arial";
			_s.text_do.getStyle().fontSize= "12px";
			_s.text_do.getStyle().color = _s.fontColor_str;
			_s.text_do.getStyle().whiteSpace= "nowrap";
			_s.text_do.getStyle().padding = "6px";
			_s.text_do.getStyle().paddingTop = "4px";
			_s.text_do.getStyle().paddingBottom = "4px";
		
			_s.addChild(_s.text_do);
			
			_s.pointer_do = new FWDUVPDisplayObject("div");
			_s.pointer_do.screen.className = 'UVP-scrubber-pointer';
			_s.pointer_do.setBkColor(_s.bkColor);
			_s.pointer_do.screen.style = "border: 4px solid transparent; border-top-color: " + _s.bkColor + ";";
			_s.pointerHolder_do.addChild(_s.pointer_do);
		}
		

		//##########################################//
		/* set label */
		//##########################################//
		_s.setLabel = function(label){
			
			if(label === undefined ) return;
			_s.text_do.setInnerHTML(label);
			
			if(_s == null) return;
			_s.setWidth(_s.text_do.getWidth());
			_s.setHeight(_s.text_do.getHeight());
			_s.positionPointer();
		};
		
		_s.positionPointer = function(offsetX){
			var finalX;
			var finalY;
			
			if(!offsetX) offsetX = 0;
			
			finalX = parseInt((_s.w - 8)/2) + offsetX;
			finalY = _s.h;
			_s.pointerHolder_do.setX(finalX);
			_s.pointerHolder_do.setY(finalY);
			
		};

		
		//##########################################//
		/* show / hide*/
		//##########################################//
		_s.show = function(){

			//if(_s.isShowed_bl) return;
			_s.isShowed_bl = true;
			clearTimeout(_s.hideWithDelayId_to);

			FWDAnimation.killTweensOf(_s);
			clearTimeout(_s.showWithDelayId_to);
			_s.showWithDelayId_to = setTimeout(_s.showFinal, _s.toolTipsButtonsHideDelay);
		};
		
		_s.showFinal = function(){
			_s.setVisible(true);
			FWDAnimation.to(_s, .4, {alpha:1, onComplete:function(){_s.setVisible(true);}, ease:Quart.easeOut});
		};
		
		_s.hide = function(){
			
			if(!_s.isShowed_bl) return;
			clearTimeout(_s.showWithDelayId_to);
			clearTimeout(_s.hideWithDelayId_to);

			_s.hideWithDelayId_to = setTimeout(function(){
				
				FWDAnimation.killTweensOf(_s);
				_s.setVisible(false);
				_s.isShowed_bl = false;	
				_s.setAlpha(0);
			}, 100);
			
		};
		
		_s.init();
	};
	

	/* set prototype */
	FWDUVPScrubberToolip.setPrototype = function(){
		FWDUVPScrubberToolip.prototype = null;
		FWDUVPScrubberToolip.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPScrubberToolip.CLICK = "onClick";
	FWDUVPScrubberToolip.MOUSE_DOWN = "onMouseDown";
	
	FWDUVPScrubberToolip.prototype = null;
	window.FWDUVPScrubberToolip = FWDUVPScrubberToolip;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Share window.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPShareWindow = function(_d, prt){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPShareWindow.prototype;
				
		_s.embedColoseN_img = _d.embedColoseN_img;
		_s.btns_ar = [];
		_s.embedWindowBackground_str = _d.embedWindowBackground_str;
		_s.embedWindowCloseButtonMargins = _d.embedWindowCloseButtonMargins;
			
		_s.totalWidth = 0;
		_s.sW = 0;
		_s.sH = 0;
		_s.minMrgXSpc = 20;
		_s.hSpace = 20;
		_s.minHSpace = 10;
		_s.vSpace = 15;

		_s.isMbl = FWDUVPUtils.isMobile;
		_s.useVectorIcons_bl = _d.useVectorIcons_bl;
	
		//#################################//
		/* init */
		//#################################//
		_s.init = function(){
			_s.setupButtons();
		};

		_s.stpInit =  function(){
			if(_s.clsBtn) return;
			var sBC = _d.sBC;
			if(window['isWhite']){
				sBC = '#000000';
			}

			_s.setBackfaceVisibility();
			_s.mainHld = new FWDUVPDisplayObject("div");
			_s.mainHld.hasTransform3d_bl = false;
			_s.mainHld.hasTransform2d_bl = false;
			_s.mainHld.setBackfaceVisibility();
			
			_s.bk_do = new FWDUVPDisplayObject("div");
			_s.bk_do.getStyle().width = "100%";
			_s.bk_do.getStyle().height = "100%";
			_s.bk_do.setAlpha(.9);
			var pth = _s.embedWindowBackground_str;

			if(window['isWhite']){
				pth = 'content/hex_white/embed-window-background.png';
			}
			_s.bk_do.getStyle().background = "url('" + pth + "')";

		
			//setup close button
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.clsBtn = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<div class='table-fwduvp-button'><span class='table-cell-fwduvp-button fwdicon-close'></span></div>",
						undefined,
						"UVPCloseButtonNormalState",
						"UVPCloseButtonSelectedState"
				);
			}else{
				
				FWDUVPSimpleButton.setPrototype();
				_s.clsBtn = new FWDUVPSimpleButton(_d.shareClooseN_img, _d.embedWindowClosePathS_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						sBC,
						false, false, false, false, true);
			}

			_s.clsBtn.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.closeButtonOnMouseUpHandler);
			
			_s.addChild(_s.mainHld);
			_s.mainHld.addChild(_s.bk_do);
			_s.mainHld.addChild(_s.clsBtn); 
		}
	
		_s.closeButtonOnMouseUpHandler = function(){
			if(!_s.isShowed_bl) return;
			_s.hide();
		};
		
		_s.positionAndResize = function(){
			_s.sW = prt.sW;
			_s.sH = prt.sH;
				
			_s.clsBtn.setX(_s.sW - _s.clsBtn.w - _s.embedWindowCloseButtonMargins);
			_s.clsBtn.setY(_s.embedWindowCloseButtonMargins);
			
			_s.setWidth(_s.sW);
			_s.setHeight(_s.sH);
			_s.mainHld.setWidth(_s.sW);
			_s.mainHld.setHeight(_s.sH);
			setTimeout(function(){
				_s.positionButtons();
			}, 100);
			
		};
		
		
		//###########################################//
		/* Setup buttons */
		//###########################################//
		_s.setupButtons = function(){
			if(_s.btsCrted){
				return;
			}

			_s.stpInit();	
			
			_s.btsCrted = true;
			var sBC = _d.sBC;
			if(window['isWhite']){
				sBC = '#000000';
			}
		
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.facebookButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='uvpicon fwdicon-facebook'></span>",
						undefined,
						"UVPSocialMediaButtonsNormalState",
						"UVPSocialMediaButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.facebookButton_do = new FWDUVPSimpleButton(_d.facebookN_img, _d.facebookSPath_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						sBC);
			}
			_s.facebookButton_do.screen.className = 'fwduvp-facebook-share-button';
			_s.facebookButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.facebookOnMouseUpHandler);
			_s.addBtnToArray(_s.facebookButton_do);
			
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.twitterButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='uvpicon fwdicon-twitter'></span>",
						undefined,
						"UVPSocialMediaButtonsNormalState",
						"UVPSocialMediaButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.twitterButton_do = new FWDUVPSimpleButton(_d.twitterN_img, _d.twitterSPath_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						sBC);
			}
			_s.twitterButton_do.screen.className = 'fwduvp-twitter-share-button';
			_s.twitterButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.twitterOnMouseUpHandler);
			_s.addBtnToArray(_s.twitterButton_do);
			
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.likedinButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='uvpicon fwdicon-linkedin'></span>",
						undefined,
						"UVPSocialMediaButtonsNormalState",
						"UVPSocialMediaButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.likedinButton_do = new FWDUVPSimpleButton(_d.likedInkN_img, _d.likedInSPath_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						sBC);
			}
			_s.likedinButton_do.screen.className = 'fwduvp-likedin-share-button';
			_s.likedinButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.likedinOnMouseUpHandler);
			_s.addBtnToArray(_s.likedinButton_do);
			
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.bufferButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='uvpicon fwdicon-comments'></span>",
						undefined,
						"UVPSocialMediaButtonsNormalState",
						"UVPSocialMediaButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.bufferButton_do = new FWDUVPSimpleButton(_d.bufferkN_img, _d.bufferSPath_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						sBC);
			}
			_s.bufferButton_do.screen.className = 'fwduvp-buffer-share-button';
			_s.bufferButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.bufferOnMouseUpHandler);
			_s.addBtnToArray(_s.bufferButton_do);
			
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.diggButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='uvpicon fwdicon-digg'></span>",
						undefined,
						"UVPSocialMediaButtonsNormalState",
						"UVPSocialMediaButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.diggButton_do = new FWDUVPSimpleButton(_d.diggN_img, _d.diggSPath_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						sBC);
			}
			_s.diggButton_do.screen.className = 'fwduvp-digg-share-button';
			_s.diggButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.diggOnMouseUpHandler);
			_s.addBtnToArray(_s.diggButton_do);
			
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.redditButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='uvpicon fwdicon-reddit'></span>",
						undefined,
						"UVPSocialMediaButtonsNormalState",
						"UVPSocialMediaButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.redditButton_do = new FWDUVPSimpleButton(_d.redditN_img, _d.redditSPath_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						sBC);	
			}
			_s.redditButton_do.screen.className = 'fwduvp-reddit-share-button';
			_s.redditButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.redditOnMouseUpHandler);
			_s.addBtnToArray(_s.redditButton_do);
			
			
			if(_s.useVectorIcons_bl){
				FWDUVPSimpleButton.setPrototype();
				_s.thumbrlButton_do = new FWDUVPSimpleButton(
						undefined, undefined, undefined, true, undefined, undefined, undefined,
						"<span class='uvpicon fwdicon-tumblr'></span>",
						undefined,
						"UVPSocialMediaButtonsNormalState",
						"UVPSocialMediaButtonsSelectedState"
				);
			}else{
				FWDUVPSimpleButton.setPrototype();
				_s.thumbrlButton_do = new FWDUVPSimpleButton(_d.thumbrlN_img, _d.thumbrlSPath_str, undefined,
						true,
						_d.useHEX,
						_d.nBC,
						sBC);
			}
			_s.thumbrlButton_do.screen.className = 'fwduvp-thumbrl-share-button';
			_s.addBtnToArray(_s.thumbrlButton_do);
			_s.thumbrlButton_do.addListener(FWDUVPSimpleButton.MOUSE_UP, _s.thumbrlOnMouseUpHandler);

			_s.mainHld.addChild(_s.facebookButton_do);
			_s.mainHld.addChild(_s.twitterButton_do);
			_s.mainHld.addChild(_s.likedinButton_do);
			_s.mainHld.addChild(_s.bufferButton_do);
			_s.mainHld.addChild(_s.diggButton_do);
			_s.mainHld.addChild(_s.redditButton_do);
			_s.mainHld.addChild(_s.thumbrlButton_do);

		}
		
		_s.facebookOnMouseUpHandler = function(){
			var url = "http://www.facebook.com/share.php?u=" + encodeURIComponent(location.href);
			window.open(url,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=600');
		};
	
		_s.twitterOnMouseUpHandler = function(){
			var url = "http://twitter.com/home?status=" + encodeURIComponent(location.href)
			window.open(url,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=600');
		};
		
		_s.likedinOnMouseUpHandler = function(){
			var url = "https://www.linkedin.com/cws/share?url=" + location.href;
			window.open(url,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=600');
		};
		
		_s.bufferOnMouseUpHandler = function(){
			var url = "https://buffer.com/add?url=" + location.href;
			window.open(url,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=600');
		};
		
		_s.diggOnMouseUpHandler = function(){
			var url = "http://digg.com/submit?url=" + location.href;
			window.open(url,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=600');
		};
		
		_s.redditOnMouseUpHandler = function(){
			var url = "https://www.reddit.com/?submit=" + location.href;
			window.open(url,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=600');
		};
		
		_s.thumbrlOnMouseUpHandler = function(){
			var url = "http://www.tumblr.com/share/link?url=" + location.href;
			window.open(url,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=600');
		};
		

		//########################################//
		/* Add buttons to array */
		//########################################//
		_s.addBtnToArray = function(btn){
			setTimeout(function(){
				if(window.getComputedStyle(btn.screen).display != 'none'){
					_s.btns_ar.push(btn);
				}
			}, 50);
		}
		
		//########################################//
		/* Position buttons */
		//########################################//
		_s.positionButtons = function(){
			var button;
			var prevButton;
			var rowsAr = [];
			var rowsWidthAr = [];
			var rowsThumbsWidthAr = [];
			var tempX;
			var tempY = 0;
			var maxY = 0;
			var totalRowWidth = 0;
			var rowsNr = 0;

			if(!_s.btns_ar.length) return;

			if(_s.btns_ar.length == 1){
				button = _s.btns_ar[0];
			
				button.setX(Math.round((_s.sW - button.getWidth())/2))
				button.setY(parseInt((_s.sH - ((rowsNr + 1) * (button.totalHeight + _s.vSpace) - _s.vSpace))/2));

				return;
			}
			
			rowsAr[rowsNr] = [0];
			rowsWidthAr[rowsNr] = _s.btns_ar[0].totalWidth;
			rowsThumbsWidthAr[rowsNr] = _s.btns_ar[0].totalWidth;
			_s.totalButtons = _s.btns_ar.length;
			
			for (var i=1; i<_s.totalButtons; i++){
				button = _s.btns_ar[i];
				
				if (rowsWidthAr[rowsNr] + button.totalWidth + _s.minHSpace > _s.sW - _s.minMrgXSpc){	
					rowsNr++;
					rowsAr[rowsNr] = [];
					rowsAr[rowsNr].push(i);
					rowsWidthAr[rowsNr] = button.totalWidth;
					rowsThumbsWidthAr[rowsNr] = button.totalWidth;
				}else{
					rowsAr[rowsNr].push(i);
					rowsWidthAr[rowsNr] += button.totalWidth + _s.minHSpace;
					rowsThumbsWidthAr[rowsNr] += button.totalWidth;
				}
			}
		
			tempY = parseInt((_s.sH - ((rowsNr + 1) * (button.totalHeight + _s.vSpace) - _s.vSpace))/2);
			
			for (var i=0; i<rowsNr + 1; i++){
				var rowMarginXSpace = 0;
				
				var rowHSpace;
				
				if (rowsAr[i].length > 1){
					rowHSpace = Math.min((_s.sW - _s.minMrgXSpc - rowsThumbsWidthAr[i]) / (rowsAr[i].length - 1), _s.hSpace);
					
					var rowWidth = rowsThumbsWidthAr[i] + rowHSpace * (rowsAr[i].length - 1);
					
					rowMarginXSpace = parseInt((_s.sW - rowWidth)/2);
				}else{
					rowMarginXSpace = parseInt((_s.sW - rowsWidthAr[i])/2);
				}
				
				if (i > 0) tempY += button.h + _s.vSpace;
				
				for (var j=0; j<rowsAr[i].length; j++){
					button = _s.btns_ar[rowsAr[i][j]];
				
					if (j == 0){
						tempX = rowMarginXSpace;
					}else{
						prevButton = _s.btns_ar[rowsAr[i][j] - 1];
						tempX = prevButton.finalX + prevButton.screen.offsetWidth + rowHSpace;
					}
					

					button.finalX = tempX;
					button.finalY = tempY;
						
					if (maxY < button.finalY) maxY = button.finalY;
					
					_s.buttonsBarTotalHeight = maxY + button.totalHeight + _s.startY ;
					button.setX(button.finalX);
					button.setY(button.finalY);
				}
			}
		}
		
		
		//###########################################//
		/* show / hide */
		//###########################################//
		_s.show = function(id){
			if(_s.isShowed_bl) return;
			_s.isShowed_bl = true;
			prt.main_do.addChild(_s);
			_s.init();
		
			if(_s.useVectorIcons_bl){
				_s.checkButtonsId_to = setInterval(function(){
					
					if(_s.clsBtn.w != 0){
				
						_s.positionAndResize();
						
						clearInterval(_s.checkButtonsId_to);
						clearTimeout(_s.hideCompleteId_to);
						clearTimeout(_s.showCompleteId_to);
						_s.mainHld.setY(- _s.sH);
						
						_s.showCompleteId_to = setTimeout(_s.showCompleteHandler, 900);
						
						FWDAnimation.to(_s.mainHld, .8, {y:0, delay:.1, ease:Expo.easeInOut});
					
					}
				
				}, 50);
			}else{
				_s.positionAndResize();
			
				clearTimeout(_s.hideCompleteId_to);
				clearTimeout(_s.showCompleteId_to);
				_s.mainHld.setY(- _s.sH);
				
				_s.showCompleteId_to = setTimeout(_s.showCompleteHandler, 900);
				setTimeout(function(){
					FWDAnimation.to(_s.mainHld, .8, {y:0, delay:.1, ease:Expo.easeInOut});
				}, 100);
			}	
		};
		
		_s.showCompleteHandler = function(){};
		
		_s.hide = function(){
			if(!_s.isShowed_bl) return;
			_s.isShowed_bl = false;
			
			if(!FWDUVPUtils.isMobile || (FWDUVPUtils.isMobile && FWDUVPUtils.hasPointerEvent)) prt.main_do.setSelectable(false);
			
			if(prt.customContextMenu_do) prt.customContextMenu_do.enable();
			_s.positionAndResize();
			
			clearTimeout(_s.hideCompleteId_to);
			clearTimeout(_s.showCompleteId_to);
			
			_s.hideCompleteId_to = setTimeout(_s.hideCompleteHandler, 800);
			FWDAnimation.killTweensOf(_s.mainHld);
			FWDAnimation.to(_s.mainHld, .8, {y:-_s.sH, ease:Expo.easeInOut});
		};
		
		_s.hideCompleteHandler = function(){
			prt.main_do.removeChild(_s);
			_s.dispatchEvent(FWDUVPShareWindow.HIDE_COMPLETE);
		};

		if(_d.useHEX){
			_s.init();
		}
	};
	

	/* set prototype */
	FWDUVPShareWindow.setPrototype = function(){
		FWDUVPShareWindow.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPShareWindow.HIDE_COMPLETE = "hideComplete";
	
	FWDUVPShareWindow.prototype = null;
	window.FWDUVPShareWindow = FWDUVPShareWindow;
}(window));﻿/**
 * Ultimate Video Player PACKAGED v9.1
 * Simple button.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
var FWDUVPSimpleButton = function(nImg, 
								  sPath, 
								  dPath, 
								  alwaysShowSelectedPath, 
								  useHEX,
								  nBC,
								  sBC,
								  iconCSSString, 
								  showHDIcon, 
								  normalCalssName,
								  selectedCalssName,
								  showOver
								 ){
		
		'use strict';

		var _s = this;
		var prototype = FWDUVPSimpleButton.prototype;
		
		_s.iconCSSString = iconCSSString;
		_s.showHDIcon = showHDIcon;
		
		_s.nImg = nImg;
		_s.sPath_str = sPath;
		_s.dPath_str = dPath;
		
		_s.testButton = Boolean(String(_s.iconCSSString).indexOf("download") != -1);

		_s.showOver = showOver;
		if(!useHEX){
			_s.showOver = false;
		}
		
		if(_s.nImg){
			_s.totalWidth = _s.nImg.width;
			_s.totalHeight = _s.nImg.height;
			_s.buttonWidth = _s.totalWidth;
			_s.buttonHeight = _s.totalHeight;
		}
		
		_s.normalCalssName = normalCalssName;
		_s.selectedCalssName = selectedCalssName;
		
		_s.useHEX = useHEX;
		_s.nBC = nBC;
		_s.sBC = sBC;
		
		_s.isShowed_bl = true;
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		_s.allowToCreateSecondButton_bl = !_s.isMbl || _s.hasPointerEvent_bl || alwaysShowSelectedPath;
		_s.useFontAwesome_bl = Boolean(_s.iconCSSString);
		

		//##########################################//
		/* initialize _s */
		//##########################################//
		_s.init = function(){
			if(_s.iconCSSString) _s.setOverflow('visible');
			_s.setupMainContainers();
			_s.setNormalState();
		};
		

		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.setupMainContainers = function(){
			if(_s.useFontAwesome_bl){
				_s.setOverflow('visible');
				_s.n_do = new FWDUVPTransformDisplayObject("div");	
				_s.n_do.setInnerHTML(_s.iconCSSString);
				_s.addChild(_s.n_do);
				
				if(_s.showHDIcon){
					var hdImage = new Image();
					hdImage.src = showHDIcon;
					_s.hd_do = new FWDUVPDisplayObject("img");
					_s.hd_do.setScreen(hdImage);
					_s.hd_do.setWidth(7);
					_s.hd_do.setHeight(5);

					_s.setOverflow("visible");
					_s.addChild(_s.hd_do);
				};
			
				_s.setFinalSize();
			}else{
				if(_s.useHEX && !_s.showOver){
					_s.n_do = new FWDUVPTransformDisplayObject("div");
					_s.n_do.setWidth(_s.totalWidth);
					_s.n_do.setHeight(_s.totalHeight);

					_s.n_do_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.nImg, _s.nBC).canvas;
					_s.n_do.screen.appendChild(_s.n_do_canvas);
					_s.addChild(_s.n_do);
				}else{
					_s.n_do = new FWDUVPTransformDisplayObject("img");	
					_s.n_do.setScreen(_s.nImg);
					_s.addChild(_s.n_do);
				}
				
				if(_s.allowToCreateSecondButton_bl){
					
					_s.img1 = new Image();
					_s.img1.src = _s.sPath_str;
					var img2 = new Image();
					_s.sImg = img2;
					
					if(_s.useHEX){
						_s.s_sdo = new FWDUVPTransformDisplayObject("div");
						_s.s_sdo.setWidth(_s.totalWidth);
						_s.s_sdo.setHeight(_s.totalHeight);
						var clr = _s.sBC;
						if(_s.showOver){
							clr = _s.nBC
						}

						_s.img1.onload = function(){
							_s.s_sdo_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.img1, clr).canvas;
							_s.s_sdo.screen.appendChild(_s.s_sdo_canvas);
						}
						if(!_s.showOver){
							_s.s_sdo.setAlpha(0);
						}
						_s.addChild(_s.s_sdo);
					}else{
						_s.s_sdo = new FWDUVPDisplayObject("img");
						_s.s_sdo.setScreen(_s.img1);
						_s.s_sdo.setWidth(_s.totalWidth);
						_s.s_sdo.setHeight(_s.totalHeight);
						if(!_s.useHEX){
							_s.s_sdo.setAlpha(0);
						}
						_s.addChild(_s.s_sdo);
					}
					
					if(_s.dPath_str){
						img2.src = _s.dPath_str;
						_s.d_sdo = new FWDUVPDisplayObject("img");
						_s.d_sdo.setScreen(img2);
						_s.d_sdo.setWidth(_s.totalWidth);
						_s.d_sdo.setHeight(_s.totalHeight);
						_s.d_sdo.setX(-100);
						_s.addChild(_s.d_sdo);
					};
					_s.setWidth(_s.totalWidth);
					_s.setHeight(_s.totalHeight);
				}
			}

			_s.setButtonMode(true);
			_s.screen.style.yellowOverlayPointerEvents = "none";
			
			if(_s.hasPointerEvent_bl){
				_s.screen.addEventListener("pointerup", _s.onMouseUp);
				_s.screen.addEventListener("pointerover", _s.onMouseOver);
				_s.screen.addEventListener("pointerout", _s.onMouseOut);
			}else if(_s.screen.addEventListener){	
				if(!_s.isMbl){
					_s.screen.addEventListener("mouseover", _s.onMouseOver);
					_s.screen.addEventListener("mouseout", _s.onMouseOut);
					_s.screen.addEventListener("mouseup", _s.onMouseUp);
				}
				_s.screen.addEventListener("touchend", _s.onMouseUp);
			}
		};
		
		_s.onMouseOver = function(e){
			_s.dispatchEvent(FWDUVPSimpleButton.SHOW_TOOLTIP, {e:e});
			if(_s.isDisabledForGood_bl) return;
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE || e.pointerType == "mouse"){
				if(_s.isDisabled_bl || _s.isSelectedFinal_bl) return;
				_s.dispatchEvent(FWDUVPSimpleButton.MOUSE_OVER, {e:e});
				_s.setSelectedState(true);
			}
		};
			
		_s.onMouseOut = function(e){
			if(_s.isDisabledForGood_bl) return;
			if(!e.pointerType || e.pointerType == e.MSPOINTER_TYPE_MOUSE || e.pointerType == "mouse"){
				if(_s.isDisabled_bl || _s.isSelectedFinal_bl) return;
				_s.dispatchEvent(FWDUVPSimpleButton.MOUSE_OUT, {e:e});
				_s.setNormalState(true);
			}
		};
		
		_s.onMouseUp = function(e){
			
			if(_s.isDisabledForGood_bl) return;
			if(e.preventDefault) e.preventDefault();
			if(_s.isDisabled_bl || e.button == 2) return;
		
			_s.dispatchEvent(FWDUVPSimpleButton.MOUSE_UP, {e:e});
		};
		
		_s.checkCount = 0;
		_s.setFinalSize = function(reset){
			if(reset){
				_s.checkCount = 0;
			}
			
			clearInterval(_s.checkId_int);
			if(_s.checkCount > 6) return;
			_s.lastWidth = _s.n_do.screen.firstChild.offsetWidth;
			_s.checkCount +=1;
		
			_s.checkId_int = setInterval(function(){
				_s.setFinalSize();
			},100);
			
			if(_s.prevWidth == _s.lastWidth || _s.lastWidth == 0) return;
			_s.setWidth(_s.n_do.screen.firstChild.offsetWidth);
			_s.setHeight(_s.n_do.screen.firstChild.offsetHeight);

			_s.n_do.setWidth(_s.w);
			_s.n_do.setHeight(_s.h);
			_s.buttonWidth = _s.w;
			_s.buttonHeight = _s.h;
			_s.totalWidth = _s.w;
			_s.totalHeight = _s.h;
		
			if(_s.hd_do){
				_s.hd_do.setX(_s.w - _s.hd_do.w + 2);
				_s.hd_do.setY( -2);	
			}
			
			_s.prevWidth = _s.lastWidth;
		}
		

		//##############################//
		// set select / deselect final.
		//##############################//
		_s.setSelected = function(){
			_s.isSelectedFinal_bl = true;
			if(!_s.s_sdo) return;
			FWDAnimation.killTweensOf(_s.s_sdo);
			FWDAnimation.to(_s.s_sdo, .8, {alpha:1, ease:Expo.easeOut});
		};
		
		_s.setUnselected = function(){
			_s.isSelectedFinal_bl = false;
			if(!_s.s_sdo) return;
			FWDAnimation.to(_s.s_sdo, .8, {alpha:0, delay:.1, ease:Expo.easeOut});
		};
		

		//####################################//
		/* Set normal / selected state */
		//####################################//
		_s.setNormalState = function(animate){
			if(_s.doNotallowToSetNormal) return;
			if(_s.useFontAwesome_bl){
				FWDAnimation.killTweensOf(_s.n_do.screen);
				if(animate){
					FWDAnimation.to(_s.n_do.screen, .6, {className:_s.normalCalssName, ease:Quart.easeOut});	
				}else{
					_s.n_do.screen.className = _s.normalCalssName;
				}
			}else{

				if(_s.showOver){
					FWDAnimation.killTweensOf(_s.s_sdo);
					FWDAnimation.to(_s.s_sdo, .6, {alpha:1, ease:Quart.easeOut});	
				}else{
					FWDAnimation.killTweensOf(_s.s_sdo);
					FWDAnimation.to(_s.s_sdo, .6, {alpha:0, ease:Quart.easeOut});	
				}
			}
		};
		
		_s.setSelectedState = function(animate){
			if(_s.useFontAwesome_bl){
				FWDAnimation.killTweensOf(_s.n_do.screen);
				if(animate){
					FWDAnimation.to(_s.n_do.screen, .6, {className:_s.selectedCalssName, ease:Quart.easeOut});	
				}else{
					_s.n_do.screen.className = _s.selectedCalssName;
				}
			}else{
				if(_s.showOver){
					FWDAnimation.killTweensOf(_s.s_sdo);
					FWDAnimation.to(_s.s_sdo, .6, {alpha:0, ease:Quart.easeOut});	
				}else{
					FWDAnimation.killTweensOf(_s.s_sdo);
					FWDAnimation.to(_s.s_sdo, .6, {alpha:1, delay:.1, ease:Quart.easeOut});
				}
				
			}
		};
		

		//####################################//
		/* Disable / enable */
		//####################################//
		_s.setDisabledState = function(){
			if(_s.isSetToDisabledState_bl) return;
			_s.isSetToDisabledState_bl = true;
			if(_s.d_sdo) _s.d_sdo.setX(0);
			if(_s.hd_do) _s.hd_do.setX(_s.w - _s.hd_do.w);
		};
		
		_s.setEnabledState = function(){
			if(!_s.isSetToDisabledState_bl) return;
			_s.isSetToDisabledState_bl = false;
			if(_s.d_sdo) _s.d_sdo.setX(-100);
			if(_s.hd_do) _s.hd_do.setX(-100000);
		};
		
		_s.disable = function(){
			if(_s.isDisabledForGood_bl  || _s.isDisabled_bl) return;
			_s.isDisabled_bl = true;
			_s.setButtonMode(false);
			FWDAnimation.killTweensOf(_s);
			FWDAnimation.to(_s, .6, {alpha:.4});
			_s.setNormalState(true);
		};
		
		_s.enable = function(){
			if(_s.isDisabledForGood_bl || !_s.isDisabled_bl) return;
			_s.isDisabled_bl = false;
			_s.setButtonMode(true);
			FWDAnimation.killTweensOf(_s);
			FWDAnimation.to(_s, .6, {alpha:1});
		};
		
		_s.disableForGood = function(){
			_s.isDisabledForGood_bl = true;
			_s.setButtonMode(false);
		};
		
		_s.showDisabledState = function(){
			if(_s.d_sdo) if(_s.d_sdo.x != 0) _s.d_sdo.setX(0);
			if(_s.hd_do) _s.hd_do.setX(_s.w - _s.hd_do.w + 2);
		};
		
		_s.hideDisabledState = function(){
			if(_s.d_sdo) if(_s.d_sdo.x != -100) _s.d_sdo.setX(-100);
			if(_s.hd_do) _s.hd_do.setX(-10000);
		};
	
		
		//#####################################//
		/* show / hide */
		//#####################################//
		_s.show = function(){
			if(_s.isShowed_bl) return;
			_s.isShowed_bl = true;
			
			FWDAnimation.killTweensOf(_s);
			if(!FWDUVPUtils.isIEAndLessThen9){
				if(FWDUVPUtils.isIEWebKit){
					FWDAnimation.killTweensOf(_s.n_do);
					_s.n_do.setScale2(0);
					FWDAnimation.to(_s.n_do, .8, {scale:1, delay:.4, onStart:function(){_s.setVisible(true);}, ease:Elastic.easeOut});
				}else{
					_s.setScale2(0);
					FWDAnimation.to(_s, .8, {scale:1, delay:.4, onStart:function(){_s.setVisible(true);}, ease:Elastic.easeOut});
				}
			}else if(FWDUVPUtils.isIEAndLessThen9){
				_s.setVisible(true);
			}else{
				_s.setAlpha(0);
				FWDAnimation.to(_s, .4, {alpha:1, delay:.4});
				_s.setVisible(true);
			}
		};	
			
		_s.hide = function(animate){
			if(!_s.isShowed_bl) return;
			_s.isShowed_bl = false;
			FWDAnimation.killTweensOf(_s);
			FWDAnimation.killTweensOf(_s.n_do);
			_s.setVisible(false);
		};
		
		
		//##########################################//
		/* Update HEX color of a canvaas */
		//##########################################//
		_s.updateHEXColors = function(nBC, sBC){
			if(_s.n_do_canvas){
				FWDUVPUtils.changeCanvasHEXColor(_s.nImg, _s.n_do_canvas, nBC);
			}
			
			if(_s.s_sdo_canvas){
				FWDUVPUtils.changeCanvasHEXColor(_s.img1, _s.s_sdo_canvas, sBC);
			}
		}
		
		_s.init();
	};
	
	/* set prototype */
	FWDUVPSimpleButton.setPrototype = function(){
		FWDUVPSimpleButton.prototype = null;
		FWDUVPSimpleButton.prototype = new FWDUVPTransformDisplayObject("div");
	};
	
	FWDUVPSimpleButton.CLICK = "onClick";
	FWDUVPSimpleButton.MOUSE_OVER = "onMouseOver";
	FWDUVPSimpleButton.SHOW_TOOLTIP = "showTooltip";
	FWDUVPSimpleButton.MOUSE_OUT = "onMouseOut";
	FWDUVPSimpleButton.MOUSE_UP = "onMouseDown";
	
	FWDUVPSimpleButton.prototype = null;
	window.FWDUVPSimpleButton = FWDUVPSimpleButton;
}(window));﻿/**
 * Ultimate Video Player PACKAGED v9.1
 * Simple size button.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
var FWDUVPSimpleSizeButton = function(
		nImgPath, 
		sImgPath,
		buttonWidth,
		buttonHeight, 
	    useHEX,
	    nBC,
	    sBC,
	    showOver){
		
		'use strict';

		var _s = this;
		var prototype = FWDUVPSimpleSizeButton.prototype;
		
		_s.useHEX = useHEX;
		_s.nBC = nBC;
		_s.sBC = sBC;
		
		_s.nImgPath_str = nImgPath;
		_s.sImgPath_str = sImgPath;
		
		_s.buttonWidth = buttonWidth;
		_s.buttonHeight = buttonHeight;

		_s.showOver = showOver;
		if(!useHEX){
			_s.showOver = false;
		}

		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		_s.isDisabled_bl = false;
		

		
		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.setupMainContainers();
			_s.setWidth(_s.buttonWidth);
			_s.setHeight(_s.buttonHeight);
			_s.setButtonMode(true);
		};
		

		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.setupMainContainers = function(){
			
			_s.nImg = new Image();
			_s.nImg.src = _s.nImgPath_str;
			
			if(_s.useHEX && !_s.showOver){
				_s.n_do = new FWDUVPTransformDisplayObject("div");
				_s.n_do.setWidth(_s.buttonWidth);
				_s.n_do.setHeight(_s.buttonHeight);
				_s.nImg.onload = function(){	
					_s.n_do_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.nImg, _s.nBC).canvas;
					_s.n_do.screen.appendChild(_s.n_do_canvas);
				}
				_s.addChild(_s.n_do);
			}else{
				_s.n_do = new FWDUVPDisplayObject("img");
				_s.n_do.setScreen(_s.nImg);
				_s.n_do.setWidth(_s.buttonWidth);
				_s.n_do.setHeight(_s.buttonHeight);
				_s.addChild(_s.n_do);
			}
			
			_s.sImg = new Image();
			_s.sImg.src = _s.sImgPath_str;
			
			if(_s.useHEX){
				_s.s_do = new FWDUVPTransformDisplayObject("div");
				_s.s_do.setWidth(_s.buttonWidth);
				_s.s_do.setHeight(_s.buttonHeight);
				_s.sImg.onload = function(){
					_s.s_do_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.sImg, _s.nBC).canvas;
					_s.s_do.screen.appendChild(_s.s_do_canvas);
				}
				if(!_s.showOver){
					_s.s_do.setAlpha(0);
				}
				_s.addChild(_s.s_do);
			}else{
				_s.s_do = new FWDUVPDisplayObject("img");
				_s.s_do.setScreen(_s.sImg);
				_s.s_do.setWidth(_s.buttonWidth);
				_s.s_do.setHeight(_s.buttonHeight);
				_s.addChild(_s.s_do);

				if(!_s.useHEX){
					_s.s_do.setAlpha(0);
				}
			}
			
			if(_s.showOver){
				_s.addChild(_s.s_do);
			}
			
			if(_s.hasPointerEvent_bl){
				_s.screen.addEventListener("pointerup", _s.onMouseUp);
				_s.screen.addEventListener("pointerover", _s.setSelectedState);
				_s.screen.addEventListener("pointerout", _s.setNormalState);
			}else if(_s.screen.addEventListener){	
				if(!_s.isMbl){
					_s.screen.addEventListener("mouseover", _s.setSelectedState);
					_s.screen.addEventListener("mouseout", _s.setNormalState);
					_s.screen.addEventListener("mouseup", _s.onMouseUp);
				}
				_s.screen.addEventListener("touchend", _s.onMouseUp);
			}
			
		};

		
		//####################################//
		/* Set normal / selected state */
		//####################################//
		_s.setNormalState = function(e){
			if(_s.showOver){
				FWDAnimation.killTweensOf(_s.s_do);
				FWDAnimation.to(_s.s_do, .6, {alpha:1, ease:Quart.easeOut});
			}else{
				FWDAnimation.killTweensOf(_s.s_do);
				FWDAnimation.to(_s.s_do, .6, {alpha:0, ease:Quart.easeOut});
			}
		};
		
		_s.setSelectedState = function(e){
			if(_s.showOver){
				FWDAnimation.killTweensOf(_s.s_do);
				FWDAnimation.to(_s.s_do, .6, {alpha:0, ease:Quart.easeOut});
			}else{
				FWDAnimation.killTweensOf(_s.s_do);
				FWDAnimation.to(_s.s_do, .6, {alpha:1, ease:Quart.easeOut});
			}	
		};
		
		_s.onMouseUp = function(e){
			_s.dispatchEvent(FWDUVPSimpleSizeButton.MOUSE_UP);
			_s.dispatchEvent(FWDUVPSimpleSizeButton.CLICK);
		};
		

		//##########################################//
		/* Update HEX color of a canvaas */
		//##########################################//
		_s.updateHEXColors = function(nBC, sBC){
			if(_s.n_do_canvas){
				FWDUVPUtils.changeCanvasHEXColor(_s.nImg, _s.n_do_canvas, nBC);
			}
			var clr = sBC;
			if(_s.showOver){
				clr = nBC;
			}
			FWDUVPUtils.changeCanvasHEXColor(_s.sImg, _s.s_do_canvas, clr);
		}
			
		_s.init();
	};
	
	
	/* set prototype */
	FWDUVPSimpleSizeButton.setPrototype = function(){
		FWDUVPSimpleSizeButton.prototype = null;
		FWDUVPSimpleSizeButton.prototype = new FWDUVPTransformDisplayObject("div", "relative");
	};
	
	FWDUVPSimpleSizeButton.MOUSE_UP = "onClick";
	FWDUVPSimpleSizeButton.CLICK = "onClick";
	
	FWDUVPSimpleSizeButton.prototype = null;
	window.FWDUVPSimpleSizeButton = FWDUVPSimpleSizeButton;
}(window));﻿/**
 * Ultimate Video Player PACKAGED v9.1
 * Subtitle.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
var FWDUVPSubtitle = function(prt, _d){
		
		'use strict';

		var _s = this;
		var prototype = FWDUVPSubtitle.prototype;
		
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		_s.showSubtitileByDefault_bl = _d.showSubtitileByDefault_bl;
		

		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.setOverflow("visible");
			_s.getStyle().pointerEvents = "none";
			_s.getStyle().cursor = "default";
			_s.setupTextContainer();
			_s.getStyle().margin = "auto";		
			_s.hide();
		};
		
	
		//##########################################//
		/* setup text containers */
		//##########################################//
		_s.setupTextContainer = function(){
			_s.text_do = new FWDUVPTransformDisplayObject("div");
			_s.text_do.getStyle().pointerEvents = "none";
			_s.text_do.hasTransform3d_bl = false;
			_s.text_do.setBackfaceVisibility();
			_s.text_do.getStyle().transformOrigin = "50% 0%";
			_s.text_do.getStyle().textAlign = "center";
			_s.addChild(_s.text_do);
		};
		

		//##########################################//
		/* Load subtitle */
		//##########################################//
		_s.loadSubtitle = function(path){
			_s.text_do.setX(-5000);
			if(location.protocol.indexOf("file:") != -1) return;
			_s.subtitiles_ar = [];
			_s.stopToLoadSubtitle();
			_s.sourceURL_str = path;
			_s.xhr = new XMLHttpRequest();
			_s.xhr.onreadystatechange = _s.onLoad;
			_s.xhr.onerror = _s.onError;
			
			try{
				_s.xhr.open("get", _s.sourceURL_str + "?rand=" + parseInt(Math.random() * 99999999), true);
				_s.xhr.send();
			}catch(e){
				var message = e;
				if(e){if(e.message)message = e.message;}
			}
		};
		
		_s.onLoad = function(e){
			var response;
			
			if(_s.xhr.readyState == 4){
				if(_s.xhr.status == 404){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Subtitle file path is not found: <font color='#FF0000'>" + _s.sourceURL_str + "</font>"});
				}else if(_s.xhr.status == 408){
					_s.dispatchEvent(FWDUVPData.LOAD_ERROR, {text:"Loadiong subtitle file file request load timeout!"});
				}else if(_s.xhr.status == 200){
					if(window.JSON){
						_s.subtitle_txt = _s.xhr.responseText;
					}else{
						_s.subtitle_txt = _s.xhr.responseText;
					}
					if(_s.isShowed_bl) _s.show();
					
					_s.parseSubtitle(_s.subtitle_txt)
					_s.prevText = "none";
					_s.shId_to = setTimeout(function(){
						_s.show();
						_s.text_do.setX(0);
						_s.updateSubtitle(prt.currentSecconds);
					}, 400);
				}
			}
			
			_s.dispatchEvent(FWDUVPSubtitle.LOAD_COMPLETE);
		};
		
		_s.onError = function(e){
			try{
				if(window.console) console.log(e);
				if(window.console) console.log(e.message);
			}catch(e){};
			_s.dispatchEvent(FWDUVPSubtitle.LOAD_ERROR, {text:"Error loading subtitle file : <font color='#FF0000'>" + _s.sourceURL_str + "</font>."});
		};

		
		//####################################################//
		/* Stop to load subtitile */
		//####################################################//
		_s.stopToLoadSubtitle = function(){
			if(_s.xhr != null){
				try{_s.xhr.abort();}catch(e){}
				_s.xhr.onreadystatechange = null;
				_s.xhr.onerror = null;
				_s.xhr = null;
			}
			_s.hide();
			_s.isLded = false;
			
		};
		

		//##########################################//
		/* parse subtitle */
		//##########################################//
		_s.parseSubtitle = function(file_str){
			
			 _s.isLded = true;
			 function strip(s) {
				if(s ==  undefined) return "";
		        return s.replace(/^\s+|\s+$/g,"");
		     }
			 
			file_str = file_str.replace(/\r\n|\r|\n/g, '\n');
			file_str = strip(file_str);

		    var srt_ = file_str.split('\n\n');
		    var cont = 0;
			
		    for(var s in srt_) {
		        var st = srt_[s].split('\n');

		        if(st.length >=2) {
		            var n = st[0];

		            var i = strip(st[1].split(' --> ')[0]);
		            var o = strip(st[1].split(' --> ')[1]);
		            var t = st[2];
					

		            if(st.length > 2) {
		                for(var j=3; j<st.length;j++)
		                  t += '<br>'+st[j];
		            }
		            
		            //define variable type as Object
		            _s.subtitiles_ar[cont] = {};
		            _s.subtitiles_ar[cont].number = n;
		            _s.subtitiles_ar[cont].start = i;
		            _s.subtitiles_ar[cont].end = o;
		            _s.subtitiles_ar[cont].startDuration = FWDUVPUtils.formatTimeWithMiliseconds(i);
		            _s.subtitiles_ar[cont].endDuration = FWDUVPUtils.formatTimeWithMiliseconds(o);
		            _s.subtitiles_ar[cont].text = "<p class='fwduvp-subtitle'>" + t + "</p>";
		        }
		        cont++;
		    }
			for(var i=0; i<_s.subtitiles_ar.length; i++){
				if(!_s.subtitiles_ar[i]){
					_s.subtitiles_ar.splice(i,1);
					i--;
				}
			}
		};
		
		
		//#####################################//
		/* Update text */
		//#####################################//
		_s.updateSubtitle = function(duration){
			if(!_s.isLded) return;
		
			var start;
			var end;
			var text = "";
			for(var i=0; i<_s.subtitiles_ar.length; i++){
				start = _s.subtitiles_ar[i].startDuration;
				end = _s.subtitiles_ar[i].endDuration;
				if(start < duration  && end > duration ){
					text = _s.subtitiles_ar[i].text
					break;
				};
			}

			if(prt.sW < 260){
				_s.setVisible(false);
			}else{
				_s.setVisible(true);
			}

			if(prt.tempStageWidth <= 600){
				text = text.replace('fwduvp-subtitle', 'fwduvp-subtitle phone');
			}else if(prt.tempStageWidth <= 1000){
				text = text.replace('fwduvp-subtitle', 'fwduvp-subtitle tablet');
			}else if(prt.tempStageWidth <= 1800){
				text = text.replace('fwduvp-subtitle', 'fwduvp-subtitle normal');
			}else{
				text = text.replace('fwduvp-subtitle', 'fwduvp-subtitle large');
			}
			
			if(_s.prevText != text){
				var totalWidth;
				_s.text_do.setInnerHTML(text);
				_s.setAlpha(0);
				setTimeout(function(){
					_s.setAlpha(1);
					_s.position();
				}, 300);
				_s.hasText_bl = true;
			}
			_s.prevText = text;
		};
		
		_s.position = function(animate){
			if(!_s.isLded) return;
			
			var finalY;
			_s.setWidth(prt.tempVidStageWidth);
			_s.text_do.setWidth(prt.tempVidStageWidth);
			_s.setX(Math.round((prt.tempVidStageWidth - _s.w)/2));

			var textHeight = _s.text_do.getHeight();
			
			if(prt.controller_do){
				if(prt.controller_do.isShowed_bl){
					finalY = parseInt(prt.vidStageHeight - prt.controller_do.h - textHeight);
				}else{
					finalY = parseInt(prt.vidStageHeight - textHeight - 10);
				}	
			}else{
				finalY = parseInt(prt.vidStageHeight - textHeight);
			}
			
			FWDAnimation.killTweensOf(_s.text_do)
			if(animate){
				FWDAnimation.to(_s.text_do, .8, {y:finalY, ease:Expo.easeInOut});
			}else{
				_s.text_do.setY(finalY)
			}
			_s.text_do.setX(0);
		};
		
		_s.show = function(){
			_s.setVisible(true);
		};
		
		_s.hide = function(){
			clearTimeout(_s.shId_to);
			_s.setVisible(false);
		}
		
		_s.init();
	};
	
	FWDUVPSubtitle.getDuration = function(str){
		var hours = 0;
		var minutes = 0;
		var seconds = 0;
		var duration = 0;
		
		str = str.split(":");
		
		hours = str[0];
		if(hours[0] == "0" && hours[1] != "0"){
			hours = parseInt(hours[1]);
		}
		if(hours == "00") hours = 0;
		
		minutes = str[1];
		if(minutes[0] == "0" && minutes[1] != "0"){
			minutes = parseInt(minutes[1]);
		}
		if(minutes == "00") minutes = 0;
		
		secs = parseInt(str[2].replace(/,.*/ig, ""));
		if(secs[0] == "0" && secs[1] != "0"){
			secs = parseInt(secs[1]);
		}
		if(secs == "00") secs = 0;
		
		if(hours != 0){
			duration += (hours * 60 * 60)
		}
		
		if(minutes != 0){
			duration += (minutes * 60)
		}
		
		duration += secs;
		
		return duration;
	}
	

	/* set prototype */
	FWDUVPSubtitle.setPrototype = function(){
		FWDUVPSubtitle.prototype = null;
		FWDUVPSubtitle.prototype = new FWDUVPTransformDisplayObject("div");
	};
	
	FWDUVPSubtitle.LOAD_ERROR = "error";
	FWDUVPSubtitle.LOAD_COMPLETE = "complete";
	
	
	FWDUVPSubtitle.prototype = null;
	window.FWDUVPSubtitle = FWDUVPSubtitle;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Button tooltip.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
var FWDUVPToolTip = function(
			buttonRef_do,
			bkPath_str,
			pointerPath_str,
			toolTipLabel_str,
			fontColor_str,
			toolTipsButtonsHideDelay
		){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPToolTip.prototype;
		
		_s.buttonRef_do = buttonRef_do;
		
		_s.bkPath_str = bkPath_str;
		_s.pointerPath_str = pointerPath_str;
	
		_s.fontColor_str = fontColor_str;
		_s.toolTipLabel_str = toolTipLabel_str;
		
		_s.toolTipsButtonsHideDelay = toolTipsButtonsHideDelay * 1000;
		_s.pointerWidth = 7;
		_s.pointerHeight = 4;
		
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.isShowed_bl = true;
	

		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.setOverflow("visible");
			_s.screen.className = 'UVP-tooltip-bk';
			_s.setupMainContainers();
			_s.setLabel(_s.toolTipLabel_str);
			_s.hide();
			_s.getStyle().background = "url('" + _s.bkPath_str + "')";
			_s.getStyle().zIndex = 9999999999999;
		};
		

		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.setupMainContainers = function(){
			_s.text_do = new FWDUVPDisplayObject("div");
			_s.text_do.screen.className = 'UVP-tooltip-text';
			_s.text_do.hasTransform3d_bl = false;
			_s.text_do.hasTransform2d_bl = false;
			_s.text_do.setBackfaceVisibility();
			_s.text_do.setDisplay("inline");
			_s.text_do.getStyle().fontFamily = "Arial";
			_s.text_do.getStyle().fontSize= "12px";
			_s.text_do.getStyle().color = _s.fontColor_str;
			_s.text_do.getStyle().whiteSpace= "nowrap";
			_s.text_do.getStyle().padding = "6px";
			_s.text_do.getStyle().paddingTop = "4px";
			_s.text_do.getStyle().paddingBottom = "4px";
			_s.setLabel();
			_s.addChild(_s.text_do);
			
			
			_s.pointer_do = new FWDUVPDisplayObject("div");
			_s.pointer_do.screen.className = 'UVP-tooltip-pointer';
			_s.pointer_do.getStyle().background = "url('" + _s.pointerPath_str + "')";
			_s.pointer_do.setWidth(_s.pointerWidth);
			_s.pointer_do.setHeight(_s.pointerHeight);
			_s.addChild(_s.pointer_do);
		};
		

		//##########################################//
		/* set label */
		//##########################################//
		_s.setLabel = function(label){
			_s.text_do.setInnerHTML(toolTipLabel_str);
			setTimeout(function(){
				if(_s == null) return;
					_s.setWidth(_s.text_do.getWidth());
					_s.setHeight(_s.text_do.getHeight());
					_s.positionPointer();
				},50);
		};
		
		_s.positionPointer = function(offsetX){
			var finalX;
			var finalY;
			
			if(!offsetX) offsetX = 0;
			
			finalX = parseInt((_s.w - _s.pointerWidth)/2) + offsetX;
			finalY = _s.h;
			_s.pointer_do.setX(finalX);
			_s.pointer_do.setY(finalY);
		};
		

		//##########################################//
		/* show / hide*/
		//##########################################//
		_s.show = function(){
			if(_s.isShowed_bl) return;
			_s.isShowed_bl = true;
			
			FWDAnimation.killTweensOf(_s);
			clearTimeout(_s.showWithDelayId_to);
			_s.showWithDelayId_to = setTimeout(_s.showFinal, _s.toolTipsButtonsHideDelay);
			_s.setMVId_to = setTimeout(function(){
				window.addEventListener("mousemove", _s.moveHandler);
			}, 50);
		};
		
		_s.showFinal = function(){
			_s.setVisible(true);
			_s.setAlpha(0);
			FWDAnimation.to(_s, .4, {alpha:1, onComplete:function(){_s.setVisible(true);}, ease:Quart.easeOut});
		};
		
		_s.moveHandler = function(e){
			var wc = FWDUVPUtils.getViewportMouseCoordinates(e);	
			if(!FWDUVPUtils.hitTest(_s.buttonRef_do.screen, wc.screenX, wc.screenY)) _s.hide();
		};
		
		_s.hide = function(){
			if(!_s.isShowed_bl) return;
			clearTimeout(_s.setMVId_to);
			clearTimeout(_s.showWithDelayId_to);
			window.removeEventListener("mousemove", _s.moveHandler);
			
			FWDAnimation.killTweensOf(_s);
			_s.setVisible(false);
			_s.isShowed_bl = false;
		};
		
		_s.init();
	};
	
	/* set prototype */
	FWDUVPToolTip.setPrototype = function(){
		FWDUVPToolTip.prototype = null;
		FWDUVPToolTip.prototype = new FWDUVPDisplayObject("div", "fixed");
	};
	
	FWDUVPToolTip.CLICK = "onClick";
	FWDUVPToolTip.MOUSE_DOWN = "onMouseDown";
	
	FWDUVPToolTip.prototype = null;
	window.FWDUVPToolTip = FWDUVPToolTip;
}(window));﻿/**
 * Ultimate Video Player PACKAGED v9.1
 * Transform  display object.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	/*
	 * @ type values: div, img.
	 * @ positon values: relative, absolute.
	 * @ positon values: hidden.
	 * @ display values: block, inline-block, _s applies only if the position is relative.
	 */
	var FWDUVPTransformDisplayObject = function(type, position, overflow, display){

		'use strict';
	
		var _s = this;
		_s.listeners = {events_ar:[]};
		
		if(type == "div" || type == "img" || type == "canvas" || type=='iframe'){
			_s.type = type;	
		}else{
			throw Error("Type is not valid! " + type);
		}
	
		_s.children_ar = [];
		_s.position = position || "absolute";
		_s.overflow = overflow || "hidden";
		_s.display = display || "block";
		_s.visible = true;
		_s.buttonMode;
		_s.x = 0;
		_s.y = 0;	
		_s.scale = 1;
		_s.rotation = 0;
		_s.w = 0;
		_s.h = 0;
		_s.alpha = 1;
		_s.innerHTML = "";
		_s.opacityType = "";
		_s.isHtml5_bl = false;
		_s.hasTransform2d_bl = FWDUVPUtils.hasTransform2d;
		

		//##############################//
		/* init */
		//#############################//
		_s.init = function(){
			_s.setScreen();
		};	
		

		//######################################//
		/* check if it supports transforms. */
		//######################################//
		_s.getTransform = function() {
		    var properties = ['transform', 'msTransform', 'WebkitTransform', 'MozTransform', 'OTransform'];
		    var p;
		    while (p = properties.shift()) {
		       if (typeof _s.screen.style[p] !== 'undefined') {
		            return p;
		       }
		    }
		    return false;
		};
		

		//######################################//
		/* set opacity type */
		//######################################//
		_s.getOpacityType = function(){
			var opacityType;
			if (typeof _s.screen.style.opacity != "undefined") {//ie9+ 
				opacityType = "opacity";
			}else{ //ie8
				opacityType = "filter";
			}
			return opacityType;
		};

		
		//######################################//
		/* setup main screen */
		//######################################//
		_s.setScreen = function(element){
			if(_s.type == "img" && element){
				_s.screen = element;
				_s.setMainProperties();
			}else{
				_s.screen = document.createElement(_s.type);
				_s.setMainProperties();
			}
		};
		

		//########################################//
		/* set main properties */
		//########################################//
		_s.setMainProperties = function(){
			
			_s.transform = _s.getTransform();
			_s.setPosition(_s.position);
			_s.setOverflow(_s.overflow);
			_s.opacityType = _s.getOpacityType();
			if(_s.opacityType == "opacity") _s.isHtml5_bl = true;
			if(_s.opacityType == "filter") _s.screen.style.filter = "inherit";
			
			_s.screen.style.left = "0px";
			_s.screen.style.top = "0px";
			_s.screen.style.margin = "0px";
			_s.screen.style.padding = "0px";
			_s.screen.style.maxWidth = "none";
			_s.screen.style.maxHeight = "none";
			_s.screen.style.border = "none";
			_s.screen.style.lineHeight = "1";
			_s.screen.style.backfaceVisibility = "hidden";
			_s.screen.style.webkitBackfaceVisibility = "hidden";
			_s.screen.style.MozBackfaceVisibility = "hidden";
			_s.screen.style.MozImageRendering = "optimizeSpeed";	
			_s.screen.style.WebkitImageRendering = "optimizeSpeed";
			
			if(type == "img"){
				_s.setWidth(_s.screen.width);
				_s.setHeight(_s.screen.height);
				_s.screen.onmousedown = function(e){return false;};
			}
		};
		
		_s.setBackfaceVisibility =  function(){
			_s.screen.style.backfaceVisibility = "visible";
			_s.screen.style.webkitBackfaceVisibility = "visible";
			_s.screen.style.MozBackfaceVisibility = "visible";		
		};
		
		_s.removeBackfaceVisibility =  function(){
			_s.screen.style.backfaceVisibility = "hidden";
			_s.screen.style.webkitBackfaceVisibility = "hidden";
			_s.screen.style.MozBackfaceVisibility = "hidden";		
		};

		
		//###################################################//
		/* set / get various peoperties.*/
		//###################################################//
		_s.setSelectable = function(val){
			if(!val){
				try{_s.screen.style.userSelect = "none";}catch(e){};
				try{_s.screen.style.MozUserSelect = "none";}catch(e){};
				try{_s.screen.style.webkitUserSelect = "none";}catch(e){};
				try{_s.screen.style.khtmlUserSelect = "none";}catch(e){};
				try{_s.screen.style.oUserSelect = "none";}catch(e){};
				try{_s.screen.style.msUserSelect = "none";}catch(e){};
				try{_s.screen.msUserSelect = "none";}catch(e){};
				_s.screen.ondragstart = function(e){return  false;};
				_s.screen.onselectstart = function(){return false;};
				_s.screen.style.webkitTouchCallout='none';
			}
		};
		
		_s.getScreen = function(){
			return _s.screen;
		};
		
		_s.setVisible = function(val){
			_s.visible = val;
			if(_s.visible == true){
				_s.screen.style.visibility = "visible";
			}else{
				_s.screen.style.visibility = "hidden";
			}
		};
		
		_s.getVisible = function(){
			return _s.visible;
		};
			
		_s.setResizableSizeAfterParent = function(){
			_s.screen.style.width = "100%";
			_s.screen.style.height = "100%";
		};
		
		_s.getStyle = function(){
			return _s.screen.style;
		};
		
		_s.setOverflow = function(val){
			_s.overflow = val;
			_s.screen.style.overflow = _s.overflow;
		};
		
		_s.setPosition = function(val){
			_s.position = val;
			_s.screen.style.position = _s.position;
		};
		
		_s.setDisplay = function(val){
			_s.display = val;
			_s.screen.style.display = _s.display;
		};
		
		_s.setButtonMode = function(val){
			_s.buttonMode = val;
			if(_s.buttonMode ==  true){
				_s.screen.style.cursor = "pointer";
			}else{
				_s.screen.style.cursor = "default";
			}
		};
		
		_s.setBkColor = function(val){
			_s.screen.style.backgroundColor = val;
		};
		
		_s.setInnerHTML = function(val){
			_s.innerHTML = val;
			_s.screen.innerHTML = _s.innerHTML;
		};
		
		_s.getInnerHTML = function(){
			return _s.innerHTML;
		};
		
		_s.getRect = function(){
			return _s.screen.getBoundingClientRect();
		};
		
		_s.setAlpha = function(val){
			_s.alpha = val;
			if(_s.opacityType == "opacity"){
				_s.screen.style.opacity = _s.alpha;
			}else if(_s.opacityType == "filter"){
				_s.screen.style.filter = "alpha(opacity=" + _s.alpha * 100 + ")";
				_s.screen.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + Math.round(_s.alpha * 100) + ")";
			}
		};
		
		_s.getAlpha = function(){
			return _s.alpha;
		};
		
		_s.getRect = function(){
			return _s.screen.getBoundingClientRect();
		};
		
		_s.getGlobalX = function(){
			return _s.getRect().left;
		};
		
		_s.getGlobalY = function(){
			return _s.getRect().top;
		};
		
		_s.setX = function(val){
			_s.x = val;
			if(_s.hasTransform2d_bl){
				_s.screen.style[_s.transform] = "translate(" + _s.x + "px," + _s.y + "px) scale(" + _s.scale + " , " + _s.scale + ") rotate(" + _s.rotation + "deg)";
			}else{
				_s.screen.style.left = _s.x + "px";
			}
		};
		
		_s.getX = function(){
			return  _s.x;
		};
		
		_s.setY = function(val){
			_s.y = val;
			if(_s.hasTransform2d_bl){
				_s.screen.style[_s.transform] = "translate(" + _s.x + "px," + _s.y + "px) scale(" + _s.scale + " , " + _s.scale + ") rotate(" + _s.rotation + "deg)";
			}else{
				_s.screen.style.top = _s.y + "px";
			}
		};
		
		_s.getY = function(){
			return  _s.y;
		};
		
		_s.setScale2 = function(val){
			_s.scale = val;
			if(_s.hasTransform2d_bl){
				_s.screen.style[_s.transform] = "translate(" + _s.x + "px," + _s.y + "px) scale(" + _s.scale + " , " + _s.scale + ") rotate(" + _s.rotation + "deg)";
			}
		};
		
		_s.getScale = function(){
			return  _s.scale;
		};
		
		_s.setRotation = function(val){
			_s.rotation = val;
			if(_s.hasTransform2d_bl){
				_s.screen.style[_s.transform] = "translate(" + _s.x + "px," + _s.y + "px) scale(" + _s.scale + " , " + _s.scale + ") rotate(" + _s.rotation + "deg)";
			}
		};
		
		_s.setWidth = function(val){
			_s.w = val;
			if(_s.type == "img"){
				_s.screen.width = _s.w;
				_s.screen.style.width = _s.w + "px";
			}else{
				_s.screen.style.width = _s.w + "px";
			}
		};
		
		_s.getWidth = function(){
			if(_s.type == "div"){
				if(_s.screen.offsetWidth != 0) return  _s.screen.offsetWidth;
				return _s.w;
			}else if(_s.type == "img"){
				if(_s.screen.offsetWidth != 0) return  _s.screen.offsetWidth;
				if(_s.screen.width != 0) return  _s.screen.width;
				return _s._w;
			}else if( _s.type == "canvas"){
				if(_s.screen.offsetWidth != 0) return  _s.screen.offsetWidth;
				return _s.w;
			}
		};
		
		_s.setHeight = function(val){
			_s.h = val;
			if(_s.type == "img"){
				_s.screen.height = _s.h;
				_s.screen.style.height = _s.h + "px";
			}else{
				_s.screen.style.height = _s.h + "px";
			}
		};
		
		_s.getHeight = function(){
			if(_s.type == "div"){
				if(_s.screen.offsetHeight != 0) return  _s.screen.offsetHeight;
				return _s.h;
			}else if(_s.type == "img"){
				if(_s.screen.offsetHeight != 0) return  _s.screen.offsetHeight;
				if(_s.screen.height != 0) return  _s.screen.height;
				return _s.h;
			}else if(_s.type == "canvas"){
				if(_s.screen.offsetHeight != 0) return  _s.screen.offsetHeight;
				return _s.h;
			}
		};
		
		_s.getNumChildren = function(){
			return _s.children_ar.length;
		};
		

		//#####################################//
		/* DOM list */
		//#####################################//
		_s.addChild = function(e){
			if(_s.contains(e)){	
				_s.children_ar.splice(FWDUVPUtils.indexOfArray(_s.children_ar, e), 1);
				_s.children_ar.push(e);
				_s.screen.appendChild(e.screen);
			}else{
				_s.children_ar.push(e);
				_s.screen.appendChild(e.screen);
			}
		};
		
		_s.removeChild = function(e){
			if(_s.contains(e)){
				_s.children_ar.splice(FWDUVPUtils.indexOfArray(_s.children_ar, e), 1);
				_s.screen.removeChild(e.screen);
			}else{
				throw Error("##removeChild()## Child doesn't exist, it can't be removed!");
			};
		};
		
		_s.contains = function(e){
			if(FWDUVPUtils.indexOfArray(_s.children_ar, e) == -1){
				return false;
			}else{
				return true;
			}
		};
		
		_s.addChildAtZero = function(e){
			if(_s.numChildren == 0){
				_s.children_ar.push(e);
				_s.screen.appendChild(e.screen);
			}else{
				_s.screen.insertBefore(e.screen, _s.children_ar[0].screen);
				if(_s.contains(e)){_s.children_ar.splice(FWDUVPUtils.indexOfArray(_s.children_ar, e), 1);}	
				_s.children_ar.unshift(e);
			}
		};
		
		_s.getChildAt = function(index){
			if(index < 0  || index > _s.numChildren -1) throw Error("##getChildAt()## Index out of bounds!");
			if(_s.numChildren == 0) throw Errror("##getChildAt## Child dose not exist!");
			return _s.children_ar[index];
		};
		
		_s.removeChildAtZero = function(){
			_s.screen.removeChild(_s.children_ar[0].screen);
			_s.children_ar.shift();
		};
		

		//################################//
		/* event dispatcher */
		//#################################//
		_s.addListener = function (type, listener){
	    	
	    	if(type == undefined) throw Error("type is required.");
	    	if(typeof type === "object") throw Error("type must be of type String.");
	    	if(typeof listener != "function") throw Error("listener must be of type Function.");
	    	
	        var event = {};
	        event.type = type;
	        event.listener = listener;
	        event.target = _s;
	        _s.listeners.events_ar.push(event);
	    };
	    
	    _s.dispatchEvent = function(type, props){
	    	if(type == undefined) throw Error("type is required.");
	    	if(typeof type === "object") throw Error("type must be of type String.");
	    	
	        for (var i=0, len=_s.listeners.events_ar.length; i < len; i++){
	        	if(_s.listeners.events_ar[i].target === _s && _s.listeners.events_ar[i].type === type){
	        		
	    	        if(props){
	    	        	for(var prop in props){
	    	        		_s.listeners.events_ar[i][prop] = props[prop];
	    	        	}
	    	        }
	        		_s.listeners.events_ar[i].listener.call(_s, _s.listeners.events_ar[i]);
	        		break;
	        	}
	        }
	    };
	    
	   _s.removeListener = function(type, listener){
	    	
	    	if(type == undefined) throw Error("type is required.");
	    	if(typeof type === "object") throw Error("type must be of type String.");
	    	if(typeof listener != "function") throw Error("listener must be of type Function." + type);
	    	
	        for (var i=0, len=_s.listeners.events_ar.length; i < len; i++){
	        	if(_s.listeners.events_ar[i].target === _s 
	        			&& _s.listeners.events_ar[i].type === type
	        			&& _s.listeners.events_ar[i].listener ===  listener
	        	){
	        		_s.listeners.events_ar.splice(i,1);
	        		break;
	        	}
	        }  
	    };
	    

	    //###########################################//
	    /* destroy methods*/
	    //###########################################//
		_s.disposeImage = function(){
			if(_s.type == "img") _s.screen.src = null;
		};
		
		
		_s.destroy = function(){
			
			try{_s.screen.parentNode.removeChild(_s.screen);}catch(e){};
			
			_s.screen.onselectstart = null;
			_s.screen.ondragstart = null;
			_s.screen.ontouchstart = null;
			_s.screen.ontouchmove = null;
			_s.screen.ontouchend = null;
			_s.screen.onmouseover = null;
			_s.screen.onmouseout = null;
			_s.screen.onmouseup = null;
			_s.screen.onmousedown = null;
			_s.screen.onmousemove = null;
			_s.screen.onclick = null;
			
			delete _s.screen;
			delete _s.style;
			delete _s.rect;
			delete _s.selectable;
			delete _s.buttonMode;
			delete _s.position;
			delete _s.overflow;
			delete _s.visible;
			delete _s.innerHTML;
			delete _s.numChildren;
			delete _s.x;
			delete _s.y;
			delete _s.w;
			delete _s.h;
			delete _s.opacityType;
			delete _s.isHtml5_bl;
			delete _s.hasTransform2d_bl;

			_s.children_ar = null;
			_s.style = null;
			_s.screen = null;
			_s.numChildren = null;
			_s.transform = null;
			_s.position = null;
			_s.overflow = null;
			_s.display= null;
			_s.visible= null;
			_s.buttonMode = null;
			_s.globalX = null;
			_s.globalY = null;
			_s.x = null;
			_s.y = null;
			_s.w = null;;
			_s.h = null;;
			_s.rect = null;
			_s.alpha = null;
			_s.innerHTML = null;
			_s.opacityType = null;
			_s.isHtml5_bl = null;
			_s.hasTransform3d_bl = null;
			_s.hasTransform2d_bl = null;
			_s = null;
		};
		
		
	    /* init */
		_s.init();
	};
	
	window.FWDUVPTransformDisplayObject = FWDUVPTransformDisplayObject;
}(window));﻿/**
 * Ultimate Video Player PACKAGED v9.1
 * Utils.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDUVPUtils = function(){
		'use strict';
	};
		
	FWDUVPUtils.dumy = document.createElement("div");
	

	//###################################//
	/* String */
	//###################################//
	FWDUVPUtils.trim = function(str){
		return str.replace(/\s/gi, "");
	};
			
	FWDUVPUtils.trimAndFormatUrl = function(str){
		str = str.toLocaleLowerCase();
		str = str.replace(/ /g, "-");
		return str;
	};
	
	FWDUVPUtils.storArrayBasedOnObjectValue = function(array, property){
		
		array.sort(dynamicSort(property));
		function dynamicSort(property) {
			var sortOrder = 1;
			if(property[0] === "-") {
				sortOrder = -1;
				property = property.substr(1);
			}
			return function (a,b) {
				var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;
				return result * sortOrder;
			}
		}
	};
	
	FWDUVPUtils.getCookie = function(name){
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}

	FWDUVPUtils.hexToRgb = function(hex){
		 // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
		var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
		hex = hex.replace(shorthandRegex, function(m, r, g, b) {
			return r + r + g + g + b + b;
		});

		var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
		result = result ? {
			r: parseInt(result[1], 16),
			g: parseInt(result[2], 16),
			b: parseInt(result[3], 16)
		} : null;
		
		return "rgb(" + result.r  + "," + result.g + "," + result.b + ")";
	};
	
	FWDUVPUtils.splitAndTrim = function(str, trim_bl){
		var array = str.split(",");
		var length = array.length;
		for(var i=0; i<length; i++){
			if(trim_bl) array[i] = FWDUVPUtils.trim(array[i]);
		};
		return array;
	};
	
	FWDUVPUtils.checkTime = function(time){
		var timeRegExp = /^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$/;
		if(!timeRegExp.test(time)) return false;
		return true;
	};
	
	FWDUVPUtils.formatTimeWithMiliseconds = function(str){
		var	hours = parseInt(str.split(':')[0]);  
		var	minutes = parseInt(str.split(':')[1]);  
		var	seconds = parseInt(str.split(':')[2]);  
		var	millisesconds = parseInt(str.split(',')[1] || str.split('.')[1]);
		var t = (hours*60*60) + (minutes*60) + seconds + (millisesconds/1000);  
		t = Math.round(t*100)/100;  
		return t;  
	};
	
	
	FWDUVPUtils.formatTime = function(secs, pushHours){
		secs = Math.round(secs);
		var hours = Math.floor(secs / (60 * 60));
		
		var divisor_for_minutes = secs % (60 * 60);
		var minutes = Math.floor(divisor_for_minutes / 60);

		var divisor_for_seconds = divisor_for_minutes % 60;
		var seconds = Math.ceil(divisor_for_seconds);
		
		minutes = (minutes >= 10) ? minutes : "0" + minutes;
		seconds = (seconds >= 10) ? seconds : "0" + seconds;
		if(seconds == 60) seconds = 59;
		
		if(isNaN(seconds)) return "00:00";
		if(hours || pushHours){
			 return "0" + hours + ":" + minutes + ":" + seconds;
		}else{
			 return minutes + ":" + seconds;
		}
	};
	
	FWDUVPUtils.MD5 = function (string) {

		function RotateLeft(lValue, iShiftBits) {
			return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
		}

		function AddUnsigned(lX,lY) {
			var lX4,lY4,lX8,lY8,lResult;
			lX8 = (lX & 0x80000000);
			lY8 = (lY & 0x80000000);
			lX4 = (lX & 0x40000000);
			lY4 = (lY & 0x40000000);
			lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF);
			if (lX4 & lY4) {
				return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
			}
			if (lX4 | lY4) {
				if (lResult & 0x40000000) {
					return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
				} else {
					return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
				}
			} else {
				return (lResult ^ lX8 ^ lY8);
			}
		}

		function F(x,y,z) { return (x & y) | ((~x) & z); }
		function G(x,y,z) { return (x & z) | (y & (~z)); }
		function H(x,y,z) { return (x ^ y ^ z); }
		function I(x,y,z) { return (y ^ (x | (~z))); }

		function FF(a,b,c,d,x,s,ac) {
			a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
			return AddUnsigned(RotateLeft(a, s), b);
		};

		function GG(a,b,c,d,x,s,ac) {
			a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
			return AddUnsigned(RotateLeft(a, s), b);
		};

		function HH(a,b,c,d,x,s,ac) {
			a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
			return AddUnsigned(RotateLeft(a, s), b);
		};

		function II(a,b,c,d,x,s,ac) {
			a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
			return AddUnsigned(RotateLeft(a, s), b);
		};

		function ConvertToWordArray(string) {
			var lWordCount;
			var lMessageLength = string.length;
			var lNumberOfWords_temp1=lMessageLength + 8;
			var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64;
			var lNumberOfWords = (lNumberOfWords_temp2+1)*16;
			var lWordArray=Array(lNumberOfWords-1);
			var lBytePosition = 0;
			var lByteCount = 0;
			while ( lByteCount < lMessageLength ) {
				lWordCount = (lByteCount-(lByteCount % 4))/4;
				lBytePosition = (lByteCount % 4)*8;
				lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<<lBytePosition));
				lByteCount++;
			}
			lWordCount = (lByteCount-(lByteCount % 4))/4;
			lBytePosition = (lByteCount % 4)*8;
			lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition);
			lWordArray[lNumberOfWords-2] = lMessageLength<<3;
			lWordArray[lNumberOfWords-1] = lMessageLength>>>29;
			return lWordArray;
		};

		function WordToHex(lValue) {
			var WordToHexValue="",WordToHexValue_temp="",lByte,lCount;
			for (lCount = 0;lCount<=3;lCount++) {
				lByte = (lValue>>>(lCount*8)) & 255;
				WordToHexValue_temp = "0" + lByte.toString(16);
				WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2);
			}
			return WordToHexValue;
		};

		function Utf8Encode(string) {
			string = string.replace(/\r\n/g,"\n");
			var utftext = "";

			for (var n = 0; n < string.length; n++) {

				var c = string.charCodeAt(n);

				if (c < 128) {
					utftext += String.fromCharCode(c);
				}
				else if((c > 127) && (c < 2048)) {
					utftext += String.fromCharCode((c >> 6) | 192);
					utftext += String.fromCharCode((c & 63) | 128);
				}
				else {
					utftext += String.fromCharCode((c >> 12) | 224);
					utftext += String.fromCharCode(((c >> 6) & 63) | 128);
					utftext += String.fromCharCode((c & 63) | 128);
				}

			}

			return utftext;
		};

		var x=Array();
		var k,AA,BB,CC,DD,a,b,c,d;
		var S11=7, S12=12, S13=17, S14=22;
		var S21=5, S22=9 , S23=14, S24=20;
		var S31=4, S32=11, S33=16, S34=23;
		var S41=6, S42=10, S43=15, S44=21;

		string = Utf8Encode(string);

		x = ConvertToWordArray(string);

		a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;

		for (k=0;k<x.length;k+=16) {
			AA=a; BB=b; CC=c; DD=d;
			a=FF(a,b,c,d,x[k+0], S11,0xD76AA478);
			d=FF(d,a,b,c,x[k+1], S12,0xE8C7B756);
			c=FF(c,d,a,b,x[k+2], S13,0x242070DB);
			b=FF(b,c,d,a,x[k+3], S14,0xC1BDCEEE);
			a=FF(a,b,c,d,x[k+4], S11,0xF57C0FAF);
			d=FF(d,a,b,c,x[k+5], S12,0x4787C62A);
			c=FF(c,d,a,b,x[k+6], S13,0xA8304613);
			b=FF(b,c,d,a,x[k+7], S14,0xFD469501);
			a=FF(a,b,c,d,x[k+8], S11,0x698098D8);
			d=FF(d,a,b,c,x[k+9], S12,0x8B44F7AF);
			c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1);
			b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE);
			a=FF(a,b,c,d,x[k+12],S11,0x6B901122);
			d=FF(d,a,b,c,x[k+13],S12,0xFD987193);
			c=FF(c,d,a,b,x[k+14],S13,0xA679438E);
			b=FF(b,c,d,a,x[k+15],S14,0x49B40821);
			a=GG(a,b,c,d,x[k+1], S21,0xF61E2562);
			d=GG(d,a,b,c,x[k+6], S22,0xC040B340);
			c=GG(c,d,a,b,x[k+11],S23,0x265E5A51);
			b=GG(b,c,d,a,x[k+0], S24,0xE9B6C7AA);
			a=GG(a,b,c,d,x[k+5], S21,0xD62F105D);
			d=GG(d,a,b,c,x[k+10],S22,0x2441453);
			c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681);
			b=GG(b,c,d,a,x[k+4], S24,0xE7D3FBC8);
			a=GG(a,b,c,d,x[k+9], S21,0x21E1CDE6);
			d=GG(d,a,b,c,x[k+14],S22,0xC33707D6);
			c=GG(c,d,a,b,x[k+3], S23,0xF4D50D87);
			b=GG(b,c,d,a,x[k+8], S24,0x455A14ED);
			a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905);
			d=GG(d,a,b,c,x[k+2], S22,0xFCEFA3F8);
			c=GG(c,d,a,b,x[k+7], S23,0x676F02D9);
			b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A);
			a=HH(a,b,c,d,x[k+5], S31,0xFFFA3942);
			d=HH(d,a,b,c,x[k+8], S32,0x8771F681);
			c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122);
			b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C);
			a=HH(a,b,c,d,x[k+1], S31,0xA4BEEA44);
			d=HH(d,a,b,c,x[k+4], S32,0x4BDECFA9);
			c=HH(c,d,a,b,x[k+7], S33,0xF6BB4B60);
			b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70);
			a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6);
			d=HH(d,a,b,c,x[k+0], S32,0xEAA127FA);
			c=HH(c,d,a,b,x[k+3], S33,0xD4EF3085);
			b=HH(b,c,d,a,x[k+6], S34,0x4881D05);
			a=HH(a,b,c,d,x[k+9], S31,0xD9D4D039);
			d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5);
			c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8);
			b=HH(b,c,d,a,x[k+2], S34,0xC4AC5665);
			a=II(a,b,c,d,x[k+0], S41,0xF4292244);
			d=II(d,a,b,c,x[k+7], S42,0x432AFF97);
			c=II(c,d,a,b,x[k+14],S43,0xAB9423A7);
			b=II(b,c,d,a,x[k+5], S44,0xFC93A039);
			a=II(a,b,c,d,x[k+12],S41,0x655B59C3);
			d=II(d,a,b,c,x[k+3], S42,0x8F0CCC92);
			c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D);
			b=II(b,c,d,a,x[k+1], S44,0x85845DD1);
			a=II(a,b,c,d,x[k+8], S41,0x6FA87E4F);
			d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0);
			c=II(c,d,a,b,x[k+6], S43,0xA3014314);
			b=II(b,c,d,a,x[k+13],S44,0x4E0811A1);
			a=II(a,b,c,d,x[k+4], S41,0xF7537E82);
			d=II(d,a,b,c,x[k+11],S42,0xBD3AF235);
			c=II(c,d,a,b,x[k+2], S43,0x2AD7D2BB);
			b=II(b,c,d,a,x[k+9], S44,0xEB86D391);
			a=AddUnsigned(a,AA);
			b=AddUnsigned(b,BB);
			c=AddUnsigned(c,CC);
			d=AddUnsigned(d,DD);
		}

		var temp = WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d);

		return temp.toLowerCase();
	}
	
	
	FWDUVPUtils.getSecondsFromString = function(str){
		var hours = 0;
		var minutes = 0;
		var seconds = 0;
		var duration = 0;
		
		if(!str) return undefined;
		
		str = str.split(":");
		
		hours = str[0];
		if(hours[0] == "0" && hours[1] != "0"){
			hours = parseInt(hours[1]);
		}
		if(hours == "00") hours = 0;
		
		minutes = str[1];
		if(minutes[0] == "0" && minutes[1] != "0"){
			minutes = parseInt(minutes[1]);
		}
		if(minutes == "00") minutes = 0;
		
		secs = parseInt(str[2].replace(/,.*/ig, ""));
		if(secs[0] == "0" && secs[1] != "0"){
			secs = parseInt(secs[1]);
		}
		if(secs == "00") secs = 0;
		
		if(hours != 0){
			duration += (hours * 60 * 60)
		}
		
		if(minutes != 0){
			duration += (minutes * 60)
		}
		
		duration += secs;
		
		return duration;
	 };
	 
	 FWDUVPUtils.getCanvasWithModifiedColor = function(img, hexColor, returnImage, width, height){
		if(!img) return;
		var newImage;
		var canvas = document.createElement("canvas");
		var ctx = canvas.getContext("2d");
		var originalPixels = null;
		var currentPixels = null;
		var long = parseInt(hexColor.replace(/^#/, ""), 16);
		var hexColorRGB = {
			R: (long >>> 16) & 0xff,
			G: (long >>> 8) & 0xff,
			B: long & 0xff
		};
		
		
		
		canvas.style.position = "absolute";
		canvas.style.left = "0px";
		canvas.style.top = "0px";
		canvas.style.margin = "0px";
		canvas.style.padding = "0px";
		canvas.style.maxWidth = "none";
		canvas.style.maxHeight = "none";
		canvas.style.border = "none";
		canvas.style.lineHeight = "1";
		canvas.style.backgroundColor = "transparent";
		canvas.style.backfaceVisibility = "hidden";
		canvas.style.webkitBackfaceVisibility = "hidden";
		canvas.style.MozBackfaceVisibility = "hidden";	
		canvas.style.MozImageRendering = "optimizeSpeed";	
		canvas.style.WebkitImageRendering = "optimizeSpeed";
		
		if(width == undefined){
			width = img.width;
			height = img.height;
		}
		
		canvas.width = width;
		canvas.height = height;
		
		ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight, 0, 0, width, height);
		originalPixels = ctx.getImageData(0, 0, width, height);
		currentPixels = ctx.getImageData(0, 0, width, height);

        for(var I = 0, L = originalPixels.data.length; I < L; I += 4){
            if(currentPixels.data[I + 3] > 0) // If it's not a transparent pixel
            {
                currentPixels.data[I] = originalPixels.data[I] / 255 * hexColorRGB.R;
                currentPixels.data[I + 1] = originalPixels.data[I + 1] / 255 * hexColorRGB.G;
                currentPixels.data[I + 2] = originalPixels.data[I + 2] / 255 * hexColorRGB.B;
            }
        }
		
		ctx.globalAlpha = .5;
        ctx.putImageData(currentPixels, 0, 0);
		ctx.drawImage(canvas, 0, 0);
        
		if(returnImage){
			newImage = new Image();
			newImage.src = canvas.toDataURL();
		}
		return {canvas:canvas, image:newImage};
	};
	
	FWDUVPUtils.xmlToJson = function(xml) {
	
		// Create the return object
		var obj = {};

		if (xml.nodeType == 1) { // element
			// do attributes
			if (xml.attributes.length > 0) {
			obj["@attributes"] = {};
				for (var j = 0; j < xml.attributes.length; j++) {
					var attribute = xml.attributes.item(j);
					obj["@attributes"][attribute.nodeName] = attribute.nodeValue;
				}
			}
		} else if (xml.nodeType == 3) { // text
			obj = xml.nodeValue.trim(); // add trim here
		}
		else if (xml.nodeType == 4) { // c_d section
			obj = xml.nodeValue
		}

		// do children
		if (xml.hasChildNodes()) {
			for(var i = 0; i < xml.childNodes.length; i++) {
				var item = xml.childNodes.item(i);
				var nodeName = item.nodeName;
				if (typeof(obj[nodeName]) == "undefined") {
					obj[nodeName] = FWDUVPUtils.xmlToJson(item);
				} else {
					if (typeof(obj[nodeName].length) == "undefined") {
						var old = obj[nodeName];
						obj[nodeName] = [];
						obj[nodeName].push(old);
					}
					if (typeof(obj[nodeName]) === 'object') {
						obj[nodeName].push(FWDUVPUtils.xmlToJson(item));
					}
				}
			}
		}
		return obj;
	};
	
	FWDUVPUtils.isIMA = function(src){
		if(src.match(/doubleclick.net/ig)) return true;
		return;
	}
 
	FWDUVPUtils.isURLEncoded = function(url){
		try{
			var decodedURL = decodeURIComponent(url);
			if(decodedURL != url && url.indexOf('%') != -1) return true;
		}catch(e){}
		return false;
	}

	FWDUVPUtils.getValidSource =  function(source){
		if(!source) return;
		
		var path1 = (location.origin == 'null') ? '' : location.origin;
		var path2 = location.pathname;
		
		if(path2.indexOf(".") != -1){
			path2 = path2.substr(0, path2.lastIndexOf("/") + 1);
		}

		var hasHTTPorHTTPS_bl = !(source.indexOf("http:") == -1 && source.indexOf("https:") == -1 && !FWDUVPUtils.isLocal);
		
		if(!hasHTTPorHTTPS_bl){
			source = path1 + path2 + source;
		}
		
		var firstUrlPath = source.substr(0,source.lastIndexOf("/") + 1) 
		if(!FWDUVPUtils.isURLEncoded(firstUrlPath)){
			firstUrlPath = encodeURI(firstUrlPath);
		}
		var secondUrlPath = source.substr(source.lastIndexOf("/") + 1);

		if(source.match(/\.mp3|\.mp4|\.m3u8|\.txt|\.srt|\.vtt|\.jpg|\.jpeg|\.png/ig)
			&& !source.match(/\.s3|\drive.|dropbox|cloudfront.|\?/ig)){
			if(FWDUVPUtils.isURLEncoded(secondUrlPath)){
				secondUrlPath = source.substr(source.lastIndexOf("/") + 1);
			}else{
				secondUrlPath = encodeURI(source.substr(source.lastIndexOf("/") + 1));
			}
		}else{
			secondUrlPath = source.substr(source.lastIndexOf("/") + 1);
		}

		
		source = firstUrlPath + secondUrlPath;	
		return source;
	}
	
	FWDUVPUtils.changeCanvasHEXColor = function(img, canvas, hexColor, returnNewImage, width, height){
		if(!img) return;
		var canvas = canvas;
		var ctx = canvas.getContext("2d");
		var originalPixels = null;
		var currentPixels = null;
		var long = parseInt(hexColor.replace(/^#/, ""), 16);
		var hexColorRGB = {
			R: (long >>> 16) & 0xff,
			G: (long >>> 8) & 0xff,
			B: long & 0xff
		};
		if(!width){
			width = img.width;
			height = img.height;
		}
		canvas.width = width;
		canvas.height = height;
		ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight, 0, 0, width, height);
		originalPixels = ctx.getImageData(0, 0, width, height);
		currentPixels = ctx.getImageData(0, 0, width, height);

        for(var I = 0, L = originalPixels.data.length; I < L; I += 4){
            if(currentPixels.data[I + 3] > 0) // If it's not a transparent pixel
            {
                currentPixels.data[I] = originalPixels.data[I] / 255 * hexColorRGB.R;
                currentPixels.data[I + 1] = originalPixels.data[I + 1] / 255 * hexColorRGB.G;
                currentPixels.data[I + 2] = originalPixels.data[I + 2] / 255 * hexColorRGB.B;
            }
        }
		
		ctx.globalAlpha = .5;
        ctx.putImageData(currentPixels, 0, 0);
		ctx.drawImage(canvas, 0, 0);
		
		if(returnNewImage){
			var newImage = new Image();
			newImage.src = canvas.toDataURL();
			return newImage;
		}
    }


	//#############################################//
	//Array //
	//#############################################//
	FWDUVPUtils.indexOfArray = function(array, prop){
		var length = array.length;
		for(var i=0; i<length; i++){
			if(array[i] === prop) return i;
		};
		return -1;
	};
	
	FWDUVPUtils.randomizeArray = function(aArray) {
		var randomizedArray = [];
		var copyArray = aArray.concat();
		var length = copyArray.length;
		for(var i=0; i< length; i++) {
				var index = Math.floor(Math.random() * copyArray.length);
				randomizedArray.push(copyArray[index]);
				copyArray.splice(index,1);
			}
		return randomizedArray;
	};
	

	//#############################################//
	/*DOM manipulation */
	//#############################################//
	FWDUVPUtils.prt = function (e, n){
		if(n === undefined) n = 1;
		while(n-- && e) e = e.parentNode;
		if(!e || e.nodeType !== 1) return null;
		return e;
	};
	
	FWDUVPUtils.sibling = function(e, n){
		while (e && n !== 0){
			if(n > 0){
				if(e.nextElementSibling){
					 e = e.nextElementSibling;	 
				}else{
					for(var e = e.nextSibling; e && e.nodeType !== 1; e = e.nextSibling);
				}
				n--;
			}else{
				if(e.previousElementSibling){
					 e = e.previousElementSibling;	 
				}else{
					for(var e = e.previousSibling; e && e.nodeType !== 1; e = e.previousSibling);
				}
				n++;
			}
		}
		return e;
	};
	
	FWDUVPUtils.getChildAt = function (e, n){
		var kids = FWDUVPUtils.getChildren(e);
		if(n < 0) n += kids.length;
		if(n < 0) return null;
		return kids[n];
	};
	
	FWDUVPUtils.getChildById = function(id){
		return document.getElementById(id) || undefined;
	};
	
	FWDUVPUtils.getChildren = function(e, allNodesTypes){
		var kids = [];
		for(var c = e.firstChild; c != null; c = c.nextSibling){
			if(allNodesTypes){
				kids.push(c);
			}else if(c.nodeType === 1){
				kids.push(c);
			}
		}
		return kids;
	};
	
	FWDUVPUtils.getChildrenFromAttribute = function(e, attr, allNodesTypes){
		var kids = [];
		for(var c = e.firstChild; c != null; c = c.nextSibling){
			if(allNodesTypes && FWDUVPUtils.hasAttribute(c, attr)){
				kids.push(c);
			}else if(c.nodeType === 1 && FWDUVPUtils.hasAttribute(c, attr)){
				kids.push(c);
			}
		}
		return kids.length == 0 ? undefined : kids;
	};
	
	FWDUVPUtils.getChildFromNodeListFromAttribute = function(e, attr, allNodesTypes){
		for(var c = e.firstChild; c != null; c = c.nextSibling){
			if(allNodesTypes && FWDUVPUtils.hasAttribute(c, attr)){
				return c;
			}else if(c.nodeType === 1 && FWDUVPUtils.hasAttribute(c, attr)){
				return c;
			}
		}
		return undefined;
	};
	
	FWDUVPUtils.getAttributeValue = function(e, attr){
		if(!FWDUVPUtils.hasAttribute(e, attr)) return undefined;
		return e.getAttribute(attr);	
	};
	
	FWDUVPUtils.hasAttribute = function(e, attr){
		if(e.hasAttribute){
			return e.hasAttribute(attr); 
		}else {
			var test = e.attributes[attr];
			return  test ? true : false;
		}
	};
	
	FWDUVPUtils.insertNodeAt = function(prt, child, n){
		var children = FWDUVPUtils.children(prt);
		if(n < 0 || n > children.length){
			throw new Error("invalid index!");
		}else {
			prt.insertBefore(child, children[n]);
		};
	};
	
	FWDUVPUtils.hasCanvas = function(){
		return Boolean(document.createElement("canvas"));
	};
	

	//###################################//
	/* DOM geometry */
	//##################################//
	FWDUVPUtils.hitTest = function(target, x, y){
		var hit = false;
		if(!target) throw Error("Hit test target is null!");
		var rect = target.getBoundingClientRect();
		
		if(x >= parseInt(rect.left) 
		   && x <= parseInt(rect.left +(rect.right - rect.left)) 
		   && y >= parseInt(rect.top) 
		   && y <= parseInt(rect.top + (rect.bottom - rect.top))){
		   	 
		    return true;
		}
		return false;
	};
	
	FWDUVPUtils.hitBuggyTest = function(target, x, y){
		var hit = false;
		if(!target) throw Error("Hit test target is null!");
		var rect = target.getBoundingClientRect();
		
		
		return false;
	};
	
	FWDUVPUtils.hasWEBGL = (function(){
		try{
			var canvas = document.createElement( 'canvas' ); 
			return !! window.WebGLRenderingContext && ( 
				 canvas.getContext( 'webgl' ) || canvas.getContext( 'experimental-webgl' ) );
		   }catch( e ) { return false; } 
	}());
	
	FWDUVPUtils.isLocal = (function(){
		if(document.location.protocol == "file:"){
			return true;
		}else{
			return false;
		}
	}());
	
	FWDUVPUtils.getScrollOffsets = function(){
		//all browsers
		if(window.pageXOffset != null) return{x:window.pageXOffset, y:window.pageYOffset};
		
		//ie7/ie8
		if(document.compatMode == "CSS1Compat"){
			return({x:document.documentElement.scrollLeft, y:document.documentElement.scrollTop});
		}
	};
	
	FWDUVPUtils.getViewportSize = function(){
		if(FWDUVPUtils.hasPointerEvent && navigator.msMaxTouchPoints > 1){
			return {w:document.documentElement.clientWidth || window.innerWidth, h:document.documentElement.clientHeight || window.innerHeight};
		}
		
		if(FWDUVPUtils.isMobile) return {w:window.innerWidth, h:window.innerHeight};
		return {w:document.documentElement.clientWidth || window.innerWidth, h:document.documentElement.clientHeight || window.innerHeight};
	};
	
	FWDUVPUtils.getViewportMouseCoordinates = function(e){
		var offsets = FWDUVPUtils.getScrollOffsets();
		
		if(e.touches){
			return{
				screenX:e.touches[0] == undefined ? e.touches.pageX - offsets.x :e.touches[0].pageX - offsets.x,
				screenY:e.touches[0] == undefined ? e.touches.pageY - offsets.y :e.touches[0].pageY - offsets.y
			};
		}
		
		return{
			screenX: e.clientX == undefined ? e.pageX - offsets.x : e.clientX,
			screenY: e.clientY == undefined ? e.pageY - offsets.y : e.clientY
		};
	};
	
	
	//###################################//
	/* Browsers test */
	//##################################//
	FWDUVPUtils.hasPointerEvent = (function(){
		return Boolean(window.navigator.msPointerEnabled) || Boolean(window.navigator.pointerEnabled);
	}());
	
	FWDUVPUtils.isMobile = (function (){
		var agents = ['android', 'webos', 'iphone', 'ipad', 'blackberry', 'kfsowi'];
	    for(var i in agents) {
	    	 if(navigator.userAgent.toLowerCase().indexOf(String(agents[i]).toLowerCase()) != -1) {
	            return true;
	        }
	    }
	    if(navigator.platform.toLowerCase() === 'macintel' && navigator.maxTouchPoints > 1 && !window.MSStream) return true;
	    return false;
	}());

	FWDUVPUtils.isIE = (function(){
		var isIE = Boolean(navigator.userAgent.toLowerCase().indexOf('msie') != -1) || Boolean(navigator.userAgent.toLowerCase().indexOf('edge') != -1);
		return isIE || Boolean(document.documentElement.msRequestFullscreen);
	}());
	
	FWDUVPUtils.isAndroid = (function(){
		 return (navigator.userAgent.toLowerCase().indexOf("android".toLowerCase()) != -1);
	}());
	
	FWDUVPUtils.isChrome = (function(){
		if(FWDUVPUtils.isIE) return;
		var t = navigator.userAgent.toLowerCase();
		if(t.match(/browser/ig)) return;
		return t.match(/chrome/ig);
	}());
	
	FWDUVPUtils.isSafari = (function(){
		return navigator.userAgent.toLowerCase().indexOf('safari') != -1 && navigator.userAgent.toLowerCase().indexOf('chrome') == -1;
	}());
	
	FWDUVPUtils.isOpera = (function(){
		return navigator.userAgent.toLowerCase().indexOf('opr') != -1;
	}());
	
	FWDUVPUtils.isFirefox = (function(){
		return navigator.userAgent.toLowerCase().indexOf('firefox') != -1;
	}());
	
	FWDUVPUtils.isIEWebKit = (function(){
		return Boolean(document.documentElement.msRequestFullscreen);
	}());
	
	FWDUVPUtils.isIEAndLessThen9 = (function(){
		return Boolean(navigator.userAgent.toLowerCase().indexOf("msie 7") != -1) || Boolean(navigator.userAgent.toLowerCase().indexOf("msie 8") != -1);
	}());
	
	FWDUVPUtils.isIEAnd9OrLess = (function(){
		return Boolean(navigator.userAgent.toLowerCase().indexOf("msie 7") != -1) 
		|| Boolean(navigator.userAgent.toLowerCase().indexOf("msie 8") != -1)
		|| Boolean(navigator.userAgent.toLowerCase().indexOf("msie 9") != -1);
		}());
	
	FWDUVPUtils.isIE7 = (function(){
		return Boolean(navigator.userAgent.toLowerCase().indexOf("msie 7") != -1);
	}());
	
	FWDUVPUtils.isMac = (function(){
		return Boolean(navigator.appVersion.toLowerCase().indexOf('mac') != -1);
	}());
	
	FWDUVPUtils.isWin = (function(){
		return Boolean(navigator.appVersion.toLowerCase().indexOf('win') != -1);
	}());
	
	FWDUVPUtils.isIOS = (function(){
		if(navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1) return true;
		return navigator.userAgent.match(/(iPad|iPhone|iPod)/g);
	}());
	
	FWDUVPUtils.isIphone = (function(){
		return navigator.userAgent.match(/(iPhone|iPod)/g);
	}());
	
	FWDUVPUtils.hasFullScreen = (function(){
		return FWDUVPUtils.dumy.requestFullScreen || FWDUVPUtils.dumy.mozRequestFullScreen || FWDUVPUtils.dumy.webkitRequestFullScreen || FWDUVPUtils.dumy.msieRequestFullScreen;
	}());
	
	function get3d(){
	    var properties = ['transform', 'msTransform', 'WebkitTransform', 'MozTransform', 'OTransform', 'KhtmlTransform'];
	    var p;
	    var position;
	    while (p = properties.shift()) {
	       if (typeof FWDUVPUtils.dumy.style[p] !== 'undefined') {
	    	   FWDUVPUtils.dumy.style.position = "absolute";
	    	   position = FWDUVPUtils.dumy.getBoundingClientRect().left;
	    	   FWDUVPUtils.dumy.style[p] = 'translate3d(500px, 0px, 0px)';
	    	   position = Math.abs(FWDUVPUtils.dumy.getBoundingClientRect().left - position);
	    	   
	           if(position > 100 && position < 900){
	        	   try{document.documentElement.removeChild(FWDUVPUtils.dumy);}catch(e){}
	        	   return true;
	           }
	       }
	    }
	    try{document.documentElement.removeChild(FWDUVPUtils.dumy);}catch(e){}
	    return false;
	};
	
	function get2d(){
	    var properties = ['transform', 'msTransform', 'WebkitTransform', 'MozTransform', 'OTransform', 'KhtmlTransform'];
	    var p;
	    while (p = properties.shift()) {
	       if (typeof FWDUVPUtils.dumy.style[p] !== 'undefined') {
	    	   return true;
	       }
	    }
	    try{document.documentElement.removeChild(FWDUVPUtils.dumy);}catch(e){}
	    return false;
	};
	

	//###############################################//
	/* Media. */
	//###############################################//
	FWDUVPUtils.volumeCanBeSet = (function(){
		var soundTest_el = document.createElement("audio");
		if(!soundTest_el) return;
		soundTest_el.volume = 0;
		return soundTest_el.volume == 0 ? true : false;
	}());
	
	
	FWDUVPUtils.getVideoFormat = (function(){
		var video  =  document.createElement("video");
		if(!video.canPlayType) return;
		var extention_str;
		if(video.canPlayType("video/mp4") == "probably" || video.canPlayType("video/mp4") == "maybe"){
			extention_str = ".mp4";
		}else if(video.canPlayType("video/ogg") == "probably" || video.canPlayType("video/ogg") == "maybe"){
			extention_str = ".ogg";
		}else if(video.canPlayType("video/webm") == "probably" || video.canPlayType("video/webm") == "maybe"){
			extention_str = ".webm";
		}
		video = null;
		return extention_str;
	})();
	
	
	//###############################################//
	/* Various utils */
	//###############################################//
	FWDUVPUtils.onReady =  function(callbalk){
		if (document.addEventListener) {
			document.addEventListener("DOMContentLoaded", function(){
				FWDUVPUtils.checkIfHasTransofrms();
				FWDUVPUtils.hasFullScreen = FWDUVPUtils.checkIfHasFullscreen();
				setTimeout(callbalk, 100);
			});
		}else{
			document.onreadystatechange = function () {
				FWDUVPUtils.checkIfHasTransofrms();
				FWDUVPUtils.hasFullScreen = FWDUVPUtils.checkIfHasFullscreen();
				if (document.readyState == "complete") setTimeout(callbalk, 100);
			};
		 }
	};
	
	FWDUVPUtils.checkIfHasTransofrms = function(){
		document.documentElement.appendChild(FWDUVPUtils.dumy);
		FWDUVPUtils.hasTransform3d = get3d();
		FWDUVPUtils.hasTransform2d = get2d();
		FWDUVPUtils.isReadyMethodCalled_bl = true;
	};
	
	FWDUVPUtils.checkIfHasFullscreen = function(){
		return Boolean(document.documentElement.requestFullScreen
		|| document.documentElement.mozRequestFullScreen
		|| document.documentElement.webkitRequestFullScreen
		|| document.documentElement.msRequestFullscreen);
	};
	
	FWDUVPUtils.disableElementSelection = function(e){
		try{e.style.userSelect = "none";}catch(e){};
		try{e.style.MozUserSelect = "none";}catch(e){};
		try{e.style.webkitUserSelect = "none";}catch(e){};
		try{e.style.khtmlUserSelect = "none";}catch(e){};
		try{e.style.oUserSelect = "none";}catch(e){};
		try{e.style.msUserSelect = "none";}catch(e){};
		try{e.msUserSelect = "none";}catch(e){};
		e.onselectstart = function(){return false;};
	};
	
	FWDUVPUtils.getUrlArgs = function urlArgs(string){
		var args = {};
		var query = string.substr(string.indexOf("?") + 1) || location.search.substring(1);
		query = query.replace(/(\?*)(\/*)/g, "");
		var pairs = query.split("&");
		for(var i=0; i< pairs.length; i++){
			var pos = pairs[i].indexOf("=");
			var name = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos + 1);
			value = decodeURIComponent(value);
			args[name] = value;
		}
		return args;
	};
	
	FWDUVPUtils.getHashUrlArgs = function urlArgs(string){
		var args = {};
		var query = string.substr(string.indexOf("#") + 1) || location.search.substring(1);
		query = query.replace(/(\?*)(\/*)/g, "");
		var pairs = query.split("&");
		for(var i=0; i< pairs.length; i++){
			var pos = pairs[i].indexOf("=");
			var name = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos + 1);
			value = decodeURIComponent(value);
			args[name] = value;
		}
		return args;
	};

	FWDUVPUtils.validateEmail = function(mail){  
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)){  
			return true;  
		}  
		return false;  
    }; 
    
	FWDUVPUtils.isReadyMethodCalled_bl = false;
	
	window.FWDUVPUtils = FWDUVPUtils;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Video screen.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function(window){
	
	var FWDUVPVideoScreen = function(prt, volume){
		
		'use strict';

		var _s = this;
		var prototype = FWDUVPVideoScreen.prototype;
	
		_s.controllerHeight = prt._d.controllerHeight;
		_s.sW = 0;
		_s.sH = 0;
		_s.lastPercentPlayed = 0;
		_s.volume = volume;
		_s.curDuration = 0;
		_s.countNormalMp3Errors = 0;
		_s.countShoutCastErrors = 0;
		_s.maxShoutCastCountErrors = 5;
		_s.maxNormalCountErrors = 1;
		_s.hasError_bl = true;
		_s.isStopped_bl = true;
		_s.currentSession = null;
		_s.isMbl = FWDUVPUtils.isMobile;
		

		//###############################################//
		/* init */
		//###############################################//
		_s.init = function(){
			_s.setBkColor(prt.videoBackgroundColor_str);
			_s.setupVideo();
			_s.testVr();
		};
	

		//###############################################//
		/* Setup audio element */
		//##############################################//
		_s.setupVideo = function(){
			if(_s.video_el == null){
				_s.video_el = document.createElement("video");
				_s.video_el.controls = false;
				_s.video_el.volume = _s.volume;
				
				if(prt.is360 || prt._d.playsinline){
					_s.video_el.setAttribute("playsinline", "");
				}else{
					try{
						_s.video_el.removeAttribute('playsinline');
					}catch(e){

					}
				}
			
				if(prt.fillEntireVideoScreen_bl){
					_s.video_el.style.objectFit = 'cover';
				}
				
				if(prt._d.autoPlay_bl){
					_s.video_el.muted = true;
				}
				
				_s.video_el.style.position = "absolute";
				_s.video_el.style.left = "0px";
				_s.video_el.style.top = "0px";
				_s.video_el.style.width = "100%";
				_s.video_el.style.height = "100%";
				_s.video_el.style.margin = "0px";
				_s.video_el.style.padding = "0px";
				_s.video_el.style.maxWidth = "none";
				_s.video_el.style.maxHeight = "none";
				_s.video_el.style.border = "none";
				_s.video_el.style.lineHeight = "0";
				_s.video_el.style.msTouchAction = "none";
			
				_s.screen.appendChild(_s.video_el);
			}
			
			if(!prt._d.playsinline && FWDUVPUtils.isIOS){
				if(prt.subsSource_ar){
					prt.subsSource_ar.forEach(function(el, index){
						if(el.source != 'none'){
							const track = document.createElement('track');
							var curTrackIndex = Math.abs((prt.subsStartAtSubtitle - prt.subsSource_ar.length)) - 1;

							track.kind = 'subtitles';
							track.label = el.label;
							
							track.src = el.source; // Path to the VTT subtitle file
						
							if(index == curTrackIndex){
								track.default = true;
								track.mode = "showing";
								
							}else{
								track.mode = "disabled";
							}

							// Add the track to the video element
							_s.video_el.appendChild(track);
						}
					});
				}
			}
			

			_s.video_el.addEventListener("error", _s.errorHandler);
			_s.video_el.addEventListener("progress", _s.updateProgress);
			_s.video_el.addEventListener("timeupdate", _s.updateVideo);
			_s.video_el.addEventListener("pause", _s.pauseHandler);
			_s.video_el.addEventListener("canplay", _s.canPlayStart);
			_s.video_el.addEventListener("play", _s.playHandler);
			if(!FWDUVPUtils.isIE){
				_s.video_el.addEventListener("waiting", _s.startToBuffer);
			}
			_s.video_el.addEventListener("playing", _s.stopToBuffer);
			_s.video_el.addEventListener("canplaythrough", _s.stopToBuffer);
			_s.video_el.addEventListener("ended", _s.endedHandler);
			_s.video_el.removeEventListener("canplay", _s.canPlayLoop);
			_s.resizeAndPosition();
		};	
		
		
		_s.destroyVideo = function(){
			clearTimeout(_s.showErrorWithDelayId_to);
			if(_s.video_el){
				_s.stopToUpdateSubtitles();
				_s.video_el.removeEventListener("error", _s.errorHandler);
				_s.video_el.removeEventListener("progress", _s.updateProgress);
				_s.video_el.removeEventListener("timeupdate", _s.updateVideo);
				_s.video_el.removeEventListener("pause", _s.pauseHandler);
				_s.video_el.removeEventListener("play", _s.playHandler);
				if(!FWDUVPUtils.isIE){
					_s.video_el.removeEventListener("waiting", _s.startToBuffer);
				}
				_s.video_el.removeEventListener("playing", _s.stopToBuffer);
				_s.video_el.removeEventListener("canplay", _s.canPlayStart);
				_s.video_el.removeEventListener("canplaythrough", _s.stopToBuffer);
				_s.video_el.removeEventListener("ended", _s.endedHandler);
				_s.video_el.addEventListener("canplay", _s.canPlayLoop);
				_s.video_el.style.visibility = "hidden";
				_s.video_el.src = "";
				_s.video_el.load();
			}
		};
		
		_s.startToBuffer = function(overwrite){
			_s.dispatchEvent(FWDUVPVideoScreen.START_TO_BUFFER);
		};
		
		_s.stopToBuffer = function(){
			_s.dispatchEvent(FWDUVPVideoScreen.STOP_TO_BUFFER);
		};

		_s.canPlayStart = function(){
			_s.addAudioTracks();
			if(prt.is360){
				_s.add360Vid();
				setTimeout(function(){
					_s.render();
				}, 200);
			}
			_s.dispatchEvent(FWDUVPVideoScreen.STOP_TO_BUFFER);
		}

		_s.canPlayLoop = function(){
			if(prt.is360 && _s.isStopped_bl){
				_s.add360Vid();
				setTimeout(function(){
					_s.render();
				}, 200);
			}
			_s.dispatchEvent(FWDUVPVideoScreen.STOP_TO_BUFFER);
		}
		
		_s.addAudioTracks = function(){
			if(_s.audioTracks) return;
			if(_s.video_el.audioTracks){
				_s.audioTracks = _s.video_el.audioTracks;
				var audioTracks = Array.from(_s.audioTracks);
				prt.setAudioTracks(audioTracks);
			}
		}

		//##########################################//
		/* Video error handler. */
		//##########################################//
		_s.errorHandler = function(e){
			if(prt.videoType_str == 'DASH') return;
			var error_str;
			_s.hasError_bl = true;
			
			if(_s.video_el.networkState == 0){
				error_str = "error '_s.video_el.networkState = 0'";
			}else if(_s.video_el.networkState == 1){
				error_str = "error '_s.video_el.networkState = 1'";
			}else if(_s.video_el.networkState == 3){
				error_str = "source not found";
			}else{
				error_str = e;
			}
			
			if(window.console) window.console.log(_s.video_el.networkState);
			
			clearTimeout(_s.showErrorWithDelayId_to);
			_s.showErrorWithDelayId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPVideoScreen.ERROR, {text:error_str });
			}, 200);
		};
		

		//##############################################//
		/* Resize and position */
		//##############################################//
		_s.resizeAndPosition = function(width, height, newX, newY){
			if(width){
				_s.sW = width;
				_s.sH = height;
			}
		
			_s.setWidth(_s.sW);
			_s.setHeight(_s.sH);		
			_s.setX(newX);
			_s.setY(newY);
			
			if(prt.is360 && _s.renderer){
				_s.resizeRenderer()
			}
		};
	

		//##############################################//
		/* Set path */
		//##############################################//
		_s.setSource = function(sourcePath){
			_s.stopToUpdateSubtitles();
			_s.sourcePath_str = sourcePath;
			if(prt.is360 && _s.video_el){
				_s.video_el.style.visibility = "hidden";
			}
		
			if(_s.video_el) _s.stop();
			_s.initVideo();
		};
	

		//##########################################//
		/* Play / pause / stop methods */
		//##########################################//
		_s.play = function(overwrite){
			
			var prm;

			clearTimeout(_s.playWithDelayId_to);
			FWDUVPlayer.curInstance = prt;
			
			if(_s.isStopped_bl){
				_s.initVideo();
				_s.setVolume();
				if(_s.isMbl){
					_s.play();
				}else{
					_s.playWithDelayId_to = setTimeout(_s.play, 1000);
				}	
				_s.hasStrtLivStrm = true;
				_s.startToBuffer(true);
				_s.isPlaying_bl = true;
			}else if(!_s.video_el.ended || overwrite){
				try{
					_s.hasStrtLivStrm = true;
					_s.isPlaying_bl = true;
					_s.hasPlayedOnce_bl = true;
					prm = _s.video_el.play();
					if(prm !== undefined) {
					    prm.then(function(){}, function(){});
					}
					if(FWDUVPUtils.isIE) _s.dispatchEvent(FWDUVPVideoScreen.PLAY);
				}catch(e){
					
				};
			}

			if(prt.is360){
				_s.add360Vid();	
				if(prt.startWhenPlayButtonClick360DegreeVideo){
					_s.startVR();
				}
			}
		};
		
		_s.initVideo = function(){
			
			_s.setupVideo();
			_s.setVolume();
			_s.isPlaying_bl = false;
			_s.hasError_bl = false;
			_s.allowScrubing_bl = false;
			_s.isStopped_bl = false;
			
			if(_s.video_el.src != _s.sourcePath_str){
				_s.video_el.src = _s.sourcePath_str;
			}
		}

		_s.pause = function(){
			if(_s == null || _s.isStopped_bl || _s.hasError_bl) return;
			if(!_s.video_el.ended){
				try{
					_s.video_el.pause();
					_s.isPlaying_bl = false;
					if(FWDUVPUtils.isIE) _s.dispatchEvent(FWDUVPVideoScreen.PAUSE);
				}catch(e){};
			}
		};
		
		_s.togglePlayPause = function(){
			if(_s == null) return;
			if(!_s.isSafeToBeControlled_bl) return;
			if(_s.isPlaying_bl){
				_s.pause();
			}else{
				_s.play();
			}
		};
		
		_s.resume = function(){
			if(_s.isStopped_bl) return;
			_s.play();
		};
		
		_s.pauseHandler = function(){
			if(_s.allowScrubing_bl) return;
			_s.dispatchEvent(FWDUVPVideoScreen.PAUSE);
		};
		
		_s.playHandler = function(){
			if(_s.allowScrubing_bl) return;

			if(!_s.isStartEventDispatched_bl){
				_s.dispatchEvent(FWDUVPVideoScreen.START);
				_s.isStartEventDispatched_bl = true;
			}
			if(prt.is360) _s.start360Render();
			_s.startToUpdateSubtitles();
			_s.stopToBuffer();
			_s.stopBufferId_to = setTimeout(function(){
				_s.stopToBuffer();
			}, 1000);
			_s.dispatchEvent(FWDUVPVideoScreen.PLAY);
		};
		
		_s.endedHandler = function(){

			_s.stopToUpdateSubtitles();
			_s.dispatchEvent(FWDUVPVideoScreen.PLAY_COMPLETE);
		};
		
		_s.stop = function(overwrite){
			if((_s == null || _s.video_el == null || _s.isStopped_bl) && !overwrite) return;
			clearTimeout(_s.sizeId_to);
			_s.isPlaying_bl = false;
			_s.isStopped_bl = true;
			_s.hasPlayedOnce_bl = true;
			_s.hasStrtLivStrm = false;
			_s.isSafeToBeControlled_bl = false;
			_s.isStartEventDispatched_bl = false;
			_s.audioTracks = null;
			_s.stopToUpdateSubtitles();
			clearTimeout(_s.playWithDelayId_to);
			clearTimeout(_s.stopBufferId_to);
			_s.endVRSesion();
			_s.stop360Render();
			_s.destroyVideo();
			_s.dispatchEvent(FWDUVPVideoScreen.LOAD_PROGRESS, {percent:0});
			_s.dispatchEvent(FWDUVPVideoScreen.UPDATE_TIME, {curTime:"00:00" , totalTime:"00:00"});
			_s.dispatchEvent(FWDUVPVideoScreen.STOP);
			_s.stopToBuffer();
		};


		//###########################################//
		/* Check if audio is safe to be controlled */
		//###########################################//
		_s.safeToBeControlled = function(){

			if((prt.videoType_str == FWDUVPlayer.HLS_JS || prt.videoType_str == FWDUVPlayer.DASH) && !_s.hasStrtLivStrm) return;
			
			if(!_s.isSafeToBeControlled_bl){
				_s.stopToScrub();
				_s.resizeAndPosition();
				_s.hasHours_bl = Math.floor(_s.video_el.duration / (60 * 60)) > 0;
				_s.isPlaying_bl = true;
				_s.isSafeToBeControlled_bl = true;
				if(!prt.is360) _s.video_el.style.visibility = "visible";
				setTimeout(function(){
					if(_s.renderer) _s.renderer.domElement.style.left = "0px";
				},1000);
				if(prt.fillEntireVideoScreen_bl){
					_s.sizeId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPVideoScreen.SAFE_TO_SCRUBB);
					}, 500);
				}else{
					_s.dispatchEvent(FWDUVPVideoScreen.SAFE_TO_SCRUBB);
				}
			}
		};
	
		//###########################################//
		/* Update progress */
		//##########################################//
		_s.updateProgress = function(){
			if(prt.videoType_str == FWDUVPlayer.HLS_JS && !_s.hasStrtLivStrm) return;
			var buffered;
			var percentLoaded = 0;
			
			if(_s.video_el.buffered.length > 0){
				buffered = _s.video_el.buffered.end(_s.video_el.buffered.length - 1);
				percentLoaded = buffered.toFixed(1)/_s.video_el.duration.toFixed(1);
				if(isNaN(percentLoaded) || !percentLoaded) percentLoaded = 0;
			}
			
			if(percentLoaded == 1) _s.video_el.removeEventListener("progress", _s.updateProgress);
			
			_s.dispatchEvent(FWDUVPVideoScreen.LOAD_PROGRESS, {percent:percentLoaded});
		};
		

		//##############################################//
		/* Update audio */
		//#############################################//
		_s.updateVideo = function(){

			var percentPlayed; 
			if (!_s.allowScrubing_bl) {
				percentPlayed = _s.video_el.currentTime /_s.video_el.duration;
				_s.dispatchEvent(FWDUVPVideoScreen.UPDATE, {percent:percentPlayed});
			}
			
			var totalTime = FWDUVPUtils.formatTime(_s.video_el.duration);
			var curTime = FWDUVPUtils.formatTime(_s.video_el.currentTime);
			if(_s.video_el.currentTime) _s.safeToBeControlled();

			if(!isNaN(_s.video_el.duration) && (prt.videoType_str == FWDUVPlayer.VIDEO || prt.videoType_str == FWDUVPlayer.HLS_JS || prt.videoType_str == FWDUVPlayer.DASH)){
				_s.dispatchEvent(FWDUVPVideoScreen.UPDATE_TIME, {curTime: curTime, totalTime:totalTime, seconds:_s.video_el.currentTime, totalTimeInSeconds:_s.video_el.duration});
			}else{
				_s.dispatchEvent(FWDUVPVideoScreen.UPDATE_TIME, {curTime:"00:00" , totalTime:"00:00", seconds:0, totalTimeInSeconds:0});
			}
		
			_s.lastPercentPlayed = percentPlayed;
			_s.curDuration = curTime;
		};
		

		//###############################################//
		/* Scrub */
		//###############################################//
		_s.startToScrub = function(){
			_s.allowScrubing_bl = true;
		};
		
		_s.stopToScrub = function(){
			_s.allowScrubing_bl = false;
		};
		
		_s.scrubbAtTime = function(duration){
			_s.video_el.currentTime = duration;
			var totalTime = FWDUVPUtils.formatTime(_s.video_el.duration);
			var curTime = FWDUVPUtils.formatTime(_s.video_el.currentTime);
			_s.dispatchEvent(FWDUVPVideoScreen.UPDATE_TIME, {curTime: curTime, totalTime:totalTime});
		}
		
		_s.scrub = function(percent, e){
			if(e) _s.startToScrub();
			try{
				_s.video_el.currentTime = _s.video_el.duration * percent;
				var totalTime = FWDUVPUtils.formatTime(_s.video_el.duration);
				var curTime = FWDUVPUtils.formatTime(_s.video_el.currentTime);
				_s.dispatchEvent(FWDUVPVideoScreen.UPDATE_TIME, {curTime: curTime, totalTime:totalTime});
			}catch(e){}
		};
		

		//###############################################//
		/* replay */
		//###############################################//
		_s.replay = function(){
			_s.scrub(0);
			_s.play();
		};
		

		//###############################################//
		/* Volume */
		//###############################################//
		_s.setVolume = function(vol){
			if(vol != undefined) _s.volume = vol;
			if(_s.video_el){
				_s.video_el.volume = _s.volume;
				if(vol) _s.video_el.muted = false;
			}
		};
		
		_s.setPlaybackRate = function(rate){
			if(!_s.video_el) return;
			_s.video_el.defaultPlaybackRate = rate;
			_s.video_el.playbackRate = rate;
		}
		

	
		//###############################################//
		/* Setup 360 vid */
		//###############################################//
		_s.start360Render = function(){
			_s.is360Rendering_bl = true;
			_s.video_el.style.visibility = 'hidden';
			_s.renderer.setAnimationLoop( _s.render );
		}
		
		_s.stop360Render = function(){
			if(!_s.renderer) return;
			_s.is360Rendering_bl = false;

			try{
				_s.screen.removeChild(_s.renderer.domElement);
			}catch(e){};

			_s.pause360Render();

			_s.videoTexture.dispose();			
			_s.renderer.dispose();
			_s.renderer = null;
			_s.cameraL = null;
			_s.scene = null
		}

		_s.pause360Render = function(){
			_s.renderer.setAnimationLoop(null); 
		}

		_s.add360Vid = function(){
			if(prt.controller_do.vrButton_do){
				prt.controller_do.enableVrButton();
			}

			if(_s.cameraL) return;
		
			try{
				_s.screen.removeChild(_s.renderer.domElement);
			}catch(e){};
			
			// Camera.
			_s.cameraL = new THREE.PerspectiveCamera(45, _s.sW / _s.sH, 0.1, 10000);
			_s.cameraL.aspect = _s.sW / _s.sH;
			_s.cameraL.position.set(0,0,500)
		

			// Video texture.
			if(!_s.videoTexture){
				_s.video_el.setAttribute('crossorigin', 'anonymous');
				_s.videoTexture = new THREE.VideoTexture(_s.video_el);	
			}

			// Geometry.
			_s.sphereGeopmetry = new THREE.SphereGeometry(500, 60, 40);
			_s.sphereMat = new THREE.MeshBasicMaterial({map: _s.videoTexture});
			_s.sphereMat.side = THREE.BackSide;
			_s.sphere = new THREE.Mesh(_s.sphereGeopmetry, _s.sphereMat);
			_s.sphere.scale.x = -1;
			_s.sphere.rotateY(prt.rotationY360DegreeVideo);

			// Renderer
			_s.renderer = new THREE.WebGLRenderer({antialias:true});
			_s.renderer.setPixelRatio(window.devicePixelRatio);
			_s.renderer.xr.enabled = true;
			_s.renderer.xr.setReferenceSpaceType('local');
		
			_s.screen.appendChild(_s.renderer.domElement);

			// Scene.
			_s.scene = new THREE.Scene();
			_s.scene.background = new THREE.Color(0x000000);
			_s.scene.add(_s.cameraL);
			_s.scene.add(_s.sphere);

			// Controls.
			_s.controls = new THREE.OrbitControls(_s.cameraL, prt.dClk_do.screen);
			_s.controls.enableDamping = true;
			_s.controls.enableZoom = true; 
			_s.controls.dampingFactor = 0.25;
			_s.controls.maxDistance = 500;
			_s.controls.minDistance = 500;
			_s.controls.maxAzimuthAngle = Infinity;
			_s.controls.enabled = true;
			
			_s.render();
		}

		
		_s.render = function(){
			if(!_s.cameraL) return;
			
			_s.resizeRenderer();
			_s.renderer.render(_s.scene, _s.cameraL);
			_s.controls.update();
		}

		_s.resizeRenderer = function(){
			if(!_s.cameraL) return;
			var w = _s.sW;
			var h = _s.sH;

			if(_s.currentSession){
				w = window.innerWidth;
				h = window.innerHeight;
			}

			// Vr camera.
			_s.renderer.setSize(w, h);
			_s.renderer.domElement.style.width = '100%';
			_s.renderer.domElement.style.height = '100%';
			_s.cameraL.aspect = w / h;
			_s.cameraL.updateProjectionMatrix();
		}


		// VR.
		_s.showVrMessage = function(){
			var msg = _s.vrMessage + ' - <a href="https://immersiveweb.dev/" target="_blank">read more about WebXR</a>';
			if(prt.main_do) prt.main_do.addChild(prt.info_do);
			if(prt.info_do) prt.info_do.showText(msg);
		}

		_s.startVR = function(){

			if(!_s.vrSupport_bl && !_s.showdVRMessage){
				_s.showVrMessage();
				_s.showdVRMessage = true;
				return;
			}

			if(prt.isFullScreen_bl){
				prt.goNormalScreen();
				return;
			}
		
			if(_s.currentSession) return;
			if( 'xr' in navigator ) {
				if( _s.currentSession === null) {

					// WebXR's requestReferenceSpace only works if the corresponding feature
					// was requested at session creation time. For simplicity, just ask for
					// the interesting ones as optional features, but be aware that the
					// requestReferenceSpace call will fail if it turns out to be unavailable.
					// ('local' is always available for immersive sessions and doesn't need to
					// be requested separately.)

					var sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor', 'hand-tracking', 'layers' ] };
					navigator.xr.requestSession( 'immersive-vr', sessionInit ).then( onSessionStarted );
				
				}else{
					_s.currentSession.end();
				}
			}

			async function onSessionStarted(session) {
				_s.resizeRenderer();
				session.addEventListener('end', onSessionEnded);
				session.isImmersive = true;
				await _s.renderer.xr.setSession(session);
				_s.currentSession  = session;
				window.scrollTo(0,0);
			}

			function onSessionEnded( /*event*/ ) {
				_s.currentSession.removeEventListener('end', onSessionEnded );
				_s.currentSession = null;
			}
		}	

		_s.endVRSesion =  async function(){
			if(_s.currentSession){
				await _s.currentSession.end();
			}
		}

		_s.testVr = function(){
			try{
				if(navigator.xr){

					navigator.xr.isSessionSupported('immersive-vr').then(function(supported){
						if(supported){
							 _s.vrSupport_bl = true;
							 _s.vrMessage = undefined;
						}else{
							 _s.vrSupport_bl = false;
							 _s.vrMessage = 'VR not supported';
						}
					}).catch(function(){
						_s.vrSupport_bl = false;
						_s.vrMessage = 'VR not allowed';
					});

				}else{
					 _s.vrSupport_bl = false;
					 _s.vrMessage = 'VR not supported';
				}
			}catch(e){}
		}

		// Set audio track.
		_s.setAudioTrack = function(id){
			var curAudioTrack = _s.audioTracks[id];
			for (var i = 0; i < _s.audioTracks.length; i++) {
				var el = _s.audioTracks[i];
				if(i == id){
					el.enabled = true;
				}else{
					el.enabled = false;
				}
			}
		}
		

		//##################################################//
		/* Subtitles */
		//##################################################//
		_s.stopToUpdateSubtitles = function(){
			clearInterval(_s.startToUpdateSubtitleId_int);	
		}
		
		_s.startToUpdateSubtitles = function(){
			clearInterval(_s.startToUpdateSubtitleId_int);
			_s.startToUpdateSubtitleId_int = setInterval(_s.updateSubtitleHandler, 10);
		}
		
		_s.updateSubtitleHandler = function(){
			_s.dispatchEvent(FWDUVPVideoScreen.UPDATE_SUBTITLE, {curTime:_s.video_el.currentTime});
		}
	
		_s.init();
	};


	/* set prototype */
	FWDUVPVideoScreen.setPrototype = function(){
		FWDUVPVideoScreen.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPVideoScreen.UPDATE_SUBTITLE = "updateSubtitle";
	FWDUVPVideoScreen.ERROR = "error";
	FWDUVPVideoScreen.UPDATE = "update";
	FWDUVPVideoScreen.UPDATE_TIME = "updateTime";
	FWDUVPVideoScreen.SAFE_TO_SCRUBB = "safeToControll";
	FWDUVPVideoScreen.LOAD_PROGRESS = "loadProgress";
	FWDUVPVideoScreen.START = "start";
	FWDUVPVideoScreen.PLAY = "play";
	FWDUVPVideoScreen.PAUSE = "pause";
	FWDUVPVideoScreen.STOP = "stop";
	FWDUVPVideoScreen.PLAY_COMPLETE = "playComplete";
	FWDUVPVideoScreen.START_TO_BUFFER = "startToBuffer";
	FWDUVPVideoScreen.STOP_TO_BUFFER = "stopToBuffer";


	window.FWDUVPVideoScreen = FWDUVPVideoScreen;

}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Vimeo screen.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function(window){
	
	var FWDUVPVimeoScreen = function(prt, volume){
		
		'use strict';

		var _s = this;
		var prototype = FWDUVPVimeoScreen.prototype;
		
		_s.lastQuality_str = "auto";
		_s.volume = volume;
		
		_s.controllerHeight = prt._d.controllerHeight;
		_s.hasBeenCreatedOnce_bl = true;
		_s.isStopped_bl = true;
		_s.isPausedInEvent_bl = true;
		_s.isShowed_bl = true;
		_s.isMbl = FWDUVPUtils.isMobile;
		

		//###############################################//
		/* init */
		//###############################################//
		_s.init = function(){
			_s.hasTransform3d_bl = false;
			_s.hasTransform2d_bl = false;
			_s.setBkColor(prt.videoBackgroundColor_str);
		
			_s.setBackfaceVisibility();
			prt.videoHolder_do.addChildAt(_s, 0);
			_s.resizeAndPosition();
			_s.setupVideo();
			_s.setupDisableClick();
		};
	
		
		//#####################################//
		/* Setup disable click */
		//#####################################//
		_s.setupDisableClick = function(){
			_s.disableClick_do = new FWDUVPDisplayObject("div");
			_s.disableClick_do.setBkColor(prt.backgroundColor_str);	
			_s.disableClick_do.setAlpha(0.00000001);
			_s.addChild(_s.disableClick_do);
		};
		
		_s.showDisable = function(){
			if(!prt.tempVidStageWidth || _s.disableClick_do.w == _s.sW) return;
			_s.disableClick_do.setWidth(prt.tempVidStageWidth);
			if(FWDUVPUtils.isIphone){	
				_s.disableClick_do.setHeight(prt.tempVidStageHeight - _s.controllerHeight);
			}else{
				_s.disableClick_do.setHeight(prt.tempVidStageHeight);
			}
		};
		
		_s.hideDisable = function(){
			if(_s.disableClick_do.w == 0) return;
			_s.disableClick_do.setWidth(0);
			_s.disableClick_do.setHeight(0);
		};
	

		//###############################################//
		/* Setup youtube video */
		//##############################################//
		_s.setupVideo = function(){
			if(_s.vimeoPlayer) return;
			_s.iframe_do = new FWDUVPDisplayObject("IFRAME");
			_s.iframe_do.hasTransform3d_bl = false;
			_s.iframe_do.hasTransform2d_bl = false;
			_s.iframe_do.screen.setAttribute("id", prt.instanceName_str + "vimeo");
			if(_s.isMbl){
				_s.iframe_do.screen.setAttribute("webkitallowfullscreen", "1");
				_s.iframe_do.screen.setAttribute("mozallowfullscreen", "1");
				_s.iframe_do.screen.setAttribute("allowfullscreen", "1");
			}
			
			var bk = 0;
			if(prt._d.showDefaultControllerForVimeo_bl && !_s.isMobile_bl) bk = 1;

			var inl = 0;
			if(prt._d.playsinline) inl = 1;
			
			_s.iframe_do.screen.setAttribute("src", "https://player.vimeo.com/video/76979871" + "?player_id=" + prt.instanceName_str + "vimeo&playsinline=" + inl + "&muted=0&autoplay=0&background=" + bk +"");

			_s.iframe_do.screen.setAttribute("id", prt.instanceName_str + "vimeo");		
			_s.iframe_do.screen.setAttribute("frameborder", "0");
			_s.iframe_do.screen.setAttribute("allow", "fullscreen; autoplay;");
			_s.iframe_do.screen.dataset.ready = 'true';
			
			if(prt._d.autoPlay_bl){
				_s.iframe_do.screen.setAttribute("muted", "1");
			}
			_s.iframe_do.getStyle().width = "100%";
			_s.iframe_do.getStyle().height = "100%";
			_s.iframe_do.setBackfaceVisibility();
			_s.addChild(_s.iframe_do);
			
			_s.vimeoPlayer = new Vimeo.Player(_s.iframe_do.screen); 
			_s.vimeoPlayer.on('play', function(e) {
				_s.playHandler();
			});
			
			_s.vimeoPlayer.on('pause', function(e) {
				_s.pauseHandler();
			});
			
			_s.vimeoPlayer.on('loadProgress', function(e) {
				_s.loadProgressHandler();
			});

			_s.vimeoPlayer.on('loaded', function(e) {
				_s.loadedHandler();
			});
			
			_s.vimeoPlayer.ready().then(function(){
				_s.readyHandler();
			});
			
			_s.blackOverlay_do = new FWDUVPDisplayObject("div");
			_s.blackOverlay_do.getStyle().backgroundColor = "#000000";
			_s.blackOverlay_do.getStyle().width = "100%";
			_s.blackOverlay_do.getStyle().height = "100%";
			_s.addChild(_s.blackOverlay_do);

		};
			
		//##############################################//
		/* Resize and position */
		//##############################################//
		_s.resizeAndPosition = function(){
			if(!prt.tempVidStageWidth) return;
			_s.setWidth(prt.tempVidStageWidth);
			_s.setHeight(prt.tempVidStageHeight);
			if(!prt._d.showDefaultControllerForVimeo_bl && prt.controller_do){
				_s.setHeight(prt.tempVidStageHeight - prt.controller_do.h)
			}
		};
		

		//##############################################//
		/* Set source and initialize player */
		//##############################################//
		_s.setSource = function(sourcePath){
			if(sourcePath) _s.sourcePath_str = sourcePath;
			_s.stopToUpdateSubtitles();
	
			var videoId = _s.sourcePath_str.match(/[^\/]+$/i);	
			
			_s.vimeoPlayer.loadVideo(videoId).then(function(id) {
				
				if(prt._d.autoPlay_bl || prt.isThumbClick_bl){

					if( prt.isThumbClick_bl){
						prt.videoPoster_do.hide(true);
						prt.play();
						setTimeout(() => {
							prt.play();
						}, 500);
					} 

					if(prt._d.autoPlay_bl){
						if(prt.controller_do) prt.controller_do.updateVolume(0);
						if(prt.displayType != FWDUVPlayer.LIGHTBOX || prt.lightBox_do.isShowed_bl){
							prt.videoPoster_do.hide(true);
							prt.play();
						} 
					}
				}else{
					prt.videoPoster_do.show();
					if(prt.lrgPlayBtn) prt.lrgPlayBtn.show();
				}

				if(!_s.isMbl && prt.isAdd_bl && !prt.loadAddFirstTime_bl){
					prt.play();
					prt.videoPoster_do.hide(true);
				}
				_s.setVolume(prt.volume);
			}).catch(function(error) {
				if(console) console.log(error);
				_s.displayErrorId_to = setTimeout(function(){
					_s.dispatchEvent(FWDUVPVimeoScreen.ERROR, {error:error.name});
				} , 2000);
				if(console) console.log(error);
			});
		};

		
		//########################################//
		/* Ready handler */
		//########################################//
		_s.readyHandler = function(){
			
			clearTimeout(_s.intitErrorId_to);
			if(_s.contains(_s.blackOverlay_do)){
				clearTimeout(_s.removeChildWithDelayId_to);
				_s.removeChildWithDelayId_to = setTimeout(function(){
					_s.removeChild(_s.blackOverlay_do);
				}, 1500);
			}
			_s.resizeAndPosition();
			
			
			if(_s.isReady_bl){
				try{
					_s.vimeoPlayer.api("setColor", '#FFFFFF');
				}catch(e){}
				if(prt.videoType_str == FWDUVPlayer.VIMEO) _s.setX(0);
				if(prt._d.autoPlay_bl) prt.play();
			
				return;
			}
			_s.isReady_bl = true;
		
			_s.dispatchEvent(FWDUVPVimeoScreen.READY);
		};
		
		_s.loadedHandler = function(){
			_s.isVideoLoaded_bl = true;
		};
		
		_s.playHandler = function(){
			clearInterval(_s.startToPlayWithDelayId_to);
			clearTimeout(_s.displayErrorId_to);
			_s.isStopped_bl = false;
			_s.isSafeToBeControlled_bl = true;
			_s.isPlaying_bl = true;
			_s.startToUpdateSubtitles();
			_s.startToUpdate();
		
			_s.dispatchEvent(FWDUVPVimeoScreen.SAFE_TO_SCRUBB);
			_s.dispatchEvent(FWDUVPVimeoScreen.PLAY);
			_s.hasHours_bl = Math.floor(_s.getDuration() / (60 * 60)) > 0;
		};
		
		_s.loadProgressHandler = function(e){
			if(_s.isShowed_bl) return;
			_s.dispatchEvent(FWDUVPVimeoScreen.LOAD_PROGRESS, {percent:e.percent});
		};
		
		_s.pauseHandler = function(){
			if(!_s.isPlaying_bl ) return;
		
			_s.isPlaying_bl = false;
			clearInterval(_s.startToPlayWithDelayId_to);
			_s.dispatchEvent(FWDUVPVimeoScreen.PAUSE);
			_s.stopToUpdate();
		};
		
		_s.finishHandler = function(){
			if(prt._d.loop_bl && !prt.isAdd_bl){
				_s.stop();
				setTimeout(_s.play, 200);
			}
			_s.dispatchEvent(FWDUVPVimeoScreen.PLAY_COMPLETE);
		};
	

		//##########################################//
		/* Play / pause / stop methods */
		//##########################################//
		_s.play = function(overwrite){
			FWDUVPlayer.curInstance = prt;
			_s.hasError_bl = false;
			_s.vimeoPlayer.play();
			if(!_s.isMbl) _s.isStopped_bl = false;
		};

		_s.pause = function(){
			if(_s.isStopped_bl || _s.hasError_bl) return;
			clearInterval(_s.startToPlayWithDelayId_to);
			_s.vimeoPlayer.pause();
			_s.stopToUpdate();
		};
		
		_s.togglePlayPause = function(){
			if(_s.isPlaying_bl){
				_s.pause();
			}else{
				_s.play();
			}
		};
		
		_s.resume = function(){
			if(_s.isStopped_bl) return;
			_s.play();
		};
		

		//###########################################//
		/* Updates. */
		//###########################################//
		_s.startToUpdate = function(){
			clearInterval(_s.updateVideoId_int);
			_s.updateVideoId_int = setInterval(_s.updateVideo, 50);
		};
		
		_s.stopToUpdate = function(){
			clearInterval(_s.updateVideoId_int);
		};
		
		_s.updateVideo = function(){
		
			var percentPlayed; 
			if(!_s.vimeoPlayer){
				stopToUpdate();
				return;
			}
			
			var totalTime = FWDUVPUtils.formatTime(_s.getDuration());
			var curTime = FWDUVPUtils.formatTime(_s.getCurrentTime());
			
			percentPlayed = _s.getCurrentTime()/_s.getDuration();
			if(isNaN(percentPlayed)) percentPlayed = 0;

			if(_s.getCurrentTime() == _s.getDuration()){
				_s.finishHandler();
				return;
			} 
		
			_s.dispatchEvent(FWDUVPYoutubeScreen.UPDATE, {percent:percentPlayed});
			_s.dispatchEvent(FWDUVPVimeoScreen.UPDATE_TIME, {curTime:curTime , totalTime:totalTime, seconds:_s.getCurrentTime(), totalTimeInSeconds:_s.getDuration()});
		};	

		
		//###########################################//
		/* Event handlers */
		//###########################################//	
		_s.stop = function(addEvents){
			_s.isVideoLoaded_bl = false;
			
			if(_s.isStopped_bl) return;
			clearInterval(_s.startToPlayWithDelayId_to);
			clearTimeout(_s.displayErrorId_to);
			_s.stopVideo();
			_s.stopToUpdateSubtitles();
			
			_s.isPlaying_bl = false;
			_s.isStopped_bl = true;
			_s.isCued_bl = false;
			_s.allowScrubing_bl = false;
			_s.isSafeToBeControlled_bl = false;
			_s.isPausedInEvent_bl = true;
			
			_s.stopToUpdate();
			if(!addEvents){
				_s.stopVideo();
				_s.dispatchEvent(FWDUVPVimeoScreen.STOP);
			}
		};
		
		_s.destroy = function(){
			if(_s.iframe_do){
				_s.iframe_do.screen.removeAttribute("id", prt.instanceName_str + "vimeo");
				_s.removeChild(_s.iframe_do);
				_s.iframe_do.destroy();
				_s.iframe_do = null;
			}
			_s.vimeoPlayer = null;
		};
		
		_s.stopVideo = function(){
			_s.vimeoPlayer.unload().then(function() {
				// the video was unloaded
			}).catch(function(e) {
				// an error occurred
				console.log(e)
			});
		};
		

		//########################################//
		/* Various Vimeo API methods */
		//########################################//
		_s.startToScrub = function(){
			if(!_s.isSafeToBeControlled_bl) return;
			_s.allowScrubing_bl = true;
		};
		
		_s.stopToScrub = function(){
			if(!_s.isSafeToBeControlled_bl) return;
			_s.allowScrubing_bl = false;
		};
		
		_s.scrubbAtTime = function(duration){
			_s.vimeoPlayer.setCurrentTime(duration).then(function(seconds) {
				// seconds = the actual time that the player seeked to
			})
		}
		
		_s.scrub = function(percent){
			if(!_s.isSafeToBeControlled_bl) return;
			_s.vimeoPlayer.setCurrentTime(percent * _s.getDuration()).then(function(seconds) {
				// seconds = the actual time that the player seeked to
			})
		};
	
		_s.setVolume = function(vol){
			if(vol != undefined) _s.volume = vol;
			if(_s.vimeoPlayer) {
				_s.vimeoPlayer.setVolume(_s.volume);
			}
		};
		
		
		_s.getDuration = function(){
			if(!_s.isSafeToBeControlled_bl) return;
				_s.vimeoPlayer.getDuration().then(function(duration) {
				_s.duration = Math.round(duration);
            });
			return _s.duration;
		};
		
		_s.getCurrentTime = function(){
			if(!_s.isSafeToBeControlled_bl) return;
			_s.vimeoPlayer.getCurrentTime().then(function(time) {
               _s.currentTime = Math.round(time);
            });
			
			return _s.currentTime;
		};

		
		//##################################################//
		/* Suntitles */
		//##################################################//
		_s.stopToUpdateSubtitles = function(){
			clearInterval(_s.startToUpdateSubtitleId_int);	
		}
		
		_s.startToUpdateSubtitles = function(){
			clearInterval(_s.startToUpdateSubtitleId_int);
			_s.startToUpdateSubtitleId_int = setInterval(_s.updateSubtitleHandler, 10);
		}
		
		_s.updateSubtitleHandler = function(){
			if(!_s.getCurrentTime()) return;
			_s.dispatchEvent(FWDUVPVimeoScreen.UPDATE_SUBTITLE, {curTime:_s.getCurrentTime()});
		}
		
	
		_s.init();
	};


	/* set prototype */
	FWDUVPVimeoScreen.setPrototype = function(){
		FWDUVPVimeoScreen.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPVimeoScreen.UPDATE_SUBTITLE = "updateSubtitle";
	FWDUVPVimeoScreen.SAFE_TO_SCRUBB = "safeToScrub";
	FWDUVPVimeoScreen.READY = "ready";
	FWDUVPVimeoScreen.ERROR = "initError";
	FWDUVPVimeoScreen.UPDATE = "update";
	FWDUVPVimeoScreen.UPDATE_TIME = "updateTime";
	FWDUVPVimeoScreen.LOAD_PROGRESS = "loadProgress";
	FWDUVPVimeoScreen.PLAY = "play";
	FWDUVPVimeoScreen.PAUSE = "pause";
	FWDUVPVimeoScreen.STOP = "stop";
	FWDUVPVimeoScreen.PLAY_COMPLETE = "playComplete";
	FWDUVPVimeoScreen.CUED = "cued";
	FWDUVPVimeoScreen.QUALITY_CHANGE = "qualityChange";


	window.FWDUVPVimeoScreen = FWDUVPVimeoScreen;

}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Volume button.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
var FWDUVPVolumeButton = function(
			nImg,
			sPath,
			dPath,
			useHEX,
			nBC,
			sBC,
			iconCSSString1, 
			iconCSSString2, 
			normalCalssName,
			selectedCalssName
		){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPVolumeButton.prototype;
		
		_s.iconCSSString1 = iconCSSString1;
		_s.iconCSSString2 = iconCSSString2;
		_s.nImg = nImg;
		_s.sPath_str = sPath;
		_s.dPath_str = dPath;
	
		_s.toolTipLabel_str;
		
		if(_s.nImg){
			_s.totalWidth = _s.nImg.width;
			_s.totalHeight = _s.nImg.height;
		}
		
		_s.normalCalssName = normalCalssName;
		_s.selectedCalssName = selectedCalssName;
		
		_s.useHEX = useHEX;
		_s.nBC = nBC;
		_s.sBC = sBC;
		
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.hasPointerEvent_bl = FWDUVPUtils.hasPointerEvent;
		_s.allowToCreateSecondButton_bl = true;
		_s.useFontAwesome_bl = Boolean(_s.iconCSSString1);
	

		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.setupMainContainers();
			_s.setNormalState(false);
			_s.setEnabledState();
		};

		
		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.setupMainContainers = function(){
	
			if(_s.useFontAwesome_bl){
				_s.setOverflow('visible');
				_s.n_sdo = new FWDUVPTransformDisplayObject("div");	
				_s.n_sdo.setInnerHTML(_s.iconCSSString1);
				_s.addChild(_s.n_sdo);
				
				_s.d_sdo = new FWDUVPTransformDisplayObject("div");
				_s.d_sdo.setInnerHTML(_s.iconCSSString2);
				_s.addChild(_s.d_sdo);
				
				_s.setFinalSize();
			}else{
				if(_s.useHEX){
					_s.n_sdo = new FWDUVPTransformDisplayObject("div");
					_s.n_sdo.setWidth(_s.totalWidth);
					_s.n_sdo.setHeight(_s.totalHeight);
					_s.n_sdo_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.nImg, _s.nBC).canvas;
					_s.n_sdo.screen.appendChild(_s.n_sdo_canvas);
					_s.addChild(_s.n_sdo);
				}else{
					_s.n_sdo = new FWDUVPTransformDisplayObject("img");	
					_s.n_sdo.setScreen(_s.nImg);
					_s.addChild(_s.n_sdo);
				}
				
				if(_s.allowToCreateSecondButton_bl){
					
					_s.img1 = new Image();
					_s.img1.src = _s.sPath_str;
					var img2 = new Image();
					_s.sImg = img2;
					
					if(_s.useHEX){
						_s.s_sdo = new FWDUVPTransformDisplayObject("div");
						_s.s_sdo.setWidth(_s.totalWidth);
						_s.s_sdo.setHeight(_s.totalHeight);
						_s.img1.onload = function(){
							_s.s_sdo_canvas = FWDUVPUtils.getCanvasWithModifiedColor(_s.img1, _s.sBC).canvas;
							_s.s_sdo.screen.appendChild(_s.s_sdo_canvas);
						}
						_s.s_sdo.setAlpha(0);
						_s.addChild(_s.s_sdo);
					}else{
						_s.s_sdo = new FWDUVPDisplayObject("img");
						_s.s_sdo.setScreen(_s.img1);
						_s.s_sdo.setWidth(_s.totalWidth);
						_s.s_sdo.setHeight(_s.totalHeight);
						_s.s_sdo.setAlpha(0);
						_s.addChild(_s.s_sdo);
					}
					
					if(_s.dPath_str){
						img2.src = _s.dPath_str;
						_s.d_sdo = new FWDUVPDisplayObject("img");
						_s.d_sdo.setScreen(img2);
						_s.d_sdo.setWidth(_s.totalWidth);
						_s.d_sdo.setHeight(_s.totalHeight);
						_s.d_sdo.setX(-100);
						_s.addChild(_s.d_sdo);
					};
				}
			}
			
			_s.setWidth(_s.totalWidth);
			_s.setHeight(_s.totalHeight);
			_s.setButtonMode(true);
			
			if(_s.hasPointerEvent_bl){
				_s.screen.addEventListener("pointerup", _s.onMouseUp);
				_s.screen.addEventListener("pointerover", _s.onMouseOver);
				_s.screen.addEventListener("pointerout", _s.onMouseOut);
			}else if(_s.screen.addEventListener){	
				_s.screen.addEventListener("mouseover", _s.onMouseOver);
				_s.screen.addEventListener("mouseout", _s.onMouseOut);
				_s.screen.addEventListener("mouseup", _s.onMouseUp);
				_s.screen.addEventListener("touchstart", _s.onMouseDown);
				_s.screen.addEventListener("touchstart", _s.onMouseUp);
			}
		};
		
		_s.setFinalSize = function(){
			
			_s.setWidth(_s.n_sdo.getWidth());
			_s.setHeight(_s.n_sdo.getHeight());
			_s.buttonWidth = _s.w;
			_s.buttonHeight = _s.h;
			
			if(_s.w == 0){
				setTimeout(function(){
					_s.setFinalSize();
				},300);
			}
		}

		
		//####################################//
		/* Set normal / selected state */
		//####################################//
		_s.setNormalState = function(animate){
			if(_s.useFontAwesome_bl){
				FWDAnimation.killTweensOf(_s.n_sdo.screen);
				FWDAnimation.killTweensOf(_s.d_sdo.screen);
				if(animate){
					FWDAnimation.to(_s.n_sdo.screen, .8, {className:_s.normalCalssName, ease:Expo.easeOut});
					FWDAnimation.to(_s.d_sdo.screen, .8, {className:_s.normalCalssName, ease:Expo.easeOut});
				}else{
					_s.n_sdo.screen.className = _s.normalCalssName;
					_s.d_sdo.screen.className = _s.normalCalssName;
				}
			}else{
				FWDAnimation.killTweensOf(_s.s_sdo);
				FWDAnimation.to(_s.s_sdo, .5, {alpha:0, ease:Expo.easeOut});	
			}
		};
		
		_s.setSelectedState = function(animate){
			if(_s.useFontAwesome_bl){
				FWDAnimation.killTweensOf(_s.n_sdo.screen);
				FWDAnimation.killTweensOf(_s.d_sdo.screen);
				if(animate){
					FWDAnimation.to(_s.n_sdo.screen, .8, {className:_s.selectedCalssName, ease:Expo.easeOut});	
					FWDAnimation.to(_s.d_sdo.screen, .8, {className:_s.selectedCalssName, ease:Expo.easeOut});
				}else{
					_s.n_sdo.screen.className = _s.selectedCalssName;
					_s.d_sdo.screen.className = _s.selectedCalssName
				}
			}else{
				FWDAnimation.killTweensOf(_s.s_sdo);
				FWDAnimation.to(_s.s_sdo, .5, {alpha:1, delay:.1, ease:Expo.easeOut});
			}
		};
		
		_s.onMouseOver = function(e){
			if(!e.pointerType || e.pointerType == 'mouse'){
				if(_s.isDisabled_bl || _s.isSelectedFinal_bl) return;

				_s.dispatchEvent(FWDUVPVolumeButton.MOUSE_OVER, {e:e});
				_s.setSelectedState(true);
			}
		};
			
		_s.onMouseOut = function(e){
			if(!e.pointerType || e.pointerType == 'mouse'){
				if(_s.isDisabled_bl || _s.isSelectedFinal_bl) return;
				_s.dispatchEvent(FWDUVPVolumeButton.MOUSE_OUT, {e:e});
				_s.setNormalState(true);
			}
		};
		
		_s.onMouseDown = function(e){
			if(e.preventDefault) e.preventDefault();
			if(_s.isDisabled_bl || e.button == 2 || _s.isSelectedFinal_bl) return;
			_s.dispatchEvent(FWDUVPVolumeButton.MOUSE_DOWN, {e:e});
		};
		
		_s.onMouseUp = function(e){
			if(e.preventDefault) e.preventDefault();
			if(_s.isDisabled_bl || e.button == 2 || _s.isSelectedFinal_bl) return;
			_s.dispatchEvent(FWDUVPVolumeButton.MOUSE_UP, {e:e});
		};

		
		//##############################//
		// set select / deselect final.
		//##############################//
		_s.setSelctedFinal = function(){
			_s.isSelectedFinal_bl = true;
			FWDAnimation.killTweensOf(_s.s_sdo);
			FWDAnimation.to(_s.s_sdo, .8, {alpha:1, ease:Expo.easeOut});
			_s.setButtonMode(false);
		};
		
		_s.setUnselctedFinal = function(){
			_s.isSelectedFinal_bl = false;
			FWDAnimation.to(_s.s_sdo, .8, {alpha:0, delay:.1, ease:Expo.easeOut});
			_s.setButtonMode(true);
		};
		

		//####################################//
		/* Disable / enable */
		//####################################//
		_s.setDisabledState = function(){
			_s.isSetToDisabledState_bl = true;
			if(_s.useFontAwesome_bl){
				_s.n_sdo.setX(-10000);
				_s.d_sdo.setX(0);
			}else{_s.d_sdo.setX(0);
				FWDAnimation.killTweensOf(_s.d_sdo);
				FWDAnimation.to(_s.d_sdo, .8, {alpha:1, ease:Expo.easeOut});
			}
		};
		
		_s.setEnabledState = function(){
			_s.isSetToDisabledState_bl = false;
			if(_s.useFontAwesome_bl){
				_s.n_sdo.setX(0);
				_s.d_sdo.setX(-10000);
			}else{
				_s.d_sdo.setX(-100);
				FWDAnimation.killTweensOf(_s.d_sdo);
				FWDAnimation.to(_s.d_sdo, .8, {alpha:0, delay:.1, ease:Expo.easeOut});
			}
		};
		
		_s.disable = function(){
			_s.isDisabled_bl = true;
			_s.setButtonMode(false);
		};
		
		_s.enable = function(){
			_s.isDisabled_bl = false;
			_s.setButtonMode(true);
		};
		

		//##########################################//
		/* Update HEX color of a canvaas */
		//##########################################//
		_s.updateHEXColors = function(nBC, sBC){
			FWDUVPUtils.changeCanvasHEXColor(_s.nImg, _s.n_sdo_canvas, nBC);
			FWDUVPUtils.changeCanvasHEXColor(_s.img1, _s.s_sdo_canvas, sBC);
		}
		

		//##############################//
		/* destroy */
		//##############################//
		_s.destroy = function(){
			if(_s.isMbl){
				if(_s.hasPointerEvent_bl){
					_s.screen.removeEventListener("pointerdown", _s.onMouseUp);
					_s.screen.removeEventListener("pointerover", _s.onMouseOver);
					_s.screen.removeEventListener("pointerout", _s.onMouseOut);
				}else{
					_s.screen.removeEventListener("touchstart", _s.onMouseDown);
					_s.screen.removeEventListener("touchend", _s.onMouseUp);
				}
			}else if(_s.screen.removeEventListener){	
				_s.screen.removeEventListener("mouseover", _s.onMouseOver);
				_s.screen.removeEventListener("mouseout", _s.onMouseOut);
				_s.screen.removeEventListener("mousedown", _s.onMouseUp);
			}
		
			FWDAnimation.killTweensOf(_s.s_sdo);
			_s.n_sdo.destroy();
			_s.s_sdo.destroy();
			
			if(_s.d_sdo){
				FWDAnimation.killTweensOf(_s.d_sdo);
				_s.d_sdo.destroy();
			}
			
			_s.nImg = null;
			_s.sImg = null;
			_s.dImg = null;
			_s.n_sdo = null;
			_s.s_sdo = null;
			_s.d_sdo = null;
			
			nImg = null;
			sImg = null;
			dImg = null;
			
			_s.toolTipLabel_str = null;
			
			_s.init = null;
			_s.setupMainContainers = null;
			_s.onMouseOver = null;
			_s.onMouseOut = null;
			_s.onClick = null;
			_s.onMouseDown = null;  
			_s.setSelctedFinal = null;
			_s.setUnselctedFinal = null;
			
			_s.setInnerHTML("");
			prototype.destroy();
			_s = null;
			prototype = null;
			FWDUVPVolumeButton.prototype = null;
		};
	
		_s.init();
	};
	
	
	/* set prototype */
	FWDUVPVolumeButton.setPrototype = function(){
		FWDUVPVolumeButton.prototype = null;
		FWDUVPVolumeButton.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPVolumeButton.SHOW_TOOLTIP = "showTooltip";
	FWDUVPVolumeButton.CLICK = "onClick";
	FWDUVPVolumeButton.MOUSE_OVER = "onMouseOver";
	FWDUVPVolumeButton.MOUSE_OUT = "onMouseOut";
	FWDUVPVolumeButton.MOUSE_UP = "onMouseUp";
	FWDUVPVolumeButton.MOUSE_DOWN = 'onMouseDown';
	
	FWDUVPVolumeButton.prototype = null;
	window.FWDUVPVolumeButton = FWDUVPVolumeButton;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Custom console for mobile devices, not included in the main class!
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (window){
	
	var FWDConsole = function(){

		'use strict';
		
		var _s  = this;
		var prototype = FWDConsole.prototype;
		
		_s.main_do = null;
	
		_s.init = function(){
			_s.setupScreen();
			window.onerror = _s.showError;
			_s.screen.style.zIndex = 9999999999999999999999999;
			setTimeout(_s.addConsoleToDom, 100);
			setInterval(_s.position, 100);
		};
		
		_s.position = function(){
			var scrollOffsets = FWDUVPUtils.getScrollOffsets();
			_s.setX(scrollOffsets.x);
			_s.setY(scrollOffsets.y);
		};
		
		_s.addConsoleToDom  = function(){
			if(navigator.userAgent.toLowerCase().indexOf("msie 7") != -1){
				document.getElementsByTagName("body")[0].appendChild(_s.screen);
			}else{
				document.documentElement.appendChild(_s.screen);
			}
		};
		

		/* setup screens */
		_s.setupScreen = function(){
			_s.main_do = new FWDUVPDisplayObject("div", "absolute");
			_s.main_do.setOverflow("auto");
			_s.main_do.setWidth(300);
			_s.main_do.setHeight(100);
			_s.setWidth(300);
			_s.setHeight(100);
			_s.main_do.setBkColor("#FFFFFF");
			_s.addChild(_s.main_do);
		};
		
		_s.showError = function(message, url, linenumber) {
			var currentInnerHTML = _s.main_do.getInnerHTML() + "<br>" + "JavaScript error: " + message + " on line " + linenumber + " for " + url;
			_s.main_do.setInnerHTML(currentInnerHTML);
			_s.main_do.screen.scrollTop = _s.main_do.screen.scrollHeight;
		};
		
		_s.log = function(message){
			var currentInnerHTML = _s.main_do.getInnerHTML() + "<br>" + message;
			_s.main_do.setInnerHTML(currentInnerHTML);  
			_s.main_do.getScreen().scrollTop = 10000;
		};
		
		_s.init();
	};
	
	
	/* set prototype */
    FWDConsole.setPrototype = function(){
    	FWDConsole.prototype = new FWDUVPDisplayObject("div", "absolute");
    };
    
    FWDConsole.prototype = null;
	window.FWDConsole = FWDConsole;
}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Youtube screen.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function(window){
	
	var FWDUVPYoutubeScreen = function(prt, volume){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPYoutubeScreen.prototype;
	
		_s.lastQuality_str = "auto";	
		_s.volume = volume;
		_s.controllerHeight = prt._d.controllerHeight;
		_s.isStopped_bl = true;
		_s.isPausedInEvent_bl = true;
		_s.isShowed_bl = true;
		_s.isQualityArrayDisapatched_bl = false; _s.playsinline = prt._d.playsinline ? 1 : 0;
		_s.isMbl = FWDUVPUtils.isMobile;
		

		//###############################################//
		/* init */
		//###############################################//
		_s.init = function(){
			
			_s.hasTransform3d_bl = false;
			_s.hasTransform2d_bl = false;
			_s.setBkColor("#000");
			_s.setBackfaceVisibility();
			prt.videoHolder_do.addChildAt(_s, 0);
			_s.resizeAndPosition();
			_s.setupVideo();
			_s.setupDisableClick();
		};



		//#####################################//
		/* Setup disable click */
		//#####################################//
		_s.setupDisableClick = function(){
			_s.disableClick_do = new FWDUVPDisplayObject("div");
			_s.disableClick_do.className = 'FWDUVP-disable';
			_s.addChild(_s.disableClick_do);
		};
		
		_s.showDisable = function(){
			if(!prt.tempVidStageWidth || _s.disableClick_do.w == _s.sW){
				return;
			}
			
			_s.disableClick_do.setWidth(prt.tempVidStageWidth);
			
				_s.disableClick_do.setHeight(prt.tempVidStageHeight);
			
		};
		
		_s.hideDisable = function(){
			if(_s.disableClick_do.w == 0) return;
			_s.disableClick_do.setWidth(0);
			_s.disableClick_do.setHeight(0);
		};
	

		//###############################################//
		/* Setup youtube video */
		//##############################################//
		_s.setupVideo = function(){
		
			_s.videoHolder_do = new FWDUVPDisplayObject("div");
			_s.videoHolder_do.hasTransform3d_bl = false;
			_s.videoHolder_do.hasTransform2d_bl = false;
			_s.videoHolder_do.screen.setAttribute("id", prt.instanceName_str + "youtube");
			_s.videoHolder_do.getStyle().width = "100%";
			_s.videoHolder_do.getStyle().height = "100%";
			_s.videoHolder_do.setBackfaceVisibility();
			_s.addChild(_s.videoHolder_do);
			
			_s.ytb = new YT.Player(prt.instanceName_str + "youtube", {
				width:"100%",
				height:"100%",
				playerVars:{
					rel:0,
					playsinline:_s.playsinline,
					wmode: 'transparent',
					controls: 0,
					enablejsapi:1,
					iv_load_policy:3,
					modestbranding: 0,
	                showinfo:0,
	                autohide: 1,
			  	},
			  	events: {
			  		"onReady":_s.playerReadyHandler,
			  		"onError":_s.playerErrorHandler,
			  		"onStateChange":_s.stateChangeHandler,
			  		"onPlaybackQualityChange":_s.qualityChangeHandler
			  	}
		    });
			_s.setBkColor("#000");
			_s.ytbIframe = document.getElementById(prt.instanceName_str + "youtube");
		};
			
		_s.playerReadyHandler = function(e){
		
			if(prt._d.autoPlay_bl) _s.ytb.mute();

			_s.resizeAndPosition();
			
			_s.dispatchEvent(FWDUVPYoutubeScreen.READY);
			_s.hasBeenCreatedOnce_bl = true;
		};
		
		_s.stateChangeHandler = function(e){
			if(e.data == -1 && _s.isCued_bl && _s.isMbl){
				_s.isStopped_bl = false;
				FWDUVPlayer.stopAllVideos(prt);
			}
			
			if(e.data == YT.PlayerState.PLAYING){
				if(!_s.isSafeToBeControlled_bl){
					_s.isStopped_bl = false;
					_s.isSafeToBeControlled_bl = true;
					_s.isPlaying_bl = true;
					_s.hasHours_bl = Math.floor(_s.ytb.getDuration() / (60 * 60)) > 0;
					_s.setVolume(prt.volume);
					_s.startToUpdate();
					_s.startToPreload();
					_s.scrub(0.00001);
					if(!_s.isMbl) _s.setQuality(_s.lastQuality_str);
					
					if(_s.ytb.getAvailableQualityLevels() && _s.ytb.getAvailableQualityLevels().length != 0){
						_s.dispatchEvent(FWDUVPYoutubeScreen.QUALITY_CHANGE, {qualityLevel:_s.ytb.getPlaybackQuality(), levels:_s.ytb.getAvailableQualityLevels()});
					}
					_s.startToUpdateSubtitles();
				    _s.dispatchEvent(FWDUVPYoutubeScreen.SAFE_TO_SCRUBB);
				}

				_s.resizeAndPosition();
				if(_s.isPausedInEvent_bl) _s.dispatchEvent(FWDUVPYoutubeScreen.PLAY);
				_s.isPausedInEvent_bl = false;
				_s.hasError_bl = false;
				
			}else if(e.data == YT.PlayerState.PAUSED){
				if(!_s.isSafeToBeControlled_bl) return;
				_s.isStopped_bl = false;
				if(!_s.isPausedInEvent_bl) _s.dispatchEvent(FWDUVPYoutubeScreen.PAUSE);
				_s.isPausedInEvent_bl = true;
			}else if(e.data == YT.PlayerState.ENDED){
				if(_s.ytb.getCurrentTime() && _s.ytb.getCurrentTime() > 0){
					_s.isStopped_bl = false;
					_s.stopToUpdateSubtitles();
					setTimeout(function(){_s.dispatchEvent(FWDUVPYoutubeScreen.PLAY_COMPLETE);}, 100);
				}
			}else if(e.data == YT.PlayerState.CUED){
				if(!_s.isStopped_bl){
					_s.dispatchEvent(FWDUVPYoutubeScreen.CUED);
				}
				_s.isCued_bl = true;
				
				if(!_s.stopp){

					if(prt._d.autoPlay_bl || prt.isThumbClick_bl){
			
						if(prt.isThumbClick_bl){
							 prt.play();
						}

						if(prt._d.autoPlay_bl){
							if(prt.controller_do) prt.controller_do.updateVolume(0);
							if(prt.displayType != FWDUVPlayer.LIGHTBOX || prt.lightBox_do.isShowed_bl){
								prt.play();
							} 
						}
					}else{
						prt.videoPoster_do.show();
						if(prt.lrgPlayBtn) prt.lrgPlayBtn.show();
					}

					if(!_s.isMbl && prt.isAdd_bl && !prt.loadAddFirstTime_bl){
						prt.play();
						prt.videoPoster_do.hide(true);
					}
				}

				_s.resizeAndPosition();
			}
		};
		
		_s.qualityChangeHandler = function(e){
			if(_s.ytb.getAvailableQualityLevels() && _s.ytb.getAvailableQualityLevels().length != 0){
				_s.dispatchEvent(FWDUVPYoutubeScreen.QUALITY_CHANGE, {qualityLevel:_s.ytb.getPlaybackQuality()});
			}
		};
		
		_s.playerErrorHandler = function(e){
			_s.isPausedInEvent_bl = true;
			if(_s.isStopped_bl || _s.hasError_bl) return;
		
			var error_str = "";
			_s.hasError_bl = true;
			if(e.data == 2){
				error_str = "The youtube id is not well formatted, make sure it has exactly 11 characters and that it dosn't contain invalid characters such as exclamation points or asterisks.";
			}else if(e.data == 5){
				error_str = "The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.";
			}else if(e.data == 100){
				error_str = "The youtube video request was not found, probably the video ID is incorrect.";
			}else if(e.data == 101 || e.data == 150){
				error_str = "The owner of the requested video does not allow it to be played in embedded players.";
			}
			_s.dispatchEvent(FWDUVPYoutubeScreen.ERROR, {text:error_str});
		};
		

		//##############################################//
		/* Resize and position */
		//##############################################//
		_s.resizeAndPosition = function(){
			_s.setWidth(prt.tempVidStageWidth);
			

			if(prt._d.showYoutubeRelAndInfo_bl){
				_s.setHeight(prt.tempVidStageHeight + 2);
				_s.setY(-1);
			}else{
				// if(!_s.isSafeToBeControlled_bl){
				// 	_s.setHeight(prt.tempVidStageHeight);
				// 	_s.setY(0);
				// }else{
					
					_s.setHeight(1.776 * prt.tempVidStageHeight);
					
					_s.setY((prt.tempVidStageHeight - (1.776 * prt.tempVidStageHeight))/2);
				//}
			}
		};
		

		//##############################################//
		/* Set path */
		//##############################################//
		_s.setSource = function(sourcePath){
			if(sourcePath) _s.sourcePath_str = sourcePath;
			_s.stopp = false;

			clearInterval(_s.setSourceId_int);
			_s.setSourceId_int = setInterval(function(){
				if(_s.ytb.cueVideoById && _s.ytb.setPlaybackRate){
					_s.ytb.cueVideoById(_s.sourcePath_str);

					if(!prt._d.autoPlay_bl){
						setTimeout(function(){
						//	prt.videoPoster_do.hide();
						//	prt.lrgPlayBtn.hide();
						}, 100);
					}
					clearInterval(_s.setSourceId_int);
				}
			},50);
		};
	

		//##########################################//
		/* Play / pause / stop methods */
		//##########################################//
		_s.play = function(overwrite){
			FWDUVPlayer.curInstance = prt;
			_s.isPlaying_bl = true;
			_s.hasError_bl = false;
			_s.hasStarted_bl = true;

			try{
				_s.ytb.playVideo();
				_s.startToUpdate();
			}catch(e){}

			_s.isStopped_bl = false;
		};

		_s.pause = function(){
			if(_s.isStopped_bl || _s.hasError_bl) return;
			_s.isPlaying_bl = false;
			try{
				_s.ytb.pauseVideo();
			}catch(e){}
			_s.stopToUpdate();
		};
		
		_s.togglePlayPause = function(){
			if(_s.isPlaying_bl){
				_s.pause();
			}else{
				_s.play();
			}
		};
		
		_s.resume = function(){
			if(_s.isStopped_bl) return;
			_s.play();
		};
		

		//###########################################//
		/* Updates. */
		//###########################################//
		_s.startToUpdate = function(){
			clearInterval(_s.updateVideoId_int);
			_s.updateVideoId_int = setInterval(_s.updateVideo, 500);
		};
		
		_s.stopToUpdate = function(){
			clearInterval(_s.updateVideoId_int);
		};
		
		_s.updateVideo = function(){
			var percentPlayed; 
			if(!_s.ytb){
				stopToUpdate();
				return;
			}
			if (!_s.allowScrubing_bl) {
				percentPlayed = _s.ytb.getCurrentTime() /_s.ytb.getDuration();
				_s.dispatchEvent(FWDUVPYoutubeScreen.UPDATE, {percent:percentPlayed});
			}
			
			var totalTime = FWDUVPUtils.formatTime(_s.ytb.getDuration());
			var curTime = FWDUVPUtils.formatTime(_s.ytb.getCurrentTime());
			
			_s.dispatchEvent(FWDUVPYoutubeScreen.UPDATE_TIME, {curTime:curTime , totalTime:totalTime, seconds:_s.ytb.getCurrentTime(), totalTimeInSeconds:_s.ytb.getDuration()});
		};
		
		_s.startToPreload = function(){
			clearInterval(_s.preloadVideoId_int);
			_s.updatePreloadId_int = setInterval(_s.updateProgress, 500);
		};
		
		_s.stopToPreload = function(){
			clearInterval(_s.updatePreloadId_int);
		};
		
		_s.updateProgress = function(){
			if(!_s.ytb){
				stopToPreload();
				return;
			}
			var buffered;
			var percentLoaded = _s.ytb.getVideoLoadedFraction();
			
			_s.dispatchEvent(FWDUVPYoutubeScreen.LOAD_PROGRESS, {percent:percentLoaded});
		};
		

		//###########################################//
		/* Event handlers */
		//###########################################//	
		_s.stop = function(){
			if(_s.isStopped_bl) return;
			_s.isPlaying_bl = false;
			_s.isStopped_bl = true;
			_s.hasStarted_bl = false;
			_s.isCued_bl = false;
			clearInterval(_s.setSourceId_int);
			_s.allowScrubing_bl = false;
			_s.isSafeToBeControlled_bl = false;
			_s.isQualityArrayDisapatched_bl = false;
			_s.isPausedInEvent_bl = true;
			_s.stopToUpdateSubtitles();
			_s.stopToUpdate();
			_s.stopToPreload();
			_s.stopVideo();
			_s.dispatchEvent(FWDUVPYoutubeScreen.STOP);
			_s.dispatchEvent(FWDUVPYoutubeScreen.LOAD_PROGRESS, {percent:0});
		};
		
		_s.destroyYoutube = function(){
			if(_s.videoHolder_do){
				_s.videoHolder_do.screen.removeAttribute("id", prt.instanceName_str + "youtube");
				_s.videoHolder_do.destroy();
				_s.videoHolder_do = null;
			}
			if(_s.ytb) _s.ytb.destroy();
			_s.ytb = null;
		};
		
		_s.stopVideo = function(){
			
			if(_s.stopp) return;
			_s.stopp = true;
			_s.ytb.cueVideoById(_s.sourcePath_str);
		};
		
		_s.setPlaybackRate = function(rate){
			if(!_s.ytb || _s.isMbl) return;
			if(rate) _s.rate = rate;
			if(_s.ytb.setPlaybackRate){
				_s.ytb.setPlaybackRate(Number(_s.rate));
			}
		};
		
		//##################################################//
		/* Subtitles */
		//##################################################//
		_s.stopToUpdateSubtitles = function(){
			clearInterval(_s.startToUpdateSubtitleId_int);	
		}
		
		_s.startToUpdateSubtitles = function(){
			clearInterval(_s.startToUpdateSubtitleId_int);
			_s.startToUpdateSubtitleId_int = setInterval(_s.updateSubtitleHandler, 10);
		}
		
		_s.updateSubtitleHandler = function(){
			_s.dispatchEvent(FWDUVPYoutubeScreen.UPDATE_SUBTITLE, {curTime:_s.ytb.getCurrentTime()});
		}


		//###############################################//
		/* Scrub */
		//###############################################//
		_s.startToScrub = function(){
			if(!_s.isSafeToBeControlled_bl) return;
			_s.allowScrubing_bl = true;
		};
		
		_s.stopToScrub = function(){
			if(!_s.isSafeToBeControlled_bl) return;
			_s.allowScrubing_bl = false;
		};
		
		_s.scrubbAtTime = function(duration){
			if(!_s.isSafeToBeControlled_bl) return;
			_s.ytb.seekTo(duration);
		}
		
		_s.scrub = function(percent){
			if(!_s.isSafeToBeControlled_bl) return;
			_s.ytb.seekTo(percent * _s.ytb.getDuration());
		};
	

		//###############################################//
		/* Volume */
		//###############################################//
		_s.setVolume = function(vol){
			if(vol != undefined) _s.volume = vol;
			if(_s.ytb && _s.ytb.setVolume){
				_s.ytb.setVolume(vol * 100);
				if(vol) _s.ytb.unMute();
			}
		};
		

		//###############################################//
		/* set quality */
		//###############################################//
		_s.setQuality = function(quality){
			_s.lastQuality_str = quality;
			_s.ytb.setPlaybackQuality(quality);
		};
	
		_s.init();
	};


	/* set prototype */
	FWDUVPYoutubeScreen.setPrototype = function(){
		FWDUVPYoutubeScreen.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPYoutubeScreen.UPDATE_SUBTITLE = "updateSubtitle";
	FWDUVPYoutubeScreen.READY = "ready";
	FWDUVPYoutubeScreen.ERROR = "error";
	FWDUVPYoutubeScreen.UPDATE = "update";
	FWDUVPYoutubeScreen.UPDATE_TIME = "updateTime";
	FWDUVPYoutubeScreen.SAFE_TO_SCRUBB = "safeToControll";
	FWDUVPYoutubeScreen.LOAD_PROGRESS = "loadProgress";
	FWDUVPYoutubeScreen.PLAY = "play";
	FWDUVPYoutubeScreen.PAUSE = "pause";
	FWDUVPYoutubeScreen.STOP = "stop";
	FWDUVPYoutubeScreen.PLAY_COMPLETE = "playComplete";
	FWDUVPYoutubeScreen.CUED = "cued";
	FWDUVPYoutubeScreen.QUALITY_CHANGE = "qualityChange";


	window.FWDUVPYoutubeScreen = FWDUVPYoutubeScreen;

}(window));/**
 * Ultimate Video Player PACKAGED v9.1
 * Youtube quality button.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
(function (){
var FWDUVPYTBQButton = function(
			label,
			nBC,
			sBC,
			hdPath,
			id
		){

		'use strict';
		
		var _s = this;
		var prototype = FWDUVPYTBQButton.prototype;
	
		_s.label_str = label;
		_s.nBC = nBC;
		_s.sBC = sBC;
		_s.hdPath_str = hdPath;

		_s.id = id;
		_s.totalWidth = 0;
		_s.totalHeight = 23;
		_s.hdWidth = 7;
		_s.hdHeight = 5;

		_s.hasHd_bl = _s.hdPath_str
		_s.isMbl = FWDUVPUtils.isMobile;
		_s.isDisabled_bl = false;

		
		//##########################################//
		/* initialize */
		//##########################################//
		_s.init = function(){
			_s.setBackfaceVisibility();
			_s.setupMainContainers();
			_s.setHeight(_s.totalHeight);
		};
		

		//##########################################//
		/* setup main containers */
		//##########################################//
		_s.setupMainContainers = function(){
			_s.text_do = new FWDUVPDisplayObject("div");
			_s.text_do.setBackfaceVisibility();
			_s.text_do.hasTransform3d_bl = false;
			_s.text_do.hasTransform2d_bl = false;
			_s.text_do.getStyle().display = "inline-block";
			_s.text_do.getStyle().whiteSpace = "nowrap";
			_s.text_do.getStyle().fontFamily = "Arial";
			_s.text_do.getStyle().fontSize= "12px";
			_s.text_do.getStyle().color = _s.nBC;
			_s.text_do.setInnerHTML(_s.label_str);
			_s.addChild(_s.text_do);
			
			if(_s.hasHd_bl){
				var img = new Image();
				
				img.src = _s.hdPath_str;
				_s.hd_do = new FWDUVPDisplayObject("img");
				_s.hd_do.setScreen(img);
				_s.hd_do.setWidth(_s.hdWidth);
				_s.hd_do.setHeight(_s.hdHeight);
				_s.addChild(_s.hd_do);
			}
				
			_s.dumy_do = new FWDUVPDisplayObject("div");
			if(FWDUVPUtils.isIE){
				_s.dumy_do.setBkColor("#FF0000");
				_s.dumy_do.setAlpha(0.0001);
			};
			
			_s.dumy_do.setButtonMode(true);
			_s.dumy_do.setHeight(_s.totalHeight);
			_s.addChild(_s.dumy_do);
			
			if(_s.hasPointerEvent_bl){
				_s.screen.addEventListener("pointerup", _s.onMouseUp);
				_s.screen.addEventListener("pointerover", _s.onMouseOver);
				_s.screen.addEventListener("pointerout", _s.onMouseOut);
			}else if(_s.screen.addEventListener){	
				if(!_s.isMbl){
					_s.screen.addEventListener("mouseover", _s.onMouseOver);
					_s.screen.addEventListener("mouseout", _s.onMouseOut);
					_s.screen.addEventListener("mouseup", _s.onMouseUp);
				}
				_s.screen.addEventListener("touchend", _s.onMouseUp);
			}
		};
		
		_s.onMouseOver = function(e){
			if(_s.isDisabled_bl) return;
			_s.setSelectedState(true);
			_s.dispatchEvent(FWDUVPYTBQButton.MOUSE_OVER, {e:e, id:_s.id});
		};
			
		_s.onMouseOut = function(e){
			if(_s.isDisabled_bl) return;
			_s.setNormalState(true);
			_s.dispatchEvent(FWDUVPYTBQButton.MOUSE_OUT, {e:e, id:_s.id});
		};
		
		_s.onMouseUp = function(e){
			if(_s.isDisabled_bl || e.button == 2) return;
			if(e.preventDefault) e.preventDefault();
			_s.dispatchEvent(FWDUVPYTBQButton.CLICK, {e:e, id:_s.id});
		};
	

		//###############################//
		/* set final size */
		//###############################//
		_s.setFinalSize = function(){
			var width = _s.text_do.getWidth() + 34;
			var height = _s.text_do.getHeight();
		
			_s.text_do.setX(18);
			_s.text_do.setY(parseInt((_s.totalHeight - height)/2));
			
			if(_s.hd_do){
				_s.hd_do.setX(width - 12);
				_s.hd_do.setY(_s.text_do.y + 1);
			}
			
			_s.dumy_do.setWidth(width);
			_s.setWidth(width);
		}
		
		_s.updateText = function(label){
			_s.label_str = label;
			_s.text_do.setInnerHTML(_s.label_str);
			
			if(_s.hd_do){
				if(_s.label_str == "highres" || _s.label_str == "hd1080" || _s.label_str == "hd720" || _s.label_str == "hd1440" || _s.label_str == "hd2160"){
					_s.hd_do.setVisible(true);
				}else{
					_s.hd_do.setVisible(false);
				}
			}
		};
		

		//################################//
		/* Set states */
		//###############################//
		_s.setSelectedState = function(animate){
			_s.isSelected_bl = true;
			FWDAnimation.killTweensOf(_s.text_do);
			if(animate){
				FWDAnimation.to(_s.text_do.screen, .5, {css:{color:_s.sBC}, ease:Expo.easeOut});
			}else{
				_s.text_do.getStyle().color = _s.sBC;
			}
		};
		
		_s.setNormalState = function(animate){
			_s.isSelected_bl = false;
			FWDAnimation.killTweensOf(_s.text_do);
			if(animate){
				FWDAnimation.to(_s.text_do.screen, .5, {css:{color:_s.nBC}, ease:Expo.easeOut});
			}else{
				_s.text_do.getStyle().color = _s.nBC;
			}
		};
		

		//##############################//
		/* disable /enable button */
		//##############################//
		_s.disable = function(){
			_s.isDisabled_bl = true;
			FWDAnimation.killTweensOf(_s.text_do);
			_s.setSelectedState(true);
			_s.dumy_do.setButtonMode(false);
		};
		
		_s.enable = function(){
			_s.isDisabled_bl = false;
			FWDAnimation.killTweensOf(_s.text_do);
			_s.setNormalState(true);
			_s.dumy_do.setButtonMode(true);
		};
		

		_s.init();
	};
	
	
	/* set prototype */
	FWDUVPYTBQButton.setPrototype = function(){
		FWDUVPYTBQButton.prototype = new FWDUVPDisplayObject("div");
	};
	
	FWDUVPYTBQButton.MOUSE_OVER = "onMouseOver";
	FWDUVPYTBQButton.MOUSE_OUT = "onMouseOut";
	FWDUVPYTBQButton.CLICK = "onClick";
	
	FWDUVPYTBQButton.prototype = null;
	window.FWDUVPYTBQButton = FWDUVPYTBQButton;
}(window));// FWDAnimation classs, not allowed to modify or use outside this plugin!
var _fwd_fwdScope;window.FWDAnimation||(((_fwd_fwdScope="undefined"!=typeof fwd_module&&fwd_module.exports&&"undefined"!=typeof fwd_global?fwd_global:this||window)._fwd_fwdQueue||(_fwd_fwdScope._fwd_fwdQueue=[])).push(function(){"use strict";function y(t,e,i,r){i===r&&(i=r-(r-e)/1e6),t===e&&(e=t+(i-t)/1e6),this.a=t,this.b=e,this.c=i,this.d=r,this.da=r-t,this.ca=i-t,this.ba=e-t}function w(t,e,i,r){var s={a:t},n={},a={},o={c:r},l=(t+e)/2,h=(e+i)/2,f=(i+r)/2,u=(l+h)/2,p=(h+f)/2,_=(p-u)/8;return s.b=l+(t-l)/4,n.b=u+_,s.c=n.a=(s.b+n.b)/2,n.c=a.a=(u+p)/2,a.b=p-_,o.b=f+(r-f)/4,a.c=o.a=(a.b+o.b)/2,[s,n,a,o]}function _(t,e,i,r,s,n){var a,o,l,h,f,u,p,_,c={},d=[],m=n||t[0];for(o in s="string"==typeof s?","+s+",":",x,y,z,left,top,right,bottom,marginTop,marginLeft,marginRight,marginBottom,paddingLeft,paddingTop,paddingRight,paddingBottom,backgroundPosition,backgroundPosition_y,",null==e&&(e=1),t[0])d.push(o);if(1<t.length){for(_=t[t.length-1],p=!0,a=d.length;-1<--a;)if(o=d[a],.05<Math.abs(m[o]-_[o])){p=!1;break}p&&(t=t.concat(),n&&t.unshift(n),t.push(t[1]),n=t[t.length-3])}for(T.length=P.length=O.length=0,a=d.length;-1<--a;)o=d[a],g[o]=-1!==s.indexOf(","+o+","),c[o]=function(t,e,i,r){var s,n,a,o,l,h,f=[];if(r)for(n=(t=[r].concat(t)).length;-1<--n;)"string"==typeof(h=t[n][e])&&"="===h.charAt(1)&&(t[n][e]=r[e]+Number(h.charAt(0)+h.substr(2)));if((s=t.length-2)<0)return f[0]=new y(t[0][e],0,0,t[s<-1?0:1][e]),f;for(n=0;n<s;n++)a=t[n][e],o=t[n+1][e],f[n]=new y(a,0,0,o),i&&(l=t[n+2][e],T[n]=(T[n]||0)+(o-a)*(o-a),P[n]=(P[n]||0)+(l-o)*(l-o));return f[n]=new y(t[n][e],0,0,t[n+1][e]),f}(t,o,g[o],n);for(a=T.length;-1<--a;)T[a]=Math.sqrt(T[a]),P[a]=Math.sqrt(P[a]);if(!r){for(a=d.length;-1<--a;)if(g[o])for(u=(l=c[d[a]]).length-1,h=0;h<u;h++)f=l[h+1].da/P[h]+l[h].da/T[h]||0,O[h]=(O[h]||0)+f*f;for(a=O.length;-1<--a;)O[a]=Math.sqrt(O[a])}for(a=d.length,h=i?4:1;-1<--a;)(function(t,e,i,r,s){for(var n,a,o,l,h,f,u,p,_,c,d,m,g=t.length-1,y=0,v=t[0].a,x=0;x<g;x++)n=(l=t[y]).a,a=l.d,o=t[y+1].d,u=s?(c=T[x],m=((d=P[x])+c)*e*.25/(!r&&O[x]||.5),a-((h=a-(a-n)*(r?.5*e:0!==c?m/c:0))+(((f=a+(o-a)*(r?.5*e:0!==d?m/d:0))-h)*(3*c/(c+d)+.5)/4||0))):a-((h=a-(a-n)*e*.5)+(f=a+(o-a)*e*.5))/2,h+=u,f+=u,l.c=p=h,l.b=0!==x?v:v=l.a+.6*(l.c-l.a),l.da=a-n,l.ca=p-n,l.ba=v-n,i?(_=w(n,v,p,a),t.splice(y,1,_[0],_[1],_[2],_[3]),y+=4):y++,v=f;(l=t[y]).b=v,l.c=v+.4*(l.d-v),l.da=l.d-l.a,l.ca=l.c-l.a,l.ba=v-l.a,i&&(_=w(l.a,v,l.c,l.d),t.splice(y,1,_[0],_[1],_[2],_[3]))})(l=c[o=d[a]],e,i,r,g[o]),p&&(l.splice(0,h),l.splice(l.length-h,h));return c}var b,T,P,O,g,i,m,t;_fwd_fwdScope.FWDFWD_fwdDefine("FWDAnimation",["core.FWDAnimation","core.FWDSimpleTimeline","FWDTweenLite"],function(m,f,g){function y(t){for(var e=[],i=t.length,r=0;r!==i;e.push(t[r++]));return e}function v(t,e,i){var r,s,n=t.cycle;for(r in n)s=n[r],t[r]="function"==typeof s?s(i,e[i]):s[i%s.length];delete t.cycle}var m=function(t,e,i){g.call(this,t,e,i),this._cycle=0,this._yoyo=!0===this.vars.yoyo,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._dirty=!0,this.render=m.prototype.render},x=1e-10,w=g._internals,T=w.isSelector,b=w.isArray,t=m.prototype=g.to({},.1,{}),P=[];m.version="1.19.0",t.constructor=m,t.kill()._gc=!1,m.killTweensOf=m.killDelayedCallsTo=g.killTweensOf,m.getTweensOf=g.getTweensOf,m.lagSmoothing=g.lagSmoothing,m.ticker=g.ticker,m.render=g.render,t.invalidate=function(){return this._yoyo=!0===this.vars.yoyo,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._uncache(!0),g.prototype.invalidate.call(this)},t.updateTo=function(t,e){var i,r=this.ratio,s=this.vars.immediateRender||t.immediateRender;for(i in e&&this._startTime<this._timeline._time&&(this._startTime=this._timeline._time,this._uncache(!1),this._gc?this._enabled(!0,!1):this._timeline.insert(this,this._startTime-this._delay)),t)this.vars[i]=t[i];if(this._initted||s)if(e)this._initted=!1,s&&this.render(0,!0,!0);else if(this._gc&&this._enabled(!0,!1),this._notifyPluginsOfEnabled&&this._firstPT&&g._onPluginEvent("_onDisable",this),.998<this._time/this._duration){var n=this._totalTime;this.render(0,!0,!1),this._initted=!1,this.render(n,!0,!1)}else if(this._initted=!1,this._init(),0<this._time||s)for(var a,o=1/(1-r),l=this._firstPT;l;)a=l.s+l.c,l.c*=o,l.s=a-l.c,l=l._next;return this},t.render=function(t,e,i){this._initted||0===this._duration&&this.vars.repeat&&this.invalidate();var r,s,n,a,o,l,h,f,u,p=this._dirty?this.totalDuration():this._totalDuration,_=this._time,c=this._totalTime,d=this._cycle,m=this._duration,g=this._rawPrevTime;if(p-1e-7<=t?(this._totalTime=p,this._cycle=this._repeat,this._yoyo&&0!=(1&this._cycle)?(this._time=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0):(this._time=m,this.ratio=this._ease._calcEnd?this._ease.getRatio(1):1),this._reversed||(r=!0,s="onComplete",i=i||this._timeline.autoRemoveChildren),0===m&&(!this._initted&&this.vars.lazy&&!i||(this._startTime===this._timeline._duration&&(t=0),(g<0||t<=0&&-1e-7<=t||g===x&&"isPause"!==this.data)&&g!==t&&(i=!0,x<g&&(s="onReverseComplete")),this._rawPrevTime=f=!e||t||g===t?t:x))):t<1e-7?(this._totalTime=this._time=this._cycle=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0,(0!==c||0===m&&0<g)&&(s="onReverseComplete",r=this._reversed),t<0&&(this._active=!1,0===m&&(!this._initted&&this.vars.lazy&&!i||(0<=g&&(i=!0),this._rawPrevTime=f=!e||t||g===t?t:x))),this._initted||(i=!0)):(this._totalTime=this._time=t,0!==this._repeat&&(a=m+this._repeatDelay,this._cycle=this._totalTime/a>>0,0!==this._cycle&&this._cycle===this._totalTime/a&&c<=t&&this._cycle--,this._time=this._totalTime-this._cycle*a,this._yoyo&&0!=(1&this._cycle)&&(this._time=m-this._time),this._time>m?this._time=m:this._time<0&&(this._time=0)),this._easeType?(o=this._time/m,(1===(l=this._easeType)||3===l&&.5<=o)&&(o=1-o),3===l&&(o*=2),1===(h=this._easePower)?o*=o:2===h?o*=o*o:3===h?o*=o*o*o:4===h&&(o*=o*o*o*o),1===l?this.ratio=1-o:2===l?this.ratio=o:this._time/m<.5?this.ratio=o/2:this.ratio=1-o/2):this.ratio=this._ease.getRatio(this._time/m)),_!==this._time||i||d!==this._cycle){if(!this._initted){if(this._init(),!this._initted||this._gc)return;if(!i&&this._firstPT&&(!1!==this.vars.lazy&&this._duration||this.vars.lazy&&!this._duration))return this._time=_,this._totalTime=c,this._rawPrevTime=g,this._cycle=d,w.lazyTweens.push(this),void(this._lazy=[t,e]);this._time&&!r?this.ratio=this._ease.getRatio(this._time/m):r&&this._ease._calcEnd&&(this.ratio=this._ease.getRatio(0===this._time?0:1))}for(!1!==this._lazy&&(this._lazy=!1),this._active||!this._paused&&this._time!==_&&0<=t&&(this._active=!0),0===c&&(2===this._initted&&0<t&&this._init(),this._startAt&&(0<=t?this._startAt.render(t,e,i):s=s||"_dummyGS"),this.vars.onStart&&(0===this._totalTime&&0!==m||e||this._callback("onStart"))),n=this._firstPT;n;){n.f?n.t[n.p](n.c*this.ratio+n.s):(u=n.c*this.ratio+n.s,"x"==n.p?n.t.setX(u):"y"==n.p?n.t.setY(u):"z"==n.p?n.t.setZ(u):"angleX"==n.p?n.t.setAngleX(u):"angleY"==n.p?n.t.setAngleY(u):"angleZ"==n.p?n.t.setAngleZ(u):"w"==n.p?n.t.setWidth(u):"h"==n.p?n.t.setHeight(u):"alpha"==n.p?n.t.setAlpha(u):"scale"==n.p?n.t.setScale2(u):n.t[n.p]=u),n=n._next}this._onUpdate&&(t<0&&this._startAt&&this._startTime&&this._startAt.render(t,e,i),e||this._totalTime===c&&!s||this._callback("onUpdate")),this._cycle!==d&&(e||this._gc||this.vars.onRepeat&&this._callback("onRepeat")),s&&(this._gc&&!i||(t<0&&this._startAt&&!this._onUpdate&&this._startTime&&this._startAt.render(t,e,i),r&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!e&&this.vars[s]&&this._callback(s),0===m&&this._rawPrevTime===x&&f!==x&&(this._rawPrevTime=0)))}else c!==this._totalTime&&this._onUpdate&&(e||this._callback("onUpdate"))},m.to=function(t,e,i){return new m(t,e,i)},m.from=function(t,e,i){return i.runBackwards=!0,i.immediateRender=0!=i.immediateRender,new m(t,e,i)},m.fromTo=function(t,e,i,r){return r.startAt=i,r.immediateRender=0!=r.immediateRender&&0!=i.immediateRender,new m(t,e,r)},m.staggerTo=m.allTo=function(t,e,i,r,s,n,a){r=r||0;function o(){i.onComplete&&i.onComplete.apply(i.onCompleteScope||this,arguments),s.apply(a||i.callbackScope||this,n||P)}var l,h,f,u,p=0,_=[],c=i.cycle,d=i.startAt&&i.startAt.cycle;for(b(t)||("string"==typeof t&&(t=g.selector(t)||t),T(t)&&(t=y(t))),t=t||[],r<0&&((t=y(t)).reverse(),r*=-1),l=t.length-1,f=0;f<=l;f++){for(u in h={},i)h[u]=i[u];if(c&&(v(h,t,f),null!=h.duration&&(e=h.duration,delete h.duration)),d){for(u in d=h.startAt={},i.startAt)d[u]=i.startAt[u];v(h.startAt,t,f)}h.delay=p+(h.delay||0),f===l&&s&&(h.onComplete=o),_[f]=new m(t[f],e,h),p+=r}return _},m.staggerFrom=m.allFrom=function(t,e,i,r,s,n,a){return i.runBackwards=!0,i.immediateRender=0!=i.immediateRender,m.staggerTo(t,e,i,r,s,n,a)},m.staggerFromTo=m.allFromTo=function(t,e,i,r,s,n,a,o){return r.startAt=i,r.immediateRender=0!=r.immediateRender&&0!=i.immediateRender,m.staggerTo(t,e,r,s,n,a,o)},m.delayedCall=function(t,e,i,r,s){return new m(e,0,{delay:t,onComplete:e,onCompleteParams:i,callbackScope:r,onReverseComplete:e,onReverseCompleteParams:i,immediateRender:!1,useFrames:s,overwrite:0})},m.set=function(t,e){return new m(t,0,e)},m.isTweening=function(t){return 0<g.getTweensOf(t,!0).length};var n=function(t,e){for(var i=[],r=0,s=t._first;s;)s instanceof g?i[r++]=s:(e&&(i[r++]=s),r=(i=i.concat(n(s,e))).length),s=s._next;return i},u=m.getAllTweens=function(t){return n(m._rootTimeline,t).concat(n(m._rootFramesTimeline,t))};m.killAll=function(t,e,i,r){null==e&&(e=!0),null==i&&(i=!0);for(var s,n,a=u(0!=r),o=a.length,l=e&&i&&r,h=0;h<o;h++)n=a[h],(l||n instanceof f||(s=n.target===n.vars.onComplete)&&i||e&&!s)&&(t?n.totalTime(n._reversed?0:n.totalDuration()):n._enabled(!1,!1))},m.killChildTweensOf=function(t,e){if(null!=t){var i,r,s,n,a,o=w.tweenLookup;if("string"==typeof t&&(t=g.selector(t)||t),T(t)&&(t=y(t)),b(t))for(n=t.length;-1<--n;)m.killChildTweensOf(t[n],e);else{for(s in i=[],o)for(r=o[s].target.parentNode;r;)r===t&&(i=i.concat(o[s].tweens)),r=r.parentNode;for(a=i.length,n=0;n<a;n++)e&&i[n].totalTime(i[n].totalDuration()),i[n]._enabled(!1,!1)}}};function r(t,e,i,r){e=!1!==e,i=!1!==i;for(var s,n,a=u(r=!1!==r),o=e&&i&&r,l=a.length;-1<--l;)n=a[l],(o||n instanceof f||(s=n.target===n.vars.onComplete)&&i||e&&!s)&&n.paused(t)}return m.pauseAll=function(t,e,i){r(!0,t,e,i)},m.resumeAll=function(t,e,i){r(!1,t,e,i)},m.globalTimeScale=function(t){var e=m._rootTimeline,i=g.ticker.time;return arguments.length?(t=t||x,e._startTime=i-(i-e._startTime)*e._timeScale/t,e=m._rootFramesTimeline,i=g.ticker.frame,e._startTime=i-(i-e._startTime)*e._timeScale/t,e._timeScale=m._rootTimeline._timeScale=t):e._timeScale},t.progress=function(t,e){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&0!=(1&this._cycle)?1-t:t)+this._cycle*(this._duration+this._repeatDelay),e):this._time/this.duration()},t.totalProgress=function(t,e){return arguments.length?this.totalTime(this.totalDuration()*t,e):this._totalTime/this.totalDuration()},t.time=function(t,e){return arguments.length?(this._dirty&&this.totalDuration(),t>this._duration&&(t=this._duration),this._yoyo&&0!=(1&this._cycle)?t=this._duration-t+this._cycle*(this._duration+this._repeatDelay):0!==this._repeat&&(t+=this._cycle*(this._duration+this._repeatDelay)),this.totalTime(t,e)):this._time},t.duration=function(t){return arguments.length?m.prototype.duration.call(this,t):this._duration},t.totalDuration=function(t){return arguments.length?-1===this._repeat?this:this.duration((t-this._repeat*this._repeatDelay)/(this._repeat+1)):(this._dirty&&(this._totalDuration=-1===this._repeat?999999999999:this._duration*(this._repeat+1)+this._repeatDelay*this._repeat,this._dirty=!1),this._totalDuration)},t.repeat=function(t){return arguments.length?(this._repeat=t,this._uncache(!0)):this._repeat},t.repeatDelay=function(t){return arguments.length?(this._repeatDelay=t,this._uncache(!0)):this._repeatDelay},t.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},m},!0),b=180/Math.PI,T=[],P=[],O=[],g={},i=_fwd_fwdScope.FWDFWD_fwdDefine.globals,m=_fwd_fwdScope.FWDFWD_fwdDefine.plugin({propName:"bezier",priority:-1,version:"1.3.7",API:2,fwd_global:!0,init:function(t,e,i){this._target=t,e instanceof Array&&(e={values:e}),this._func={},this._mod={},this._props=[],this._timeRes=null==e.timeResolution?6:parseInt(e.timeResolution,10);var r,s,n,a,o,l,h=e.values||[],f={},u=h[0],p=e.autoRotate||i.vars.orientToBezier;for(r in this._autoRotate=p?p instanceof Array?p:[["x","y","rotation",!0!==p&&Number(p)||0]]:null,u)this._props.push(r);for(n=this._props.length;-1<--n;)r=this._props[n],this._overwriteProps.push(r),s=this._func[r]="function"==typeof t[r],f[r]=s?t[r.indexOf("set")||"function"!=typeof t["get"+r.substr(3)]?r:"get"+r.substr(3)]():parseFloat(t[r]),o||f[r]!==h[0][r]&&(o=f);if(this._beziers="cubic"!==e.type&&"quadratic"!==e.type&&"soft"!==e.type?_(h,isNaN(e.curviness)?1:e.curviness,!1,"thruBasic"===e.type,e.correlate,o):function(t,e,i){var r,s,n,a,o,l,h,f,u,p,_,c={},d="cubic"===(e=e||"soft")?3:2,m="soft"===e,g=[];if(m&&i&&(t=[i].concat(t)),null==t||t.length<1+d)throw"invalid Bezier data";for(u in t[0])g.push(u);for(l=g.length;-1<--l;){for(c[u=g[l]]=o=[],p=0,f=t.length,h=0;h<f;h++)r=null==i?t[h][u]:"string"==typeof(_=t[h][u])&&"="===_.charAt(1)?i[u]+Number(_.charAt(0)+_.substr(2)):Number(_),m&&1<h&&h<f-1&&(o[p++]=(r+o[p-2])/2),o[p++]=r;for(f=p-d+1,h=p=0;h<f;h+=d)r=o[h],s=o[h+1],n=o[h+2],a=2==d?0:o[h+3],o[p++]=_=3==d?new y(r,s,n,a):new y(r,(2*s+r)/3,(2*s+n)/3,n);o.length=p}return c}(h,e.type,f),this._segCount=this._beziers[r].length,this._timeRes&&(l=function(t,e){var i,r,s,n,a=[],o=[],l=0,h=0,f=(e=e>>0||6)-1,u=[],p=[];for(i in t)!function(t,e,i){for(var r,s,n,a,o,l,h,f,u,p,_,c=1/i,d=t.length;-1<--d;)for(n=(p=t[d]).a,a=p.d-n,o=p.c-n,l=p.b-n,r=s=0,f=1;f<=i;f++)r=s-(s=((h=c*f)*h*a+3*(u=1-h)*(h*o+u*l))*h),e[_=d*i+f-1]=(e[_]||0)+r*r}(t[i],a,e);for(s=a.length,r=0;r<s;r++)l+=Math.sqrt(a[r]),p[n=r%e]=l,n===f&&(h+=l,u[n=r/e>>0]=p,o[n]=h,l=0,p=[]);return{length:h,lengths:o,segments:u}}(this._beziers,this._timeRes),this._length=l.length,this._lengths=l.lengths,this._segments=l.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length),p=this._autoRotate)for(this._initialRotations=[],p[0]instanceof Array||(this._autoRotate=p=[p]),n=p.length;-1<--n;){for(a=0;a<3;a++)r=p[n][a],this._func[r]="function"==typeof t[r]&&t[r.indexOf("set")||"function"!=typeof t["get"+r.substr(3)]?r:"get"+r.substr(3)];r=p[n][2],this._initialRotations[n]=(this._func[r]?this._func[r].call(this._target):this._target[r])||0,this._overwriteProps.push(r)}return this._startRatio=i.vars.runBackwards?1:0,!0},set:function(t){var e,i,r,s,n,a,o,l,h,f=this._segCount,u=this._func,p=this._target,_=t!==this._startRatio;if(this._timeRes){if(l=this._lengths,h=this._curSeg,t*=this._length,T=this._li,t>this._l2&&T<f-1){for(o=f-1;T<o&&(this._l2=l[++T])<=t;);this._l1=l[T-1],this._li=T,this._curSeg=h=this._segments[T],this._s2=h[this._s1=this._si=0]}else if(t<this._l1&&0<T){for(;0<T&&(this._l1=l[--T])>=t;);0===T&&t<this._l1?this._l1=0:T++,this._l2=l[T],this._li=T,this._curSeg=h=this._segments[T],this._s1=h[(this._si=h.length-1)-1]||0,this._s2=h[this._si]}if(e=T,t-=this._l1,T=this._si,t>this._s2&&T<h.length-1){for(o=h.length-1;T<o&&(this._s2=h[++T])<=t;);this._s1=h[T-1],this._si=T}else if(t<this._s1&&0<T){for(;0<T&&(this._s1=h[--T])>=t;);0===T&&t<this._s1?this._s1=0:T++,this._s2=h[T],this._si=T}n=(T+(t-this._s1)/(this._s2-this._s1))*this._prec||0}else n=(t-(e=t<0?0:1<=t?f-1:f*t>>0)*(1/f))*f;for(i=1-n,T=this._props.length;-1<--T;)r=this._props[T],a=(n*n*(s=this._beziers[r][e]).da+3*i*(n*s.ca+i*s.ba))*n+s.a,this._mod[r]&&(a=this._mod[r](a,p)),u[r]?p[r](a):"x"==r?p.setX(a):"y"==r?p.setY(a):"z"==r?p.setZ(a):"angleX"==r?p.setAngleX(a):"angleY"==r?p.setAngleY(a):"angleZ"==r?p.setAngleZ(a):"w"==r?p.setWidth(a):"h"==r?p.setHeight(a):"alpha"==r?p.setAlpha(a):"scale"==r?p.setScale2(a):p[r]=a;if(this._autoRotate)for(var c,d,m,g,y,v,x,w=this._autoRotate,T=w.length;-1<--T;)r=w[T][2],v=w[T][3]||0,x=!0===w[T][4]?1:b,s=this._beziers[w[T][0]],c=this._beziers[w[T][1]],s&&c&&(s=s[e],c=c[e],d=s.a+(s.b-s.a)*n,d+=((g=s.b+(s.c-s.b)*n)-d)*n,g+=(s.c+(s.d-s.c)*n-g)*n,m=c.a+(c.b-c.a)*n,m+=((y=c.b+(c.c-c.b)*n)-m)*n,y+=(c.c+(c.d-c.c)*n-y)*n,a=_?Math.atan2(y-m,g-d)*x+v:this._initialRotations[T],this._mod[r]&&(a=this._mod[r](a,p)),u[r]?p[r](a):p[r]=a)}}),t=m.prototype,m.bezierThrough=_,m.cubicToQuadratic=w,m._autoCSS=!0,m.quadraticToCubic=function(t,e,i){return new y(t,(2*e+t)/3,(2*e+i)/3,i)},m._cssRegister=function(){var t,_,c,d,e=i.CSSPlugin;e&&(t=e._internals,_=t._parseToProxy,c=t._setPluginRatio,d=t.CSSPropTween,t._registerComplexSpecialProp("bezier",{parser:function(t,e,i,r,s,n){e instanceof Array&&(e={values:e}),n=new m;var a,o,l,h=e.values,f=h.length-1,u=[],p={};if(f<0)return s;for(a=0;a<=f;a++)l=_(t,h[a],r,s,n,f!==a),u[a]=l.end;for(o in e)p[o]=e[o];return p.values=u,(s=new d(t,"bezier",0,0,l.pt,2)).data=l,s.plugin=n,s.setRatio=c,0===p.autoRotate&&(p.autoRotate=!0),!p.autoRotate||p.autoRotate instanceof Array||(a=!0===p.autoRotate?0:Number(p.autoRotate),p.autoRotate=null!=l.end.left?[["left","top","rotation",a,!1]]:null!=l.end.x&&[["x","y","rotation",a,!1]]),p.autoRotate&&(r._transform||r._enableTransforms(!1),l.autoRotate=r._target._fwdTransform,l.proxy.rotation=l.autoRotate.rotation||0,r._overwriteProps.push("rotation")),n._onInitTween(l.proxy,p,r._tween),s}}))},t._mod=function(t){for(var e,i=this._overwriteProps,r=i.length;-1<--r;)(e=t[i[r]])&&"function"==typeof e&&(this._mod[i[r]]=e)},t._kill=function(t){var e,i,r=this._props;for(e in this._beziers)if(e in t)for(delete this._beziers[e],delete this._func[e],i=r.length;-1<--i;)r[i]===e&&r.splice(i,1);if(r=this._autoRotate)for(i=r.length;-1<--i;)t[r[i][2]]&&r.splice(i,1);return this._super._kill.call(this,t)},_fwd_fwdScope.FWDFWD_fwdDefine("plugins.CSSPlugin",["plugins.TweenPlugin","FWDTweenLite"],function(n,B){var c,P,O,d,W=function(){n.call(this,"css"),this._overwriteProps.length=0,this.setRatio=W.prototype.setRatio},h=_fwd_fwdScope.FWDFWD_fwdDefine.globals,m={},t=W.prototype=new n("css");(t.constructor=W).version="1.19.0",W.API=2,W.defaultTransformPerspective=0,W.defaultSkewType="compensated",W.defaultSmoothOrigin=!0,t="px",W.suffixMap={top:t,right:t,bottom:t,left:t,width:t,height:t,fontSize:t,padding:t,margin:t,perspective:t,lineHeight:""};function a(t,e){return e.toUpperCase()}function e(t){return K.createElementNS?K.createElementNS("http://www.w3.org/1999/xhtml",t):K.createElement(t)}function o(t){return N.test("string"==typeof t?t:(t.currentStyle?t.currentStyle.filter:t.style.filter)||"")?parseFloat(RegExp.$1)/100:1}function g(t){window.console&&console.log(t)}function k(t,e){var i,r,s=(e=e||J).style;if(void 0!==s[t])return t;for(t=t.charAt(0).toUpperCase()+t.substr(1),i=["O","Moz","ms","Ms","Webkit"],r=5;-1<--r&&void 0===s[i[r]+t];);return 0<=r?(st="-"+(nt=3===r?"ms":i[r]).toLowerCase()+"-",nt+t):null}function y(t,e){var i,r,s,n={};if(e=e||at(t,null))if(i=e.length)for(;-1<--i;)-1!==(s=e[i]).indexOf("-transform")&&It!==s||(n[s.replace(p,a)]=e.getPropertyValue(s));else for(i in e)-1!==i.indexOf("Transform")&&Xt!==i||(n[i]=e[i]);else if(e=t.currentStyle||t.style)for(i in e)"string"==typeof i&&void 0===n[i]&&(n[i.replace(p,a)]=e[i]);return rt||(n.opacity=o(t)),r=Zt(t,e,!1),n.rotation=r.rotation,n.skewX=r.skewX,n.scaleX=r.scaleX,n.scaleY=r.scaleY,n.x=r.x,n.y=r.y,Yt&&(n.z=r.z,n.rotationX=r.rotationX,n.rotationY=r.rotationY,n.scaleZ=r.scaleZ),n.filters&&delete n.filters,n}function v(t,e,i,r,s){var n,a,o,l={},h=t.style;for(a in i)"cssText"!==a&&"length"!==a&&isNaN(a)&&(e[a]!==(n=i[a])||s&&s[a])&&-1===a.indexOf("Origin")&&("number"!=typeof n&&"string"!=typeof n||(l[a]="auto"!==n||"left"!==a&&"top"!==a?""!==n&&"auto"!==n&&"none"!==n||"string"!=typeof e[a]||""===e[a].replace(f,"")?n:0:ht(t,a),void 0!==h[a]&&(o=new vt(h,a,h[a],o))));if(r)for(a in r)"className"!==a&&(l[a]=r[a]);return{difs:l,firstMPT:o}}function R(t,e){return"function"==typeof t&&(t=t(D,F)),"string"==typeof t&&"="===t.charAt(1)?parseInt(t.charAt(0)+"1",10)*parseFloat(t.substr(2)):parseFloat(t)-parseFloat(e)||0}function S(t,e){return"function"==typeof t&&(t=t(D,F)),null==t?e:"string"==typeof t&&"="===t.charAt(1)?parseInt(t.charAt(0)+"1",10)*parseFloat(t.substr(2))+e:parseFloat(t)||0}function A(t,e,i,r){var s,n,a,o,l;return"function"==typeof t&&(t=t(D,F)),(o=null==t?e:"number"==typeof t?t:(s=360,n=t.split("_"),a=((l="="===t.charAt(1))?parseInt(t.charAt(0)+"1",10)*parseFloat(n[0].substr(2)):parseFloat(n[0]))*(-1===t.indexOf("rad")?1:G)-(l?0:e),n.length&&(r&&(r[i]=e+a),-1!==t.indexOf("short")&&(a%=s)!==a%180&&(a=a<0?a+s:a-s),-1!==t.indexOf("_cw")&&a<0?a=(a+3599999999640)%s-(a/s|0)*s:-1!==t.indexOf("ccw")&&0<a&&(a=(a-3599999999640)%s-(a/s|0)*s)),e+a))<1e-6&&-1e-6<o&&(o=0),o}function _(t,e,i){return 255*(6*(t=t<0?t+1:1<t?t-1:t)<1?e+(i-e)*t*6:t<.5?i:3*t<2?e+(i-e)*(2/3-t)*6:e)+.5|0}function r(t,e){for(var i,r,s=t.match(dt)||[],n=0,a=s.length?"":t,o=0;o<s.length;o++)i=s[o],n+=(r=t.substr(n,t.indexOf(i,n)-n)).length+i.length,3===(i=ct(i,e)).length&&i.push(1),a+=r+(e?"hsla("+i[0]+","+i[1]+"%,"+i[2]+"%,"+i[3]:"rgba("+i.join(","))+")";return a+t.substr(n)}var M,x,w,Y,T,C,F,D,i,s,z=/(?:\-|\.|\b)(\d|\.|e\-)+/g,X=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,b=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,f=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,I=/(?:\d|\-|\+|=|#|\.)*/g,N=/opacity *= *([^)]*)/i,E=/opacity:([^;]*)/i,l=/alpha\(opacity *=.+?\)/i,L=/^(rgb|hsl)/,u=/([A-Z])/g,p=/-([a-z])/gi,j=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,V=/(?:Left|Right|Width)/i,q=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,Z=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,U=/,(?=[^\)]*(?:\(|$))/gi,$=/[\s,\(]/i,Q=Math.PI/180,G=180/Math.PI,H={},K=document,J=e("div"),tt=e("img"),et=W._internals={_specialProps:m},it=navigator.userAgent,rt=(i=it.indexOf("Android"),s=e("a"),w=-1!==it.indexOf("Safari")&&-1===it.indexOf("Chrome")&&(-1===i||3<Number(it.substr(i+8,1))),T=w&&Number(it.substr(it.indexOf("Version/")+8,1))<6,Y=-1!==it.indexOf("Firefox"),(/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(it)||/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(it))&&(C=parseFloat(RegExp.$1)),!!s&&(s.style.cssText="top:1px;opacity:.55;",/^0.55/.test(s.style.opacity))),st="",nt="",at=K.defaultView?K.defaultView.getComputedStyle:function(){},ot=W.getStyle=function(t,e,i,r,s){var n;return rt||"opacity"!==e?(!r&&t.style[e]?n=t.style[e]:(i=i||at(t))?n=i[e]||i.getPropertyValue(e)||i.getPropertyValue(e.replace(u,"-$1").toLowerCase()):t.currentStyle&&(n=t.currentStyle[e]),null==s||n&&"none"!==n&&"auto"!==n&&"auto auto"!==n?n:s):o(t)},lt=et.convertToPixels=function(t,e,i,r,s){if("px"===r||!r)return i;if("auto"===r||!i)return 0;var n,a,o,l=V.test(e),h=t,f=J.style,u=i<0,p=1===i;if(u&&(i=-i),p&&(i*=100),"%"===r&&-1!==e.indexOf("border"))n=i/100*(l?t.clientWidth:t.clientHeight);else{if(f.cssText="border:0 solid red;position:"+ot(t,"position")+";line-height:0;","%"!==r&&h.appendChild&&"v"!==r.charAt(0)&&"rem"!==r)f[l?"borderLeftWidth":"borderTopWidth"]=i+r;else{if(a=(h=t.parentNode||K.body)._fwdCache,o=B.ticker.frame,a&&l&&a.time===o)return a.width*i/100;f[l?"width":"height"]=i+r}h.appendChild(J),n=parseFloat(J[l?"offsetWidth":"offsetHeight"]),h.removeChild(J),l&&"%"===r&&!1!==W.cacheWidths&&((a=h._fwdCache=h._fwdCache||{}).time=o,a.width=n/i*100),0!==n||s||(n=lt(t,e,i,r,!0))}return p&&(n/=100),u?-n:n},ht=et.calculateOffset=function(t,e,i){if("absolute"!==ot(t,"position",i))return 0;var r="left"===e?"Left":"Top",s=ot(t,"margin"+r,i);return t["offset"+r]-(lt(t,e,parseFloat(s),s.replace(I,""))||0)},ft={width:["Left","Right"],height:["Top","Bottom"]},ut=["marginLeft","marginRight","marginTop","marginBottom"],pt=function(t,e){if("contain"===t||"auto"===t||"auto auto"===t)return t+" ";null!=t&&""!==t||(t="0 0");var i,r=t.split(" "),s=-1!==t.indexOf("left")?"0%":-1!==t.indexOf("right")?"100%":r[0],n=-1!==t.indexOf("top")?"0%":-1!==t.indexOf("bottom")?"100%":r[1];if(3<r.length&&!e){for(r=t.split(", ").join(",").split(","),t=[],i=0;i<r.length;i++)t.push(pt(r[i]));return t.join(",")}return null==n?n="center"===s?"50%":"0":"center"===n&&(n="50%"),("center"===s||isNaN(parseFloat(s))&&-1===(s+"").indexOf("="))&&(s="50%"),t=s+" "+n+(2<r.length?" "+r[2]:""),e&&(e.oxp=-1!==s.indexOf("%"),e.oyp=-1!==n.indexOf("%"),e.oxr="="===s.charAt(1),e.oyr="="===n.charAt(1),e.ox=parseFloat(s.replace(f,"")),e.oy=parseFloat(n.replace(f,"")),e.v=t),e||t},_t={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],fuchsia:[255,0,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},ct=W.parseColor=function(t,e){var i,r,s,n,a,o,l,h,f,u,p;if(t)if("number"==typeof t)i=[t>>16,t>>8&255,255&t];else{if(","===t.charAt(t.length-1)&&(t=t.substr(0,t.length-1)),_t[t])i=_t[t];else if("#"===t.charAt(0))4===t.length&&(t="#"+(r=t.charAt(1))+r+(s=t.charAt(2))+s+(n=t.charAt(3))+n),i=[(t=parseInt(t.substr(1),16))>>16,t>>8&255,255&t];else if("hsl"===t.substr(0,3))if(i=p=t.match(z),e){if(-1!==t.indexOf("="))return t.match(X)}else a=Number(i[0])%360/360,o=Number(i[1])/100,r=2*(l=Number(i[2])/100)-(s=l<=.5?l*(o+1):l+o-l*o),3<i.length&&(i[3]=Number(t[3])),i[0]=_(a+1/3,r,s),i[1]=_(a,r,s),i[2]=_(a-1/3,r,s);else i=t.match(z)||_t.transparent;i[0]=Number(i[0]),i[1]=Number(i[1]),i[2]=Number(i[2]),3<i.length&&(i[3]=Number(i[3]))}else i=_t.black;return e&&!p&&(r=i[0]/255,s=i[1]/255,n=i[2]/255,l=((h=Math.max(r,s,n))+(f=Math.min(r,s,n)))/2,h===f?a=o=0:(u=h-f,o=.5<l?u/(2-h-f):u/(h+f),a=h===r?(s-n)/u+(s<n?6:0):h===s?(n-r)/u+2:(r-s)/u+4,a*=60),i[0]=a+.5|0,i[1]=100*o+.5|0,i[2]=100*l+.5|0),i},dt="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b";for(t in _t)dt+="|"+t+"\\b";dt=new RegExp(dt+")","gi"),W.colorStringFilter=function(t){var e,i=t[0]+t[1];dt.test(i)&&(e=-1!==i.indexOf("hsl(")||-1!==i.indexOf("hsla("),t[0]=r(t[0],e),t[1]=r(t[1],e)),dt.lastIndex=0},B.defaultStringFilter||(B.defaultStringFilter=W.colorStringFilter);function mt(t,e,n,a){if(null==t)return function(t){return t};var o,l=e?(t.match(dt)||[""])[0]:"",h=t.split(l).join("").match(b)||[],f=t.substr(0,t.indexOf(h[0])),u=")"===t.charAt(t.length-1)?")":"",p=-1!==t.indexOf(" ")?" ":",",_=h.length,c=0<_?h[0].replace(z,""):"";return _?o=e?function(t){var e,i,r,s;if("number"==typeof t)t+=c;else if(a&&U.test(t)){for(s=t.replace(U,"|").split("|"),r=0;r<s.length;r++)s[r]=o(s[r]);return s.join(",")}if(e=(t.match(dt)||[l])[0],r=(i=t.split(e).join("").match(b)||[]).length,_>r--)for(;++r<_;)i[r]=n?i[(r-1)/2|0]:h[r];return f+i.join(p)+p+e+u+(-1!==t.indexOf("inset")?" inset":"")}:function(t){var e,i,r;if("number"==typeof t)t+=c;else if(a&&U.test(t)){for(i=t.replace(U,"|").split("|"),r=0;r<i.length;r++)i[r]=o(i[r]);return i.join(",")}if(r=(e=t.match(b)||[]).length,_>r--)for(;++r<_;)e[r]=n?e[(r-1)/2|0]:h[r];return f+e.join(p)+u}:function(t){return t}}function gt(h){return h=h.split(","),function(t,e,i,r,s,n,a){var o,l=(e+"").split(" ");for(a={},o=0;o<4;o++)a[h[o]]=l[o]=l[o]||l[(o-1)/2>>0];return r.parse(t,a,s,n)}}et._setPluginRatio=function(t){this.plugin.setRatio(t);for(var e,i,r,s,n,a=this.data,o=a.proxy,l=a.firstMPT;l;)e=o[l.v],l.r?e=Math.round(e):e<1e-6&&-1e-6<e&&(e=0),l.t[l.p]=e,l=l._next;if(a.autoRotate&&(a.autoRotate.rotation=a.mod?a.mod(o.rotation,this.t):o.rotation),1===t||0===t)for(l=a.firstMPT,n=1===t?"e":"b";l;){if((i=l.t).type){if(1===i.type){for(s=i.xs0+i.s+i.xs1,r=1;r<i.l;r++)s+=i["xn"+r]+i["xs"+(r+1)];i[n]=s}}else i[n]=i.s+i.xs0;l=l._next}};function yt(t,e,i,r,s,n){var a=new xt(t,e,i,r-i,s,-1,n);return a.b=i,a.e=a.xs0=r,a}var vt=function(t,e,i,r,s){this.t=t,this.p=e,this.v=i,this.r=s,r&&((r._prev=this)._next=r)},xt=(et._parseToProxy=function(t,e,i,r,s,n){var a,o,l,h,f,u=r,p={},_={},c=i._transform,d=H;for(i._transform=null,H=e,r=f=i.parse(t,e,r,s),H=d,n&&(i._transform=c,u&&(u._prev=null,u._prev&&(u._prev._next=null)));r&&r!==u;){if(r.type<=1&&(_[o=r.p]=r.s+r.c,p[o]=r.s,n||(h=new vt(r,"s",o,h,r.r),r.c=0),1===r.type))for(a=r.l;0<--a;)l="xn"+a,_[o=r.p+"_"+l]=r.data[l],p[o]=r[l],n||(h=new vt(r,l,o,h,r.rxp[l]));r=r._next}return{proxy:p,end:_,firstMPT:h,pt:f}},et.CSSPropTween=function(t,e,i,r,s,n,a,o,l,h,f){this.t=t,this.p=e,this.s=i,this.c=r,this.n=a||e,t instanceof xt||d.push(this.n),this.r=o,this.type=n||0,l&&(this.pr=l,c=!0),this.b=void 0===h?i:h,this.e=void 0===f?i+r:f,s&&((this._next=s)._prev=this)}),wt=W.parseComplex=function(t,e,i,r,s,n,a,o,l,h){i=i||n||"","function"==typeof r&&(r=r(D,F)),a=new xt(t,e,0,0,a,h?2:1,null,!1,o,i,r),r+="",s&&dt.test(r+i)&&(r=[i,r],W.colorStringFilter(r),i=r[0],r=r[1]);var f,u,p,_,c,d,m,g,y,v,x,w,T,b=i.split(", ").join(",").split(" "),P=r.split(", ").join(",").split(" "),O=b.length,k=!1!==M;for(-1===r.indexOf(",")&&-1===i.indexOf(",")||(b=b.join(" ").replace(U,", ").split(" "),P=P.join(" ").replace(U,", ").split(" "),O=b.length),O!==P.length&&(O=(b=(n||"").split(" ")).length),a.plugin=l,a.setRatio=h,f=dt.lastIndex=0;f<O;f++)if(_=b[f],c=P[f],(g=parseFloat(_))||0===g)a.appendXtra("",g,R(c,g),c.replace(X,""),k&&-1!==c.indexOf("px"),!0);else if(s&&dt.test(_))w=")"+((w=c.indexOf(")")+1)?c.substr(w):""),T=-1!==c.indexOf("hsl")&&rt,_=ct(_,T),c=ct(c,T),(y=6<_.length+c.length)&&!rt&&0===c[3]?(a["xs"+a.l]+=a.l?" transparent":"transparent",a.e=a.e.split(P[f]).join("transparent")):(rt||(y=!1),T?a.appendXtra(y?"hsla(":"hsl(",_[0],R(c[0],_[0]),",",!1,!0).appendXtra("",_[1],R(c[1],_[1]),"%,",!1).appendXtra("",_[2],R(c[2],_[2]),y?"%,":"%"+w,!1):a.appendXtra(y?"rgba(":"rgb(",_[0],c[0]-_[0],",",!0,!0).appendXtra("",_[1],c[1]-_[1],",",!0).appendXtra("",_[2],c[2]-_[2],y?",":w,!0),y&&(_=_.length<4?1:_[3],a.appendXtra("",_,(c.length<4?1:c[3])-_,w,!1))),dt.lastIndex=0;else if(d=_.match(z)){if(!(m=c.match(X))||m.length!==d.length)return a;for(u=p=0;u<d.length;u++)x=d[u],v=_.indexOf(x,p),a.appendXtra(_.substr(p,v-p),Number(x),R(m[u],x),"",k&&"px"===_.substr(v+x.length,2),0===u),p=v+x.length;a["xs"+a.l]+=_.substr(p)}else a["xs"+a.l]+=a.l||a["xs"+a.l]?" "+c:c;if(-1!==r.indexOf("=")&&a.data){for(w=a.xs0+a.data.s,f=1;f<a.l;f++)w+=a["xs"+f]+a.data["xn"+f];a.e=w+a["xs"+f]}return a.l||(a.type=-1,a.xs0=a.e),a.xfirst||a},Tt=9;for((t=xt.prototype).l=t.pr=0;0<--Tt;)t["xn"+Tt]=0,t["xs"+Tt]="";t.xs0="",t._next=t._prev=t.xfirst=t.data=t.plugin=t.setRatio=t.rxp=null,t.appendXtra=function(t,e,i,r,s,n){var a=this,o=a.l;return a["xs"+o]+=n&&(o||a["xs"+o])?" "+t:t||"",i||0===o||a.plugin?(a.l++,a.type=a.setRatio?2:1,a["xs"+a.l]=r||"",0<o?(a.data["xn"+o]=e+i,a.rxp["xn"+o]=s,a["xn"+o]=e,a.plugin||(a.xfirst=new xt(a,"xn"+o,e,i,a.xfirst||a,0,a.n,s,a.pr),a.xfirst.xs0=0)):(a.data={s:e+i},a.rxp={},a.s=e,a.c=i,a.r=s),a):(a["xs"+o]+=e+(r||""),a)};function bt(t,e){e=e||{},this.p=e.prefix&&k(t)||t,(m[t]=m[this.p]=this).format=e.formatter||mt(e.defaultValue,e.color,e.collapsible,e.multi),e.parser&&(this.parse=e.parser),this.clrs=e.color,this.multi=e.multi,this.keyword=e.keyword,this.dflt=e.defaultValue,this.pr=e.priority||0}var Pt=et._registerComplexSpecialProp=function(t,e,i){"object"!=typeof e&&(e={parser:i});var r,s=t.split(","),n=e.defaultValue;for(i=i||[n],r=0;r<s.length;r++)e.prefix=0===r&&e.prefix,e.defaultValue=i[r]||n,new bt(s[r],e)},Ot=et._registerPluginProp=function(t){var l;m[t]||(l=t.charAt(0).toUpperCase()+t.substr(1)+"Plugin",Pt(t,{parser:function(t,e,i,r,s,n,a){var o=h.com.fwd.plugins[l];return o?(o._cssRegister(),m[i].parse(t,e,i,r,s,n,a)):(g("Error: "+l+" js file not loaded."),s)}}))};(t=bt.prototype).parseComplex=function(t,e,i,r,s,n){var a,o,l,h,f,u,p=this.keyword;if(this.multi&&(U.test(i)||U.test(e)?(o=e.replace(U,"|").split("|"),l=i.replace(U,"|").split("|")):p&&(o=[e],l=[i])),l){for(h=l.length>o.length?l.length:o.length,a=0;a<h;a++)e=o[a]=o[a]||this.dflt,i=l[a]=l[a]||this.dflt,p&&(f=e.indexOf(p))!==(u=i.indexOf(p))&&(-1===u?o[a]=o[a].split(p).join(""):-1===f&&(o[a]+=" "+p));e=o.join(", "),i=l.join(", ")}return wt(t,this.p,e,i,this.clrs,this.dflt,r,this.pr,s,n)},t.parse=function(t,e,i,r,s,n,a){return this.parseComplex(t.style,this.format(ot(t,this.p,O,!1,this.dflt)),this.format(e),s,n)},W.registerSpecialProp=function(t,l,h){Pt(t,{parser:function(t,e,i,r,s,n,a){var o=new xt(t,i,0,0,s,2,i,!1,h);return o.plugin=n,o.setRatio=l(t,e,r._tween,i),o},priority:h})},W.useSVGTransformAttr=w||Y;function kt(t,e,i){var r,s=K.createElementNS("http://www.w3.org/2000/svg",t),n=/([a-z])([A-Z])/g;for(r in i)s.setAttributeNS(null,r.replace(n,"$1-$2").toLowerCase(),i[r]);return e.appendChild(s),s}function Rt(t,e,i,r,s,n){var a,o,l,h,f,u,p,_,c,d,m,g,y,v,x=t._fwdTransform,w=qt(t,!0);x&&(y=x.xOrigin,v=x.yOrigin),(!r||(a=r.split(" ")).length<2)&&(p=t.getBBox(),a=[(-1!==(e=pt(e).split(" "))[0].indexOf("%")?parseFloat(e[0])/100*p.width:parseFloat(e[0]))+p.x,(-1!==e[1].indexOf("%")?parseFloat(e[1])/100*p.height:parseFloat(e[1]))+p.y]),i.xOrigin=h=parseFloat(a[0]),i.yOrigin=f=parseFloat(a[1]),r&&w!==Vt&&(u=w[0],p=w[1],_=w[2],c=w[3],d=w[4],o=h*(c/(g=u*c-p*_))+f*(-_/g)+(_*(m=w[5])-c*d)/g,l=h*(-p/g)+f*(u/g)-(u*m-p*d)/g,h=i.xOrigin=a[0]=o,f=i.yOrigin=a[1]=l),x&&(n&&(i.xOffset=x.xOffset,i.yOffset=x.yOffset,x=i),s||!1!==s&&!1!==W.defaultSmoothOrigin?(o=h-y,l=f-v,x.xOffset+=o*w[0]+l*w[2]-o,x.yOffset+=o*w[1]+l*w[3]-l):x.xOffset=x.yOffset=0),n||t.setAttribute("data-svg-origin",a.join(" "))}function St(t){var e,i,r=this.data,s=-r.rotation*Q,n=s+r.skewX*Q,a=1e5,o=(Math.cos(s)*r.scaleX*a|0)/a,l=(Math.sin(s)*r.scaleX*a|0)/a,h=(Math.sin(n)*-r.scaleY*a|0)/a,f=(Math.cos(n)*r.scaleY*a|0)/a,u=this.t.style,p=this.t.currentStyle;if(p){i=l,l=-h,h=-i,e=p.filter,u.filter="";var _=this.t.offsetWidth,c=this.t.offsetHeight,d="absolute"!==p.position,m="progid:DXImageTransform.Microsoft.Matrix(M11="+o+", M12="+l+", M21="+h+", M22="+f,g=r.x+_*r.xPercent/100,y=r.y+c*r.yPercent/100;if(null!=r.ox&&(g+=(b=(r.oxp?_*r.ox*.01:r.ox)-_/2)-(b*o+(P=(r.oyp?c*r.oy*.01:r.oy)-c/2)*l),y+=P-(b*h+P*f)),m+=d?", Dx="+((b=_/2)-(b*o+(P=c/2)*l)+g)+", Dy="+(P-(b*h+P*f)+y)+")":", sizingMethod='auto expand')",-1!==e.indexOf("DXImageTransform.Microsoft.Matrix(")?u.filter=e.replace(Z,m):u.filter=m+" "+e,0!==t&&1!==t||1==o&&0===l&&0===h&&1==f&&(d&&-1===m.indexOf("Dx=0, Dy=0")||N.test(e)&&100!==parseFloat(RegExp.$1)||-1===e.indexOf(e.indexOf("Alpha"))&&u.removeAttribute("filter")),!d){var v,x,w,T=C<8?1:-1,b=r.ieOffsetX||0,P=r.ieOffsetY||0;for(r.ieOffsetX=Math.round((_-((o<0?-o:o)*_+(l<0?-l:l)*c))/2+g),r.ieOffsetY=Math.round((c-((f<0?-f:f)*c+(h<0?-h:h)*_))/2+y),Tt=0;Tt<4;Tt++)w=(i=-1!==(v=p[x=ut[Tt]]).indexOf("px")?parseFloat(v):lt(this.t,x,parseFloat(v),v.replace(I,""))||0)!==r[x]?Tt<2?-r.ieOffsetX:-r.ieOffsetY:Tt<2?b-r.ieOffsetX:P-r.ieOffsetY,u[x]=(r[x]=Math.round(i-w*(0===Tt||2===Tt?1:T)))+"px"}}}var At,Mt,Ct,Ft,Dt,zt="scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent".split(","),Xt=k("transform"),It=st+"transform",Nt=k("transformOrigin"),Yt=null!==k("perspective"),Et=et.Transform=function(){this.perspective=parseFloat(W.defaultTransformPerspective)||0,this.force3D=!(!1===W.defaultForce3D||!Yt)&&(W.defaultForce3D||"auto")},Bt=window.SVGElement,Wt=K.documentElement,Lt=(Dt=C||/Android/i.test(it)&&!window.chrome,K.createElementNS&&!Dt&&(Mt=kt("svg",Wt),Ft=(Ct=kt("rect",Mt,{width:100,height:50,x:100})).getBoundingClientRect().width,Ct.style[Nt]="50% 50%",Ct.style[Xt]="scaleX(0.5)",Dt=Ft===Ct.getBoundingClientRect().width&&!(Y&&Yt),Wt.removeChild(Mt)),Dt),jt=function(t){return!!(Bt&&t.getBBox&&t.getCTM&&function(t){try{return t.getBBox()}catch(t){}}(t)&&(!t.parentNode||t.parentNode.getBBox&&t.parentNode.getCTM))},Vt=[1,0,0,1,0,0],qt=function(t,e){var i,r,s,n,a,o,l=t._fwdTransform||new Et,h=t.style;if(Xt?r=ot(t,It,null,!0):t.currentStyle&&(r=(r=t.currentStyle.filter.match(q))&&4===r.length?[r[0].substr(4),Number(r[2].substr(4)),Number(r[1].substr(4)),r[3].substr(4),l.x||0,l.y||0].join(","):""),(i=!r||"none"===r||"matrix(1, 0, 0, 1, 0, 0)"===r)&&Xt&&((o="none"===at(t).display)||!t.parentNode)&&(o&&(n=h.display,h.display="block"),t.parentNode||(a=1,Wt.appendChild(t)),i=!(r=ot(t,It,null,!0))||"none"===r||"matrix(1, 0, 0, 1, 0, 0)"===r,n?h.display=n:o&&Gt(h,"display"),a&&Wt.removeChild(t)),(l.svg||t.getBBox&&jt(t))&&(i&&-1!==(h[Xt]+"").indexOf("matrix")&&(r=h[Xt],i=0),s=t.getAttribute("transform"),i&&s&&(-1!==s.indexOf("matrix")?(r=s,i=0):-1!==s.indexOf("translate")&&(r="matrix(1,0,0,1,"+s.match(/(?:\-|\b)[\d\-\.e]+\b/gi).join(",")+")",i=0))),i)return Vt;for(s=(r||"").match(z)||[],Tt=s.length;-1<--Tt;)n=Number(s[Tt]),s[Tt]=(a=n-(n|=0))?(1e5*a+(a<0?-.5:.5)|0)/1e5+n:n;return e&&6<s.length?[s[0],s[1],s[4],s[5],s[12],s[13]]:s},Zt=et.getTransform=function(t,e,i,r){if(t._fwdTransform&&i&&!r)return t._fwdTransform;var s,n,a,o,l,h,f,u,p,_,c,d,m,g,y,v,x,w,T,b,P,O,k,R,S,A,M,C,F,D,z,X,I=i&&t._fwdTransform||new Et,N=I.scaleX<0,Y=Yt&&(parseFloat(ot(t,Nt,e,!1,"0 0 0").split(" ")[2])||I.zOrigin)||0,E=parseFloat(W.defaultTransformPerspective)||0;if(I.svg=!(!t.getBBox||!jt(t)),I.svg&&(Rt(t,ot(t,Nt,e,!1,"50% 50%")+"",I,t.getAttribute("data-svg-origin")),At=W.useSVGTransformAttr||Lt),(s=qt(t))!==Vt)for(n in 16===s.length?(f=s[0],u=s[1],p=s[2],_=s[3],c=s[4],d=s[5],m=s[6],g=s[7],y=s[8],v=s[9],x=s[10],w=s[12],T=s[13],b=s[14],P=s[11],O=Math.atan2(m,x),I.zOrigin&&(w=y*(b=-I.zOrigin)-s[12],T=v*b-s[13],b=x*b+I.zOrigin-s[14]),I.rotationX=O*G,O&&(k=c*(A=Math.cos(-O))+y*(M=Math.sin(-O)),R=d*A+v*M,S=m*A+x*M,y=c*-M+y*A,v=d*-M+v*A,x=m*-M+x*A,P=g*-M+P*A,c=k,d=R,m=S),O=Math.atan2(-p,x),I.rotationY=O*G,O&&(R=u*(A=Math.cos(-O))-v*(M=Math.sin(-O)),S=p*A-x*M,v=u*M+v*A,x=p*M+x*A,P=_*M+P*A,f=k=f*A-y*M,u=R,p=S),O=Math.atan2(u,f),I.rotation=O*G,O&&(f=f*(A=Math.cos(-O))+c*(M=Math.sin(-O)),R=u*A+d*M,d=u*-M+d*A,m=p*-M+m*A,u=R),I.rotationX&&359.9<Math.abs(I.rotationX)+Math.abs(I.rotation)&&(I.rotationX=I.rotation=0,I.rotationY=180-I.rotationY),I.scaleX=(1e5*Math.sqrt(f*f+u*u)+.5|0)/1e5,I.scaleY=(1e5*Math.sqrt(d*d+v*v)+.5|0)/1e5,I.scaleZ=(1e5*Math.sqrt(m*m+x*x)+.5|0)/1e5,I.rotationX||I.rotationY?I.skewX=0:(I.skewX=c||d?Math.atan2(c,d)*G+I.rotation:I.skewX||0,90<Math.abs(I.skewX)&&Math.abs(I.skewX)<270&&(N?(I.scaleX*=-1,I.skewX+=I.rotation<=0?180:-180,I.rotation+=I.rotation<=0?180:-180):(I.scaleY*=-1,I.skewX+=I.skewX<=0?180:-180))),I.perspective=P?1/(P<0?-P:P):0,I.x=w,I.y=T,I.z=b,I.svg&&(I.x-=I.xOrigin-(I.xOrigin*f-I.yOrigin*c),I.y-=I.yOrigin-(I.yOrigin*u-I.xOrigin*d))):Yt&&!r&&s.length&&I.x===s[4]&&I.y===s[5]&&(I.rotationX||I.rotationY)||(F=(C=6<=s.length)?s[0]:1,D=s[1]||0,z=s[2]||0,X=C?s[3]:1,I.x=s[4]||0,I.y=s[5]||0,a=Math.sqrt(F*F+D*D),o=Math.sqrt(X*X+z*z),l=F||D?Math.atan2(D,F)*G:I.rotation||0,h=z||X?Math.atan2(z,X)*G+l:I.skewX||0,90<Math.abs(h)&&Math.abs(h)<270&&(N?(a*=-1,h+=l<=0?180:-180,l+=l<=0?180:-180):(o*=-1,h+=h<=0?180:-180)),I.scaleX=a,I.scaleY=o,I.rotation=l,I.skewX=h,Yt&&(I.rotationX=I.rotationY=I.z=0,I.perspective=E,I.scaleZ=1),I.svg&&(I.x-=I.xOrigin-(I.xOrigin*F+I.yOrigin*z),I.y-=I.yOrigin-(I.xOrigin*D+I.yOrigin*X))),I.zOrigin=Y,I)I[n]<2e-5&&-2e-5<I[n]&&(I[n]=0);return i&&(t._fwdTransform=I).svg&&(At&&t.style[Xt]?B.delayedCall(.001,function(){Gt(t.style,Xt)}):!At&&t.getAttribute("transform")&&B.delayedCall(.001,function(){t.removeAttribute("transform")})),I},Ut=et.set3DTransformRatio=et.setTransformRatio=function(t){var e,i,r,s,n,a,o,l,h,f,u,p,_,c,d,m,g,y,v,x,w,T,b,P=this.data,O=this.t.style,k=P.rotation,R=P.rotationX,S=P.rotationY,A=P.scaleX,M=P.scaleY,C=P.scaleZ,F=P.x,D=P.y,z=P.z,X=P.svg,I=P.perspective,N=P.force3D;if(!((1!==t&&0!==t||"auto"!==N||this.tween._totalTime!==this.tween._totalDuration&&this.tween._totalTime)&&N||z||I||S||R||1!==C)||At&&X||!Yt)k||P.skewX||X?(k*=Q,T=P.skewX*Q,b=1e5,e=Math.cos(k)*A,s=Math.sin(k)*A,i=Math.sin(k-T)*-M,n=Math.cos(k-T)*M,T&&"simple"===P.skewType&&(g=Math.tan(T-P.skewY*Q),i*=g=Math.sqrt(1+g*g),n*=g,P.skewY&&(g=Math.tan(P.skewY*Q),e*=g=Math.sqrt(1+g*g),s*=g)),X&&(F+=P.xOrigin-(P.xOrigin*e+P.yOrigin*i)+P.xOffset,D+=P.yOrigin-(P.xOrigin*s+P.yOrigin*n)+P.yOffset,At&&(P.xPercent||P.yPercent)&&(c=this.t.getBBox(),F+=.01*P.xPercent*c.width,D+=.01*P.yPercent*c.height),F<(c=1e-6)&&-c<F&&(F=0),D<c&&-c<D&&(D=0)),v=(e*b|0)/b+","+(s*b|0)/b+","+(i*b|0)/b+","+(n*b|0)/b+","+F+","+D+")",X&&At?this.t.setAttribute("transform","matrix("+v):O[Xt]=(P.xPercent||P.yPercent?"translate("+P.xPercent+"%,"+P.yPercent+"%) matrix(":"matrix(")+v):O[Xt]=(P.xPercent||P.yPercent?"translate("+P.xPercent+"%,"+P.yPercent+"%) matrix(":"matrix(")+A+",0,0,"+M+","+F+","+D+")";else{if(Y&&(A<(c=1e-4)&&-c<A&&(A=C=2e-5),M<c&&-c<M&&(M=C=2e-5),!I||P.z||P.rotationX||P.rotationY||(I=0)),k||P.skewX)k*=Q,d=e=Math.cos(k),m=s=Math.sin(k),P.skewX&&(k-=P.skewX*Q,d=Math.cos(k),m=Math.sin(k),"simple"===P.skewType&&(g=Math.tan((P.skewX-P.skewY)*Q),d*=g=Math.sqrt(1+g*g),m*=g,P.skewY&&(g=Math.tan(P.skewY*Q),e*=g=Math.sqrt(1+g*g),s*=g))),i=-m,n=d;else{if(!(S||R||1!==C||I||X))return void(O[Xt]=(P.xPercent||P.yPercent?"translate("+P.xPercent+"%,"+P.yPercent+"%) translate3d(":"translate3d(")+F+"px,"+D+"px,"+z+"px)"+(1!==A||1!==M?" scale("+A+","+M+")":""));e=n=1,i=s=0}h=1,r=a=o=l=f=u=0,p=I?-1/I:0,_=P.zOrigin,c=1e-6,x=",",w="0",(k=S*Q)&&(d=Math.cos(k),f=p*(o=-(m=Math.sin(k))),r=e*m,a=s*m,p*=h=d,e*=d,s*=d),(k=R*Q)&&(g=i*(d=Math.cos(k))+r*(m=Math.sin(k)),y=n*d+a*m,l=h*m,u=p*m,r=i*-m+r*d,a=n*-m+a*d,h*=d,p*=d,i=g,n=y),1!==C&&(r*=C,a*=C,h*=C,p*=C),1!==M&&(i*=M,n*=M,l*=M,u*=M),1!==A&&(e*=A,s*=A,o*=A,f*=A),(_||X)&&(_&&(F+=r*-_,D+=a*-_,z+=h*-_+_),X&&(F+=P.xOrigin-(P.xOrigin*e+P.yOrigin*i)+P.xOffset,D+=P.yOrigin-(P.xOrigin*s+P.yOrigin*n)+P.yOffset),F<c&&-c<F&&(F=w),D<c&&-c<D&&(D=w),z<c&&-c<z&&(z=0)),v=P.xPercent||P.yPercent?"translate("+P.xPercent+"%,"+P.yPercent+"%) matrix3d(":"matrix3d(",v+=(e<c&&-c<e?w:e)+x+(s<c&&-c<s?w:s)+x+(o<c&&-c<o?w:o),v+=x+(f<c&&-c<f?w:f)+x+(i<c&&-c<i?w:i)+x+(n<c&&-c<n?w:n),R||S||1!==C?(v+=x+(l<c&&-c<l?w:l)+x+(u<c&&-c<u?w:u)+x+(r<c&&-c<r?w:r),v+=x+(a<c&&-c<a?w:a)+x+(h<c&&-c<h?w:h)+x+(p<c&&-c<p?w:p)+x):v+=",0,0,0,0,1,0,",v+=F+x+D+x+z+x+(I?1+-z/I:1)+")",O[Xt]=v}};(t=Et.prototype).x=t.y=t.z=t.skewX=t.skewY=t.rotation=t.rotationX=t.rotationY=t.zOrigin=t.xPercent=t.yPercent=t.xOffset=t.yOffset=0,t.scaleX=t.scaleY=t.scaleZ=1,Pt("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,svgOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent,smoothOrigin",{parser:function(t,e,i,r,s,n,a){if(r._lastParsedTransform===a)return s;var o;"function"==typeof(r._lastParsedTransform=a)[i]&&(o=a[i],a[i]=e);var l,h,f,u,p,_,c,d,m,g=t._fwdTransform,y=t.style,v=zt.length,x=a,w={},T="transformOrigin",b=Zt(t,O,!0,x.parseTransform),P=x.transform&&("function"==typeof x.transform?x.transform(D,F):x.transform);if(r._transform=b,P&&"string"==typeof P&&Xt)(h=J.style)[Xt]=P,h.display="block",h.position="absolute",K.body.appendChild(J),l=Zt(J,null,!1),b.svg&&(_=b.xOrigin,c=b.yOrigin,l.x-=b.xOffset,l.y-=b.yOffset,(x.transformOrigin||x.svgOrigin)&&(P={},Rt(t,pt(x.transformOrigin),P,x.svgOrigin,x.smoothOrigin,!0),_=P.xOrigin,c=P.yOrigin,l.x-=P.xOffset-b.xOffset,l.y-=P.yOffset-b.yOffset),(_||c)&&(d=qt(J,!0),l.x-=_-(_*d[0]+c*d[2]),l.y-=c-(_*d[1]+c*d[3]))),K.body.removeChild(J),l.perspective||(l.perspective=b.perspective),null!=x.xPercent&&(l.xPercent=S(x.xPercent,b.xPercent)),null!=x.yPercent&&(l.yPercent=S(x.yPercent,b.yPercent));else if("object"==typeof x){if(l={scaleX:S(null!=x.scaleX?x.scaleX:x.scale,b.scaleX),scaleY:S(null!=x.scaleY?x.scaleY:x.scale,b.scaleY),scaleZ:S(x.scaleZ,b.scaleZ),x:S(x.x,b.x),y:S(x.y,b.y),z:S(x.z,b.z),xPercent:S(x.xPercent,b.xPercent),yPercent:S(x.yPercent,b.yPercent),perspective:S(x.transformPerspective,b.perspective)},null!=(p=x.directionalRotation))if("object"==typeof p)for(h in p)x[h]=p[h];else x.rotation=p;"string"==typeof x.x&&-1!==x.x.indexOf("%")&&(l.x=0,l.xPercent=S(x.x,b.xPercent)),"string"==typeof x.y&&-1!==x.y.indexOf("%")&&(l.y=0,l.yPercent=S(x.y,b.yPercent)),l.rotation=A("rotation"in x?x.rotation:"shortRotation"in x?x.shortRotation+"_short":"rotationZ"in x?x.rotationZ:b.rotation-b.skewY,b.rotation-b.skewY,"rotation",w),Yt&&(l.rotationX=A("rotationX"in x?x.rotationX:"shortRotationX"in x?x.shortRotationX+"_short":b.rotationX||0,b.rotationX,"rotationX",w),l.rotationY=A("rotationY"in x?x.rotationY:"shortRotationY"in x?x.shortRotationY+"_short":b.rotationY||0,b.rotationY,"rotationY",w)),l.skewX=A(x.skewX,b.skewX-b.skewY),(l.skewY=A(x.skewY,b.skewY))&&(l.skewX+=l.skewY,l.rotation+=l.skewY)}for(Yt&&null!=x.force3D&&(b.force3D=x.force3D,u=!0),b.skewType=x.skewType||b.skewType||W.defaultSkewType,(f=b.force3D||b.z||b.rotationX||b.rotationY||l.z||l.rotationX||l.rotationY||l.perspective)||null==x.scale||(l.scaleZ=1);-1<--v;)(1e-6<(P=l[m=zt[v]]-b[m])||P<-1e-6||null!=x[m]||null!=H[m])&&(u=!0,s=new xt(b,m,b[m],P,s),m in w&&(s.e=w[m]),s.xs0=0,s.plugin=n,r._overwriteProps.push(s.n));return P=x.transformOrigin,b.svg&&(P||x.svgOrigin)&&(_=b.xOffset,c=b.yOffset,Rt(t,pt(P),l,x.svgOrigin,x.smoothOrigin),s=yt(b,"xOrigin",(g?b:l).xOrigin,l.xOrigin,s,T),s=yt(b,"yOrigin",(g?b:l).yOrigin,l.yOrigin,s,T),_===b.xOffset&&c===b.yOffset||(s=yt(b,"xOffset",g?_:b.xOffset,b.xOffset,s,T),s=yt(b,"yOffset",g?c:b.yOffset,b.yOffset,s,T)),P=At?null:"0px 0px"),(P||Yt&&f&&b.zOrigin)&&(Xt?(u=!0,m=Nt,P=(P||ot(t,m,O,!1,"50% 50%"))+"",(s=new xt(y,m,0,0,s,-1,T)).b=y[m],s.plugin=n,Yt?(h=b.zOrigin,P=P.split(" "),b.zOrigin=(2<P.length&&(0===h||"0px"!==P[2])?parseFloat(P[2]):h)||0,s.xs0=s.e=P[0]+" "+(P[1]||"50%")+" 0px",(s=new xt(b,"zOrigin",0,0,s,-1,s.n)).b=h,s.xs0=s.e=b.zOrigin):s.xs0=s.e=P):pt(P+"",b)),u&&(r._transformType=b.svg&&At||!f&&3!==this._transformType?2:3),o&&(a[i]=o),s},prefix:!0}),Pt("boxShadow",{defaultValue:"0px 0px 0px 0px #999",prefix:!0,color:!0,multi:!0,keyword:"inset"}),Pt("borderRadius",{defaultValue:"0px",parser:function(t,e,i,r,s,n){e=this.format(e);for(var a,o,l,h,f,u,p,_,c,d,m,g,y=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],v=t.style,x=parseFloat(t.offsetWidth),w=parseFloat(t.offsetHeight),T=e.split(" "),b=0;b<y.length;b++)this.p.indexOf("border")&&(y[b]=k(y[b])),-1!==(l=o=ot(t,y[b],O,!1,"0px")).indexOf(" ")&&(l=(o=l.split(" "))[0],o=o[1]),h=a=T[b],f=parseFloat(l),_=l.substr((f+"").length),""===(p=(c="="===h.charAt(1))?(u=parseInt(h.charAt(0)+"1",10),h=h.substr(2),u*=parseFloat(h),h.substr((u+"").length-(u<0?1:0))||""):(u=parseFloat(h),h.substr((u+"").length)))&&(p=P[i]||_),p!==_&&(d=lt(t,"borderLeft",f,_),m=lt(t,"borderTop",f,_),o="%"===p?(l=d/x*100+"%",m/w*100+"%"):"em"===p?(l=d/(g=lt(t,"borderLeft",1,"em"))+"em",m/g+"em"):(l=d+"px",m+"px"),c&&(h=parseFloat(l)+u+p,a=parseFloat(o)+u+p)),s=wt(v,y[b],l+" "+o,h+" "+a,!1,"0px",s);return s},prefix:!0,formatter:mt("0px 0px 0px 0px",!1,!0)}),Pt("borderBottomLeftRadius,borderBottomRightRadius,borderTopLeftRadius,borderTopRightRadius",{defaultValue:"0px",parser:function(t,e,i,r,s,n){return wt(t.style,i,this.format(ot(t,i,O,!1,"0px 0px")),this.format(e),!1,"0px",s)},prefix:!0,formatter:mt("0px 0px",!1,!0)}),Pt("backgroundPosition",{defaultValue:"0 0",parser:function(t,e,i,r,s,n){var a,o,l,h,f,u,p="background-position",_=O||at(t,null),c=this.format((_?C?_.getPropertyValue(p+"-x")+" "+_.getPropertyValue(p+"-y"):_.getPropertyValue(p):t.currentStyle.backgroundPositionX+" "+t.currentStyle.backgroundPositionY)||"0 0"),d=this.format(e);if(-1!==c.indexOf("%")!=(-1!==d.indexOf("%"))&&d.split(",").length<2&&(u=ot(t,"backgroundImage").replace(j,""))&&"none"!==u){for(a=c.split(" "),o=d.split(" "),tt.setAttribute("src",u),l=2;-1<--l;)(h=-1!==(c=a[l]).indexOf("%"))!=(-1!==o[l].indexOf("%"))&&(f=0===l?t.offsetWidth-tt.width:t.offsetHeight-tt.height,a[l]=h?parseFloat(c)/100*f+"px":parseFloat(c)/f*100+"%");c=a.join(" ")}return this.parseComplex(t.style,c,d,s,n)},formatter:pt}),Pt("backgroundSize",{defaultValue:"0 0",formatter:function(t){return pt(-1===(t+="").indexOf(" ")?t+" "+t:t)}}),Pt("perspective",{defaultValue:"0px",prefix:!0}),Pt("perspectiveOrigin",{defaultValue:"50% 50%",prefix:!0}),Pt("transformStyle",{prefix:!0}),Pt("backfaceVisibility",{prefix:!0}),Pt("userSelect",{prefix:!0}),Pt("margin",{parser:gt("marginTop,marginRight,marginBottom,marginLeft")}),Pt("padding",{parser:gt("paddingTop,paddingRight,paddingBottom,paddingLeft")}),Pt("clip",{defaultValue:"rect(0px,0px,0px,0px)",parser:function(t,e,i,r,s,n){var a,o,l;return e=C<9?(o=t.currentStyle,l=C<8?" ":",",a="rect("+o.clipTop+l+o.clipRight+l+o.clipBottom+l+o.clipLeft+")",this.format(e).split(",").join(l)):(a=this.format(ot(t,this.p,O,!1,this.dflt)),this.format(e)),this.parseComplex(t.style,a,e,s,n)}}),Pt("textShadow",{defaultValue:"0px 0px 0px #999",color:!0,multi:!0}),Pt("autoRound,strictUnits",{parser:function(t,e,i,r,s){return s}}),Pt("border",{defaultValue:"0px solid #000",parser:function(t,e,i,r,s,n){var a=ot(t,"borderTopWidth",O,!1,"0px"),o=this.format(e).split(" "),l=o[0].replace(I,"");return"px"!==l&&(a=parseFloat(a)/lt(t,"borderTopWidth",1,l)+l),this.parseComplex(t.style,this.format(a+" "+ot(t,"borderTopStyle",O,!1,"solid")+" "+ot(t,"borderTopColor",O,!1,"#000")),o.join(" "),s,n)},color:!0,formatter:function(t){var e=t.split(" ");return e[0]+" "+(e[1]||"solid")+" "+(t.match(dt)||["#000"])[0]}}),Pt("borderWidth",{parser:gt("borderTopWidth,borderRightWidth,borderBottomWidth,borderLeftWidth")}),Pt("float,cssFloat,styleFloat",{parser:function(t,e,i,r,s,n){var a=t.style,o="cssFloat"in a?"cssFloat":"styleFloat";return new xt(a,o,0,0,s,-1,i,!1,0,a[o],e)}});function $t(t){var e,i=this.t,r=i.filter||ot(this.data,"filter")||"",s=this.s+this.c*t|0;100==s&&(e=-1===r.indexOf("atrix(")&&-1===r.indexOf("radient(")&&-1===r.indexOf("oader(")?(i.removeAttribute("filter"),!ot(this.data,"filter")):(i.filter=r.replace(l,""),!0)),e||(this.xn1&&(i.filter=r=r||"alpha(opacity="+s+")"),-1===r.indexOf("pacity")?0==s&&this.xn1||(i.filter=r+" alpha(opacity="+s+")"):i.filter=r.replace(N,"opacity="+s))}Pt("opacity,alpha,autoAlpha",{defaultValue:"1",parser:function(t,e,i,r,s,n){var a=parseFloat(ot(t,"opacity",O,!1,"1")),o=t.style,l="autoAlpha"===i;return"string"==typeof e&&"="===e.charAt(1)&&(e=("-"===e.charAt(0)?-1:1)*parseFloat(e.substr(2))+a),l&&1===a&&"hidden"===ot(t,"visibility",O)&&0!==e&&(a=0),rt?s=new xt(o,"opacity",a,e-a,s):((s=new xt(o,"opacity",100*a,100*(e-a),s)).xn1=l?1:0,o.zoom=1,s.type=2,s.b="alpha(opacity="+s.s+")",s.e="alpha(opacity="+(s.s+s.c)+")",s.data=t,s.plugin=n,s.setRatio=$t),l&&((s=new xt(o,"visibility",0,0,s,-1,null,!1,0,0!==a?"inherit":"hidden",0===e?"hidden":"inherit")).xs0="inherit",r._overwriteProps.push(s.n),r._overwriteProps.push(i)),s}});function Qt(t){if(this.t._fwdClassPT=this,1===t||0===t){this.t.setAttribute("class",0===t?this.b:this.e);for(var e=this.data,i=this.t.style;e;)e.v?i[e.p]=e.v:Gt(i,e.p),e=e._next;1===t&&this.t._fwdClassPT===this&&(this.t._fwdClassPT=null)}else this.t.getAttribute("class")!==this.e&&this.t.setAttribute("class",this.e)}var Gt=function(t,e){e&&(t.removeProperty?("ms"!==e.substr(0,2)&&"webkit"!==e.substr(0,6)||(e="-"+e),t.removeProperty(e.replace(u,"-$1").toLowerCase())):t.removeAttribute(e))};Pt("className",{parser:function(t,e,i,r,s,n,a){var o,l,h,f,u,p=t.getAttribute("class")||"",_=t.style.cssText;if((s=r._classNamePT=new xt(t,i,0,0,s,2)).setRatio=Qt,s.pr=-11,c=!0,s.b=p,l=y(t,O),h=t._fwdClassPT){for(f={},u=h.data;u;)f[u.p]=1,u=u._next;h.setRatio(1)}return(t._fwdClassPT=s).e="="!==e.charAt(1)?e:p.replace(new RegExp("(?:\\s|^)"+e.substr(2)+"(?![\\w-])"),"")+("+"===e.charAt(0)?" "+e.substr(2):""),t.setAttribute("class",s.e),o=v(t,l,y(t),a,f),t.setAttribute("class",p),s.data=o.firstMPT,t.style.cssText=_,s=s.xfirst=r.parse(t,o.difs,s,n)}});function Ht(t){if((1===t||0===t)&&this.data._totalTime===this.data._totalDuration&&"isFromStart"!==this.data.data){var e,i,r,s,n,a=this.t.style,o=m.transform.parse;if("all"===this.e)s=!(a.cssText="");else for(r=(e=this.e.split(" ").join("").split(",")).length;-1<--r;)i=e[r],m[i]&&(m[i].parse===o?s=!0:i="transformOrigin"===i?Nt:m[i].p),Gt(a,i);s&&(Gt(a,Xt),(n=this.t._fwdTransform)&&(n.svg&&(this.t.removeAttribute("data-svg-origin"),this.t.removeAttribute("transform")),delete this.t._fwdTransform))}}for(Pt("clearProps",{parser:function(t,e,i,r,s){return(s=new xt(t,i,0,0,s,2)).setRatio=Ht,s.e=e,s.pr=-10,s.data=r._tween,c=!0,s}}),t="bezier,throwProps,physicsProps,physics2D".split(","),Tt=t.length;Tt--;)Ot(t[Tt]);(t=W.prototype)._firstPT=t._lastParsedTransform=t._transform=null,t._onInitTween=function(t,e,i,r){if(!t.nodeType)return!1;this._target=F=t,this._tween=i,this._vars=e,D=r,M=e.autoRound,c=!1,P=e.suffixMap||W.suffixMap,O=at(t,""),d=this._overwriteProps;var s,n,a,o,l,h,f,u,p,_=t.style;if(x&&""===_.zIndex&&("auto"!==(s=ot(t,"zIndex",O))&&""!==s||this._addLazySet(_,"zIndex",0)),"string"==typeof e&&(o=_.cssText,s=y(t,O),_.cssText=o+";"+e,s=v(t,s,y(t)).difs,!rt&&E.test(e)&&(s.opacity=parseFloat(RegExp.$1)),e=s,_.cssText=o),e.className?this._firstPT=n=m.className.parse(t,e.className,"className",this,null,null,e):this._firstPT=n=this.parse(t,e,null),this._transformType){for(p=3===this._transformType,Xt?w&&(x=!0,""===_.zIndex&&("auto"!==(f=ot(t,"zIndex",O))&&""!==f||this._addLazySet(_,"zIndex",0)),T&&this._addLazySet(_,"WebkitBackfaceVisibility",this._vars.WebkitBackfaceVisibility||(p?"visible":"hidden"))):_.zoom=1,a=n;a&&a._next;)a=a._next;u=new xt(t,"transform",0,0,null,2),this._linkCSSP(u,null,a),u.setRatio=Xt?Ut:St,u.data=this._transform||Zt(t,O,!0),u.tween=i,u.pr=-1,d.pop()}if(c){for(;n;){for(h=n._next,a=o;a&&a.pr>n.pr;)a=a._next;(n._prev=a?a._prev:l)?n._prev._next=n:o=n,(n._next=a)?a._prev=n:l=n,n=h}this._firstPT=o}return!0},t.parse=function(t,e,i,r){var s,n,a,o,l,h,f,u,p,_,c=t.style;for(s in e)"function"==typeof(h=e[s])&&(h=h(D,F)),(n=m[s])?i=n.parse(t,h,s,this,i,r,e):(l=ot(t,s,O)+"",p="string"==typeof h,"color"===s||"fill"===s||"stroke"===s||-1!==s.indexOf("Color")||p&&L.test(h)?(p||(h=(3<(h=ct(h)).length?"rgba(":"rgb(")+h.join(",")+")"),i=wt(c,s,l,h,!0,"transparent",i,0,r)):p&&$.test(h)?i=wt(c,s,l,h,!0,null,i,0,r):(f=(a=parseFloat(l))||0===a?l.substr((a+"").length):"",""!==l&&"auto"!==l||(f="width"===s||"height"===s?(a=function(t,e,i){if("svg"===(t.nodeName+"").toLowerCase())return(i||at(t))[e]||0;if(t.getBBox&&jt(t))return t.getBBox()[e]||0;var r=parseFloat("width"===e?t.offsetWidth:t.offsetHeight),s=ft[e],n=s.length;for(i=i||at(t,null);-1<--n;)r-=parseFloat(ot(t,"padding"+s[n],i,!0))||0,r-=parseFloat(ot(t,"border"+s[n]+"Width",i,!0))||0;return r}(t,s,O),"px"):"left"===s||"top"===s?(a=ht(t,s,O),"px"):(a="opacity"!==s?0:1,"")),""===(u=(_=p&&"="===h.charAt(1))?(o=parseInt(h.charAt(0)+"1",10),h=h.substr(2),o*=parseFloat(h),h.replace(I,"")):(o=parseFloat(h),p?h.replace(I,""):""))&&(u=s in P?P[s]:f),h=o||0===o?(_?o+a:o)+u:e[s],f!==u&&""!==u&&(o||0===o)&&a&&(a=lt(t,s,a,f),"%"===u?(a/=lt(t,s,100,"%")/100,!0!==e.strictUnits&&(l=a+"%")):"em"===u||"rem"===u||"vw"===u||"vh"===u?a/=lt(t,s,1,u):"px"!==u&&(o=lt(t,s,o,u),u="px"),_&&(!o&&0!==o||(h=o+a+u))),_&&(o+=a),!a&&0!==a||!o&&0!==o?void 0!==c[s]&&(h||h+""!="NaN"&&null!=h)?(i=new xt(c,s,o||a||0,0,i,-1,s,!1,0,l,h)).xs0="none"!==h||"display"!==s&&-1===s.indexOf("Style")?h:l:g("invalid "+s+" tween value: "+e[s]):(i=new xt(c,s,a,o-a,i,0,s,!1!==M&&("px"===u||"zIndex"===s),0,l,h)).xs0=u)),r&&i&&!i.plugin&&(i.plugin=r);return i},t.setRatio=function(t){var e,i,r,s=this._firstPT;if(1!==t||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(t||this._tween._time!==this._tween._duration&&0!==this._tween._time||-1e-6===this._tween._rawPrevTime)for(;s;){if(e=s.c*t+s.s,s.r?e=Math.round(e):e<1e-6&&-1e-6<e&&(e=0),s.type)if(1===s.type)if(2===(r=s.l))s.t[s.p]=s.xs0+e+s.xs1+s.xn1+s.xs2;else if(3===r)s.t[s.p]=s.xs0+e+s.xs1+s.xn1+s.xs2+s.xn2+s.xs3;else if(4===r)s.t[s.p]=s.xs0+e+s.xs1+s.xn1+s.xs2+s.xn2+s.xs3+s.xn3+s.xs4;else if(5===r)s.t[s.p]=s.xs0+e+s.xs1+s.xn1+s.xs2+s.xn2+s.xs3+s.xn3+s.xs4+s.xn4+s.xs5;else{for(i=s.xs0+e+s.xs1,r=1;r<s.l;r++)i+=s["xn"+r]+s["xs"+(r+1)];s.t[s.p]=i}else-1===s.type?s.t[s.p]=s.xs0:s.setRatio&&s.setRatio(t);else s.t[s.p]=e+s.xs0;s=s._next}else for(;s;)2!==s.type?s.t[s.p]=s.b:s.setRatio(t),s=s._next;else for(;s;){if(2!==s.type)if(s.r&&-1!==s.type)if(e=Math.round(s.s+s.c),s.type){if(1===s.type){for(r=s.l,i=s.xs0+e+s.xs1,r=1;r<s.l;r++)i+=s["xn"+r]+s["xs"+(r+1)];s.t[s.p]=i}}else s.t[s.p]=e+s.xs0;else s.t[s.p]=s.e;else s.setRatio(t);s=s._next}},t._enableTransforms=function(t){this._transform=this._transform||Zt(this._target,O,!0),this._transformType=this._transform.svg&&At||!t&&3!==this._transformType?2:3};function Kt(t){this.t[this.p]=this.e,this.data._linkCSSP(this,this._next,null,!0)}t._addLazySet=function(t,e,i){var r=this._firstPT=new xt(t,e,0,0,this._firstPT,2);r.e=i,r.setRatio=Kt,r.data=this},t._linkCSSP=function(t,e,i,r){return t&&(e&&(e._prev=t),t._next&&(t._next._prev=t._prev),t._prev?t._prev._next=t._next:this._firstPT===t&&(this._firstPT=t._next,r=!0),i?i._next=t:r||null!==this._firstPT||(this._firstPT=t),t._next=e,t._prev=i),t},t._mod=function(t){for(var e=this._firstPT;e;)"function"==typeof t[e.p]&&t[e.p]===Math.round&&(e.r=1),e=e._next},t._kill=function(t){var e,i,r,s=t;if(t.autoAlpha||t.alpha){for(i in s={},t)s[i]=t[i];s.opacity=1,s.autoAlpha&&(s.visibility=1)}for(t.className&&(e=this._classNamePT)&&((r=e.xfirst)&&r._prev?this._linkCSSP(r._prev,e._next,r._prev._prev):r===this._firstPT&&(this._firstPT=e._next),e._next&&this._linkCSSP(e._next,e._next._next,r._prev),this._classNamePT=null),e=this._firstPT;e;)e.plugin&&e.plugin!==i&&e.plugin._kill&&(e.plugin._kill(t),i=e.plugin),e=e._next;return n.prototype._kill.call(this,s)};var Jt=function(t,e,i){var r,s,n,a;if(t.slice)for(s=t.length;-1<--s;)Jt(t[s],e,i);else for(s=(r=t.childNodes).length;-1<--s;)a=(n=r[s]).type,n.style&&(e.push(y(n)),i&&i.push(n)),1!==a&&9!==a&&11!==a||!n.childNodes.length||Jt(n,e,i)};return W.cascadeTo=function(t,e,i){var r,s,n,a,o=B.to(t,e,i),l=[o],h=[],f=[],u=[],p=B._internals.reservedProps;for(t=o._targets||o.target,Jt(t,h,u),o.render(e,!0,!0),Jt(t,f),o.render(0,!0,!0),o._enabled(!0),r=u.length;-1<--r;)if((s=v(u[r],h[r],f[r])).firstMPT){for(n in s=s.difs,i)p[n]&&(s[n]=i[n]);for(n in a={},s)a[n]=h[r][n];l.push(B.fromTo(u[r],e,a,s))}return l},n.activate([W]),W},!0),_fwd_fwdScope.FWDFWD_fwdDefine("easing.Back",["easing.Ease"],function(m){function t(t,e){var i=f("easing."+t,function(){},!0),r=i.prototype=new m;return r.constructor=i,r.getRatio=e,i}function e(t,e,i,r,s){var n=f("easing."+t,{easeOut:new e,easeIn:new i,easeInOut:new r},!0);return u(n,t),n}function g(t,e,i){this.t=t,this.v=e,i&&(((this.next=i).prev=this).c=i.v-e,this.gap=i.t-t)}function i(t,e){var i=f("easing."+t,function(t){this._p1=t||0===t?t:1.70158,this._p2=1.525*this._p1},!0),r=i.prototype=new m;return r.constructor=i,r.getRatio=e,r.config=function(t){return new i(t)},i}var r,s,n,a=_fwd_fwdScope.FWDGlobals||_fwd_fwdScope,o=a.com.fwd,l=2*Math.PI,h=Math.PI/2,f=o._class,u=m.register||function(){},p=e("Back",i("BackOut",function(t){return--t*t*((this._p1+1)*t+this._p1)+1}),i("BackIn",function(t){return t*t*((this._p1+1)*t-this._p1)}),i("BackInOut",function(t){return(t*=2)<1?.5*t*t*((this._p2+1)*t-this._p2):.5*((t-=2)*t*((this._p2+1)*t+this._p2)+2)})),_=f("easing.SlowMo",function(t,e,i){e=e||0===e?e:.7,null==t?t=.7:1<t&&(t=1),this._p=1!==t?e:0,this._p1=(1-t)/2,this._p2=t,this._p3=this._p1+this._p2,this._calcEnd=!0===i},!0),c=_.prototype=new m;return c.constructor=_,c.getRatio=function(t){var e=t+(.5-t)*this._p;return t<this._p1?this._calcEnd?1-(t=1-t/this._p1)*t:e-(t=1-t/this._p1)*t*t*t*e:t>this._p3?this._calcEnd?1-(t=(t-this._p3)/this._p1)*t:e+(t-e)*(t=(t-this._p3)/this._p1)*t*t*t:this._calcEnd?1:e},_.ease=new _(.7,.7),c.config=_.config=function(t,e,i){return new _(t,e,i)},(c=(r=f("easing.SteppedEase",function(t){t=t||1,this._p1=1/t,this._p2=t+1},!0)).prototype=new m).constructor=r,c.getRatio=function(t){return t<0?t=0:1<=t&&(t=.999999999),(this._p2*t>>0)*this._p1},c.config=r.config=function(t){return new r(t)},(c=(s=f("easing.RoughEase",function(t){for(var e,i,r,s,n,a,o=(t=t||{}).taper||"none",l=[],h=0,f=0|(t.points||20),u=f,p=!1!==t.randomize,_=!0===t.clamp,c=t.template instanceof m?t.template:null,d="number"==typeof t.strength?.4*t.strength:.4;-1<--u;)e=p?Math.random():1/f*u,i=c?c.getRatio(e):e,r="none"===o?d:"out"===o?(s=1-e)*s*d:"in"===o?e*e*d:e<.5?(s=2*e)*s*.5*d:(s=2*(1-e))*s*.5*d,p?i+=Math.random()*r-.5*r:u%2?i+=.5*r:i-=.5*r,_&&(1<i?i=1:i<0&&(i=0)),l[h++]={x:e,y:i};for(l.sort(function(t,e){return t.x-e.x}),a=new g(1,1,null),u=f;-1<--u;)n=l[u],a=new g(n.x,n.y,a);this._prev=new g(0,0,0!==a.t?a:a.next)},!0)).prototype=new m).constructor=s,c.getRatio=function(t){var e=this._prev;if(t>e.t){for(;e.next&&t>=e.t;)e=e.next;e=e.prev}else for(;e.prev&&t<=e.t;)e=e.prev;return(this._prev=e).v+(t-e.t)/e.gap*e.c},c.config=function(t){return new s(t)},s.ease=new s,e("Bounce",t("BounceOut",function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}),t("BounceIn",function(t){return(t=1-t)<1/2.75?1-7.5625*t*t:t<2/2.75?1-(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}),t("BounceInOut",function(t){var e=t<.5;return(t=e?1-2*t:2*t-1)<1/2.75?t*=7.5625*t:t=t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5})),e("Circ",t("CircOut",function(t){return Math.sqrt(1- --t*t)}),t("CircIn",function(t){return-(Math.sqrt(1-t*t)-1)}),t("CircInOut",function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)})),e("Elastic",(n=function(t,e,i){var r=f("easing."+t,function(t,e){this._p1=1<=t?t:1,this._p2=(e||i)/(t<1?t:1),this._p3=this._p2/l*(Math.asin(1/this._p1)||0),this._p2=l/this._p2},!0),s=r.prototype=new m;return s.constructor=r,s.getRatio=e,s.config=function(t,e){return new r(t,e)},r})("ElasticOut",function(t){return this._p1*Math.pow(2,-10*t)*Math.sin((t-this._p3)*this._p2)+1},.3),n("ElasticIn",function(t){return-(this._p1*Math.pow(2,10*--t)*Math.sin((t-this._p3)*this._p2))},.3),n("ElasticInOut",function(t){return(t*=2)<1?this._p1*Math.pow(2,10*--t)*Math.sin((t-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*--t)*Math.sin((t-this._p3)*this._p2)*.5+1},.45)),e("Expo",t("ExpoOut",function(t){return 1-Math.pow(2,-10*t)}),t("ExpoIn",function(t){return Math.pow(2,10*(t-1))-.001}),t("ExpoInOut",function(t){return(t*=2)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))})),e("Sine",t("SineOut",function(t){return Math.sin(t*h)}),t("SineIn",function(t){return 1-Math.cos(t*h)}),t("SineInOut",function(t){return-.5*(Math.cos(Math.PI*t)-1)})),f("easing.EaseLookup",{find:function(t){return m.map[t]}},!0),u(a.SlowMo,"SlowMo","ease,"),u(s,"RoughEase","ease,"),u(r,"SteppedEase","ease,"),p},!0)}),_fwd_fwdScope.FWDFWD_fwdDefine&&_fwd_fwdScope._fwd_fwdQueue.pop()(),function(_,c){"use strict";var d={},m=_.FWDGlobals=_.FWDGlobals||_;if(!m.FWDTweenLite){var g,e,i,y=function(t){for(var e=t.split("."),i=m,r=0;r<e.length;r++)i[e[r]]=i=i[e[r]]||{};return i},u=y("com.fwd"),v=1e-10,l=function(t){for(var e=[],i=t.length,r=0;r!==i;e.push(t[r++]));return e},r=function(){},x=(e=Object.prototype.toString,i=e.call([]),function(t){return null!=t&&(t instanceof Array||"object"==typeof t&&!!t.push&&e.call(t)===i)}),w={},T=function(l,h,f,u){this.sc=w[l]?w[l].sc:[],(w[l]=this).gsClass=null,this.func=f;var p=[];this.check=function(t){for(var e,i,r,s,n,a=h.length,o=a;-1<--a;)(e=w[h[a]]||new T(h[a],[])).gsClass?(p[a]=e.gsClass,o--):t&&e.sc.push(this);if(0===o&&f){if(r=(i=("com.fwd."+l).split(".")).pop(),s=y(i.join("."))[r]=this.gsClass=f.apply(f,p),u)if(m[r]=d[r]=s,!(n="undefined"!=typeof fwd_module&&fwd_module.exports)&&"function"==typeof define&&define.amd)define((_.FWDAMDPath?_.FWDAMDPath+"/":"")+l.split(".").pop(),[],function(){return s});else if(n)if(l===c)for(a in fwd_module.exports=d[c]=s,d)s[a]=d[a];else d[c]&&(d[c][r]=s);for(a=0;a<this.sc.length;a++)this.sc[a].check()}},this.check(!0)},s=_.FWDFWD_fwdDefine=function(t,e,i,r){return new T(t,e,i,r)},p=u._class=function(t,e,i){return e=e||function(){},s(t,[],function(){return e},i),e};s.globals=m;var t,n=[0,0,1,1],b=p("easing.Ease",function(t,e,i,r){this._func=t,this._type=i||0,this._power=r||0,this._params=e?n.concat(e):n},!0),P=b.map={},a=b.register=function(t,e,i,r){for(var s,n,a,o,l=e.split(","),h=l.length,f=(i||"easeIn,easeOut,easeInOut").split(",");-1<--h;)for(n=l[h],s=r?p("easing."+n,null,!0):u.easing[n]||{},a=f.length;-1<--a;)o=f[a],P[n+"."+o]=P[o+n]=s[o]=t.getRatio?t:t[o]||new t};for((t=b.prototype)._calcEnd=!1,t.getRatio=function(t){if(this._func)return this._params[0]=t,this._func.apply(null,this._params);var e=this._type,i=this._power,r=1===e?1-t:2===e?t:t<.5?2*t:2*(1-t);return 1===i?r*=r:2===i?r*=r*r:3===i?r*=r*r*r:4===i&&(r*=r*r*r*r),1===e?1-r:2===e?r:t<.5?r/2:1-r/2},h=(o=["Linear","Quad","Cubic","Quart","Quint,Strong"]).length;-1<--h;)t=o[h]+",Power"+h,a(new b(null,null,1,h),t,"easeOut",!0),a(new b(null,null,2,h),t,"easeIn"+(0===h?",easeNone":"")),a(new b(null,null,3,h),t,"easeInOut");P.linear=u.easing.Linear.easeIn,P.swing=u.easing.Quad.easeInOut;var O=p("events.EventDispatcher",function(t){this._listeners={},this._eventTarget=t||this});(t=O.prototype).addEventListener=function(t,e,i,r,s){s=s||0;var n,a,o=this._listeners[t],l=0;for(this!==M||g||M.wake(),null==o&&(this._listeners[t]=o=[]),a=o.length;-1<--a;)(n=o[a]).c===e&&n.s===i?o.splice(a,1):0===l&&n.pr<s&&(l=a+1);o.splice(l,0,{c:e,s:i,up:r,pr:s})},t.removeEventListener=function(t,e){var i,r=this._listeners[t];if(r)for(i=r.length;-1<--i;)if(r[i].c===e)return void r.splice(i,1)},t.dispatchEvent=function(t){var e,i,r,s=this._listeners[t];if(s)for(1<(e=s.length)&&(s=s.slice(0)),i=this._eventTarget;-1<--e;)(r=s[e])&&(r.up?r.c.call(r.s||i,{type:t,target:i}):r.c.call(r.s||i))};for(var o,k=_.requestAnimationFrame,R=_.cancelAnimationFrame,S=Date.now||function(){return(new Date).getTime()},A=S(),h=(o=["ms","moz","webkit","o"]).length;-1<--h&&!k;)k=_[o[h]+"RequestAnimationFrame"],R=_[o[h]+"CancelAnimationFrame"]||_[o[h]+"CancelRequestAnimationFrame"];p("Ticker",function(t,e){var s,n,a,o,l,h=this,f=S(),i=!(!1===e||!k)&&"auto",u=500,p=33,_=function(t){var e,i,r=S()-A;u<r&&(f+=r-p),A+=r,h.time=(A-f)/1e3,e=h.time-l,(!s||0<e||!0===t)&&(h.frame++,l+=e+(o<=e?.004:o-e),i=!0),!0!==t&&(a=n(_)),i&&h.dispatchEvent("tick")};O.call(h),h.time=h.frame=0,h.tick=function(){_(!0)},h.lagSmoothing=function(t,e){u=t||1e10,p=Math.min(e,u,0)},h.sleep=function(){null!=a&&((i&&R?R:clearTimeout)(a),n=r,a=null,h===M&&(g=!1))},h.wake=function(t){null!==a?h.sleep():t?f+=-A+(A=S()):10<h.frame&&(A=S()-u+5),n=0===s?r:i&&k?k:function(t){return setTimeout(t,1e3*(l-h.time)+1|0)},h===M&&(g=!0),_(2)},h.fps=function(t){if(!arguments.length)return s;o=1/((s=t)||60),l=this.time+o,h.wake()},h.useRAF=function(t){if(!arguments.length)return i;h.sleep(),i=t,h.fps(s)},h.fps(t),setTimeout(function(){"auto"===i&&h.frame<5&&"hidden"!==document.visibilityState&&h.useRAF(!1)},1500)}),(t=u.Ticker.prototype=new u.events.EventDispatcher).constructor=u.Ticker;var f=p("core.FWDAnimation",function(t,e){var i;this.vars=e=e||{},this._duration=this._totalDuration=t||0,this._delay=Number(e.delay)||0,this._timeScale=1,this._active=!0===e.immediateRender,this.data=e.data,this._reversed=!0===e.reversed,$&&(g||M.wake(),(i=this.vars.useFrames?U:$).add(this,i._time),this.vars.paused&&this.paused(!0))}),M=f.ticker=new u.Ticker;(t=f.prototype)._dirty=t._gc=t._initted=t._paused=!1,t._totalTime=t._time=0,t._rawPrevTime=-1,t._next=t._last=t._onUpdate=t._timeline=t.timeline=null,t._paused=!1;var C=function(){g&&2e3<S()-A&&M.wake(),setTimeout(C,2e3)};C(),t.play=function(t,e){return null!=t&&this.seek(t,e),this.reversed(!1).paused(!1)},t.pause=function(t,e){return null!=t&&this.seek(t,e),this.paused(!0)},t.resume=function(t,e){return null!=t&&this.seek(t,e),this.paused(!1)},t.seek=function(t,e){return this.totalTime(Number(t),!1!==e)},t.restart=function(t,e){return this.reversed(!1).paused(!1).totalTime(t?-this._delay:0,!1!==e,!0)},t.reverse=function(t,e){return null!=t&&this.seek(t||this.totalDuration(),e),this.reversed(!0).paused(!1)},t.render=function(t,e,i){},t.invalidate=function(){return this._time=this._totalTime=0,this._initted=this._gc=!1,this._rawPrevTime=-1,!this._gc&&this.timeline||this._enabled(!0),this},t.isActive=function(){var t,e=this._timeline,i=this._startTime;return!e||!this._gc&&!this._paused&&e.isActive()&&(t=e.rawTime())>=i&&t<i+this.totalDuration()/this._timeScale},t._enabled=function(t,e){return g||M.wake(),this._gc=!t,this._active=this.isActive(),!0!==e&&(t&&!this.timeline?this._timeline.add(this,this._startTime-this._delay):!t&&this.timeline&&this._timeline._remove(this,!0)),!1},t._kill=function(t,e){return this._enabled(!1,!1)},t.kill=function(t,e){return this._kill(t,e),this},t._uncache=function(t){for(var e=t?this:this.timeline;e;)e._dirty=!0,e=e.timeline;return this},t._swapSelfInParams=function(t){for(var e=t.length,i=t.concat();-1<--e;)"{self}"===t[e]&&(i[e]=this);return i},t._callback=function(t){var e=this.vars,i=e[t],r=e[t+"Params"],s=e[t+"Scope"]||e.callbackScope||this;switch(r?r.length:0){case 0:i.call(s);break;case 1:i.call(s,r[0]);break;case 2:i.call(s,r[0],r[1]);break;default:i.apply(s,r)}},t.eventCallback=function(t,e,i,r){if("on"===(t||"").substr(0,2)){var s=this.vars;if(1===arguments.length)return s[t];null==e?delete s[t]:(s[t]=e,s[t+"Params"]=x(i)&&-1!==i.join("").indexOf("{self}")?this._swapSelfInParams(i):i,s[t+"Scope"]=r),"onUpdate"===t&&(this._onUpdate=e)}return this},t.delay=function(t){return arguments.length?(this._timeline.smoothChildTiming&&this.startTime(this._startTime+t-this._delay),this._delay=t,this):this._delay},t.duration=function(t){return arguments.length?(this._duration=this._totalDuration=t,this._uncache(!0),this._timeline.smoothChildTiming&&0<this._time&&this._time<this._duration&&0!==t&&this.totalTime(this._totalTime*(t/this._duration),!0),this):(this._dirty=!1,this._duration)},t.totalDuration=function(t){return this._dirty=!1,arguments.length?this.duration(t):this._totalDuration},t.time=function(t,e){return arguments.length?(this._dirty&&this.totalDuration(),this.totalTime(t>this._duration?this._duration:t,e)):this._time},t.totalTime=function(t,e,i){if(g||M.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(t<0&&!i&&(t+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var r=this._totalDuration,s=this._timeline;if(r<t&&!i&&(t=r),this._startTime=(this._paused?this._pauseTime:s._time)-(this._reversed?r-t:t)/this._timeScale,s._dirty||this._uncache(!1),s._timeline)for(;s._timeline;)s._timeline._time!==(s._startTime+s._totalTime)/s._timeScale&&s.totalTime(s._totalTime,!0),s=s._timeline}this._gc&&this._enabled(!0,!1),this._totalTime===t&&0!==this._duration||(X.length&&G(),this.render(t,e,!1),X.length&&G())}return this},t.progress=t.totalProgress=function(t,e){var i=this.duration();return arguments.length?this.totalTime(i*t,e):i?this._time/i:this.ratio},t.startTime=function(t){return arguments.length?(t!==this._startTime&&(this._startTime=t,this.timeline&&this.timeline._sortChildren&&this.timeline.add(this,t-this._delay)),this):this._startTime},t.endTime=function(t){return this._startTime+(0!=t?this.totalDuration():this.duration())/this._timeScale},t.timeScale=function(t){return arguments.length?(t=t||v,this._timeline&&this._timeline.smoothChildTiming&&(i=(e=this._pauseTime)||0===e?e:this._timeline.totalTime(),this._startTime=i-(i-this._startTime)*this._timeScale/t),this._timeScale=t,this._uncache(!1)):this._timeScale;var e,i},t.reversed=function(t){return arguments.length?(t!=this._reversed&&(this._reversed=t,this.totalTime(this._timeline&&!this._timeline.smoothChildTiming?this.totalDuration()-this._totalTime:this._totalTime,!0)),this):this._reversed},t.paused=function(t){if(!arguments.length)return this._paused;var e,i,r=this._timeline;return t!=this._paused&&r&&(g||t||M.wake(),i=(e=r.rawTime())-this._pauseTime,!t&&r.smoothChildTiming&&(this._startTime+=i,this._uncache(!1)),this._pauseTime=t?e:null,this._paused=t,this._active=this.isActive(),!t&&0!=i&&this._initted&&this.duration()&&(e=r.smoothChildTiming?this._totalTime:(e-this._startTime)/this._timeScale,this.render(e,e===this._totalTime,!0))),this._gc&&!t&&this._enabled(!0,!1),this};var F=p("core.FWDSimpleTimeline",function(t){f.call(this,0,t),this.autoRemoveChildren=this.smoothChildTiming=!0});(t=F.prototype=new f).constructor=F,t.kill()._gc=!1,t._first=t._last=t._recent=null,t._sortChildren=!1,t.add=t.insert=function(t,e,i,r){var s,n;if(t._startTime=Number(e||0)+t._delay,t._paused&&this!==t._timeline&&(t._pauseTime=t._startTime+(this.rawTime()-t._startTime)/t._timeScale),t.timeline&&t.timeline._remove(t,!0),t.timeline=t._timeline=this,t._gc&&t._enabled(!0,!0),s=this._last,this._sortChildren)for(n=t._startTime;s&&s._startTime>n;)s=s._prev;return s?(t._next=s._next,s._next=t):(t._next=this._first,this._first=t),t._next?t._next._prev=t:this._last=t,t._prev=s,this._recent=t,this._timeline&&this._uncache(!0),this},t._remove=function(t,e){return t.timeline===this&&(e||t._enabled(!1,!0),t._prev?t._prev._next=t._next:this._first===t&&(this._first=t._next),t._next?t._next._prev=t._prev:this._last===t&&(this._last=t._prev),t._next=t._prev=t.timeline=null,t===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},t.render=function(t,e,i){var r,s=this._first;for(this._totalTime=this._time=this._rawPrevTime=t;s;)r=s._next,(s._active||t>=s._startTime&&!s._paused)&&(s._reversed?s.render((s._dirty?s.totalDuration():s._totalDuration)-(t-s._startTime)*s._timeScale,e,i):s.render((t-s._startTime)*s._timeScale,e,i)),s=r},t.rawTime=function(){return g||M.wake(),this._totalTime};var D=p("FWDTweenLite",function(t,e,i){if(f.call(this,e,i),this.render=D.prototype.render,null==t)throw"Cannot tween a null target.";this.target=t="string"==typeof t&&D.selector(t)||t;var r,s,n,a=t.jquery||t.length&&t!==_&&t[0]&&(t[0]===_||t[0].nodeType&&t[0].style&&!t.nodeType),o=this.vars.overwrite;if(this._overwrite=o=null==o?Z[D.defaultOverwrite]:"number"==typeof o?o>>0:Z[o],(a||t instanceof Array||t.push&&x(t))&&"number"!=typeof t[0])for(this._targets=n=l(t),this._propLookup=[],this._siblings=[],r=0;r<n.length;r++)(s=n[r])?"string"!=typeof s?s.length&&s!==_&&s[0]&&(s[0]===_||s[0].nodeType&&s[0].style&&!s.nodeType)?(n.splice(r--,1),this._targets=n=n.concat(l(s))):(this._siblings[r]=H(s,this,!1),1===o&&1<this._siblings[r].length&&J(s,this,null,1,this._siblings[r])):"string"==typeof(s=n[r--]=D.selector(s))&&n.splice(r+1,1):n.splice(r--,1);else this._propLookup={},this._siblings=H(t,this,!1),1===o&&1<this._siblings.length&&J(t,this,null,1,this._siblings);(this.vars.immediateRender||0===e&&0===this._delay&&!1!==this.vars.immediateRender)&&(this._time=-v,this.render(Math.min(0,-this._delay)))},!0),z=function(t){return t&&t.length&&t!==_&&t[0]&&(t[0]===_||t[0].nodeType&&t[0].style&&!t.nodeType)};(t=D.prototype=new f).constructor=D,t.kill()._gc=!1,t.ratio=0,t._firstPT=t._targets=t._overwrittenProps=t._startAt=null,t._notifyPluginsOfEnabled=t._lazy=!1,D.version="1.19.0",D.defaultEase=t._ease=new b(null,null,1,1),D.defaultOverwrite="auto",D.ticker=M,D.autoSleep=120,D.lagSmoothing=function(t,e){M.lagSmoothing(t,e)},D.selector=_.$||_.jQuery||function(t){var e=_.$||_.jQuery;return e?(D.selector=e)(t):"undefined"==typeof document?t:document.querySelectorAll?document.querySelectorAll(t):document.getElementById("#"===t.charAt(0)?t.substr(1):t)};var X=[],I={},N=/(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,Y=function(t){for(var e,i=this._firstPT;i;)e=i.blob?t?this.join(""):this.start:i.c*t+i.s,i.m?e=i.m(e,this._target||i.t):e<1e-6&&-1e-6<e&&(e=0),i.f?i.fp?i.t[i.p](i.fp,e):i.t[i.p](e):i.t[i.p]=e,i=i._next},E=function(t,e,i,r){var s,n,a,o,l,h,f,u=[t,e],p=0,_="",c=0;for(u.start=t,i&&(i(u),t=u[0],e=u[1]),u.length=0,s=t.match(N)||[],n=e.match(N)||[],r&&(r._next=null,r.blob=1,u._firstPT=u._applyPT=r),l=n.length,o=0;o<l;o++)f=n[o],_+=(h=e.substr(p,e.indexOf(f,p)-p))||!o?h:",",p+=h.length,c?c=(c+1)%5:"rgba("===h.substr(-5)&&(c=1),f===s[o]||s.length<=o?_+=f:(_&&(u.push(_),_=""),a=parseFloat(s[o]),u.push(a),u._firstPT={_next:u._firstPT,t:u,p:u.length-1,s:a,c:("="===f.charAt(1)?parseInt(f.charAt(0)+"1",10)*parseFloat(f.substr(2)):parseFloat(f)-a)||0,f:0,m:c&&c<4?Math.round:0}),p+=f.length;return(_+=e.substr(p))&&u.push(_),u.setRatio=Y,u},B=function(t,e,i,r,s,n,a,o,l){"function"==typeof r&&(r=r(l||0,t));var h,f="get"===i?t[e]:i,u=typeof t[e],p="string"==typeof r&&"="===r.charAt(1),_={t:t,p:e,s:f,f:"function"==u,pg:0,n:s||e,m:n?"function"==typeof n?n:Math.round:0,pr:0,c:p?parseInt(r.charAt(0)+"1",10)*parseFloat(r.substr(2)):parseFloat(r)-f||0};if("number"!=u&&("function"==u&&"get"===i&&(h=e.indexOf("set")||"function"!=typeof t["get"+e.substr(3)]?e:"get"+e.substr(3),_.s=f=a?t[h](a):t[h]()),"string"==typeof f&&(a||isNaN(f))?(_.fp=a,_={t:E(f,r,o||D.defaultStringFilter,_),p:"setRatio",s:0,c:1,f:2,pg:0,n:s||e,pr:0,m:0}):p||(_.s=parseFloat(f),_.c=parseFloat(r)-_.s||0)),_.c)return(_._next=this._firstPT)&&(_._next._prev=_),this._firstPT=_},W=D._internals={isArray:x,isSelector:z,lazyTweens:X,blobDif:E},L=D._plugins={},j=W.tweenLookup={},V=0,q=W.reservedProps={ease:1,delay:1,overwrite:1,onComplete:1,onCompleteParams:1,onCompleteScope:1,useFrames:1,runBackwards:1,startAt:1,onUpdate:1,onUpdateParams:1,onUpdateScope:1,onStart:1,onStartParams:1,onStartScope:1,onReverseComplete:1,onReverseCompleteParams:1,onReverseCompleteScope:1,onRepeat:1,onRepeatParams:1,onRepeatScope:1,easeParams:1,yoyo:1,immediateRender:1,repeat:1,repeatDelay:1,data:1,paused:1,reversed:1,autoCSS:1,lazy:1,onOverwrite:1,callbackScope:1,stringFilter:1,id:1},Z={none:0,all:1,auto:2,concurrent:3,allOnStart:4,preexisting:5,true:1,false:0},U=f._rootFramesTimeline=new F,$=f._rootTimeline=new F,Q=30,G=W.lazyRender=function(){var t,e=X.length;for(I={};-1<--e;)(t=X[e])&&!1!==t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0),t._lazy=!1);X.length=0};$._startTime=M.time,U._startTime=M.frame,$._active=U._active=!0,setTimeout(G,1),f._updateRoot=D.render=function(){var t,e,i;if(X.length&&G(),$.render((M.time-$._startTime)*$._timeScale,!1,!1),U.render((M.frame-U._startTime)*U._timeScale,!1,!1),X.length&&G(),M.frame>=Q){for(i in Q=M.frame+(parseInt(D.autoSleep,10)||120),j){for(t=(e=j[i].tweens).length;-1<--t;)e[t]._gc&&e.splice(t,1);0===e.length&&delete j[i]}if((!(i=$._first)||i._paused)&&D.autoSleep&&!U._first&&1===M._listeners.tick.length){for(;i&&i._paused;)i=i._next;i||M.sleep()}}},M.addEventListener("tick",f._updateRoot);var H=function(t,e,i){var r,s,n=t._fwdTweenID;if(j[n||(t._fwdTweenID=n="t"+V++)]||(j[n]={target:t,tweens:[]}),e&&((r=j[n].tweens)[s=r.length]=e,i))for(;-1<--s;)r[s]===e&&r.splice(s,1);return j[n].tweens},K=function(t,e,i,r){var s,n,a=t.vars.onOverwrite;return a&&(s=a(t,e,i,r)),(a=D.onOverwrite)&&(n=a(t,e,i,r)),!1!==s&&!1!==n},J=function(t,e,i,r,s){var n,a,o;if(1===r||4<=r){for(o=s.length,_=0;_<o;_++)if((a=s[_])!==e)a._gc||a._kill(null,t,e)&&(n=!0);else if(5===r)break;return n}for(var l,h=e._startTime+v,f=[],u=0,p=0===e._duration,_=s.length;-1<--_;)(a=s[_])===e||a._gc||a._paused||(a._timeline!==e._timeline?(l=l||tt(e,0,p),0===tt(a,l,p)&&(f[u++]=a)):a._startTime<=h&&a._startTime+a.totalDuration()/a._timeScale>h&&((p||!a._initted)&&h-a._startTime<=2e-10||(f[u++]=a)));for(_=u;-1<--_;)if(a=f[_],2===r&&a._kill(i,t,e)&&(n=!0),2!==r||!a._firstPT&&a._initted){if(2!==r&&!K(a,e))continue;a._enabled(!1,!1)&&(n=!0)}return n},tt=function(t,e,i){for(var r=t._timeline,s=r._timeScale,n=t._startTime;r._timeline;){if(n+=r._startTime,s*=r._timeScale,r._paused)return-100;r=r._timeline}return e<(n/=s)?n-e:i&&n===e||!t._initted&&n-e<2*v?v:(n+=t.totalDuration()/t._timeScale/s)>e+v?0:n-e-v};t._init=function(){var t,e,i,r,s,n,a=this.vars,o=this._overwrittenProps,l=this._duration,h=!!a.immediateRender,f=a.ease;if(a.startAt){for(r in this._startAt&&(this._startAt.render(-1,!0),this._startAt.kill()),s={},a.startAt)s[r]=a.startAt[r];if(s.overwrite=!1,s.immediateRender=!0,s.lazy=h&&!1!==a.lazy,s.startAt=s.delay=null,this._startAt=D.to(this.target,0,s),h)if(0<this._time)this._startAt=null;else if(0!==l)return}else if(a.runBackwards&&0!==l)if(this._startAt)this._startAt.render(-1,!0),this._startAt.kill(),this._startAt=null;else{for(r in 0!==this._time&&(h=!1),i={},a)q[r]&&"autoCSS"!==r||(i[r]=a[r]);if(i.overwrite=0,i.data="isFromStart",i.lazy=h&&!1!==a.lazy,i.immediateRender=h,this._startAt=D.to(this.target,0,i),h){if(0===this._time)return}else this._startAt._init(),this._startAt._enabled(!1),this.vars.immediateRender&&(this._startAt=null)}if(this._ease=f=f?f instanceof b?f:"function"==typeof f?new b(f,a.easeParams):P[f]||D.defaultEase:D.defaultEase,a.easeParams instanceof Array&&f.config&&(this._ease=f.config.apply(f,a.easeParams)),this._easeType=this._ease._type,this._easePower=this._ease._power,this._firstPT=null,this._targets)for(n=this._targets.length,t=0;t<n;t++)this._initProps(this._targets[t],this._propLookup[t]={},this._siblings[t],o?o[t]:null,t)&&(e=!0);else e=this._initProps(this.target,this._propLookup,this._siblings,o,0);if(e&&D._onPluginEvent("_onInitAllProps",this),o&&(this._firstPT||"function"!=typeof this.target&&this._enabled(!1,!1)),a.runBackwards)for(i=this._firstPT;i;)i.s+=i.c,i.c=-i.c,i=i._next;this._onUpdate=a.onUpdate,this._initted=!0},t._initProps=function(t,e,i,r,s){var n,a,o,l,h,f;if(null==t)return!1;for(n in I[t._fwdTweenID]&&G(),this.vars.css||t.style&&t!==_&&t.nodeType&&L.css&&!1!==this.vars.autoCSS&&function(t,e){var i,r={};for(i in t)q[i]||i in e&&"transform"!==i&&"x"!==i&&"y"!==i&&"width"!==i&&"height"!==i&&"className"!==i&&"border"!==i||!(!L[i]||L[i]&&L[i]._autoCSS)||(r[i]=t[i],delete t[i]);t.css=r}(this.vars,t),this.vars)if(f=this.vars[n],q[n])f&&(f instanceof Array||f.push&&x(f))&&-1!==f.join("").indexOf("{self}")&&(this.vars[n]=f=this._swapSelfInParams(f,this));else if(L[n]&&(l=new L[n])._onInitTween(t,this.vars[n],this,s)){for(this._firstPT=h={_next:this._firstPT,t:l,p:"setRatio",s:0,c:1,f:1,n:n,pg:1,pr:l._priority,m:0},a=l._overwriteProps.length;-1<--a;)e[l._overwriteProps[a]]=this._firstPT;(l._priority||l._onInitAllProps)&&(o=!0),(l._onDisable||l._onEnable)&&(this._notifyPluginsOfEnabled=!0),h._next&&(h._next._prev=h)}else e[n]=B.call(this,t,n,"get",f,n,0,null,this.vars.stringFilter,s);return r&&this._kill(r,t)?this._initProps(t,e,i,r,s):1<this._overwrite&&this._firstPT&&1<i.length&&J(t,this,e,this._overwrite,i)?(this._kill(e,t),this._initProps(t,e,i,r,s)):(this._firstPT&&(!1!==this.vars.lazy&&this._duration||this.vars.lazy&&!this._duration)&&(I[t._fwdTweenID]=!0),o)},t.render=function(t,e,i){var r,s,n,a,o,l,h,f=this._time,u=this._duration,p=this._rawPrevTime;if(u-1e-7<=t?(this._totalTime=this._time=u,this.ratio=this._ease._calcEnd?this._ease.getRatio(1):1,this._reversed||(r=!0,s="onComplete",i=i||this._timeline.autoRemoveChildren),0===u&&(!this._initted&&this.vars.lazy&&!i||(this._startTime===this._timeline._duration&&(t=0),(p<0||t<=0&&-1e-7<=t||p===v&&"isPause"!==this.data)&&p!==t&&(i=!0,v<p&&(s="onReverseComplete")),this._rawPrevTime=a=!e||t||p===t?t:v))):t<1e-7?(this._totalTime=this._time=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0,(0!==f||0===u&&0<p)&&(s="onReverseComplete",r=this._reversed),t<0&&(this._active=!1,0===u&&(!this._initted&&this.vars.lazy&&!i||(0<=p&&(p!==v||"isPause"!==this.data)&&(i=!0),this._rawPrevTime=a=!e||t||p===t?t:v))),this._initted||(i=!0)):(this._totalTime=this._time=t,this._easeType?(o=t/u,(1===(l=this._easeType)||3===l&&.5<=o)&&(o=1-o),3===l&&(o*=2),1===(h=this._easePower)?o*=o:2===h?o*=o*o:3===h?o*=o*o*o:4===h&&(o*=o*o*o*o),this.ratio=1===l?1-o:2===l?o:t/u<.5?o/2:1-o/2):this.ratio=this._ease.getRatio(t/u)),this._time!==f||i){if(!this._initted){if(this._init(),!this._initted||this._gc)return;if(!i&&this._firstPT&&(!1!==this.vars.lazy&&this._duration||this.vars.lazy&&!this._duration))return this._time=this._totalTime=f,this._rawPrevTime=p,X.push(this),void(this._lazy=[t,e]);this._time&&!r?this.ratio=this._ease.getRatio(this._time/u):r&&this._ease._calcEnd&&(this.ratio=this._ease.getRatio(0===this._time?0:1))}for(!1!==this._lazy&&(this._lazy=!1),this._active||!this._paused&&this._time!==f&&0<=t&&(this._active=!0),0===f&&(this._startAt&&(0<=t?this._startAt.render(t,e,i):s=s||"_dummyGS"),this.vars.onStart&&(0===this._time&&0!==u||e||this._callback("onStart"))),n=this._firstPT;n;)n.f?n.t[n.p](n.c*this.ratio+n.s):n.t[n.p]=n.c*this.ratio+n.s,n=n._next;this._onUpdate&&(t<0&&this._startAt&&-1e-4!==t&&this._startAt.render(t,e,i),e||(this._time!==f||r||i)&&this._callback("onUpdate")),s&&(this._gc&&!i||(t<0&&this._startAt&&!this._onUpdate&&-1e-4!==t&&this._startAt.render(t,e,i),r&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!e&&this.vars[s]&&this._callback(s),0===u&&this._rawPrevTime===v&&a!==v&&(this._rawPrevTime=0)))}},t._kill=function(t,e,i){if("all"===t&&(t=null),null==t&&(null==e||e===this.target))return this._lazy=!1,this._enabled(!1,!1);e="string"!=typeof e?e||this._targets||this.target:D.selector(e)||e;var r,s,n,a,o,l,h,f,u,p=i&&this._time&&i._startTime===this._startTime&&this._timeline===i._timeline;if((x(e)||z(e))&&"number"!=typeof e[0])for(r=e.length;-1<--r;)this._kill(t,e[r],i)&&(l=!0);else{if(this._targets){for(r=this._targets.length;-1<--r;)if(e===this._targets[r]){o=this._propLookup[r]||{},this._overwrittenProps=this._overwrittenProps||[],s=this._overwrittenProps[r]=t?this._overwrittenProps[r]||{}:"all";break}}else{if(e!==this.target)return!1;o=this._propLookup,s=this._overwrittenProps=t?this._overwrittenProps||{}:"all"}if(o){if(h=t||o,f=t!==s&&"all"!==s&&t!==o&&("object"!=typeof t||!t._tempKill),i&&(D.onOverwrite||this.vars.onOverwrite)){for(n in h)o[n]&&(u=u||[]).push(n);if((u||!t)&&!K(this,i,e,u))return!1}for(n in h)(a=o[n])&&(p&&(a.f?a.t[a.p](a.s):a.t[a.p]=a.s,l=!0),a.pg&&a.t._kill(h)&&(l=!0),a.pg&&0!==a.t._overwriteProps.length||(a._prev?a._prev._next=a._next:a===this._firstPT&&(this._firstPT=a._next),a._next&&(a._next._prev=a._prev),a._next=a._prev=null),delete o[n]),f&&(s[n]=1);!this._firstPT&&this._initted&&this._enabled(!1,!1)}}return l},t.invalidate=function(){return this._notifyPluginsOfEnabled&&D._onPluginEvent("_onDisable",this),this._firstPT=this._overwrittenProps=this._startAt=this._onUpdate=null,this._notifyPluginsOfEnabled=this._active=this._lazy=!1,this._propLookup=this._targets?{}:[],f.prototype.invalidate.call(this),this.vars.immediateRender&&(this._time=-v,this.render(Math.min(0,-this._delay))),this},t._enabled=function(t,e){if(g||M.wake(),t&&this._gc){var i,r=this._targets;if(r)for(i=r.length;-1<--i;)this._siblings[i]=H(r[i],this,!0);else this._siblings=H(this.target,this,!0)}return f.prototype._enabled.call(this,t,e),!(!this._notifyPluginsOfEnabled||!this._firstPT)&&D._onPluginEvent(t?"_onEnable":"_onDisable",this)},D.to=function(t,e,i){return new D(t,e,i)},D.from=function(t,e,i){return i.runBackwards=!0,i.immediateRender=0!=i.immediateRender,new D(t,e,i)},D.fromTo=function(t,e,i,r){return r.startAt=i,r.immediateRender=0!=r.immediateRender&&0!=i.immediateRender,new D(t,e,r)},D.delayedCall=function(t,e,i,r,s){return new D(e,0,{delay:t,onComplete:e,onCompleteParams:i,callbackScope:r,onReverseComplete:e,onReverseCompleteParams:i,immediateRender:!1,lazy:!1,useFrames:s,overwrite:0})},D.set=function(t,e){return new D(t,0,e)},D.getTweensOf=function(t,e){if(null==t)return[];var i,r,s,n;if(t="string"==typeof t&&D.selector(t)||t,(x(t)||z(t))&&"number"!=typeof t[0]){for(i=t.length,r=[];-1<--i;)r=r.concat(D.getTweensOf(t[i],e));for(i=r.length;-1<--i;)for(n=r[i],s=i;-1<--s;)n===r[s]&&r.splice(i,1)}else for(i=(r=H(t).concat()).length;-1<--i;)(r[i]._gc||e&&!r[i].isActive())&&r.splice(i,1);return r},D.killTweensOf=D.killDelayedCallsTo=function(t,e,i){"object"==typeof e&&(i=e,e=!1);for(var r=D.getTweensOf(t,e),s=r.length;-1<--s;)r[s]._kill(i,t)};var et=p("plugins.TweenPlugin",function(t,e){this._overwriteProps=(t||"").split(","),this._propName=this._overwriteProps[0],this._priority=e||0,this._super=et.prototype},!0);if(t=et.prototype,et.version="1.19.0",et.API=2,t._firstPT=null,t._addTween=B,t.setRatio=Y,t._kill=function(t){var e,i=this._overwriteProps,r=this._firstPT;if(null!=t[this._propName])this._overwriteProps=[];else for(e=i.length;-1<--e;)null!=t[i[e]]&&i.splice(e,1);for(;r;)null!=t[r.n]&&(r._next&&(r._next._prev=r._prev),r._prev?(r._prev._next=r._next,r._prev=null):this._firstPT===r&&(this._firstPT=r._next)),r=r._next;return!1},t._mod=t._roundProps=function(t){for(var e,i=this._firstPT;i;)(e=t[this._propName]||null!=i.n&&t[i.n.split(this._propName+"_").join("")])&&"function"==typeof e&&(2===i.f?i.t._applyPT.m=e:i.m=e),i=i._next},D._onPluginEvent=function(t,e){var i,r,s,n,a,o=e._firstPT;if("_onInitAllProps"===t){for(;o;){for(a=o._next,r=s;r&&r.pr>o.pr;)r=r._next;(o._prev=r?r._prev:n)?o._prev._next=o:s=o,(o._next=r)?r._prev=o:n=o,o=a}o=e._firstPT=s}for(;o;)o.pg&&"function"==typeof o.t[t]&&o.t[t]()&&(i=!0),o=o._next;return i},et.activate=function(t){for(var e=t.length;-1<--e;)t[e].API===et.API&&(L[(new t[e])._propName]=t[e]);return!0},s.plugin=function(t){if(!(t&&t.propName&&t.init&&t.API))throw"illegal plugin definition.";var e,i=t.propName,r=t.priority||0,s=t.overwriteProps,n={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},a=p("plugins."+i.charAt(0).toUpperCase()+i.substr(1)+"Plugin",function(){et.call(this,i,r),this._overwriteProps=s||[]},!0===t.fwd_global),o=a.prototype=new et(i);for(e in(o.constructor=a).API=t.API,n)"function"==typeof t[e]&&(o[n[e]]=t[e]);return a.version=t.version,et.activate([a]),a},o=_._fwd_fwdQueue){for(h=0;h<o.length;h++)o[h]();for(t in w)w[t].func||_.console.log("FWDAnimation encountered missing dependency: "+t)}g=!1}}("undefined"!=typeof fwd_module&&fwd_module.exports&&"undefined"!=typeof fwd_global?fwd_global:this||window,"FWDAnimation"));/**
 * Ultimate Video Player PACKAGED v9.1
 * Custom deeplinking.
 *
 * @author Tibi - FWDesign [https://webdesign-flash.ro/]
 * Copyright © 2006 All Rights Reserved.
 */
if (typeof fwdal == "undefined") {
    var fwdal = {}
}
if (typeof fwdal.util == "undefined") {
    fwdal.util = {}
}
fwdal.util.Browser = new function () {
    var b = navigator.userAgent.toLowerCase(),
        a = /webkit/.test(b),
        e = /opera/.test(b),
        c = /msie/.test(b) && !/opera/.test(b),
        d = /mozilla/.test(b) && !/(compatible|webkit)/.test(b),
        f = parseFloat(c ? b.substr(b.indexOf("msie") + 4) : (b.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [0, "0"])[1]);
    this.toString = function () {
        return "[class Browser]"
    };
    this.getVersion = function () {
        return f
    };
    this.isMSIE = function () {
        return c
    };
    this.isSafari = function () {
        return a
    };
    this.isOpera = function () {
        return e
    };
    this.isMozilla = function () {
        return d
    }
};
fwdal.util.Events = new function () {
    var c = "DOMContentLoaded",
        j = "onstop",
        k = window,
        h = document,
        b = [],
        a = fwdal.util,
        e = a.Browser,
        d = e.isMSIE(),
        g = e.isSafari();
    this.toString = function () {
        return "[class Events]"
    };
    this.addListener = function (n, l, m) {
        b.push({
            o: n,
            t: l,
            l: m
        });
        if (!(l == c && (d || g))) {
            if (n.addEventListener) {
                n.addEventListener(l, m, false)
            } else {
                if (n.attachEvent) {
                    n.attachEvent("on" + l, m)
                }
            }
        }
    };
    this.removeListener = function (p, m, n) {
        for (var l = 0, o; o = b[l]; l++) {
            if (o.o == p && o.t == m && o.l == n) {
                b.splice(l, 1);
                break
            }
        }
        if (!(m == c && (d || g))) {
            if (p.removeEventListener) {
                p.removeEventListener(m, n, false)
            } else {
                if (p.detachEvent) {
                    p.detachEvent("on" + m, n)
                }
            }
        }
    };
    var i = function () {
        for (var m = 0, l; l = b[m]; m++) {
            if (l.t != c) {
                a.Events.removeListener(l.o, l.t, l.l)
            }
        }
    };
    var f = function () {
        if (h.readyState == "interactive") {
            function l() {
                h.detachEvent(j, l);
                i()
            }
            h.attachEvent(j, l);
            k.setTimeout(function () {
                h.detachEvent(j, l)
            }, 0)
        }
    };
    if (d || g) {
        (function () {
            try {
                if ((d && h.body) || !/loaded|complete/.test(h.readyState)) {
                    h.documentElement.doScroll("left")
                }
            } catch (m) {
                return setTimeout(arguments.callee, 0)
            }
            for (var l = 0, m; m = b[l]; l++) {
                if (m.t == c) {
                    m.l.call(null)
                }
            }
        })()
    }
    if (d) {
        if(k.attachEvent) k.attachEvent("onbeforeunload", f)
    }
    this.addListener(k, "unload", i)
};
fwdal.util.Functions = new function () {
    this.toString = function () {
        return "[class Functions]"
    };
    this.bind = function (f, b, e) {
        for (var c = 2, d, a = []; d = arguments[c]; c++) {
            a.push(d)
        }
        return function () {
            return f.apply(b, a)
        }
    }
};
var FWDUVPEvent = function (d) {
    this.toString = function () {
        return "[object FWDUVPEvent]"
    };
    this.type = d;
    this.target = [FWDUVPDL][0];
    this.value = FWDUVPDL.getValue();
    this.path = FWDUVPDL.getPath();
    this.pathNames = FWDUVPDL.getPathNames();
    this.parameters = {};
    var c = FWDUVPDL.getParameterNames();
    for (var b = 0, a = c.length; b < a; b++) {
        this.parameters[c[b]] = FWDUVPDL.getParameter(c[b])
    }
    this.parameterNames = c
};
FWDUVPEvent.INIT = "init";
FWDUVPEvent.CHANGE = "change";
FWDUVPEvent.INTERNAL_CHANGE = "internalChange";
FWDUVPEvent.EXTERNAL_CHANGE = "externalChange";
var FWDUVPDL = new function () {

        'use strict';

        var _getHash = function () {
            var index = _l.href.indexOf("#");
            return index != -1 ? _ec(_dc(_l.href.substr(index + 1))) : ""
        };

        var _getWindow = function () {
            try {
                top.document;
                return top
            } catch (e) {
                return window
            }
        };

        var _strictCheck = function (value, force) {
            if (_opts.strict) {
                value = force ? (value.substr(0, 1) != "/" ? "/" + value : value) : (value == "" ? "/" : value)
            }
            return value
        };

        var _ieLocal = function (value, direction) {
            return (_msie && _l.protocol == "file:") ? (direction ? _value.replace(/\?/, "%3F") : _value.replace(/%253F/, "?")) : value
        };

        var _searchScript = function (el) {
            if (el.childNodes) {
                for (var i = 0, l = el.childNodes.length, s; i < l; i++) {
                    if (el.childNodes[i].src) {
                        _url = String(el.childNodes[i].src)
                    }
                    if (s = _searchScript(el.childNodes[i])) {
                        return s
                    }
                }
            }
        };

        var _titleCheck = function () {
            if (_d.title != _title && _d.title.indexOf("#") != -1) {
                _d.title = _title
            }
        };

        var _listen = function () {
            if (!_silent) {
                var hash = _getHash();
                var diff = !(_value == hash);
                if (_safari && _version < 523) {
                    if (_length != _h.length) {
                        _length = _h.length;
                        if (typeof _stack[_length - 1] != UNDEFINED) {
                            _value = _stack[_length - 1]
                        }
                        _update.call(this, false)
                    }
                } else {
                    if (_msie && diff) {
                        if (_version < 7) {
                            _l.reload()
                        } else {
                            this.setValue(hash)
                        }
                    } else {
                        if (diff) {
                            _value = hash;
                            _update.call(this, false)
                        }
                    }
                } if (_msie) {
                    _titleCheck.call(this)
                }
            }
        };

        var _bodyClick = function (e) {
            if (_popup.length > 0) {
                var popup = window.open(_popup[0], _popup[1], eval(_popup[2]));
                if (typeof _popup[3] != UNDEFINED) {
                    eval(_popup[3])
                }
            }
            _popup = []
        };

        var _swfChange = function () {
            for (var i = 0, id, obj, value = FWDUVPDL.getValue(), setter = "setFWDUVPAddressValue"; id = _ids[i]; i++) {
                obj = document.getElementById(id);
                if (obj) {
                    if (obj.parentNode && typeof obj.parentNode.so != UNDEFINED) {
                        obj.parentNode.so.call(setter, value)
                    } else {
                        if (!(obj && typeof obj[setter] != UNDEFINED)) {
                            var objects = obj.getElementsByTagName("object");
                            var embeds = obj.getElementsByTagName("embed");
                            obj = ((objects[0] && typeof objects[0][setter] != UNDEFINED) ? objects[0] : ((embeds[0] && typeof embeds[0][setter] != UNDEFINED) ? embeds[0] : null))
                        }
                        if (obj) {
                            obj[setter](value)
                        }
                    }
                } else {
                    if (obj = document[id]) {
                        if (typeof obj[setter] != UNDEFINED) {
                            obj[setter](value)
                        }
                    }
                }
            }
        };

        var _jsDispatch = function (type) {
            this.dispatchEvent(new FWDUVPEvent(type));
            type = type.substr(0, 1).toUpperCase() + type.substr(1);
            if (typeof this["on" + type] == FUNCTION) {
                this["on" + type]()
            }
        };

        var _jsInit = function () {
            if (_util.Browser.isSafari()) {
                _d.body.addEventListener("click", _bodyClick)
            }
            _jsDispatch.call(this, "init")
        };

        var _jsChange = function () {
            _swfChange();
            _jsDispatch.call(this, "change")
        };

        var _update = function (internal) {
            _jsChange.call(this);
            if (internal) {
                _jsDispatch.call(this, "internalChange")
            } else {
                _jsDispatch.call(this, "externalChange")
            }
            _st(_functions.bind(_track, this), 10)
        };

        var _track = function () {
            var value = (_l.pathname + (/\/$/.test(_l.pathname) ? "" : "/") + this.getValue()).replace(/\/\//, "/").replace(/^\/$/, "");
            var fn = _t[_opts.tracker];
            if (typeof fn == FUNCTION) {
                fn(value)
            } else {
                if (typeof _t.pageTracker != UNDEFINED && typeof _t.pageTracker._trackPageview == FUNCTION) {
                    _t.pageTracker._trackPageview(value)
                } else {
                    if (typeof _t.urchinTracker == FUNCTION) {
                        _t.urchinTracker(value)
                    }
                }
            }
        };

        var _htmlWrite = function () {
            var doc = _frame.contentWindow.document;
            doc.open();
            doc.write("<html><head><title>" + _d.title + "</title><script>var " + ID + ' = "' + _getHash() + '";<\/script></head></html>');
            doc.close()
        };

        var _htmlLoad = function () {
            var win = _frame.contentWindow;
            var src = win.location.href;
            _value = (typeof win[ID] != UNDEFINED ? win[ID] : "");
            if (_value != _getHash()) {
                _update.call(FWDUVPDL, false);
                _l.hash = _ieLocal(_value, TRUE)
            }
        };

        var _load = function () {
        
            if (!_loaded) {
                _loaded = TRUE;
                if (_msie && _version < 8) {
                    var frameset = _d.getElementsByTagName("frameset")[0];
                    _frame = _d.createElement((frameset ? "" : "i") + "frame");
                    if (frameset) {
                        frameset.insertAdjacentElement("beforeEnd", _frame);
                        frameset[frameset.cols ? "cols" : "rows"] += ",0";
                        _frame.src = "javascript:false";
                        _frame.noResize = true;
                        _frame.frameBorder = _frame.frameSpacing = 0
                    } else {
                        _frame.src = "javascript:false";
                        _frame.style.display = "none";
                        _d.body.insertAdjacentElement("afterBegin", _frame)
                    }
                    _st(function () {
                        _events.addListener(_frame, "load", _htmlLoad);
                        if (typeof _frame.contentWindow[ID] == UNDEFINED) {
                            _htmlWrite()
                        }
                    }, 50)
                } else {
                    if (_safari) {
                        if (_version < 418) {
                            _d.body.innerHTML += '<form id="' + ID + '" style="position:absolute;top:-9999px;" method="get"></form>';
                            _form = _d.getElementById(ID)
                        }
                        if (typeof _l[ID] == UNDEFINED) {
                            _l[ID] = {}
                        }
                        if (typeof _l[ID][_l.pathname] != UNDEFINED) {
                            _stack = _l[ID][_l.pathname].split(",")
                        }
                    }
                }
                _st(_functions.bind(function () {
                    _jsInit.call(_s);
                    _jsChange.call(_s);
                    _track.call(_s)
                }, _s), 1);
                if (_msie && _version >= 8) {
                    _d.body.onhashchange = _functions.bind(_listen, _s);
                    _si(_functions.bind(_titleCheck, _s), 50)
                } else {
                    _si(_functions.bind(_listen, _s), 50)
                }
            }
        };

        var ID = "swfaddress",
            FUNCTION = "function",
            UNDEFINED = "undefined",
            TRUE = true,
            FALSE = false,
            _util = fwdal.util,
            _browser = _util.Browser,
            _events = _util.Events,
            _functions = _util.Functions,
            _version = _browser.getVersion(),
            _msie = _browser.isMSIE(),
            _mozilla = _browser.isMozilla(),
            _opera = _browser.isOpera(),
            _safari = _browser.isSafari(),
            _supported = TRUE,
            _t = _getWindow(),
            _d = _t.document,
            _h = _t.history,
            _l = _t.location,
            _si = setInterval,
            _st = setTimeout,
            _dc = decodeURI,
            _ec = encodeURI,
            _frame, _form, _url, _title = _d.title,
            _length = _h.length,
            _silent = FALSE,
            _loaded = FALSE,
            _justset = TRUE,
            _juststart = TRUE,
            _ref = this,
            _stack = [],
            _ids = [],
            _popup = [],
            _listeners = {}, _value = _getHash(),
            _opts = {
                history: TRUE,
                strict: TRUE
            };
        if (_msie && _d.documentMode && _d.documentMode != _version) {
            _version = _d.documentMode != 8 ? 7 : 8
        }

        var _s = this;
        if (_supported) {
            if (_opera) {
                history.navigationMode = "compatible"
            }
            for (var i = 1; i < _length; i++) {
                _stack.push("")
            }
            _stack.push(_getHash());
            if (_msie && _l.hash != _getHash()) {
                _l.hash = "#" + _ieLocal(_getHash(), TRUE)
            }
            _searchScript(document);
            var _qi = _url ? _url.indexOf("?") : -1;
            if (_qi != -1) {
                var param, params = _url.substr(_qi + 1).split("&");
                for (var i = 0, p; p = params[i]; i++) {
                    param = p.split("=");
                    if (/^(history|strict)$/.test(param[0])) {
                        _opts[param[0]] = (isNaN(param[1]) ? /^(true|yes)$/i.test(param[1]) : (parseInt(param[1]) != 0))
                    }
                    if (/^tracker$/.test(param[0])) {
                        _opts[param[0]] = param[1]
                    }
                }
            }
            if (_msie) {
                _titleCheck.call(this)
            }

            if(window == _t) {
                _events.addListener(document, "DOMContentLoaded", _functions.bind(_load, this))
            }
            _events.addListener(_t, "load", _functions.bind(_load, this))

            if(document.readyState == 'complete'){
                _load();
            }
        } else {
            if ((!_supported && _l.href.indexOf("#") != -1) || (_safari && _version < 418 && _l.href.indexOf("#") != -1 && _l.search != "")) {
                _d.open();
                _d.write('<html><head><meta http-equiv="refresh" content="0;url=' + _l.href.substr(0, _l.href.indexOf("#")) + '" /></head></html>');
                _d.close()
            } else {
                _track()
            }
        }
        this.toString = function () {
            return "[class FWDUVPDL]"
        };
        this.back = function () {
            _h.back()
        };
        this.forward = function () {
            _h.forward()
        };
        this.up = function () {
            var path = this.getPath();
            this.setValue(path.substr(0, path.lastIndexOf("/", path.length - 2) + (path.substr(path.length - 1) == "/" ? 1 : 0)))
        };
        this.go = function (delta) {
            _h.go(delta)
        };
        this.href = function (url, target) {
            target = typeof target != UNDEFINED ? target : "_self";
            if (target == "_self") {
                self.location.href = url
            } else {
                if (target == "_top") {
                    _l.href = url
                } else {
                    if (target == "_blank") {
                        window.open(url)
                    } else {
                        _t.frames[target].location.href = url
                    }
                }
            }
        };
        this.popup = function (url, name, options, handler) {
            try {
                var popup = window.open(url, name, eval(options));
                if (typeof handler != UNDEFINED) {
                    eval(handler)
                }
            } catch (ex) {}
            _popup = arguments
        };
        this.getIds = function () {
            return _ids
        };
        this.getId = function (index) {
            return _ids[0]
        };
        this.setId = function (id) {
            _ids[0] = id
        };
        this.addId = function (id) {
            this.removeId(id);
            _ids.push(id)
        };
        this.removeId = function (id) {
            for (var i = 0; i < _ids.length; i++) {
                if (id == _ids[i]) {
                    _ids.splice(i, 1);
                    break
                }
            }
        };
        this.addEventListener = function (type, listener) {
            if (typeof _listeners[type] == UNDEFINED) {
                _listeners[type] = []
            }
            _listeners[type].push(listener)
        };
        this.removeEventListener = function (type, listener) {
            if (typeof _listeners[type] != UNDEFINED) {
                for (var i = 0, l; l = _listeners[type][i]; i++) {
                    if (l == listener) {
                        break
                    }
                }
                _listeners[type].splice(i, 1)
            }
        };
        this.dispatchEvent = function (event) {
            if (this.hasEventListener(event.type)) {
                event.target = this;
                for (var i = 0, l; l = _listeners[event.type][i]; i++) {
                    l(event)
                }
                return TRUE
            }
            return FALSE
        };
        this.hasEventListener = function (type) {
            return (typeof _listeners[type] != UNDEFINED && _listeners[type].length > 0)
        };
        this.getBaseURL = function () {
            var url = _l.href;
            if (url.indexOf("#") != -1) {
                url = url.substr(0, url.indexOf("#"))
            }
            if (url.substr(url.length - 1) == "/") {
                url = url.substr(0, url.length - 1)
            }
            return url
        };
        this.getStrict = function () {
            return _opts.strict
        };
        this.setStrict = function (strict) {
            _opts.strict = strict
        };
        this.getHistory = function () {
            return _opts.history
        };
        this.setHistory = function (history) {
            _opts.history = history
        };
        this.getTracker = function () {
            return _opts.tracker
        };
        this.setTracker = function (tracker) {
            _opts.tracker = tracker
        };
        this.getTitle = function () {
            return _d.title
        };
        this.setTitle = function (title) {
            if (!_supported) {
                return null
            }
            if (typeof title == UNDEFINED) {
                return
            }
            if (title == "null") {
                title = ""
            }
            title = _dc(title);
            _st(function () {
                _title = _d.title = title;
                if (_juststart && _frame && _frame.contentWindow && _frame.contentWindow.document) {
                    _frame.contentWindow.document.title = title;
                    _juststart = FALSE
                }
                if (!_justset && _mozilla) {
                    _l.replace(_l.href.indexOf("#") != -1 ? _l.href : _l.href + "#")
                }
                _justset = FALSE
            }, 10)
        };
        this.getStatus = function () {
            return _t.status
        };
        this.setStatus = function (status) {
            if (!_supported) {
                return null
            }
            if (typeof status == UNDEFINED) {
                return
            }
            if (status == "null") {
                status = ""
            }
            status = _dc(status);
            if (!_safari) {
                status = _strictCheck((status != "null") ? status : "", TRUE);
                if (status == "/") {
                    status = ""
                }
                if (!(/http(s)?:\/\//.test(status))) {
                    var index = _l.href.indexOf("#");
                    status = (index == -1 ? _l.href : _l.href.substr(0, index)) + "#" + status
                }
                _t.status = status
            }
        };
        this.resetStatus = function () {
            _t.status = ""
        };
        this.getValue = function () {
            if (!_supported) {
                return null
            }
            return _dc(_strictCheck(_ieLocal(_value, FALSE), FALSE))
        };
        this.setValue = function (value) {
            if (!_supported) {
                return null
            }
            if (typeof value == UNDEFINED) {
                return
            }
            if (value == "null") {
                value = ""
            }
            value = _ec(_dc(_strictCheck(value, TRUE)));
            if (value == "/") {
                value = ""
            }
            if (_value == value) {
                return
            }
            _justset = TRUE;
            _value = value;
            _silent = TRUE;
            _update.call(FWDUVPDL, true);
            _stack[_h.length] = _value;
            
           
                if (_value != _getHash()) {
                    if (_opts.history) {
                        _l.hash = "#" + _dc(_ieLocal(_value, TRUE))
                    } else {
                        _l.replace("#" + _dc(_value))
                    }
                }
            if ((_msie && _version < 8) && _opts.history) {
                _st(_htmlWrite, 50)
            }
            if (_safari) {
                _st(function () {
                    _silent = FALSE
                }, 1)
            } else {
                _silent = FALSE
            }
        
        };
        this.getPath = function () {
            var value = this.getValue();
            if (value.indexOf("?") != -1) {
                return value.split("?")[0]
            } else {
                if (value.indexOf("#") != -1) {
                    return value.split("#")[0]
                } else {
                    return value
                }
            }
        };
        this.getPathNames = function () {
            var path = this.getPath(),
                names = path.split("/");
            if (path.substr(0, 1) == "/" || path.length == 0) {
                names.splice(0, 1)
            }
            if (path.substr(path.length - 1, 1) == "/") {
                names.splice(names.length - 1, 1)
            }
            return names
        };
        this.getQueryString = function () {
            var value = this.getValue(),
                index = value.indexOf("?");
            if (index != -1 && index < value.length) {
                return value.substr(index + 1)
            }
        };
        this.getParameter = function (param) {
            var value = this.getValue();
            var index = value.indexOf("?");
            if (index != -1) {
                value = value.substr(index + 1);
                var p, params = value.split("&"),
                    i = params.length,
                    r = [];
                while (i--) {
                    p = params[i].split("=");
                    if (p[0] == param) {
                        r.push(p[1])
                    }
                }
                if (r.length != 0) {
                    return r.length != 1 ? r : r[0]
                }
            }
        };
        this.getParameterNames = function () {
            var value = this.getValue();
            var index = value.indexOf("?");
            var names = [];
            if (index != -1) {
                value = value.substr(index + 1);
                if (value != "" && value.indexOf("=") != -1) {
                    var params = value.split("&"),
                        i = 0;
                    while (i < params.length) {
                        names.push(params[i].split("=")[0]);
                        i++
                    }
                }
            }
            return names
        };
        this.onInit = null;
        this.onChange = null;
        this.onInternalChange = null;
        this.onExternalChange = null;
        (function () {
            var _args;
            if (typeof FlashObject != UNDEFINED) {
                SWFObject = FlashObject
            }
            if (typeof SWFObject != UNDEFINED && SWFObject.prototype && SWFObject.prototype.write) {
                var _s1 = SWFObject.prototype.write;
                SWFObject.prototype.write = function () {
                    _args = arguments;
                    if (this.getAttribute("version").major < 8) {
                        this.addVariable("$swfaddress", FWDUVPDL.getValue());
                        ((typeof _args[0] == "string") ? document.getElementById(_args[0]) : _args[0]).so = this
                    }
                    var success;
                    if (success = _s1.apply(this, _args)) {
                        _ref.addId(this.getAttribute("id"))
                    }
                    return success
                }
            }
            if (typeof swfobject != UNDEFINED) {
                var _s2r = swfobject.registerObject;
                swfobject.registerObject = function () {
                    _args = arguments;
                    _s2r.apply(this, _args);
                    _ref.addId(_args[0])
                };
                var _s2c = swfobject.createSWF;
                swfobject.createSWF = function () {
                    _args = arguments;
                    var swf = _s2c.apply(this, _args);
                    if (swf) {
                        _ref.addId(_args[0].id)
                    }
                    return swf
                };
                var _s2e = swfobject.embedSWF;
                swfobject.embedSWF = function () {
                    _args = arguments;
                    if (typeof _args[8] == UNDEFINED) {
                        _args[8] = {}
                    }
                    if (typeof _args[8].id == UNDEFINED) {
                        _args[8].id = _args[1]
                    }
                    _s2e.apply(this, _args);
                    _ref.addId(_args[8].id)
                }
            }
            if (typeof UFO != UNDEFINED) {
                var _u = UFO.create;
                UFO.create = function () {
                    _args = arguments;
                    _u.apply(this, _args);
                    _ref.addId(_args[0].id)
                }
            }
            if (typeof AC_FL_RunContent != UNDEFINED) {
                var _a = AC_FL_RunContent;
                AC_FL_RunContent = function () {
                    _args = arguments;
                    _a.apply(this, _args);
                    for (var i = 0, l = _args.length; i < l; i++) {
                        if (_args[i] == "id") {
                            _ref.addId(_args[i + 1])
                        }
                    }
                }
            }
        })()
    };