function CNNVideoControls(parentDiv) {
	this.parentDiv = $(parentDiv);
	this.buttons = new Array();
	this.scrubbers = new Array();
	this.clocks = new Array();
}

CNNVideoControls.prototype.initialize = function(callbackMethod) {
	/* ************
	 * Pause / Play button
	 * ************/
	// place the pause disabled button
	var divObj = document.createElement('div');
	divObj.setAttribute('id','pauseLayer');
	divObj.className = this.buttons['pause'].classes['disabled'];
	this.parentDiv.appendChild(divObj);
	
	// place the play button
	var divObj = document.createElement('div');
	divObj.setAttribute('id','playLayer');
	divObj.className = this.buttons['play'].classes['disabled'];
	divObj.style.display = 'none';
	this.parentDiv.appendChild(divObj);

	/* ************
	 * email
	 * ************/
	// place the email disabled button
	var divObj = document.createElement('div');
	divObj.setAttribute('id','emailLayer');
	divObj.className = this.buttons['email'].classes['disabled'];
	this.parentDiv.appendChild(divObj);

	/* ************
	 * fullscreen
	 * ************/
	// place the fullscreen disabled button
	var divObj = document.createElement('div');
	divObj.setAttribute('id','fullscreenLayer');
	divObj.className = this.buttons['fullscreen'].classes['disabled'];
	this.parentDiv.appendChild(divObj);

	/* ************
	 * volume
	 * ************/
	// place the volume mutted button
	this.buttons['volume'].isMuted = false;
	this.buttons['volume'].lastDrop = 0;
	var divObj = document.createElement('div');
	divObj.setAttribute('id','volumeLayer');
	divObj.className = this.buttons['volume'].classes['disabled'];
	divObj.onclick = function() { CNNPlaylistManager.getInstance().controller.buttons['volume'].clickEvent(); }
	this.parentDiv.appendChild(divObj);

	/* ************
	 * time and duration
	 * ************/
	var divObj = document.createElement('div');
	divObj.setAttribute('id','timeLayer');
	divObj.className = this.clocks['time and duration'].classes['time'];
	this.parentDiv.appendChild(divObj);
	$('timeLayer').innerHTML = "0:00";

	var divObj = document.createElement('div');
	divObj.setAttribute('id','sepLayer');
	divObj.className = this.clocks['time and duration'].classes['sep'];
	this.parentDiv.appendChild(divObj);
	$('sepLayer').innerHTML = "/";

	var divObj = document.createElement('div');
	divObj.setAttribute('id','durationLayer');
	divObj.className = this.clocks['time and duration'].classes['duration'];
	this.parentDiv.appendChild(divObj);
	$('durationLayer').innerHTML = "0:00";

	/* ************
	 * Timeline Scrubber
	 * ************/

	// place the background layer for the handle
	var divObj = document.createElement('div');
	divObj.setAttribute('id','timelineTrackBackground');
	divObj.className = this.scrubbers['timeline'].classes['trackBackground'];
	this.parentDiv.appendChild(divObj);

	// fill the background layer
	var divObj = document.createElement('div');
	divObj.setAttribute('id','timelineTrackBuffer');
	divObj.className = this.scrubbers['timeline'].classes['trackBuffer'];
	$('timelineTrackBackground').appendChild(divObj);

	// create the handle encloser
	var divObj = document.createElement('div');
	divObj.setAttribute('id','timelineHandlerBacker');
	divObj.className = this.scrubbers['timeline'].classes['handlerBacker'];
	this.parentDiv.appendChild(divObj);
	
	// create the handle
	var divObj = document.createElement('div');
	divObj.setAttribute('id','timelineHandler');
	divObj.className = this.scrubbers['timeline'].classes['handlerDisabled'];
	$('timelineHandlerBacker').appendChild(divObj);

	/* ************
	 * Volume Scrubber
	 * ************/

	// place the background layer for the handle
	var divObj = document.createElement('div');
	divObj.setAttribute('id','volumeTrackBackground');
	divObj.className = this.scrubbers['volume'].classes['trackBackground'];
	this.parentDiv.appendChild(divObj);

	// create the handle encloser
	var divObj = document.createElement('div');
	divObj.setAttribute('id','volumeHandlerBacker');
	divObj.className = this.scrubbers['volume'].classes['handlerBacker'];
	this.parentDiv.appendChild(divObj);
	
	// create the handle
	var divObj = document.createElement('div');
	divObj.setAttribute('id','volumeHandler');
	divObj.className = this.scrubbers['volume'].classes['handlerEnabled'];
	$('volumeHandlerBacker').appendChild(divObj);

	this.scrubbers['timeline'].scrubberPointer = new Control.Slider('timelineHandler', 'timelineHandlerBacker', {
				onSlide: function(v) {  },
				onChange: function(v) {  },
				disabled: true
			});

	this.scrubbers['volume'].scrubberPointer = new Control.Slider('volumeHandler', 'volumeHandlerBacker', {
				onSlide: CNNPlaylistManager.getInstance().controller.scrubbers['volume'].slideEvent,
				onChange: CNNPlaylistManager.getInstance().controller.scrubbers['volume'].changeEvent
			});

	callbackMethod();
}

CNNVideoControls.prototype.swapPlayPause = function(hide,show) {
	$(hide).style.display = 'none';
	$(show).style.display = 'block';
}

CNNVideoControls.prototype.pausePressed = function() {
	this.enablePlay();
	// ::: XMP ::: - insert XMP call here
}

CNNVideoControls.prototype.pausePressed = function() {
	this.enablePause();
	// ::: XMP ::: - insert XMP call here
}

CNNVideoControls.prototype.disablePause = function() {
	this.swapPlayPause('playLayer','pauseLayer');
	$('pauseLayer').className = this.buttons['pause'].classes['disabled'];
	$('pauseLayer').onclick = function() { }
	$('pauseLayer').onmouseover = function() { }
	$('pauseLayer').onmouseout = function() { }
}

CNNVideoControls.prototype.enablePause = function() {
	this.swapPlayPause('playLayer','pauseLayer');
	$('pauseLayer').className = this.buttons['pause'].classes['activeOff'];
	$('pauseLayer').onclick = this.buttons['pause'].clickEvent;
	$('pauseLayer').onmouseover = function() { this.className = CNNPlaylistManager.getInstance().controller.buttons['pause'].classes['activeOn']; }
	$('pauseLayer').onmouseout = function() { this.className = CNNPlaylistManager.getInstance().controller.buttons['pause'].classes['activeOff']; }
}

CNNVideoControls.prototype.disablePlay = function() {
	this.swapPlayPause('pauseLayer','playLayer');
	$('playLayer').className = this.buttons['play'].classes['disabled'];
	$('playLayer').onclick = function() { }
	$('playLayer').onmouseover = function() { }
	$('playLayer').onmouseout = function() { }
}

CNNVideoControls.prototype.enablePlay = function() {
	this.swapPlayPause('pauseLayer','playLayer');
	$('playLayer').className = this.buttons['play'].classes['activeOff'];
	$('playLayer').onclick = this.buttons['play'].clickEvent;
	$('playLayer').onmouseover = function() { this.className = CNNPlaylistManager.getInstance().controller.buttons['play'].classes['activeOn']; }
	$('playLayer').onmouseout = function() { this.className = CNNPlaylistManager.getInstance().controller.buttons['play'].classes['activeOff']; }
}

CNNVideoControls.prototype.disableEmail = function() {
	$('emailLayer').className = this.buttons['email'].classes['disabled'];
	$('emailLayer').onclick = function() { }
	$('emailLayer').onmouseover = function() { }
	$('emailLayer').onmouseout = function() { }
}

CNNVideoControls.prototype.enableEmail = function() {
	$('emailLayer').className = this.buttons['email'].classes['activeOff'];
	$('emailLayer').onclick = this.buttons['email'].clickEvent;
	$('emailLayer').onmouseover = function() { this.className = CNNPlaylistManager.getInstance().controller.buttons['email'].classes['activeOn']; }
	$('emailLayer').onmouseout = function() { this.className = CNNPlaylistManager.getInstance().controller.buttons['email'].classes['activeOff']; }
}

CNNVideoControls.prototype.enableScrubber = function() {
	this.scrubbers['timeline'].scrubberPointer.disabled = false;
	$('timelineHandler').className = this.scrubbers['timeline'].classes['handlerEnabled'];
}

CNNVideoControls.prototype.setScrubberBuffer = function(val) {
	$('timelineTrackBuffer').style.width = ('' + (val * 100) + '%');
}

CNNVideoControls.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'];
	}
	// ::: XMP ::: - insert XMP call here
}

CNNVideoControls.prototype.volumeButtonClicked = function() {
	if (this.buttons['volume'].isMuted) {
		this.scrubbers['volume'].scrubberPointer.setValue(this.buttons['volume'].lastDrop);
		this.setVolumeButton(this.buttons['volume'].lastDrop);
	} else {
		this.buttons['volume'].lastDrop = this.scrubbers['volume'].scrubberPointer.value;
		this.scrubbers['volume'].scrubberPointer.setValue(0);
		this.setVolumeButton(0);
		this.buttons['volume'].isMuted = true;
	}
}

CNNVideoControls.prototype.calculateTime = function(val) {
	var seconds = val % 60;
	var minutes = Math.floor(val / 60);
	if (seconds < 10) seconds = ('' + "0") + seconds;
	return (minutes + ":" + seconds);
}

CNNVideoControls.prototype.setDuration = function(val) {
	$('durationLayer').innerHTML = this.calculateTime(val);
}

CNNVideoControls.prototype.setTime = function(val) {
	$('timeLayer').innerHTML = this.calculateTime(val);
}

CNNVideoControls.prototype.resetTimeDuration = function() {
	this.setTime(0);
	this.setDuration(0);
}

CNNVideoControls.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;
}

CNNVideoControls.Clock = function(time,duration,sep) {
	this.classes = new Array();
	this.classes['time'] = time;
	this.classes['duration'] = duration;
	this.classes['sep'] = sep;
}

CNNVideoControls.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;
}