sl.Controls = function(plugIn, rootElement) 
{	
	this.plugIn = plugIn;
	this.rootElement = rootElement;
	
	this.controls = this.rootElement.findName('controls');
	
	this.controlsBg = this.controls.findName('controlsBg'); 
	this.playBtn = this.controls.findName('playBtn');
	this.pauseBtn = this.controls.findName('pauseBtn');
	this.stopBtn = this.controls.findName('stopBtn');
	this.fullscreenBtn = this.controls.findName('fullscreenBtn');
	this.muteBtn = this.controls.findName('muteBtn');
	this.menu = this.controls.findName('menu');
	this.menuBtn = this.controls.findName('menuBtn');
	this.menuBg = this.menuBtn.findName('menuBg');
	this.menuBwBtn = this.menuBtn.findName('menuBwBtn');
	this.menuStfBtn = this.menuBtn.findName('menuStfBtn');
	this.menuFeedbackBtn = this.menuBtn.findName('menuFeedbackBtn');
	this.timeTxt = this.controls.findName('timeTxt');
	this.durationTxt = this.controls.findName('durationTxt');
	this.progressBar= this.controls.findName('progressBar');
	this.volumeBar= this.controls.findName('volumeBar');
	this.guide = this.progressBar.findName('guide');
	this.head = this.progressBar.findName('head');	
	this.downloadProgress = this.progressBar.findName('downloadProgress');
	this.progressBg = this.progressBar.findName('progressBg');
	this.tooltip = this.controls.findName('tooltip');
	this.adMessageTxt = this.controls.findName('adMessageTxt');
	
	//play
	this.playBtn.children.getItem(1).addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.controlPlay));
	this.playBtn.children.getItem(1).addEventListener("MouseEnter", Silverlight.createDelegate(this, this.enterPlay));
	this.playBtn.children.getItem(1).addEventListener("MouseLeave", Silverlight.createDelegate(this, this.leavePlay));
	//pause
	this.pauseBtn.children.getItem(2).addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.controlPause));
	this.pauseBtn.children.getItem(2).addEventListener("MouseEnter", Silverlight.createDelegate(this, this.enterPlay));
	this.pauseBtn.children.getItem(2).addEventListener("MouseLeave", Silverlight.createDelegate(this, this.leavePlay));
	//pause
	this.stopBtn.children.getItem(1).addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.controlStop));
	this.stopBtn.children.getItem(1).addEventListener("MouseEnter", Silverlight.createDelegate(this, this.enterPlay));
	this.stopBtn.children.getItem(1).addEventListener("MouseLeave", Silverlight.createDelegate(this, this.leavePlay));
	//fullscreen
	this.fullscreenBtn.children.getItem(3).addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.maximizeSl));
	this.fullscreenBtn.children.getItem(3).addEventListener("MouseEnter", Silverlight.createDelegate(this, this.enterButton));	
	this.fullscreenBtn.children.getItem(3).addEventListener("MouseLeave", Silverlight.createDelegate(this, this.leaveButton));
	//mute
	this.muteBtn.children.getItem(4).addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.setMute));
	this.muteBtn.children.getItem(4).addEventListener("MouseEnter", Silverlight.createDelegate(this, this.enterButton));	
	this.muteBtn.children.getItem(4).addEventListener("MouseLeave", Silverlight.createDelegate(this, this.leaveButton));
	//guide
	this.guide.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.jumpTo));
	this.guide.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.guideEnter));
	this.guide.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.guideLeave));
	//menu 
	this.menuBtn.children.getItem(3).addEventListener("MouseEnter", Silverlight.createDelegate(this, this.enterMenuBtn));
	this.menuBtn.children.getItem(3).addEventListener("MouseLeave", Silverlight.createDelegate(this, this.leaveMenuBtn));
	//menu bandwidth
	this.menuBwBtn.children.getItem(4).addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.showBandwidth));
	this.menuBwBtn.children.getItem(4).addEventListener("MouseEnter", Silverlight.createDelegate(this, this.enterMenuBtn));
	this.menuBwBtn.children.getItem(4).addEventListener("MouseLeave", Silverlight.createDelegate(this, this.leaveMenuBtn));
	//menu send to friend
	this.menuStfBtn.children.getItem(4).addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.showStf));
	this.menuStfBtn.children.getItem(4).addEventListener("MouseEnter", Silverlight.createDelegate(this, this.enterMenuBtn));
	this.menuStfBtn.children.getItem(4).addEventListener("MouseLeave", Silverlight.createDelegate(this, this.leaveMenuBtn));
	//menu feedback
	this.menuFeedbackBtn.children.getItem(4).addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.feedbackHit));
	this.menuFeedbackBtn.children.getItem(4).addEventListener("MouseEnter", Silverlight.createDelegate(this, this.enterMenuBtn));
	this.menuFeedbackBtn.children.getItem(4).addEventListener("MouseLeave", Silverlight.createDelegate(this, this.leaveMenuBtn));
	//volume
	this.volumeBar.children.getItem(2).addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.volumeUp));
	this.volumeBar.children.getItem(2).addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.volumeDown));
	this.volumeBar.children.getItem(2).addEventListener("MouseMove", Silverlight.createDelegate(this, this.volumeMove));
	//progress head
	this.head.children.getItem(1).addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.progressUp));
	this.head.children.getItem(1).addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.progressDown));
	this.head.children.getItem(1).addEventListener("MouseMove", Silverlight.createDelegate(this, this.progressMove));

	this.controls.Visibility = 'Visible';
	this.stopBtn.Visibility = this.pauseBtn.Visibility = 'Collapsed';
	this.tooltip.Visibility = "Collapsed";
	this.adMessageTxt.Visibility = 'Collapsed';
	this.menu.Visibility = 'Collapsed';

	this.totTime = 0;
	this.volume = 80;
	this.isProgressDown = false;
	this.deleteTimeTxt = false;
	this.isMute = false;
	
	this.volumeBar.children.getItem(1).Clip.Transform.children.getItem( 0 ).ScaleX = (35 + 5)/45;
};

sl.Controls.prototype =
{
	scaleControls: function(w, h, fullscreen){
		this.controls['Canvas.Top'] = h;
		if(fullscreen){
			this.controls['Canvas.Top'] -= 25;
			if(this.fullscreenBtn){
				this.fullscreenBtn.children.getItem(2).children.getItem(0).Visibility = 'Visible';
				this.fullscreenBtn.children.getItem(2).children.getItem(1).Visibility = 'Collapsed';
			}
		}else{
			if(this.fullscreenBtn){
				this.fullscreenBtn.children.getItem(2).children.getItem(0).Visibility = 'Collapsed';
				this.fullscreenBtn.children.getItem(2).children.getItem(1).Visibility = 'Visible';
			}
		}
		
		this.controlsBg.findName('bg01').width = w;
		
		this.menu['Canvas.Left'] = w - 101;
		this.menu['Canvas.Top'] = -63;
		
		this.durationTxt['Canvas.Left'] = w - 177;
		this.muteBtn['Canvas.Left'] = w - 120;
		this.volumeBar['Canvas.Left'] = w - 96;
		this.fullscreenBtn['Canvas.Left'] = w - 70;
		this.menuBtn['Canvas.Left'] = w - 35;

		this.guide.width = w - 287;
		this.origDownloadProgressWidth = w - 285;
		this.downloadProgress.width =  this.progressBg.width = this.origDownloadProgressWidth;

		this.downloadProgress.width = this.origDownloadProgressWidth;
	},
	
	controlPlay: function(){
		var objFlash = getObject("objFlashPlayer");
		objFlash.sendState(3);
	},
	
	enterPlay: function(){
		this.playBtn.children.getItem(0).Fill = this.pauseBtn.children.getItem(0).Fill = this.pauseBtn.children.getItem(1).Fill = this.stopBtn.children.getItem(0).Fill = "#FF0099CC";
	},
	
	leavePlay: function(){
		this.playBtn.children.getItem(0).Fill = this.pauseBtn.children.getItem(0).Fill = this.pauseBtn.children.getItem(1).Fill = this.stopBtn.children.getItem(0).Fill = "#FFFFFFFF";
	},
	
	enterMenuBtn: function(sender){
		if(sender.getParent().name == "menuBtn"){
			sender.getParent().children.getItem(2).children.getItem(0).Fill = "#FF0099CC";
			sender.getParent().children.getItem(2).children.getItem(1).Fill = "#FFFFFFFF";

			if(host.content.FullScreen){
				this.menu.Visibility = "Visible";
			}else{
				var objFlash = getObject("objFlashPlayerTrans");
				objFlash.showMenu({'val':'1'});
				return;
			}
		}else{
			sender.getParent().children.getItem(1).Visibility = "Visible";
		}
		clearTimeout(this.menuTimeout);
	},
	
	leaveMenuBtn: function(sender){
		if(sender.getParent().name == "menuBtn"){
			sender.getParent().children.getItem(2).children.getItem(0).Fill = "#FFFFFFFF";
			sender.getParent().children.getItem(2).children.getItem(1).Fill = "#FF000000";
			
			if(!host.content.FullScreen){
				var objFlash = getObject("objFlashPlayerTrans");
				objFlash.showMenu({'val':'0'});	
				return;
			}
		}else{
			sender.getParent().children.getItem(1).Visibility = "Collapsed";
		}
		this.menuTimeout = setTimeout(this.hideMenu, 500);
	},
	
	hideMenu: function(){
		controls.menu.Visibility = "Collapsed";
	},
	
	controlPause: function(){
		var objFlash = getObject("objFlashPlayer");
		objFlash.sendState(2);
	},
	
	controlStop: function(){
		var objFlash = getObject("objFlashPlayer");
		objFlash.sendState(1);
		
		if(host.content.FullScreen)
			this.plugIn.content.fullScreen = false;
	},	
	
	setVolume: function(){
		if(this.volume == undefined){
			this.volume = 80;
			this.isMute = false;
		}
	},
	
	setMute: function(sender){
		debugThis("setMute ");
		
		var objFlash = getObject("objFlashPlayer");
		objFlash.setMute();
		
		if(sender != undefined){
			var title = this.setHover(sender);
			this.showTooltip(true, title, sender.getParent()['Canvas.Left'], false);
		}
	},
	
	
	setControlsMute: function(val){
		debugThis("setControlsMute ");
		this.isMute = val;
		if(val){
			this.volumeBar.children.getItem(1).Visibility = this.volumeBar.children.getItem(2).Visibility = 'Collapsed';
			this.muteBtn.children.getItem(1).Visibility = 'Collapsed';
		}else{
			this.volumeBar.children.getItem(1).Visibility = this.volumeBar.children.getItem(2).Visibility = 'Visible';
			this.muteBtn.children.getItem(1).Visibility = 'Visible';
		}
	}, 
	
	updateDragTimer: function(curX){
		var curTime;
		if(curX == undefined || curX == 0){
			curTime = 0;
		}else{
			curTime = (curX/(this.guide.width-this.head.width)) * this.totTime;
		}
		
		if(!this.deleteTimeTxt){
			this.timeTxt.Text = dateFormat(curTime, this.totTime);
			this.durationTxt.Text = dateFormat(this.totTime, this.totTime);	
		}else{
			this.durationTxt.Text = dateFormat((this.totTime-curTime), this.totTime);	
		}
	},
	
	updateTime:function(curTime, totTime, dProgress, adPlaying){
		debugThis("updateTime "+curTime+"/"+totTime+"/"+dProgress);
		debugThis("adPlaying"+adPlaying);
		if(isLive){
			this.timeTxt.Text = "LIVE";
			this.durationTxt.Text = "";
			this.downloadProgress.width = this.origDownloadProgressWidth;
		}else{
			this.totTime = totTime;
			this.downloadProgress.width = this.origDownloadProgressWidth * dProgress / 100;
			if(!this.isProgressDown){
				this.timeTxt.Text = dateFormat(curTime, totTime);
				this.durationTxt.Text = dateFormat(totTime, totTime);
				this.updatePlayHead(curTime, totTime);
			}
		}
		
		if (adPlaying) {
			this.adMessageTxt.visibility = 'Visible';
			this.progressBar.visibility = 'Collapsed';
			this.timeTxt.Text = this.durationTxt.Text = "";
			if((totTime-curTime) != 0){
				this.adMessageTxt.Text = adMessage.replace("%time%", (totTime-curTime));
			}else{
				this.adMessageTxt.Text = "";
			}
		}else {
			this.adMessageTxt.visibility = 'Collapsed';
			this.progressBar.visibility = 'Visible';
		}
	},
	
	updatePlayHead: function(curTime, totTime){
		if(curTime == 0 || totTime == 0){
			this.head['Canvas.Left'] = 0;
			this.totTime = 0;
			return;
		}
		var perc = curTime / totTime;
		var pos = (this.guide.width - this.head.width) * perc;
		
		if(this.isProgressDown == false){
			this.head['Canvas.Left'] = pos;
		}
		
		this.totTime = totTime;
	},
	
	setPlayState: function(status){
		debugThis("setPlayState "+status);
		if(status == "pause"){
			this.playBtn.Visibility = 'Visible';
			this.pauseBtn.Visibility = this.stopBtn.Visibility = 'Collapsed';
		}else{
			this.playBtn.Visibility = 'Collapsed';
			if(isLive){
				this.stopBtn.Visibility = 'Visible';
			}else{
				this.pauseBtn.Visibility = 'Visible';
			}
		}
		debugThis("setPlayState done");
	},
	
	showStf: function(sender){
		if(showMenu == '1'){
			this.leaveMenuBtn(sender);
		}else{
			this.leaveButton(sender);	
		}
		
		if(host.content.FullScreen){
			videoPlayer.maximizeSl();
		}
		
		var objFlash = getObject("objFlashPlayer");
		objFlash.showStf(true);
	},
	
	feedbackHit: function(sender){
		if(showMenu == '1'){
			this.leaveMenuBtn(sender);
		}else{
			this.leaveButton(sender);	
		}
		
		if(host.content.FullScreen){
			videoPlayer.maximizeSl();
		}
		
		var objFlash = getObject("objFlashPlayer");
		objFlash.feedbackHit();
	},
	
	showControls: function(status){
		if(status){
			this.controls.Visibility = 'Visible';
		}else{
			this.controls.Visibility = 'Collapsed';
		}
	},	
	
	enableBandWidth: function(status){
		debugThis('enableBandWidth '+status);
			
		if(status){
			this.menuBwBtn.children.getItem(4).Visibility = 'Visible';
			this.menuBwBtn.children.getItem(2).Opacity = this.menuBwBtn.children.getItem(3).Opacity = 1;
		}else{
			this.menuBwBtn.children.getItem(4).Visibility = 'Collapsed';
			this.menuBwBtn.children.getItem(2).Opacity = this.menuBwBtn.children.getItem(3).Opacity = 0.5;
		}
	},
	
	
	showControls: function(status){
		debugThis('showControls  .....'+status);
		if(status){
			this.controls.Visibility = 'Visible';
		}else{
			this.controls.Visibility = 'Collapsed';
		}
	},

	
	setVisibility: function(status){
		debugThis('setVisibility controls .....'+status);
		if(status){
			this.controls['Canvas.Top'] = Number(videoHeight);
		}else{
			this.controls['Canvas.Top'] = 0;
		}
	},	
	
	
	maximizeSl: function(sender, args){
		var title = this.setHover(sender, "#FFFFFFFF");
		this.showTooltip(false);
		
		videoPlayer.maximizeSl();
	},	
	
	
	showBandwidth: function(sender, args){
		if(showMenu == '1'){
			this.leaveMenuBtn(sender);
		}else{
			this.leaveButton(sender);	
		}
		
		if(host.content.FullScreen){
			videoPlayer.maximizeSl();
		}
		
		var objFlash = getObject("objFlashPlayer");
		objFlash.showBandwidth(true);
	},

		
	enableFullscreen: function(status){
		debugThis('enableFullscreen '+status);
		if(status){
			this.fullscreenBtn.children.getItem(3).Visibility = 'Visible';
		}else{
			this.fullscreenBtn.children.getItem(3).Visibility = 'Collapsed';
		}
	}, 
	
	setControlsLive: function(val){
		debugThis('setControlsLive '+val);
		var status = !val;
		if(status){
			this.guide.cursor = "Hand";
			this.head.cursor = "Hand";
			
			this.guide.Visibility = 'Visible';
			this.head.children.getItem(1).Visibility = 'Visible';
		}else{
			this.guide.cursor = "Arrow";
			this.head.cursor = "Arrow";

			this.guide.Visibility = 'Collapsed';
			this.head.children.getItem(1).Visibility = 'Collapsed';
		}
		
		this.updateTime(0, 0, 100);
		debugThis('setControlsLive done');
	},  
	
	enableControls: function(status, adPlaying){
		debugThis('enableControls '+status);
		if(status){
			if(!isLive){
				this.guide.cursor = "Hand";
				this.head.cursor = "Hand";	
			}
			
			this.playBtn.Opacity = 1;
			this.pauseBtn.Opacity = 1;
			this.stopBtn.Opacity = 1;
			
			this.playBtn.children.getItem(1).Visibility = 'Visible';
			this.pauseBtn.children.getItem(2).Visibility = 'Visible';
			this.stopBtn.children.getItem(1).Visibility = 'Visible';
			if(!isLive){
				this.guide.Visibility = 'Visible';
				this.head.children.getItem(1).Visibility = 'Visible';	
			}

		}else{
			this.guide.cursor = "Arrow";
			this.head.cursor = "Arrow";
			
			this.playBtn.Opacity = 0.5;
			this.pauseBtn.Opacity = 0.5;
			this.stopBtn.Opacity = 0.5;
			
			this.playBtn.children.getItem(1).Visibility = 'Collapsed';
			this.pauseBtn.children.getItem(2).Visibility = 'Collapsed';
			this.stopBtn.children.getItem(1).Visibility = 'Collapsed';
			this.guide.Visibility = 'Collapsed';
			this.head.children.getItem(1).Visibility = 'Collapsed';
		}
		
		if(adPlaying && status){
			this.playBtn.children.getItem(1).Visibility = 'Collapsed';
			this.pauseBtn.children.getItem(2).Visibility = 'Collapsed';
			this.stopBtn.children.getItem(1).Visibility = 'Collapsed';
			this.playBtn.Opacity = 0.5;
			this.pauseBtn.Opacity = 0.5;
			this.stopBtn.Opacity = 0.5;
			this.guide.Visibility = 'Collapsed';
			this.head.children.getItem(1).Visibility = 'Collapsed';
		}
		
		debugThis('enableControls done');
	}, 
	
	
	enableDragging: function(status){
		debugThis('enableDragging '+status);
		if(status){
			this.guide.Visibility = 'Visible';
			this.head.children.getItem(1).Visibility = 'Visible';
			this.guide.cursor = 'Hand';
			this.head.cursor = "Hand";
		}else{
			this.guide.Visibility = 'Collapsed';
			this.head.children.getItem(1).Visibility = 'Collapsed';
			this.guide.cursor = 'Arrow';
			this.head.cursor = "Arrow";
		}
	},   
	
	
	progressDown: function(sender, mouseEventArgs)
	{
		// Ensure this object is the only one receiving mouse events.
		sender.captureMouse();
	
		// Set the beginning position of the mouse.
		this.beginX = mouseEventArgs.getPosition(null).x;
	
		this.isProgressDown = true;
	},
	
	progressMove: function(sender, mouseEventArgs)
	{
		// Determine whether the mouse button is down.
		// If so, move the object.
		if (this.isProgressDown == true)
		{
			// Retrieve the current position of the mouse.
			var currX = mouseEventArgs.getPosition(null).x;
			var newX = sender.getParent()["Canvas.Left"] + currX - this.beginX;
			
			if(newX < (this.guide.width - sender.width) && newX > 0){
				sender.getParent()["Canvas.Left"] = newX;
	
				// Update the beginning position of the mouse.
				this.beginX = currX;
				
				//update the time
				this.updateDragTimer(newX);
			}
		}
	},
	
	progressUp: function(sender, mouseEventArgs)
	{
		this.isProgressDown = false;
	
		sender.releaseMouseCapture();
		
		var perc  = sender.getParent()["Canvas.Left"] / (this.guide.width-this.head.width) ;
		var newTime = this.totTime * perc;
		debugThis('jumpTo '+ perc+ '  newTime: '+newTime);
		var objFlash = getObject("objFlashPlayer");
		objFlash.jumpToMedia(newTime);
	},
	
	
	volumeDown: function(sender, mouseEventArgs)
	{
		// Ensure this object is the only one receiving mouse events.
		sender.captureMouse();
	
		this.isMouseDown = true;
	},
	
	volumeMove: function(sender, mouseEventArgs)
	{
		// Determine whether the mouse button is down.
		// If so, move the object.
		if (this.isMouseDown == true)
		{
			// Retrieve the current position of the mouse.
			var currX = mouseEventArgs.getPosition(sender).x;
			var perc = currX/sender.width;

			sender.getParent().children.getItem(1).Clip.Transform.children.getItem( 0 ).ScaleX = perc;			
		}
	},
	
	volumeUp: function(sender, mouseEventArgs)
	{
		debugThis('volumeUp ');
		this.isMouseDown = false;
		
		var currX = mouseEventArgs.getPosition(sender).x;
		var perc = currX/sender.width;
		
		sender.getParent().children.getItem(1).Clip.Transform.children.getItem( 0 ).ScaleX = perc;	
	
		sender.releaseMouseCapture();
		this.volume = Math.round(perc * 100);
		
		if(this.volume <= 0)
			this.volume = 1;

		var objFlash = getObject("objFlashPlayer");
		objFlash.setVolume(this.volume, 'WMV', true);
	},
	
	
	setControlsVolume: function(val)
	{
		debugThis('setControlsVolume '+val);
		debugThis('this.volumeBar.children.getItem(1) '+this.volumeBar.children.getItem(1));
		this.volumeBar.children.getItem(1).Clip.Transform.children.getItem( 0 ).ScaleX = val/100;
		debugThis('setControlsVolume done');
	},
	
	
	guideEnter: function(sender, mouseEventArgs)
	{
		// Ensure this object is the only one receiving mouse events.
		sender.captureMouse();
		this.guideTimeToken = this.guide.addEventListener("MouseMove", Silverlight.createDelegate(this, this.guideMove));
		
		var xPos = mouseEventArgs.getPosition(sender).x + sender.getParent()['Canvas.Left'];

		this.showTooltip(true, dateFormat((mouseEventArgs.getPosition(sender).x/this.guide.width) * this.totTime, this.totTime), xPos, true);
	},
	
	guideMove: function(sender, mouseEventArgs)
	{
		// Determine whether the mouse button is down.
		// Retrieve the current position of the mouse.
		var xPos = mouseEventArgs.getPosition(sender).x + sender.getParent()['Canvas.Left'];
		this.showTooltip(true, dateFormat((mouseEventArgs.getPosition(sender).x/this.guide.width) * this.totTime, this.totTime), xPos, true);
	},
	
	guideLeave: function(sender, mouseEventArgs)
	{
		sender.releaseMouseCapture();
		this.guide.removeEventListener("MouseMove", this.guideTimeToken);
		
		this.showTooltip(false);
	},
	
	
	jumpTo: function(sender, args){
		var perc = (args.getPosition(null).x - (this.controls['Canvas.Left'] + this.progressBar['Canvas.Left'] + this.guide['Canvas.Left'])) / sender.width;
		var newTime = this.totTime * perc;
		debugThis('jumpTo '+ perc+ '  newTime: '+newTime);
		var objFlash = getObject("objFlashPlayer");
		objFlash.jumpToMedia(newTime);
	}, 
	
	
	enterButton: function(sender, args){
		
		var title = this.setHover(sender, "#FF0099CC");
		
		this.showTooltip(true, title, sender.getParent()['Canvas.Left'], false);
	}, 
	
	
	leaveButton: function(sender){
		
		var title = this.setHover(sender, "#FFFFFFFF");
		
		this.showTooltip(false);
	},
	
	
	setHover: function(sender, color){
		var title = "";
		switch(sender.getParent().name){
			case "fullscreenBtn":
				var canvas = this.fullscreenBtn.children.getItem(2);
				for(var i=0; i<10; i++)
					canvas.children.getItem(i).Fill = color;
					
				if(host.content.FullScreen){
					title = "Exit full screen";
				}else{
					title = "Full screen";
				}
				break;
			case "muteBtn":
				if(!this.isMute){
					title = "Mute";
				}else{
					title = "Unmute";
				}
				break;
		}
		
		return title;
	},
	
	
	showTooltip: function(val, title, xPos, center){
		debugThis('showTooltip title'+ title+ '  xPos: '+xPos);
		if(val){
			this.tooltip.Visibility = "Visible";
		}else{
			this.tooltip.Visibility = "Collapsed";
			return;
		}
		
		this.tooltip['Canvas.Left'] = xPos;
		if(center)
			this.tooltip['Canvas.Left'] -= (this.tooltip.children.getItem(0).width/2);
		this.tooltip.findName('tooltipTxt').Text = title;
		
		if((xPos+this.tooltip.children.getItem(0).width) > this.controlsBg.findName('bg01').width){
			this.tooltip['Canvas.Left'] = this.controlsBg.findName('bg01').width - this.tooltip.children.getItem(0).width;
		}
	}, 
	
	resetControls: function(){
		debugThis('resetControls ');
		this.leavePlay();
		debugThis('this.isMute '+this.isMute);
		if(this.isMute)
			this.setMute();
		debugThis('resetControls done');
	}
};

