VideoOverlay = function(controlId, url, width, height, linkId) {
	this.control = $('#' + controlId);
	this.url = url;
	this.width = width;
	this.height = height;
	this.link = $('#' + linkId);
	this.close = this.control.find(".video-overlay-close");
}

VideoOverlay.prototype.initialise = function() {
	this.close.click(CallInContext(this, this.hide));
	this.link.click(CallInContext(this, this.show));

	if (navigator.platform == "iPhone" || navigator.platform == "iPod") {
		this.link.attr("href", this.link.attr("href").replace('.mov', '.m4v'));
	}

	if (navigator.platform != "iPhone" && navigator.platform != "iPod") {
		if (document.location.hash.toLowerCase() == "#video") {
			this.show();
		}
	}
}

VideoOverlay.prototype.hide = function() {
	this.control.hide();
}

VideoOverlay.prototype.show = function() {
	if (navigator.platform == "iPhone" || navigator.platform == "iPod") {
		window.location.href = this.url.replace('.mov', '.m4v');
	} else {
		this.control.show();		
	}
}