function CoreVideoControls(parentDiv) {
	this.parentDiv = $(parentDiv);
	this.buttons = new Array();
	this.scrubbers = new Array();
	this.clocks = new Array();
	this.amScrubbing = false;
	this.duration = null;
	this.initList = new Array();
	this.endSlateActive = false;
}

CoreVideoControls.prototype.initialize = function(callbackMethod) {
	for (var i = 0; i < this.initList.length; i++) {
		this.initList[i]();
	}
	callbackMethod();
}

CoreVideoControls.prototype.handleXMPEvent = function(p_method, p_arg) {
		var returnVal;
		switch(p_method) {
			case 'endSlateStarted':
				this.endSlateActive = true;
				this.enableShare();
				this.enableEmbed();
				break;
			case 'newVideo':
				this.hideEmbed();
				this.hideShare();
				break;
			case 'videoStarted':
				this.endSlateActive = false;
				this.enableShare();
				if (CNNPlaylistManager.getInstance().doNotEmbed == false)
					this.enableEmbed();
				this.enableFullscreen();
				break;
			case 'turnOffSharing':
				this.disableShare();
				this.disableEmbed();
				break;
			case 'setEnabled':
				if (p_arg == false) {
					this.disablePause();
					this.disableShare();
					this.disableEmbed();
					this.disableFullscreen();
					this.disableTimelineScrubber();
				}
				if (p_arg == true) {
					this.enablePause();
				}
				break;
			case 'setVolume':
				this.scrubbers['volume'].scrubberPointer.setValue((p_arg/100));
				break;
			case 'setTime':
				this.setTime(p_arg);
				break;
			case 'setDuration':
				this.setDuration(p_arg);
				break;
			case 'togglePlay':
				if (p_arg == true) {
					this.enablePause();
				} else {
					this.enablePlay();
				}
				break;
			case 'setScrubberEnabled':
				if (p_arg == true) {
					this.enableTimelineScrubber();
				} else {
					this.disableTimelineScrubber();
				}
				break;
			case 'setLoadedPercent':
				this.setTimelineScrubberBuffer(p_arg);
				break;
			case 'getVolume':
				returnVal = 100 * this.scrubbers['volume'].scrubberPointer.value;
				break;
		}
		return returnVal;
}

/* 	**********************************************

	End		-	Initialization 
	Start 	- 	Play

	********************************************** */
	
function CoreVideoControls_Play() { }

CoreVideoControls_Play.prototype.swapPlayPause = function(hide,show) {
	$(hide).style.display = 'none';
	$(show).style.display = 'block';
}

CoreVideoControls_Play.prototype.disablePlay = function() {
	if ($('playLayer')) {
		this.swapPlayPause('pauseLayer','playLayer');
		$('playLayer').className = this.buttons['play'].classes['disabled'];
		$('playLayer').onclick = function() { }
	}
}

CoreVideoControls_Play.prototype.enablePlay = function() {
	if ($('playLayer')) {
		this.swapPlayPause('pauseLayer','playLayer');
		$('playLayer').className = this.buttons['play'].classes['activeOff'];
		$('playLayer').onclick = this.buttons['play'].clickEvent;
	}
}

CoreVideoControls_Play.init = function() {
	// place the play button
	var divObj = document.createElement('div');
	divObj.setAttribute('id','playLayer');
	divObj.className = CNNPlaylistManager.getInstance().controller.buttons['play'].classes['disabled'];
	divObj.style.display = 'none';
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);
}

CoreVideoControls_Play.clickEvent = function() {
	CNNPlaylistManager.getInstance().controller.hideShare();
	CNNPlaylistManager.getInstance().controller.hideEmbed();
	if (CNNPlaylistManager.getInstance().playlistType == 'bvp') {
		try {
			if (window.displayOverlay != null)
				window.displayOverlay.enableButton(true);
		} catch(err) {  }
	}
	CNNPlayer.getActivePlayer().handleEvent('playPressed');
}

/* 	**********************************************

	End		-	Play 
	Start 	- 	Pause

	********************************************** */

function CoreVideoControls_Pause() { }

CoreVideoControls_Pause.prototype.disablePause = function() {
	if ($('pauseLayer')) {
	this.swapPlayPause('playLayer','pauseLayer');
	$('pauseLayer').className = this.buttons['pause'].classes['disabled'];
	$('pauseLayer').onclick = function() { }
	}
}

CoreVideoControls_Pause.prototype.enablePause = function() {
	if ($('pauseLayer')) {
		this.swapPlayPause('playLayer','pauseLayer');
		$('pauseLayer').className = this.buttons['pause'].classes['activeOff'];
		$('pauseLayer').onclick = this.buttons['pause'].clickEvent;
	}
}

CoreVideoControls_Pause.init = function() {
	// place the pause disabled button
	var divObj = document.createElement('div');
	divObj.setAttribute('id','pauseLayer');
	divObj.className = CNNPlaylistManager.getInstance().controller.buttons['pause'].classes['disabled'];
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);
}

CoreVideoControls_Pause.clickEvent = function() {
	CNNPlayer.getActivePlayer().handleEvent('pausePressed');
}

/* 	**********************************************

	End		-	Play/Pause
	Start 	- 	Embed

	********************************************** */

function CoreVideoControls_Embed() { }

CoreVideoControls_Embed.prototype.disableEmbed = function() {
	if ($('embedLayer')) {
		this.hideEmbed();
		$('embedLayer').className = this.buttons['embed'].classes['disabled'];
		$('embedLayer').onclick = function() { }
	}
}

CoreVideoControls_Embed.prototype.enableEmbed = function() {
	if ($('embedLayer') && CNNPlaylistManager.getInstance().doNotEmbed == false) {
		$('embedLayer').className = this.buttons['embed'].classes['activeOff'];
		$('embedLayer').onclick = this.buttons['embed'].clickEvent;
	}
}

CoreVideoControls_Embed.prototype.showEmbed = function() {
	if ($('embedLayer')) {
		if (this.endSlateActive == false) {
			CNNPlayer.getActivePlayer().handleEvent('pausePressed');
			if (CNNPlaylistManager.getInstance().playlistType == 'bvp') {
				try {
					if (window.displayOverlay != null)
						window.displayOverlay.enableButton(false);
				} catch(err) {  }
			}
		}
		var p = CNNPlaylistManager.getInstance();
		var hosturl = 'http://www.cnn.com/video/savp/evp/?loc=dom&vid=';
		if (location.hostname.indexOf('edition.') > -1) {
			hosturl = 'http://edition.cnn.com/video/savp/evp/?loc=int&vid=';
		}
		$('embedForm').value = '<iframe src="'+hosturl+p.playlists[p.activePlaylist].playlistJsonObjs[p.playlists[p.activePlaylist].pointer].getDataObject().id+'" height="393" width="406" allowtransparency="true" frameborder="0" scrolling="no"></iframe>';
		$('embedOverlay').style.display = 'block';
	}
}

CoreVideoControls_Embed.prototype.hideEmbed = function(restart) {
	if ($('embedLayer')) {
		$('embedOverlay').style.display = 'none';
		if (this.endSlateActive) {
			$('endReplay').style.display = 'block';
			$('endEmbed').style.display = 'block';
			$('endShare').style.display = 'block';
			if ($('thumBs')) {
				$('thumBs').style.display = 'block';
				$('thumbOverlay').style.display = 'block';
			}
		} else {
			if (restart) {
				CNNPlayer.getActivePlayer().handleEvent('playPressed');
				if (CNNPlaylistManager.getInstance().playlistType == 'bvp') {
					try {
						if (window.displayOverlay != null)
							window.displayOverlay.enableButton(true);
					} catch(err) {  }
				}
			}
		}
	}
}

CoreVideoControls_Embed.init = function() {
	var divObj = document.createElement('div');
	divObj.setAttribute('id','embedLayer');
	divObj.className = CNNPlaylistManager.getInstance().controller.buttons['embed'].classes['disabled'];
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);
	var divObj = document.createElement('div');
	divObj.setAttribute('id','embedOverlay');
	divObj.innerHTML = '<div id="embedClose" onclick="CNNPlaylistManager.getInstance().controller.hideEmbed(true);"></div><div id="embedButton"><a href="javascript:CNNPlaylistManager.getInstance().controller.copyEmbed()"><img border="no" src="http://i.cdn.turner.com/cnn/.e/img/2.0/video/controls/copy.png"></a></div><input onfocus="this.select();" id="embedForm"><div id="embedTitle">Embed this video</div><div id="embedDesc1">Copy and paste this code into your blog/website</div><div id="embedDesc2">Or click on the button to copy the code</div>';
	if ($('mosVidContainer')) {
		$('mosVidContainer').appendChild(divObj);
	} else {
		$('htVidContainer').appendChild(divObj);
	}
}

CoreVideoControls_Embed.clickEvent = function() {
	if ($('embedOverlay').style.display == 'block') {
		CNNPlaylistManager.getInstance().controller.hideEmbed(true);
	} else {
		CNNPlaylistManager.getInstance().controller.hideShare();
		if (CNNPlaylistManager.getInstance().controller.endSlateActive == true) {
			$('endReplay').style.display = 'none';
			$('endEmbed').style.display = 'none';
			$('endShare').style.display = 'none';
			if ($('thumBs')) {
				$('thumBs').style.display = 'none';
				$('thumbOverlay').style.display = 'none';
			}
		}
		CNNPlaylistManager.getInstance().controller.showEmbed();
	}
}

/* 	**********************************************

	End		-	Embed 
	Start 	- 	Share

	********************************************** */

function CoreVideoControls_Share() { }

CoreVideoControls_Share.prototype.disableShare = function() {
	if ($('shareLayer')) {
		this.hideShare();
		$('shareLayer').className = this.buttons['share'].classes['disabled'];
		$('shareLayer').onclick = function() { }
	}
}

CoreVideoControls_Share.prototype.enableShare = function() {
	if ($('shareLayer')) {
		$('shareLayer').className = this.buttons['share'].classes['activeOff'];
		$('shareLayer').onclick = this.buttons['share'].clickEvent;
	}
}

CoreVideoControls_Share.prototype.showShare = function() {
	if ($('shareLayer')) {
		if (this.endSlateActive == false) {
			CNNPlayer.getActivePlayer().handleEvent('pausePressed');
			if (CNNPlaylistManager.getInstance().playlistType == 'bvp') {
				try {
					if (window.displayOverlay != null)
						window.displayOverlay.enableButton(false);
				} catch(err) {  }
			}
		}
		var p = CNNPlaylistManager.getInstance();
		$('shareOverlay').style.display = 'block';
	}
}

CoreVideoControls_Share.prototype.hideShare = function(restart) {
	if ($('shareLayer')) {
		$('shareOverlay').style.display = 'none';
		if (this.endSlateActive) {
			$('endReplay').style.display = 'block';
			$('endEmbed').style.display = 'block';
			$('endShare').style.display = 'block';
			if ($('thumBs')) {
				$('thumBs').style.display = 'block';
				$('thumbOverlay').style.display = 'block';
			}
		} else {
			if (restart) {
				CNNPlayer.getActivePlayer().handleEvent('playPressed');
				if (CNNPlaylistManager.getInstance().playlistType == 'bvp') {
					try {
						if (window.displayOverlay != null)
							window.displayOverlay.enableButton(true);
					} catch(err) {  }
				}
			}
		}
	}
}

CoreVideoControls_Share.prototype.shareVideo = function(shareType) {
	var p = CNNPlaylistManager.getInstance();
	var dataObj = p.playlists[p.activePlaylist].playlistJsonObjs[p.playlists[p.activePlaylist].pointer].getDataObject();
	var linkUrl = null;
	var hstName = (location.hostname.indexOf('edition.') > -1) ? 'edition' : 'www';
	var vidUrl = encodeURIComponent('http://'+hstName+'.cnn.com/video/?JSONLINK='+dataObj.id);
	var desc = encodeURIComponent(dataObj.description);
	var headline = encodeURIComponent(dataObj.headline);
	switch (shareType) {
		case 'mixx':
			linkUrl = 'http://www.mixx.com/submit/video?page_url='+vidUrl+'&title='+headline+'&description='+desc+'&partner=CNN';
			break;
		case 'digg':
			linkUrl = 'http://digg.com/submit?phase=2&url='+vidUrl+'&title='+headline+'&bodytext='+desc;
			break;
		case 'facebook':
			var faceLink = 'http://'+hstName+'.cnn.com/video/data/2.0' + dataObj.id + '.html';
			linkUrl = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(faceLink)+'&t='+headline;
			break;
		case 'delicious':
			linkUrl = 'http://del.icio.us/post?v=4&partner=cnn&noui&jump=close&url='+vidUrl+'&title='+headline;
			break;
		case 'reddit':
			linkUrl = 'http://reddit.com/submit?url='+vidUrl+'&title='+headline;
			break;
		case 'stumbleupon':
			linkUrl = 'http://www.stumbleupon.com/submit?url='+vidUrl+'&title='+headline;
			break;
		case 'myspace':
			linkUrl = 'http://www.myspace.com/Modules/PostTo/Pages/?t='+headline+'&c='+desc+'&u='+vidUrl;
			break;
	}
	if (linkUrl != null) {
		window.open(linkUrl,'videoShareLink');
	}
}

CoreVideoControls_Share.init = function() {
	var divObj = document.createElement('div');
	divObj.setAttribute('id','shareLayer');
	divObj.className = CNNPlaylistManager.getInstance().controller.buttons['share'].classes['disabled'];
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);
	var divObj = document.createElement('div');
	divObj.setAttribute('id','shareOverlay');
	divObj.innerHTML = '<div id="shareContainer"></div><div id="shareIcons"><table border="0" cellpadding="0" cellspacing="0"><tr><td id="shareMixx" class="shareCell"><a href="javascript:CNNPlaylistManager.getInstance().controller.shareVideo(\'mixx\')">Mixx</a></td><td id="shareReddit" class="shareCell"><a href="javascript:CNNPlaylistManager.getInstance().controller.shareVideo(\'reddit\')">reddit</a></td></tr><tr><td id="shareDigg" class="shareCell"><a href="javascript:CNNPlaylistManager.getInstance().controller.shareVideo(\'digg\')">Digg</a></td><td id="shareStumbleupon" class="shareCell"><a href="javascript:CNNPlaylistManager.getInstance().controller.shareVideo(\'stumbleupon\')">StumbleUpon</a></td></tr><tr><td id="shareFacebook" class="shareCell"><a href="javascript:CNNPlaylistManager.getInstance().controller.shareVideo(\'facebook\')">Facebook</a></td><td id="shareMyspace" class="shareCell"><a href="javascript:CNNPlaylistManager.getInstance().controller.shareVideo(\'myspace\')">MySpace</a></td></tr><tr><td id="shareDelicious" class="shareCell"><a href="javascript:CNNPlaylistManager.getInstance().controller.shareVideo(\'delicious\')">del.icio.us</a></td></tr></table></div><div id="shareDivider"></div><div onclick="CNNPlaylistManager.getInstance().emailVideo();" class="shareEmail" onmouseover="this.className=\'shareEmailOver\';" onmouseout="this.className=\'shareEmail\';" id="shareEmail"></div><div id="shareClose" onclick="CNNPlaylistManager.getInstance().controller.hideShare(true);"></div><div id="shareTitle">Share this video</div>';
	if ($('mosVidContainer')) {
		$('mosVidContainer').appendChild(divObj);
	} else {
		$('htVidContainer').appendChild(divObj);
	}
}



CoreVideoControls_Share.clickEvent = function() {
	if ($('shareOverlay').style.display == 'block') {
		CNNPlaylistManager.getInstance().controller.hideShare(true);
	} else {
		CNNPlaylistManager.getInstance().controller.hideEmbed();
		if (CNNPlaylistManager.getInstance().controller.endSlateActive == true) {
			$('endReplay').style.display = 'none';
			$('endEmbed').style.display = 'none';
			$('endShare').style.display = 'none';
			if ($('thumBs')) {
				$('thumBs').style.display = 'none';
				$('thumbOverlay').style.display = 'none';
			}
		}
		CNNPlaylistManager.getInstance().controller.showShare();
	}
}

/* 	**********************************************

	End		-	Share
	Start 	- 	Fullscreen

	********************************************** */

function CoreVideoControls_Fullscreen() { }

CoreVideoControls_Fullscreen.prototype.fullscreenDiv = null;
CoreVideoControls_Fullscreen.prototype.fullscreenHide = false;

CoreVideoControls_Fullscreen.prototype.disableFullscreen = function() {
	if ($('fullscreenLayer')) {
		$('fullscreenLayer').className = this.buttons['fullscreen'].classes['disabled'];
		$('fullscreenLayer').onclick = function() { }
		$('fullscreenLayer').onmouseover = function() { }
		$('fullscreenLayer').onmouseover = function() { }
		CNNPlaylistManager.getInstance().controller.fullscreenDiv.style.display = 'none';
	}
}

CoreVideoControls_Fullscreen.prototype.enableFullscreen = function() {
	if ($('fullscreenLayer')) {
		$('fullscreenLayer').className = this.buttons['fullscreen'].classes['activeOff'];
		$('fullscreenLayer').onclick = this.buttons['fullscreen'].clickEvent;
		$('fullscreenLayer').onmouseover = function() { CNNPlaylistManager.getInstance().controller.fullscreenHide = false; CNNPlaylistManager.getInstance().controller.fullscreenDiv.style.display = 'block'; }
		$('fullscreenLayer').onmouseout = function() { 
			if (CNNPlaylistManager.getInstance().controller.fullscreenDiv.id == 'fullscreenUpgrade') {
				CNNPlaylistManager.getInstance().controller.fullscreenHide = true;
				setTimeout("if (CNNPlaylistManager.getInstance().controller.fullscreenHide) { CNNPlaylistManager.getInstance().controller.fullscreenDiv.style.display = 'none'; }",3000);
			} else {
				CNNPlaylistManager.getInstance().controller.fullscreenDiv.style.display = 'none';
			}
		}
	}
}

CoreVideoControls_Fullscreen.init = function() {
	var divObj = document.createElement('div');
	divObj.setAttribute('id','fullscreenLayer');
	divObj.className = CNNPlaylistManager.getInstance().controller.buttons['fullscreen'].classes['disabled'];
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);
	// build the div for the fullscreen item
	var fullScreenBubbleCheck = DetectFlashVer(9,0,115);
	if (fullScreenBubbleCheck) {
		divObj = document.createElement('div');
		divObj.setAttribute('id','fullscreenDoubleClick');
		divObj.innerHTML = '<img src="http://i.cdn.turner.com/cnn/.e/img/2.0/video/controls/flashDoubleClick.gif">';
		$('mosVidContainer').appendChild(divObj);
		CNNPlaylistManager.getInstance().controller.fullscreenDiv = $('fullscreenDoubleClick');
	}
	else {
		divObj = document.createElement('div');
		divObj.setAttribute('id','fullscreenUpgrade');
		divObj.innerHTML = '<a href="http://www.adobe.com/products/flashplayer/" target="_blank"><img border="no" src="http://i.cdn.turner.com/cnn/.e/img/2.0/video/controls/flashUpgrade.gif"></a>';
		$('mosVidContainer').appendChild(divObj);
		CNNPlaylistManager.getInstance().controller.fullscreenDiv = $('fullscreenUpgrade');
	}

}

CoreVideoControls_Fullscreen.clickEvent = function() {
	CNNPlayer.getActivePlayer().handleEvent('fullscreenPressed');
}

/* 	**********************************************

	End		-	Fullscreen
	Start 	- 	Timeline

	********************************************** */

function CoreVideoControls_Timeline() { }

CoreVideoControls_Timeline.prototype.enableTimelineScrubber = function() {
	if ($('timelineTrackBackground')) {
	this.scrubbers['timeline'].scrubberPointer.disabled = false;
	$('timelineHandler').className = this.scrubbers['timeline'].classes['handlerEnabled'];
	}
}

CoreVideoControls_Timeline.prototype.disableTimelineScrubber = function() {
	if ($('timelineTrackBackground')) {
	this.scrubbers['timeline'].scrubberPointer.disabled = true;
	$('timelineHandler').className = this.scrubbers['timeline'].classes['handlerDisabled'];
	}
}

CoreVideoControls_Timeline.prototype.setTimelineScrubberBuffer = function(val) {
	if ($('timelineTrackBackground')) {
	$('timelineTrackBuffer').style.width = ('' + (val * 100) + '%');
	}
}

CoreVideoControls_Timeline.prototype.doneTimelineScrubbing = function(val) {
	if ($('timelineTrackBackground')) {
	CNNPlayer.getActivePlayer().getMediaPlayer().seek(Math.floor(this.duration * val));
	}
}

CoreVideoControls_Timeline.init = function() {
	// place the background layer for the handle
	var divObj = document.createElement('div');
	divObj.setAttribute('id','timelineTrackBackground');
	divObj.className = CNNPlaylistManager.getInstance().controller.scrubbers['timeline'].classes['trackBackground'];
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);

	// fill the background layer
	var divObj = document.createElement('div');
	divObj.setAttribute('id','timelineTrackBuffer');
	divObj.className = CNNPlaylistManager.getInstance().controller.scrubbers['timeline'].classes['trackBuffer'];
	$('timelineTrackBackground').appendChild(divObj);

	// create the handle encloser
	var divObj = document.createElement('div');
	divObj.setAttribute('id','timelineHandlerBacker');
	divObj.className = CNNPlaylistManager.getInstance().controller.scrubbers['timeline'].classes['handlerBacker'];
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);
	
	// create the handle
	var divObj = document.createElement('div');
	divObj.setAttribute('id','timelineHandler');
	divObj.className = CNNPlaylistManager.getInstance().controller.scrubbers['timeline'].classes['handlerDisabled'];
	$('timelineHandlerBacker').appendChild(divObj);

	CNNPlaylistManager.getInstance().controller.scrubbers['timeline'].scrubberPointer = new Control.Slider('timelineHandler', 'timelineHandlerBacker', {
		onSlide: CNNPlaylistManager.getInstance().controller.scrubbers['timeline'].slideEvent,
		onChange: CNNPlaylistManager.getInstance().controller.scrubbers['timeline'].changeEvent,
		disabled: true
	});
}

CoreVideoControls_Timeline.slideEvent = function(val) {
	CNNPlaylistManager.getInstance().controller.amScrubbing = true;
}

CoreVideoControls_Timeline.changeEvent = function(val) {
	CNNPlaylistManager.getInstance().controller.amScrubbing = false;
	CNNPlaylistManager.getInstance().controller.doneTimelineScrubbing(val);
}

/* 	**********************************************

	End		-	Timeline 
	Start 	- 	Volume Button

	********************************************** */

function CoreVideoControls_VolumeButton() { }

CoreVideoControls_VolumeButton.prototype.setVolumeButton = function(val) {
	this.buttons['volume'].isMuted = false;
	if (val < 0.3333 ) {
		$('volumeLayer').className = this.buttons['volume'].classes['disabled'];
	} else if (val >= 0.3333 && val < 0.6666) {
		$('volumeLayer').className = this.buttons['volume'].classes['activeOff'];
	} else if (val >= 0.6666) {
		$('volumeLayer').className = this.buttons['volume'].classes['activeOn'];
	}
	CNNPlayer.getActivePlayer().handleEvent('volumeChanged');
}

CoreVideoControls_VolumeButton.init = function() {
	// place the volume mutted button
	CNNPlaylistManager.getInstance().controller.buttons['volume'].isMuted = false;
	CNNPlaylistManager.getInstance().controller.buttons['volume'].lastDrop = 0;
	var divObj = document.createElement('div');
	divObj.setAttribute('id','volumeLayer');
	divObj.className = CNNPlaylistManager.getInstance().controller.buttons['volume'].classes['disabled'];
	divObj.onclick = function() { CNNPlaylistManager.getInstance().controller.buttons['volume'].clickEvent(); }
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);
}

CoreVideoControls_VolumeButton.clickEvent = function() {
	var c = CNNPlaylistManager.getInstance().controller;
	if (c.buttons['volume'].isMuted) {
		c.scrubbers['volume'].scrubberPointer.setValue(c.buttons['volume'].lastDrop);
		c.setVolumeButton(c.buttons['volume'].lastDrop);
	} else {
		c.buttons['volume'].lastDrop = c.scrubbers['volume'].scrubberPointer.value;
		c.scrubbers['volume'].scrubberPointer.setValue(0);
		c.setVolumeButton(0);
		c.buttons['volume'].isMuted = true;
	}
}

/* 	**********************************************

	End		-	Volume Button 
	Start 	- 	Volume Scrubber

	********************************************** */

function CoreVideoControls_VolumeScrubber() { }

CoreVideoControls_VolumeScrubber.slideChangeEvent = function(val) {
	CNNPlaylistManager.getInstance().controller.setVolumeButton(val);
}

CoreVideoControls_VolumeScrubber.init = function() {
	// place the background layer for the handle
	var divObj = document.createElement('div');
	divObj.setAttribute('id','volumeTrackBackground');
	divObj.className = CNNPlaylistManager.getInstance().controller.scrubbers['volume'].classes['trackBackground'];
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);

	// create the handle encloser
	var divObj = document.createElement('div');
	divObj.setAttribute('id','volumeHandlerBacker');
	divObj.className = CNNPlaylistManager.getInstance().controller.scrubbers['volume'].classes['handlerBacker'];
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);
	
	// create the handle
	var divObj = document.createElement('div');
	divObj.setAttribute('id','volumeHandler');
	divObj.className = CNNPlaylistManager.getInstance().controller.scrubbers['volume'].classes['handlerEnabled'];
	$('volumeHandlerBacker').appendChild(divObj);

	CNNPlaylistManager.getInstance().controller.scrubbers['volume'].scrubberPointer = new Control.Slider('volumeHandler', 'volumeHandlerBacker', {
		onSlide: CNNPlaylistManager.getInstance().controller.scrubbers['volume'].slideEvent,
		onChange: CNNPlaylistManager.getInstance().controller.scrubbers['volume'].changeEvent
	});
}

/* 	**********************************************

	End		-	Volume Scrubber
	Start 	- 	Time and Duration

	********************************************** */

function CoreVideoControls_Clock() { }

CoreVideoControls_Clock.prototype.calculateTime = function(val) {
	if ($('timeLayer')) {
	if (val > 59) {
		var minutes = Math.floor(val / 60);
		seconds = (val % 60);
		var seconds = val - (60 * minutes);
		if (seconds < 10) seconds = ('' + "0") + seconds;
		return (minutes + ":" + seconds);
	} else {
		if (val < 10) val = ('' + "0") + val;
		return ("0:" + val);
	}
	}
}

CoreVideoControls_Clock.prototype.setDuration = function(val) {
	if ($('timeLayer')) {
	if ( val ) {
		this.duration = val;
		$('durationLayer').innerHTML = this.calculateTime(val);
	}
	}
}

CoreVideoControls_Clock.prototype.setTime = function(val) {
	if ($('timeLayer')) {
	$('timeLayer').innerHTML = this.calculateTime(val);
	if (this.duration != null && this.amScrubbing == false) {
		this.scrubbers['timeline'].scrubberPointer.setValueExternally(val/this.duration);
	}
	}
}

CoreVideoControls_Clock.prototype.resetTimeDuration = function() {
	if ($('timeLayer')) {
	this.setTime(0);
	this.setDuration(0);
	}
}

CoreVideoControls_Clock.init = function() {
	var divObj = document.createElement('div');
	divObj.setAttribute('id','timeLayer');
	divObj.className = CNNPlaylistManager.getInstance().controller.clocks['time and duration'].classes['time'];
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);
	$('timeLayer').innerHTML = "0:00";

	var divObj = document.createElement('div');
	divObj.setAttribute('id','sepLayer');
	divObj.className = CNNPlaylistManager.getInstance().controller.clocks['time and duration'].classes['sep'];
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);
	$('sepLayer').innerHTML = "/";

	var divObj = document.createElement('div');
	divObj.setAttribute('id','durationLayer');
	divObj.className = CNNPlaylistManager.getInstance().controller.clocks['time and duration'].classes['duration'];
	CNNPlaylistManager.getInstance().controller.parentDiv.appendChild(divObj);
	$('durationLayer').innerHTML = "0:00";
}

/* 	**********************************************

	End		-	Time and Duration 
	Start 	- 	add<object> abstracts

	********************************************** */

CoreVideoControls.prototype.addButton = function(buttonName,buttonInit,disabledClass,activeOffClass,activeOnClass,clickEvent) {
	this.buttons[buttonName] = new CoreVideoControls.Button(disabledClass,activeOffClass,activeOnClass,clickEvent);
	this.initList[this.initList.length] = buttonInit;
}

CoreVideoControls.prototype.addClock = function(clockName,clockInit,timeClass,durationClass,sepClass) {
	this.clocks[clockName] = new CoreVideoControls.Clock(timeClass,durationClass,sepClass);
	this.initList[this.initList.length] = clockInit;
}

CoreVideoControls.prototype.addScrubber = function(scrubberName,scrubberInit,trackBackground,trackBuffer,handlerBacker,handlerDisabled,handlerEnabled,slideEvent,changeEvent) {
	this.scrubbers[scrubberName] = new CoreVideoControls.Scrubber(trackBackground,trackBuffer,handlerBacker,handlerDisabled,handlerEnabled,slideEvent,changeEvent);
	this.initList[this.initList.length] = scrubberInit;
}

CoreVideoControls.inheritAll = function() {
	for (var i = 1; i < arguments.length; i++) {
		for (x in arguments[i].prototype) {
			arguments[0].prototype[x] = arguments[i].prototype[x];
		}
	}
}

/* 	**********************************************

	End 	- 	add<object> abstracts
	Start 	- 	<object> abstracts

	********************************************** */

CoreVideoControls.Button = function(disabledClass,activeOffClass,activeOnClass,clickEvent) {
	this.classes = new Array();
	this.classes['disabled'] = disabledClass;
	this.classes['activeOff'] = activeOffClass;
	this.classes['activeOn'] = activeOnClass;
	this.clickEvent = clickEvent;
}

CoreVideoControls.Clock = function(time,duration,sep) {
	this.classes = new Array();
	this.classes['time'] = time;
	this.classes['duration'] = duration;
	this.classes['sep'] = sep;
}

CoreVideoControls.Scrubber = function(trackBackground,trackBuffer,handlerBacker,handlerDisabled,handlerEnabled,slideEvent,changeEvent) {
	this.classes = new Array();
	this.classes['trackBackground'] = trackBackground;
	this.classes['trackBuffer'] = trackBuffer;
	this.classes['handlerBacker'] = handlerBacker;
	this.classes['handlerEnabled'] = handlerEnabled;
	this.classes['handlerDisabled'] = handlerDisabled;
	this.slideEvent = slideEvent;
	this.changeEvent = changeEvent;
}

Control.Slider.prototype.setValueExternally = function(sliderValue, handleIdx){
	if(!this.active) {
		this.activeHandleIdx = handleIdx || 0;
		this.activeHandle    = this.handles[this.activeHandleIdx];
		this.updateStyles();
	}
	handleIdx = handleIdx || this.activeHandleIdx || 0;
	if(this.initialized && this.restricted) {
		if((handleIdx>0) && (sliderValue<this.values[handleIdx-1]))
			sliderValue = this.values[handleIdx-1];
		if((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1]))
			sliderValue = this.values[handleIdx+1];
	}
	sliderValue = this.getNearestValue(sliderValue);
	this.values[handleIdx] = sliderValue;
	this.value = this.values[0]; // assure backwards compat
	
	this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = 
	this.translateToPx(sliderValue);
	
	this.drawSpans();
}

CoreVideoControls.inheritAll(CoreVideoControls,CoreVideoControls_Play,CoreVideoControls_Pause,CoreVideoControls_Embed,CoreVideoControls_Share,CoreVideoControls_Fullscreen,CoreVideoControls_Timeline,CoreVideoControls_VolumeButton,CoreVideoControls_VolumeScrubber,CoreVideoControls_Clock);
