
MakeUCC=function() {
	this.ComID = "";
	this.ComURL = "";
	this.UserID = "";
	this.WatermarkUse = "";
	this.WatermarkURL = "null";
	this.PlayButtonUse = "";
	this.PlayButtonURL = "null";
	this.BannerUse = "";
	this.BannerURL = "null";
	this.AdTextUse = "";
	this.AdTextURL = "null";
	this.FtpDir = "";
	this.ViewerParam1="";
	this.ViewerParam2="";
	this.DataBase = "";
	this.CabID = "0D07A301-DFC5-4bcb-A3AC-76A32F7E630B";
	this.CabName = "MakeUCC.cab";
	this.CabVer = "VERSION=2008,9,10,11";
	this.SwfName = "makeucc.swf"
}

MakeUCC.prototype.SetID=function(UID) {
	this.ComID = UID;
}

MakeUCC.prototype.GetID=function() {
	return this.ComID;
}

MakeUCC.prototype.SetSrvID=function(SID) {
	this.UserID = SID;
}

MakeUCC.prototype.GetSrvID=function() {
	return this.UserID;
}

MakeUCC.prototype.SetUserID=function(UID) {
	this.UserID = UID;
}

MakeUCC.prototype.GetUserID=function() {
	return this.UserID;
}

MakeUCC.prototype.SetURL=function(CURL) {
	this.ComURL = CURL;
}

MakeUCC.prototype.GetURL=function() {
	return this.ComURL;
}

MakeUCC.prototype.SetDBName=function(DBN) {
	this.DataBase = DBN;
}

MakeUCC.prototype.GetDBName=function() {
	return this.DataBase;
}

MakeUCC.prototype.SetMakeUCC=function(CID, CURL) {
	if("" == CID) {
		alert("MakeUCC : ID를 입력하세요.");
		return;
	}
	if("" == CURL) {
		alert("MakeUCC : 컴포넌트 URL을 입력하세요.");
		return;
	}
	this.ComID = CID;
	this.ComURL = CURL;
}

MakeUCC.prototype.SetWatermark=function(WURL) {
	this.WatermarkUse = "1";
	if(undefined != WURL)
	{
		this.WatermarkURL = WURL;
	}
}

MakeUCC.prototype.SetPlayButton=function(PURL) {
	this.PlayButtonUse = "1";
	if(undefined != PURL)
	{
		this.PlayButtonURL = PURL;
	}
}

MakeUCC.prototype.SetBannerURL=function(BURL) {
	this.BannerUse = "1";
	if(undefined != BURL)
	{
		this.BannerURL = BURL;
	}
}

MakeUCC.prototype.SetAdText=function(AURL) {
	this.AdTextUse = "1";
	if(undefined != AURL)
	{
		this.AdTextURL = AURL;
	}
}

MakeUCC.prototype.SetFtpDir=function(Dir) {
	this.FtpDir = Dir;
}

MakeUCC.prototype.SetViewParam1=function(VP) {
	this.ViewerParam1 = VP;
}

MakeUCC.prototype.SetViewParam2=function(VP) {
	this.ViewerParam2 = VP;
}

MakeUCC.prototype.GetSelectFile=function() {
	if("" == this.ComID) {
		alert("MakeUCC : ID를 입력하세요.");
		return;
	}
	return MakeUCC_Converter.strSelectedFile;
}

MakeUCC.prototype.GetPlayTime=function() {
	if("" == this.ComID) {
		alert("MakeUCC : ID를 입력하세요.");
		return;
	}
	return MakeUCC_Converter.VideoPlayTime;
}

MakeUCC.prototype.GetVideoFileSize=function() {
	if("" == this.ComID) {
		alert("MakeUCC : ID를 입력하세요.");
		return;
	}
	return MakeUCC_Converter.nVideoFileSize
}

MakeUCC.prototype.Convert=function(bImage, nLimitSize) {
	if("" == this.ComID) {
		alert("MakeUCC : ID를 입력하세요.");
		return;
	}
	MakeUCC_Converter.ComponentURL = this.ComURL;
	MakeUCC_Converter.DataBaseName = this.DataBase;
	MakeUCC_Converter.ComponentID = this.ComID;
	if("" != this.UserID) {
		MakeUCC_Converter.ServiceID = this.UserID;
	}
	if( ("1" == this.WatermarkUse) && ("null" == this.WatermarkURL) ){
		MakeUCC_Converter.WatermarkURL = this.ComURL + "watermark.jpg";
	}
	else {
		MakeUCC_Converter.WatermarkURL = this.WatermarkURL;
	}
	if(undefined == nLimitSize) {
		MakeUCC_Converter.nLimitSize = 0;
	}
	else	{
		MakeUCC_Converter.nLimitSize = nLimitSize;
	}
	MakeUCC_Converter.Convert(bImage);
}

MakeUCC.prototype.GetUploadVideoFile=function() {
	if("" == this.ComID) {
		alert("MakeUCC : ID를 입력하세요.");
		return;
	}
	return MakeUCC_Converter.strConvertedVideoFile;
}

MakeUCC.prototype.GetUploadImageFile=function() {
	if("" == this.ComID) {
		alert("MakeUCC : ID를 입력하세요.");
		return;
	}	
	return MakeUCC_Converter.strConvertedImageFile;
}

MakeUCC.prototype.Upload=function(Folder, Ftp_Type) {
	if("" == this.ComID) {
		alert("MakeUCC : ID를 입력하세요.");
		return;
	}	
	MakeUCC_Converter.WebRoot = this.FtpDir;
	MakeUCC_Converter.is_passive_ftp = Ftp_Type;
	MakeUCC_Converter.Upload(Folder);
}

MakeUCC.prototype.CreateConverter=function() {
	this.CheckConverter();
	sTag = "<object id=\"MakeUCC_Converter\" classid=\"clsid:" + this.CabID + "\" ";
	sTag += "codebase=\"" + this.ComURL + "/" + this.CabName + "#" + this.CabVer + "\" width=\"0\" height=\"0\"> ";
	sTag += "</object>";
	document.write(sTag);
	return sTag;
}

MakeUCC.prototype.CreateConverterPopup=function(PopupName) {
	this.CheckConverter();
	sTag = "<object id=\"MakeUCC_Converter\" classid=\"" + this.CabID + "\" ";
	sTag += "codebase=\"" + this.ComURL + "/" + this.CabName + "#" + this.CabVer + "\" width=\"0\" height=\"0\" onerror=\""+ PopupName + "\"> ";
	sTag += "</object>";
	document.write(sTag);
	return sTag;
}

MakeUCC.prototype.CheckConverter=function() {
	if("" == this.ComID) {
		alert("MakeUCC : ID를 입력하세요.");
		return;
	}	
	if("" == this.ComURL) {
		this.CabID = "f1b6fcd7-5d5f-48fd-b431-5e80939a8583";
		this.CabName = "UCCLauncher.cab";
		this.CabVer = "VERSION=2008,5,19,1";
		this.ComURL = "http://service.makeucc.co.kr/install";
		if( ("1" == this.WatermarkUse) && ("null" == this.WatermarkURL) ){
			this.WatermarkURL = "http://admin.makeucc.co.kr/upload/comservice";
		}
	}
	if('/' != this.ComURL[this.ComURL.length - 1])
	{
		this.ComURL += "/";
	}
}

MakeUCC.prototype.CreateViewer=function(MovieID, nWidth, nHeight) {
	this.CheckViewer("normal");
	this.Viewer(MovieID, nWidth, nHeight);
}

MakeUCC.prototype.CreateMiniViewer=function(MovieID, nWidth, nHeight) {
	this.CheckViewer("mini");
	this.Viewer(MovieID, nWidth, nHeight);
}

MakeUCC.prototype.Viewer=function(MovieID, nWidth, nHeight) {
	sTag = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" ";
	sTag += "codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" ";
	sTag += "width=\"" + nWidth +"\" height=\"" + nHeight +"\" id=\"MakeUCC_Viewer\" align=\"middle\" /> ";
	sTag += "<param name=\"allowScriptAccess\" value=\"always\" /> ";
	sTag += "<param name=\"allowfullscreen\" value=\"true\" /> ";
	sTag += "<param name=\"movie\" value=\"" + this.ComURL + this.SwfName + "\" /> ";
	sTag += "<param name=\"quality\" value=\"high\" /> ";
	sTag += "<param name=\"devicefont\" value=\"true\" /> ";
	sTag += "<param name=\"bgcolor\" value=\"#ffffff\" /> ";
	if( (this.UserID != undefined) && (this.UserID != "") ) {
		sTag += "<param name=\"FlashVars\" value=\"ComURL=" + this.ComURL + "&ComSrv_ID=" + this.ComID + "&Srv_ID=" + this.UserID + "&MovieID=" + MovieID  + "&playicon=" + this.PlayButtonURL + "&WatermarkURL=" + this.WatermarkURL + "&BannerURL=" + this.BannerURL  + "&ComSrv_AdText=" + this.AdTextURL + "&ViewerParam1=" + this.ViewerParam1 + "&ViewerParam2=" + this.ViewerParam2 + "\" /> ";
	}
	else {
		sTag += "<param name=\"FlashVars\" value=\"ComURL=" + this.ComURL + "&ComSrv_ID=" + this.ComID + "&MovieID=" + MovieID  + "&playicon=" + this.PlayButtonURL + "&WatermarkURL=" + this.WatermarkURL + "&BannerURL=" + this.BannerURL + "&ComSrv_AdText=" + this.AdTextURL  + "&ViewerParam1=" + this.ViewerParam1 + "&ViewerParam2=" + this.ViewerParam2  + "\" /> ";
	}
	sTag += "<embed src=\"" + this.ComURL + "viewer.swf\" ";
	sTag += "quality=\"high\" wmode=\"transparent\" devicefont=\"true\" ";
	sTag += "bgcolor=\"#ffffff\" width=\"" + nWidth +"\" height=\"" + nHeight +"\" id=\"MakeUCC_Viewer\" name=\"MakeUCC_Viewer\" ";
	sTag += "align=\"middle\" allowScriptAccess=\"always\" allowfullscreen=\"true\" type=\"application/x-shockwave-flash\" ";
	sTag += "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" ";
	if( (this.UserID != undefined) && (this.UserID != "") ) {
		sTag += "flashvars=\"ComSrv_ID=" + this.ComID + "&Srv_ID=" + this.UserID +"&MovieID=" + MovieID  + "&playicon=" + this.PlayButtonURL + "&WatermarkURL=" + this.WatermarkURL + "&BannerURL=" + this.BannerURL + "&ComSrv_AdText=" + this.AdTextURL + "&ViewerParam1=" + this.ViewerParam1 + "&ViewerParam2=" + this.ViewerParam2  + "\" /> ";
	}
	else {
		sTag += "flashvars=\"ComSrv_ID=" + this.ComID + "&MovieID=" + MovieID  + "&playicon=" + this.PlayButtonURL + "&WatermarkURL=" + this.WatermarkURL + "&BannerURL=" + this.BannerURL + "&ComSrv_AdText=" + this.AdTextURL  + "&ViewerParam1=" + this.ViewerParam1 + "&ViewerParam2=" + this.ViewerParam2  + "\" /> ";

	}
	
	sTag += "</object>";

	document.write(sTag);

	return sTag;
}

MakeUCC.prototype.CheckViewer=function(VTYPE) {
	if("" == this.ComID) {
		alert("MakeUCC : ID를 입력하세요.");
		return;
	}	
	if("" == this.ComURL) {
		this.ComURL = "http://service.makeucc.co.kr/install";
		if("mini" == VTYPE) {
			this.SwfName = "viewer_mini.swf";
		}
		else	{
			this.SwfName = "viewer.swf";
		}
	}
	else {
		if("mini" == VTYPE) {
			this.SwfName = "makeucc_mini.swf";
		}
		else	{
			this.SwfName = "makeucc.swf";
		}
	}
	if('/' != this.ComURL[this.ComURL.length - 1])
	{
		this.ComURL += "/";
	}
	if( ("1" == this.PlayButtonUse) && ("null" == this.PlayButtonURL) ){
		this.PlayButtonURL = this.ComURL + "playbutton.png";
	}
	if( ("1" == this.WatermarkUse) && ("null" == this.WatermarkURL) ){
		this.WatermarkURL = this.ComURL + "watermark.png";
	}
	if( ("1" == this.AdTextUse) && ("null" == this.AdTextURL) ){
		this.AdTextURL = this.ComURL + "AdText.xml";
	}
}
