function YouTubeUnit() {
	this.videoUrl = '';
	this.videoWidth = 0;
	this.videoHeight = 0;
	this.divId = '';
	
	this.SetVideoURL = SetVideoURL;
	this.SetVideoWidth = SetVideoWidth;
	this.SetDivID = SetDivID;
	this.CreateVideo = CreateVideo;
}

function SetVideoURL(url) {
	var urlSplit = url.split('v=');
	this.videoUrl = "http://www.youtube.com/v/"+urlSplit[1]+"&enablejsapi=1&playerapiid=ytplayer&rel=0";
}

function SetVideoWidth(width) {
	this.videoWidth = width;
	this.videoHeight = Math.ceil((356 / 425) * this.videoWidth);
}

function SetDivID(divId) {
	this.SetDivID = divId;
}

function CreateVideo() {
	var params = { allowScriptAccess: "always" };
	var atts = { id: "myytplayer" };
	swfobject.embedSWF(this.videoUrl, this.SetDivID, this.videoWidth, this.videoHeight, "8", null, null, params, atts);
}
