/**
 * @projectDescription
 * 
 * @author rhio.kim@pandora.tv
 * @version v 0.1.0
 * 
 * @sdoc
 * @namespace pandora.util.share
 * @usage var instanceName = cTShare.getInstance();
 */
var categResultJson = null;
var prgInfoJson = null;
var shareLang = {
	ko : {
		caption : {
			tScrap : '<strong>1. 내 채널로 퍼가기</strong> (스크랩)',
			tCopy : '<strong>2. 플레이어 그대로 퍼가기/에디터 게시판</strong> (싸이월드,네이버등)', 
			tHtml : '<strong>3. HTML 소스 퍼가기</strong> (다음, 엠파스 등)', 
			tLink : '<strong>4. 동영상 링크로 퍼가기</strong> (네이버, 세이클럽 등)', 
			tBlog : '<strong>5. 소문내기</strong>(Social Bookmark)', 
			tEmail : '<strong>6. 이메일 보내기</strong>',
			tSender : '보내는 사람',
			tRecver : '받는 사람',
			tBody : '내용',
			msg_fromMsg : "받는사람의 Email 주소입력", msg_toMsg : "자신의 Email 주소입력", 
			msg_text1 : "수신자가 여러 명일 경우  ;로 구분",
			btn_scrap : '스크랩', 
			btn_copy : '복사하기', 
			btn_send_mail : '보내기',
			scrap_txt : 'Copy to my Pandora.tv channel',
			link_txt : 'Copy and paste this link into an email or instant message:',
			embed_txt : 'Copy and paste this embed code above'
		},
		scrapCaption : {
			scrapMsg1 : '님 스크랩해가시면서 간단한 답글남기는건 필수인거 아시죠~^^',
			scrapMsg2 : '답글을 남겨주세요~',
			scrapMsg3 : '님의 &quot;[[title]]&quot; 게시물 입니다.',
			scrapMsg4 : '카테고리',
			scrapMsg5 : '카테고리추가',
			scrapMsg6 : '공개설정',
			scrapMsg7 : '스크랩허용',
			scrapMsg8 : '확인',
			scrapMsg9 : '취소',
			scrapMsg0 : '자신의 영상은 스크랩하실수 없습니다.'
		},
		noshar : '해당 동영상은 퍼가기가 불가능 합니다.',
		popTitle : '퍼가기',
		scrapTitle : '스크랩 하기',
		needToScrapLogin : '스크랩은 로그인이 필요합니다. 지금 로그인 하시겠습니까?',
		msg_mail_nofrom : '보내시는 분의 메일 주소를 입력해 주세요.', msg_mail_noadd : '받는 메일 주소를 입력해 주세요.', msg_mail_nopub : '메일 전송이 제한된 영상입니다.',
		msg_mail_bad : '메일 형식에 맞지 않습니다.', msg_mail_nobody : '내용을 입력해 주세요.', msg_mail_sendok : '메일 전송이 완료되었습니다.',
		msg_mail_sendfail : '메일 전송이 실패 하였습니다.', msg_mail_noaddr : '로그인을 하지 않았거나 보내는 사람 메일 주소가 없습니다.'
	},
	en : {
		caption : {
			tScrap : '<strong>1. Add to my channel.</strong>',
			tCopy : '<strong>2. Embed/Edit Player Forum</strong>', 
			tHtml : '<strong>3. Embed HTML Source</strong>', 
			tLink : '<strong>4. Embed Video Link</strong>', 
			tBlog : '<strong>4. Social Bookmark</strong>', 
			tEmail : '<strong>5. Send Email</strong>',
			tSender : 'Sender',
			tRecver : 'Send To',
			tBody : 'Message',
			msg_fromMsg : 'Enter email address.', 
			msg_toMsg : 'Enter your email address.', 
			msg_text1 : 'Please separate recipients with comma(,).',
			btn_scrap : 'Favorites', 
			btn_copy : 'Copy URL', 
			btn_send_mail : 'Send',
			scrap_txt : 'Add to my channel',
			link_txt : 'Copy and paste this link.',
			embed_txt : 'Copy and paste this embed code.'
			},
		scrapCaption : {
			scrapMsg1 : ' Leave comment while embedding.',
			scrapMsg2 : 'Enter your Reply here.',
			scrapMsg3 : '[[title]]\'s video.',
			scrapMsg4 : 'Category',
			scrapMsg5 : 'Add Category',
			scrapMsg6 : 'Public Settings',
			scrapMsg7 : 'Sharing',
			scrapMsg8 : 'Ok',
			scrapMsg9 : 'Cancel',
			scrapMsg0 : 'Video already added to your channel.'
		},
		noshar : 'This video cannot be shared.',
		popTitle : 'Share',
		scrapTitle : 'Scrap',
		needToScrapLogin : 'Login to add favorite video.Login now?',
		msg_mail_nofrom : 'Enter sender\'s email address.', msg_mail_noadd : 'Enter email address.', msg_mail_nopub : 'Restricted video content.',
		msg_mail_bad : 'Enter a valid email address.', msg_mail_nobody : 'Enter message.', msg_mail_sendok : 'Your mail has been sent.',
		msg_mail_sendfail : 'Failed to send e-mail.', msg_mail_noaddr : 'You might not be logged in or the sender\'s email address is not entered.'
	},
  cn : {
		caption : {
			tScrap : '<strong>1. 剪贴到我的频道</strong>',
			tCopy : '<strong>2. 直接复制播放视频</strong>', 
			tHtml : '<strong>3. HTML代码</strong>', 
			tLink : '<strong>4. 视频地址</strong>', 
			tBlog : '<strong>4. 社区书签</strong>', 
			tEmail : '<strong>5. 发邮件</strong>',
			tSender : '发送',
			tRecver : '收件人',
			tBody : '内容',
			msg_fromMsg : "请输入收件人地址", 
			msg_toMsg : "请输入您的e-mail地址", 
			msg_text1 : "如果接收人很多，请用逗号将他们隔开。",
			btn_scrap : '书签', 
			btn_copy : '复制地址', 
			btn_send_mail : '发送',
			scrap_txt : '剪贴到我的频道',
			link_txt : '复制并粘贴此链接:',
			embed_txt : '复制并粘贴嵌入码'
		},
		scrapCaption : {
			scrapMsg1 : '您知道吗？一定要在留言后才能添加专辑到自己频道。',
			scrapMsg2 : '请输入评论内容',
			scrapMsg3 : '的“[[title]]“视频',
			scrapMsg4 : '类别',
			scrapMsg5 : '请添加类别',
			scrapMsg6 : '公开设置',
			scrapMsg7 : '容许分享',
			scrapMsg8 : '确定',
			scrapMsg9 : '取消',
			scrapMsg0 : '自己的视频不能嵌入.'
		},
		noshar : 'この動画はスクラップができません。',
		popTitle : '分享',
		scrapTitle : '分享',
		needToScrapLogin : '嵌入必须先登录. 要现在登录吗？',
		msg_mail_nofrom : '请输入发件人的e-mail', msg_mail_noadd : '请输入收件人邮件地址', msg_mail_nopub : '此视频是传送受限视频', msg_mail_bad : '邮件格式不符合', msg_mail_nobody : '请输入内容', msg_mail_sendok : '邮件已被发送',
		msg_mail_sendfail : '发送失败', msg_mail_noaddr : '您没有登录，或者没有发信人邮件地址。'
	},

	jp : {
		caption : {
			tScrap : '<strong>1. マイチャンネルへスクラップ<\/strong>',
			tCopy : '<strong>2. プレイヤーをそのままスクラップ/エディター掲示板</strong>', 
			tHtml : '<strong>3. HTMLソースを持ち出す</strong>', 
			tLink : '<strong>4. 動画のリンクを持ち出す</strong>', 
			tBlog : '<strong>4. クチコミする(ソーシャルブックマーク)</strong>', 
			tEmail : '<strong>5. メッセージを送る</strong>',
			tSender : '差出人',
			tRecver : '受取人',
			tBody : '内容',
			msg_fromMsg : "あて先のメールアドレスを入力してください。", 
			msg_toMsg : "自分の Email アドレスを入力", 
			msg_text1 : "あて先はコンマで区切ってください。",
			btn_scrap : 'ブックマーク', 
			btn_copy : 'URLをコピー', 
			btn_send_mail : '送信',
			scrap_txt : 'マイチャンネルへスクラップ',
			link_txt : 'メールやIMでこのリンクをコピーして貼り付ける:',
			embed_txt : 'HTMLソースをコピーして貼り付ける:'
		},
		scrapCaption : {
			scrapMsg1 : 'スクラップしていくときは簡単なメモを残すこと、知ってますよね~^^',
			scrapMsg2 : 'コメントを入力してください。',
			scrapMsg3 : '様の「[[title]]」掲示物です。',
			scrapMsg4 : 'カテゴリー',
			scrapMsg5 : 'カテゴリーを追加してください。',
			scrapMsg6 : '公開設定',
			scrapMsg7 : 'スクラップ許可',
			scrapMsg8 : '確認',
			scrapMsg9 : 'キャンセル',
			scrapMsg0 : 'マイ動画はスクラップできません。'
		},
		noshar : 'スクラップできない動画です。',
		popTitle : '共有',
		scrapTitle : '共有',
		needToScrapLogin : 'スクラップはログインが必要です。ログインしますか？',
		msg_mail_nofrom : '送信者のイーメールアドレスを入力してください。', msg_mail_noadd : 'あて先のメールアドレスを入力してください。', msg_mail_nopub : 'メールの送信が制限されている映像です。', msg_mail_bad : 'メールの形式が正しくありません。', msg_mail_nobody : '内容を入力してください', msg_mail_sendok : 'メールが送信されました。',
		msg_mail_sendfail : 'メール送信失敗', msg_mail_noaddr : 'ログインしていないか、または差出人のメールアドレスがありません。'
	}
};
shareLang["gb"] = shareLang["en"];

var blogAr = {
	ko : ["mar", "pumfit","facebook", "digg", "stumbleupon", "del", "cyworld"],
	en : ["facebook", "digg", "stumbleupon", "del"],
	jp : ["fc2","yahoojp","ameba","hatena","facebook", "digg", "stumbleupon", "del"],
	cn : ["qq","facebook", "digg", "stumbleupon", "del"],
	gb : ["mar", "pumfit", "facebook", "digg", "stumbleupon", "del", "fc2","yahoojp","ameba","hatena", "qq"],

//	title : {"facebook":"Facebook", "digg":"Digg", "stumbleupon":"Stumbleupon", "del":"Del.icio.us", "pumfit":"pumfit", "mar":"mar.gar.in", "fc2":"fc2", "qq":"shupian.qq"},
	title : {"facebook":"myspace", "digg":"Digg", "stumbleupon":"Stumbleupon", "del":"Del.icio.us", "pumfit":"pumfit", "mar":"mar.gar.in", "fc2":"fc2", "qq":"shupian.qq","yahoojp":"yahoojp","ameba":"ameba","hatena":"hatena", "cyworld":"싸이월드"},

	cname : {"facebook":"icon_blog_01", "digg":"icon_blog_02", "stumbleupon":"icon_blog_03", "del":"icon_blog_04", "pumfit":"icon_blog_06", "mar":"icon_blog_05", "fc2":"icon_blog_07", "qq":"icon_blog_08","yahoojp":"icon_blog_09","ameba":"icon_blog_10","hatena":"icon_blog_11", "cyworld":"icon_blog_12"},

//	facebook : 'http://www.facebook.com/sharer.php?u=#{prg_url}&t=#{prg_title}',
	facebook : 'http://www.myspace.com/Modules/PostTo/Pages/?t=#{prg_title}&c=#{prg_title}&u=#{prg_url}&l=1',
	digg : 'http://digg.com/submit?phase=2&url=#{prg_url}&title=#{prg_title}&bodytext=#{prg_content}',
	stumbleupon : 'http://www.stumbleupon.com/submit?url=#{prg_url}&title=#{prg_title}',
	del : 'http://del.icio.us/post?url=#{prg_url}&title=#{prg_title}&v=4',
//	mar : 'http://mar.gar.in/post/popup_post/&qTitle=#{prg_title}&qURL=#{prg_url}&qNote=#{prg_content}',
	mar : 'http://mar.gar.in/post/popup_post/&qTitle=#{prg_title}&qURL=#{prg_url}&qNote=#{prg_content}&qNote=#{prg_content}',

	pumfit : 'http://www.pumfit.com/post?charset=utf-8&location=#{prg_url}&title=#{prg_title}',
	qq : 'http://shuqian.qq.com/post/?uri=#{prg_url}&jumpback=0&noui=0&method=manual&from=4',
	fc2 : 'http://bookmark.fc2.com/user/post?url=#{prg_url}&title=#{prg_title}&description=#{prg_content}',
	yahoojp : 'http://blogs.yahoo.co.jp/FRONT/blogthis.html?type=pandoratv&item=#{swf_url}&itemwidth=425&itemheight=355&link=#{prg_url}&linktitle=#{prg_title}',
	ameba : 'http://blog.ameba.jp/ucs/entry/srventryinsertinput.do?entry_text=#{embed_url}',
	hatena : 'http://d.hatena.ne.jp/edit?appendbody=#{prg_url}',
	cyworld : 'http://api.cyworld.com/openscrap/video/v1/?vu=#{prg_url}&vt=#{prg_title}&vp=#{ch_userid}&vd=#{reg_date}&vl=#{prg_url}&vc=#{prg_content}'

};

// copy end html
var copyHtml = [];
copyHtml.push('<div class="playlist"  style="text-align:center ;width:270px;">');
copyHtml.push('<div style="padding:5px;"><strong>복사되었습니다.</strong><BR>');
copyHtml.push('HTML소스 넣기에 CTRL+V로<BR> 붙여넣기하세요</div>');
copyHtml.push('<div class="pop_bg" style="padding:5px;"><a class="upload_link" id="paClsBtn">닫기</a></div>');
copyHtml.push('</div>');

/** Abstract Class */

var cTShare = Class.create();
	cTShare.prototype = {
		/* add by rhio.kim 2007.12.21 
		 * 메일 호스트가 변경되어질 수 있음
		 */
		sDomain : null,
		sharJson : null,
		initialize : function() {},

		set : function(target, kind, control) {
			// kind ;; 공개 설정
			this.prgInfo = null;
			this.size = null;

			// 스크랩시 카테고리 리스트 가지고 올때 try 시도 횟수
			this.tryCnt = 0;

			this.SendMailUrl = 'http://wmail.pandora.tv/pan_send/send_prg_union.htm';
			this._layerPop = cLayerPop.getInstance("new");
			this._layerPop1 = cLayerPop.getInstance("new");

/*
			this._layerPop2 = cLayerPop.getInstance("new");
*/
			this._layerPop3 = cLayerPop.getInstance("new");

			this._parent			= control;
			this._language			= shareLang[chInfoJson['clientLang']];
			this._targetElement		= target;

			// storage check
			try {
				this.storage = this._parent.storage;
			} catch (e) {
				try {
					this.storage = cStorageMgr.getInstance();
				} catch (e) {
					alert("storage error");
				}
			}

			// 이벤트 관련 변수
			this.evtAct				= null;
			this.evtLote			= null;
			this.evtFunc			= null;

			// 스크랩 이벤트 변수
			this.scrapEvt			= null;
			this.addCateEvt			= null;
			this.c1List				= null;
			this.c2List				= null;
			this.infoTryCnt			= 0;
		},

		setInitInfo : function(prgInfo, evt, wh, resetv) {
			this.prgInfo = null;
			this.prgInfo = prgInfo;

			if(prgInfoJson == null || prgInfoJson == "null" || !prgInfoJson) {
				if(this.infoTryCnt == 0) {
					var oScript = document.createElement("SCRIPT");
					with(oScript) {
						setAttribute("type", "text/javascript");
						setAttribute("language", "javascript");
						setAttribute("charset", "utf-8");
						setAttribute("src", variable.getChild("chHost") + "php/prgInfo.ptv?ch_userid=" + this.prgInfo['ch_userid'] + "&prg_id=" + this.prgInfo['prg_id']);
					}
					document.getElementsByTagName('head')[0].appendChild(oScript);
				}
				if(this.infoTryCnt < 10) {
					setTimeout(function() {this.setInitInfo(prgInfo, evt, wh, "1");}.bind(this), 200);
				}
				this.infoTryCnt++;
			} else {
				/*
				if (prgInfoJson['vod_url'] == null || !prgInfoJson['vod_url']) {
					prgInfoJson = null;
					this.prgInfo = null;
					this.infoTryCnt=0;
					alert(this._language['noshar']);
					return false;
				}
				*/
				this.prgInfo = Object.extend(this.prgInfo, prgInfoJson);
				var embedurl = this.flashVars('flashV1', this.prgInfo['prg_id']);
				var pagelink = this.flashVars('flashV2', this.prgInfo['prg_id']);

				var from = oCookie.get('glb_mem[email]');
				var nick = oCookie.get('glb_mem[nickname]');

				// @@ 싸이월드 스크랩 수정
				// @@ reg_date, ch_userid 값 추가
				
				// json 셋팅
				this.sharJson = {prgId:this.prgInfo['prg_id'], thumbnail:this.prgInfo['thumbnail'], prg_title:this.prgInfo['title'], prg_desc:this.prgInfo['contents'], mailfrom:decodeURIComponent(from), nickname:decodeURIComponent(nick), url:pagelink, embed_url:embedurl, lang:chInfoJson['clientLang'],reg_date:this.prgInfo['reg_date'],ch_userid:this.prgInfo['ch_userid']};


				if (!this._once) {
					this.createFrm(evt); // 화면 UI 구성
					this._once = false;
				}

				this._targetElement		= $(this._targetElement);

				var tmp = new Template(this._frmShare.join(''));

				tmp = tmp.evaluate(this.sharJson);

				this._layerPop.set(tmp.toString(), this.popRemoveEventListener.bind(this), "", "4", this._language['popTitle'], "448", "", wh['y'], wh['x']);
				this._frmElement = $('FRM_SHARE_FRM');	//form Element

				// 플래시 퍼가기 정보 교체
				var innerSwf = "";
				var browerName = navigator.appName;

				var subParam = "";

				if (this.prgInfo['resolquality_type']==1) {
					subParam = "&w=500&h=402";
				} else {
					subParam = "&w=540&h=331";
				}

				if (browerName.search("Explorer") > 0) {
					innerSwf += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="424" height="100" id="shareSwf1" align="middle">';
					innerSwf += '<param name="allowScriptAccess" value="always"></param>';
					innerSwf += '<param name="quality" value="high"></param>';
					innerSwf += '<param name="allowFullScreen" value="false"></param>';
					innerSwf += '<param name="bgcolor" value="#ffffff"></param>';
					innerSwf += '<param name="movie" value="http://imgcdn.pandora.tv/gplayer/transfer.swf?ch_userid=' + this.prgInfo["ch_userid"] + '&prg_id=' + this.prgInfo["prg_id"] + '&lang='+chInfoJson["clientLang"]+subParam+'"></param>';
					innerSwf += '</object>';
				} else {
					innerSwf += '<embed src="http://imgcdn.pandora.tv/gplayer/transfer.swf?ch_userid=' + this.prgInfo["ch_userid"] + '&prg_id=' + this.prgInfo["prg_id"] + '&lang='+chInfoJson["clientLang"]+subParam+'" quality="high" bgcolor="#ffffff" width="424" height="100" id="shareSwf1" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
				}

				$("swfArea").innerHTML = innerSwf;

				this.popEventListener(evt);
				// mychannel
				if (oCookie.get("glb_mem[userid]") == chInfoJson['ch_userid'] || chInfoJson['mychannel'].toString() == "1") {
					try {Event.stopObserving("popAct_scrap","click",this.doPopScrap.bindAsEventListener(this));} catch(e) {}
//					$("popAct_scrap").disabled = true;
				}

				// scrap_pub confirm
				if (prgInfoJson['scrap_pub'].toString() != 0 || prgInfoJson['embed_pub'].toString() != 0) {
					if (chInfoJson['clientLang'] == "ko") {
//						$("popAct_scrap").disabled = true;
						try { Event.stopObserving("popAct_scrap","click",this.doPopScrap.bindAsEventListener(this)); } catch(e) {};
					} else {
						try{ Event.stopObserving("popAct_scrap","click",this.doPopScrap.bindAsEventListener(this)); } catch(e) {};
						$("popAct_scrap").onclick = function() {
							
						}
					}
				}

				// embed_pub confirm
/*				if ( (prgInfoJson['scrap_pub'].toString() != 0 || prgInfoJson['embed_pub'].toString() != 0)) {
					if (chInfoJson['clientLang'] == "ko") {

						try{Event.stopObserving("popAct_scrap","click",this.doPopScrap.bindAsEventListener(this));} catch(e) {};
						try{Event.stopObserving("popAct_html","click",this.doPopHtml.bindAsEventListener(this));} catch(e) {};

						$("popAct_copy").disabled = true;
						$("popAct_html").disabled = true;
					} else {
						try{ Event.stopObserving("embedCopy","click",this.doSelected.bindAsEventListener(this)); } catch(e) {};
						$("embedCopy").value = this._language['noshar'];
					}
				}
*/

				if (prgInfoJson['adult_chk_age'].toString() == "19") {
					if (chInfoJson['clientLang'] == "ko") {
						try{Event.stopObserving("popAct_scrap","click",this.doPopScrap.bindAsEventListener(this)); } catch(e) {};
/*
						try{Event.stopObserving("popAct_copy","click",this.doPopCopy.bindAsEventListener(this)); } catch(e) {};
						try{Event.stopObserving("popAct_html","click",this.doPopHtml.bindAsEventListener(this)); } catch(e) {};
*/
//						$("popAct_scrap").disabled = true;
/*
						$("popAct_copy").disabled = true;
						$("popAct_html").disabled = true;
*/
					} else {
						try{ Event.stopObserving("popAct_scrap","click",this.doPopScrap.bindAsEventListener(this)); } catch(e) {};
/*
						try{ Event.stopObserving("embedCopy","click",this.doSelected.bindAsEventListener(this)); } catch(e) {};
*/
//						$("popAct_scrap").disabled = true;
//						$("embedCopy").value = this._language['noshar'];
					}
				}

				prgInfoJson = null;
				this.infoTryCnt = 0;
			}
		},


		createFrm : function(e) {
			this._frmShare = [];

			this._frmShare.push('<div style="width:100%">');

			this._frmShare.push('<table width="100%" border="0" cellpadding="0" cellspacing="0" id="'+ this._targetElement + '">');
			this._frmShare.push('<tr valign="top">');
			this._frmShare.push('<td><div id="swfArea"></div>');
			this._frmShare.push('<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>');
			this._frmShare.push('<td height="25">#{tBlog}</td>');
			this._frmShare.push('<td align="right">&nbsp;</td>');
			this._frmShare.push('</tr>');
			this._frmShare.push('<tr>');
			this._frmShare.push('<td colspan="2">');
			this._frmShare.push('<div id="blogDiv">');
			this._frmShare.push('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
			this._frmShare.push('<tr>');

			for (var i = 0; i < blogAr[chInfoJson['clientLang']].length; i++) {
				if (i > 0 && i % 4 == 0) {
					this._frmShare.push('</tr><tr>');
				}
				this._frmShare.push('<td height="25"><a id="' + blogAr[chInfoJson['clientLang']][i] + '" style="text-decoration:none"><span class="'+blogAr.cname[blogAr[chInfoJson['clientLang']][i]]+'"></span>'+blogAr.title[blogAr[chInfoJson['clientLang']][i]]+'</a>&nbsp;</td>');
			}

			this._frmShare.push('</tr>');
			this._frmShare.push('</table></div></td>');
			this._frmShare.push('</tr>');
			this._frmShare.push('</table>');
			this._frmShare.push('</td></tr>');
			this._frmShare.push('<tr>');
			this._frmShare.push('<td height="1" bgcolor="#cccccc"></td></tr>');
			this._frmShare.push('<tr>');
			this._frmShare.push('<td>');

			this._frmShare.push('<iframe id="iFrm" name="iFrm" style="display:none"></iframe>');
			this._frmShare.push('<form id="FRM_SHARE_FRM" action="'+ this.SendMailUrl +'" style="margin:0px;">');
			this._frmShare.push('<input id="lang" name="lang" type="hidden" value="\\#{lang}">'); 
			this._frmShare.push('<input id="prg_title" name="prg_title" type="hidden" value="\\#{prg_title}">'); 
			this._frmShare.push('<input id="url" name="url" type="hidden" value="\\#{url}">');
			this._frmShare.push('<input id="thumbnail" name="thumbnail" type="hidden" value="\\#{thumbnail}">');
			this._frmShare.push('<input id="prg_desc" name="prg_desc" type="hidden" value="\\#{prg_desc}">');

			this._frmShare.push('<table width="100%"  border="0" cellpadding="0" cellspacing="5">');
			this._frmShare.push('<tr>');
			this._frmShare.push('<td colspan="2" ><strong>#{tEmail} </strong></td>');	// 이메일 보내기
			this._frmShare.push('</tr>');
			this._frmShare.push('<tr>');
			this._frmShare.push('<td>#{tSender}</td>');	// 보내는사람
			this._frmShare.push('<td>');

			if (oCookie.get("glb_mem[userid]")) {	// 로그인시
				this._frmShare.push('<input id="mailfrom" name="mailfrom" type="text" value="\\#{mailfrom}" style="width:100%" readonly/><input id="nickname" name="nickname" type="hidden" value="\\#{nickname}" />');
			} else {	// 비로그인시
				this._frmShare.push('<input id="mailfrom" name="mailfrom" type="text" value="#{msg_toMsg}" style="width:100%" />'); // 자신의 Email 주소입력
			}

			this._frmShare.push('</td></tr>');
			this._frmShare.push('<tr>');
			this._frmShare.push('<td>#{tRecver}</td>'); // 받는사람
			this._frmShare.push('<td>');
			this._frmShare.push('<input id="mailto" name="mailto" type="text" value="#{msg_fromMsg}" style="width:100%" >'); // 받는사람의 Email 주소입력
			this._frmShare.push('<div style="padding-top:3px;">(#{msg_text1})</div></td>'); // 신자가 여러 명일 경우  ;로 구분
			this._frmShare.push('</tr>');
			this._frmShare.push('<tr>');
			this._frmShare.push(' <td> #{tBody} </td> ');
			this._frmShare.push(' <td><textarea id="contents" name="contents" style="width:100%; height:50px; margin-bottom:5px; overflow:auto"  type="text"></textarea></td> ');
			this._frmShare.push('</tr>');
			this._frmShare.push('<tr>');
			this._frmShare.push('<td align="right">&nbsp;</td>');
			this._frmShare.push('<td align="right"><input type="button" id="BTN_SUBMIT" value="#{btn_send_mail}" onfocus="this.blur();"></td>'); // 보내기
			this._frmShare.push('</tr>');
			this._frmShare.push('</table>');

			this._frmShare.push('</form>');

			this._frmShare.push(' </td> ');
			this._frmShare.push('</tr>');
			this._frmShare.push('</table>');

			this._frmShare.push('</div>');

			var tmp = new Template(this._frmShare.join(''));
			this._frmShare = [];
			this._frmShare.push(tmp.evaluate(this._language['caption']));
		},

		popEventListener : function () {
			this.evtAct			= new Array();
			this.evtLote		= new Array();
			this.evtFunc		= new Array();

			this.evtAct[0] = "click";
			this.evtAct[1] = "click";
			this.evtAct[2] = "focus";
			this.evtAct[3] = "click";

			this.evtLote[0] = "";//popAct_scrap";
			this.evtLote[1] = "FRM_SHARE_FRM";
			this.evtLote[2] = "FRM_SHARE_FRM";
			this.evtLote[3] = "blogDiv";

			this.evtFunc[0] = this.doPopScrap.bindAsEventListener(this);
			this.evtFunc[1] = this.occurEvent.bindAsEventListener(this);
			this.evtFunc[2] = this.occurEvent.bindAsEventListener(this);
			this.evtFunc[3] = this.occurEvent.bindAsEventListener(this);
			if (chInfoJson['clientLang'] == "ko") {
				this.evtAct[4] = "click";
				this.evtAct[5] = "click";
				this.evtAct[6] = "click";

				this.evtLote[4] = "";//popAct_copy";
				this.evtLote[5] = "";//popAct_html";
				this.evtLote[6] = "";//popAct_link";

				this.evtFunc[4] = this.doPopCopy.bindAsEventListener(this);
				this.evtFunc[5] = this.doPopHtml.bindAsEventListener(this);
				this.evtFunc[6] = this.doPopLink.bindAsEventListener(this);
			} else {
				this.evtAct[4] = "click";
				this.evtAct[5] = "click";

				this.evtLote[4] = "";//linkCopy";
				this.evtLote[5] = "";//embedCopy";

				this.evtFunc[4] = this.doSelected.bindAsEventListener(this);
				this.evtFunc[5] = this.doSelected.bindAsEventListener(this);
			}

			/* add by rhio.kim 2008.06.24 이벤트 페이지에서는 필요없는 필드 */
			var j = 0;
			if (document.domain == 'event.pandora.tv') j = 1;

			for (var i = j; i < this.evtAct.length; i++) {
				if (this.evtLote[i]) {
					Event.observe(this.evtLote[i], this.evtAct[i], this.evtFunc[i]);
				}
			}
		},

		popRemoveEventListener : function () {
			/* add by rhio.kim 2008.06.24 이벤트 페이지에서는 필요없는 필드 */
			var j = 0;
			if (document.domain == 'event.pandora.tv') j = 1;
			
			for (var i = j; i < this.evtAct.length; i++) {
				Event.stopObserving(this.evtLote[i], this.evtAct[i], this.evtFunc[i]);
			}
		},
		
		checkFrm : function() {
			var frmElements = this._frmElement.getElements();
			if ($("emailFrm")) {
				
			} else {
//				new Insertion.Top(this._parent._layerPop._topLayerId, '<iframe id="emailFrm" name="emailFrm" style="display:" width=200 height=100></iframe>');
				new Insertion.Top(document.body, '<iframe id="emailFrm" name="emailFrm" style="display:none" width=200 height=100></iframe>');
			}
			this._frmElement.target = "emailFrm";

			var mailfrom	= this._frmElement['mailfrom'];
			var mail		= this._frmElement['mailto'];
			var cont		= this._frmElement['contents'];

			if(mailfrom.value.blank()) {
				alert(this._language['msg_mail_nofrom']); // 보내시는 분의 Email 주소를 입력해 주십시요
				mailfrom.focus();
				return false;
			}

			if(mail.value.blank()) {
				alert(this._language['msg_mail_noadd']);
				mail.focus();
				return false;
			}
/*
			if(!this.checkMail(mail.value)) {
				alert(this._language['msg_mail_bad']); 
				mail.focus();
				return false;
			}
*/
			if(cont.value.blank()) {
				alert(this._language['msg_mail_nobody']);
				cont.focus();
				return false;
			}
			
			return true;
		},
		
		checkMail : function(str) {
			var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			return filter.test(str);
		},

		clickSbumit : function() {
			if(this.checkFrm()) {
				this.sDomain = document.domain;
				// 서버가 달라서 ajax request를 할수가 없다.
				this._frmElement.method = "post";
				$("BTN_SUBMIT").disabled = true;
				this._frmElement.submit();
				document.domain = "pandora.tv";
			} else {
				return false;
			}

		},
		
		mailSendOk : function(ret) {
			var lang1 = {ko:'정상적으로 발송 하였습니다.', en:'sent via email address', gb:'sent via email address', jp:'送信しました。', cn:'正常发送了'};
			var lang2 = {ko:'메일 발송에 실패 하였습니다.', en:'Mail Sent Failed', gb:'Mail Send Fail', jp:'Mail Send Fail', cn:'Mail Send Fail'};
			if (ret == 1) {
				alert(lang1[chInfoJson['clientLang']]);
			} else {
				alert(lang2[chInfoJson['clientLang']]);
				$("BTN_SUBMIT").disabled = false;
			}
			document.domain = this.sDomain;
		},
		
		clickClose : function() {
			this.freeEventListener();
			this._targetElement.hide();
		},
		
		occurEvent : function(event) {
			var element = Event.element(event);
			
			switch (element.id) {
				case 'BTN_SUBMIT' :  this.clickSbumit();
					break;

				case 'mailto' :
				case 'mailfrom' : 
					if (element.value == element.defaultValue) {
						if ( (oCookie.get('glb_mem[userid]') && element.id == "mailto") || oCookie.get('glb_mem[userid]') == null) {
							element.value = "";
						}
					}
					break;
				case 'facebook':
				case 'digg':
				case 'stumbleupon':
				case 'del':
				case 'mar':
				case 'pumfit':
				case 'qq':
				case 'fc2':
				case 'yahoojp':
				case 'ameba':
				case 'hatena':
				case 'cyworld':
					this.doPopBlog(element.id);
					break;
				case 'contents' :
					break;
			}
			Event.stop(event);
		},
		
		setEventListener : function() {
			var startEvent = this.occurEvent.bindAsEventListener(this);
			this._targetElement.observe('click', startEvent);
		},

		freeEventListener : function() {		
			var stopEvent = this.occurEvent.bindAsEventListener(this);
			this._targetElement.stopObserving('click', stopEvent);
		},

		copy_clip : function(inElement) {
			var html = "";
			if (typeof (inElement) == 'object' ) {
				html = inElement.value;
			} else {
				html = inElement;
			}
			copyText(html);//[jake.jee]
			/*
			var browerName = navigator.appName;
			if (browerName.search("Explorer") > 0) { // IE
				window.clipboardData.setData("text", html);
//				var range = inElement.createTextRange();
//				range.execCommand("Copy");
			} else {
				var flashCopier = 'flashcopier';
				if ($(flashCopier) ) {
					$(flashCopier).innerHTML = "";
				}
				if (!$(flashCopier)) {
					var divholder = document.createElement("DIV");
					divholder.style.width = "0px;";
					divholder.style.height = "0px;";

					divholder.id = flashCopier;
					document.body.appendChild(divholder);
				}

				$(flashCopier).innerHTML = '';
				var divinfo = '<embed src="http://imgcdn.pandora.tv/static/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(html) + '" width=0 height=0 type="application/x-shockwave-flash"></embed>';

				$(flashCopier).innerHTML = divinfo;
				document.body.removeChild(divholder);
			}*/

			return true;
		},

		/* 2008-02-27 오현섭 추가 share popup Action start */
		doPopScrap : function (e, posY) {
			var noScrapLang = {'ko':'스크랩이 허용이 되지 않았습니다.', 'en':'Not Allow Scrap', 'gb':'Not Allow Scrap', 'cn':'不允许分享', 'jp':'スクラップが許可されていません。'};
			var popupLang = {'ko':'차단된 팝업을 허용해 주세요', 'en':'Allow pop-ups', 'gb':'Allow pop-ups', 'cn':'请允许被拦截的弹出窗口', 'jp':'遮断されたポップアップウィンドウを許可してください。'};

			if (this.prgInfo['scrap_pub'] != 0) { // 스크랩 허용이 불가 인거
				alert(noScrapLang[chInfoJson['clientLang']]);
			} else if (!oCookie.get("glb_mem[userid]")) { // 로그인이 안되어 있을경우
				glb_auth(location.href, "", "1");
			} else if (oCookie.get("glb_mem[userid]") == chInfoJson['ch_userid']) { // 자신의 채널
				alert(this._language['scrapCaption']['scrapMsg0']);
			} else {
				var newWin = window.open( variable.getChild('chHost') + 'php/scrap.ptv?ch_userid=' + this.prgInfo['ch_userid'] + '&prg_id=' + this.prgInfo['prg_id'], "scrap", "width=250, height=250");

				if (newWin == null) {
					alert(popupLang[chInfoJson['clientLang']]);
				} else {
					newWin.focus();
				}
			}
		},

		popScrapEventListener : function(pos) {
			this.scrapEvt = new Array();
			this.scrapEvt[0] = {target:'addCategBtn', act:'click', func:this.categAdd.bindAsEventListener(this, pos)};
			this.scrapEvt[1] = {target:'pub', act:'change', func:this.funcScrap.bindAsEventListener(this, 'pub')};
			this.scrapEvt[2] = {target:'scrSBtn', act:'click', func:this.funcScrap.bindAsEventListener(this, 'scrSBtn')};
			this.scrapEvt[3] = {target:'scrCBtn', act:'click', func:this.funcScrap.bindAsEventListener(this, 'scrCBtn')};

			try {
				for (var i=0; i<this.scrapEvt.length; i++) {
					Event.stopObserving(this.scrapEvt[i].target, this.scrapEvt[i].act, this.scrapEvt[i].func);
				}
			} catch (e) {}

			for (var i=0; i<this.scrapEvt.length; i++) {
				Event.observe(this.scrapEvt[i].target, this.scrapEvt[i].act, this.scrapEvt[i].func);
			}
		},

		popScrapRemoveEventListener : function() {
			for (var i=0; i<this.scrapEvt.length; i++) {
				Event.stopObserving(this.scrapEvt[i].target, this.scrapEvt[i].act, this.scrapEvt[i].func);
			}
		},

		funcScrap : function(evt, kind) { // 공개 설정의 value 값이 있을때는 스크랩 허용 체크를 해지 하고 disabled를 해 준다.
			switch (kind) {
			case "pub" :
				var el = Event.element(evt);
				if ($(el.id)[$(el.id).selectedIndex].value > 0 ) {
					$("scrap_pub").disabled = true;
					$("scrap_pub").checked = false;
				} else {
					$("scrap_pub").disabled = false;
					$("scrap_pub").checked = true;
				}
				break;
			case "scrSBtn": 
				alert('스크랩 확인');
				break;
			case "scrCBtn": 
				this._layerPop1._evtClosePop();
				break;
			}
		},

		popCategEventListener : function() {
			this.addCateEvt =  new Array();
			this.addCateEvt[0] = {target:'c1', act:'change', func:this.fCateg.bindAsEventListener(this, 'c1')};
			this.addCateEvt[1] = {target:'sBtn', act:'click', func:this.fCateg.bindAsEventListener(this, 'sBtn')};
			this.addCateEvt[2] = {target:'cBtn', act:'click', func:this.fCateg.bindAsEventListener(this, 'cBtn')};

			try {
				for (var i=0; i<this.scrapEvt.length; i++) {
					Event.stopObserving(this.scrapEvt[i].target, this.scrapEvt[i].act, this.scrapEvt[i].func);
				}
			} catch (e) {}

			for (var i=0; i<this.scrapEvt.length; i++) {
				Event.observe(this.scrapEvt[i].target, this.scrapEvt[i].act, this.scrapEvt[i].func);
			}
		},

		popCategRemoveEventListener : function() {
			alert('remove popcate');
			try {
				for (var i=0; i<this.scrapEvt.length; i++) {
					Event.stopObserving(this.scrapEvt[i].target, this.scrapEvt[i].act, this.scrapEvt[i].func);
				}
			} catch (e) {}
		},

		fCateg : function (e, type) { // 1차 카테고리 변경시 2차 카테고리값 변경
			switch (type) {
				case "c1": 
					var idx = $("c1").selectedIndex;
					var c2List = oVodCateg.getLevel2(idx);

					for (var i=1; i<c2List.length; i++) {
						c2Option	+= '<option value="'+c2List[i][0]+'" />'+c2List[i][1];
					}
					break;
				case "sBtn": // 입력 버튼
					if ($("aa") == "aa") {
						
					}
					break;
				case "cBtn": // 취소 버튼 닫기로 사용
					break;
			}
		},

/*
		doPopCopy : function (e) {
			var el = Event.element(e);
			var elementId = el.up();
			var browerName = navigator.appName;

			if (browerName.search("Explorer") > 0) { // IE
				var tmp = this.flashVars('flashV1', this.prgInfo['prg_id']);
				var oDiv = document.createElement("DIV");
				document.body.appendChild(oDiv);
				oDiv.style.visibility='hidden';
				oDiv.style.height = 0;
				oDiv.style.width = 0;
				oDiv.style.top = document.body.scrollTop;
				oDiv.style.left = Event.pointerX(e) - 150;
				oDiv.style.position = "absolute";
				oDiv.innerHTML = tmp;

				var doc = document.body.createTextRange();
					doc.moveToElementText(oDiv.childNodes[0]);
					doc.select();
					doc.execCommand('copy');
				doc = null;
				oDiv.innerHTML = '';
				document.body.removeChild(oDiv);
				oDiv = null;

			} else {
				alert('IE Only');
				return;
				document.getElementById(el.up(7).id).contentEditable = "true" 
				document.getElementById(el.up(7).id).unselectable = "off"; 
				document.getElementById(el.up(7).id).focus(); 

				document.execCommand('SelectAll', true, null); 
				document.execCommand('Copy', true, null); 
				document.execCommand('Unselect', true, null); 
				document.getElementById(el.up(7).id).contentEditable = "false"; 

			}
			this.popAlimi(e);
		},
*/

		doPopCopy : function (e) {
//			var el = Event.element(e);
//			var elementId = el.up();
			var browerName = navigator.appName;

			var endMsg1 = {'ko':'복사가 완료 되었습니다.', 'en':'The copy is complete', 'gb':'The copy is complete', 'jp':'コピー完了しました。', 'cn':'已复制'};
			var endMsg2 = {'ko':'정상적으로 복사 되었습니다.', 'en':'The copy is complete Normally', 'gb':'The copy is complete Normally', 'jp':'正常にコピーできました。', 'cn':'已复制'};
			var endMsg3 = {'ko':'복사에 실패 하였습니다.', 'en':'Failed to copy', 'gb':'Failed to copy', 'jp':'コピーに失敗しました。', 'cn':'复制失败'};
			var endMsg4 = {'ko':'현재는 IE만 지원 합니다.', 'en':'Just support IE', 'gb':'Just support IE', 'jp':'現在はIEのみ支援します。', 'cn':'现在只支持IE'};

			if (browerName.search("Explorer") > 0) { // IE
				var tmp = this.flashVars('flashV1', this.prgInfo['prg_id']);
				var oDiv = document.createElement("DIV");
				document.body.appendChild(oDiv);
				oDiv.style.visibility='hidden';
				oDiv.style.height = 0;
				oDiv.style.width = 0;
				oDiv.style.top = document.body.scrollTop;
				oDiv.style.left = 0;//(e ? Event.pointerX(e) : 150) - 150;
				oDiv.style.position = "absolute";
				oDiv.innerHTML = tmp;

				var doc = document.body.createTextRange();
					doc.moveToElementText(oDiv.childNodes[0]);
				var ccc = doc.select();
//				alert(doc);

//				document.getElementById("shareSwf1").copyHandler(doc);
					doc.execCommand('copy');
				// 플래시로 리턴 해 준다.

				doc = null;
				oDiv.innerHTML = '';
				document.body.removeChild(oDiv);
				oDiv = null;
//				console.log(document.getElementById("shareSwf1"));

				document.getElementById('shareSwf1').copyHandler(endMsg1[chInfoJson["clientLang"]],endMsg2[chInfoJson["clientLang"]]);
//				this.popAlimi(e);

			} else {
				document.getElementById('shareSwf1').copyHandler(endMsg3[chInfoJson["clientLang"]], endMsg4[chInfoJson["clientLang"]]);
//				alert('IE Only');
				return;
/*
				document.getElementById(el.up(7).id).contentEditable = "true" 
				document.getElementById(el.up(7).id).unselectable = "off"; 
				document.getElementById(el.up(7).id).focus(); 

				document.execCommand('SelectAll', true, null); 
				document.execCommand('Copy', true, null); 
				document.execCommand('Unselect', true, null); 
				document.getElementById(el.up(7).id).contentEditable = "false"; 
*/
			}
		},

		doPopHtml : function (e) {
			var html = this.flashVars('flashV1', this.prgInfo['prg_id']);
			if ( this.copy_clip(html) ) {
				this.popAlimi(e);
			}
		},

		doPopLink : function (e) {
			var html = this.flashVars('flashV2', this.prgInfo['prg_id']);
			if ( this.copy_clip(html) ) {
				this.popAlimi(e);
			}
		},

		doSelected : function(e) {
			var el = Event.element(e);
			$(el.id).activate();
		},

		doPopBlog : function(id) {
			var tmp = blogAr[id].toString();
			var tmpJson = null;
			if (id == "mar") {
				var tmpUrl = this.sharJson.url.split("#");
				var tUrl = tmpUrl[0] + encodeURIComponent("#" + tmpUrl[1]);

				tmpJson = {prg_url:tUrl, prg_title:encodeURIComponent(this.sharJson.prg_title), prg_content:encodeURIComponent(this.sharJson.prg_desc)};
			} else if (id == "yahoojp") {
				var sUrl = this.flashVars('flashV3', this.prgInfo['prg_id']);
				tmpJson = {swf_url:encodeURIComponent(sUrl), prg_url:encodeURIComponent(this.sharJson.url), prg_title:encodeURIComponent(this.sharJson.prg_title)};
			}
			// @@ 싸이월드 스크랩 수정
			else if (id == "cyworld")
			{
				var url		= this.prgInfo['vod_url'].substring(this.prgInfo['vod_url'].lastIndexOf("/")+1,this.prgInfo['vod_url'].toString().length);
				var emUrl	= variable.getChild('embedPlayer') + '/userid='+this.prgInfo['ch_userid']+'&url='+url+'&prgid='+this.prgInfo['prg_id']+'&lang=' + chInfoJson['clientLang'] + '&res='+this.prgInfo['resolquality_type']
				tmpJson =	{
								//embed_url	: escape(emUrl), 
								embed_url	: escape(this.sharJson.url),
								prg_title	: escape(this.sharJson.prg_title), 
								ch_userid	: escape(this.sharJson.ch_userid),
								reg_date	: escape(this.sharJson.reg_date.replace(/-/g,"")),
								prg_url		: escape(this.sharJson.url),
								prg_content	: escape(this.sharJson.prg_desc.substring(0,100))
							};

			}
			else
			{
				tmpJson = {prg_url:encodeURIComponent(this.sharJson.url), prg_title:encodeURIComponent(this.sharJson.prg_title), prg_content:encodeURIComponent(this.sharJson.prg_desc), embed_url:encodeURIComponent(this.sharJson.embed_url)};
			}

			tmp = new Template(tmp);
			tmp = tmp.evaluate(tmpJson);
			var wiselogUrl = "http://www.pandora.tv/wiselog/bmark.ptv?k=web&s="+id;
			$("iFrm").src = wiselogUrl;

			// @@ 싸이월드 스크랩 수정

			if(id!="cyworld")

				window.open(tmp);

			else

				window.open(tmp,"cyopenscrap","width=450,height=410");
		},

		/* 2008-02-27 오현섭 추가 share popup Action end   */
		popAlimi : function(e) {
			var posX = 166 + 100;
			var posY = Event.pointerY(e); //(Event.pointerY(e) > 10) ? Event.pointerY(e) - 10 : Event.pointerY(e);

			if (document.body.scrollWidth > 974) {
				posX = posX + parseInt((document.body.scrollWidth-974) / 2, 10); //(Event.pointerX(e) > 50) ? Event.pointerX(e) - 50 : Event.pointerX(e);
			}

//			this._parent._layerPop.set(tmp.toString(), this.popRemoveEventListener.bind(this), "", "1", "퍼가기", "447r", "363", posY, posX);
//			skinlayerid, toplayerid, layerid, targetid, tophiddenlayerid

			this._layerPop3.set(copyHtml.join('').toString(), this.popAlimiRemoveEventListener.bind(this), "", "3", "", "270", "130", posY, posX, "copyslid", "copytlid", "copylid", "copytid", "copythlid");

			this.popAlimiEventListener();
		},

		popAlimiEventListener : function() {
			var f = this._layerPop3._evtClosePop.bindAsEventListener(this);
			Event.observe("paClsBtn", "click", f);
		},

		popAlimiRemoveEventListener : function() {
			var f = this._layerPop3._evtClosePop.bindAsEventListener(this);
			Event.stopObserving("paClsBtn", "click", f);
		},

		flashVars : function(type, prg_id){
//			var url = this._parent.getOneJson()['vod_url'].substring(this._parent.getOneJson()['vod_url'].lastIndexOf("/")+1,this._parent.getOneJson()['vod_url'].toString().length);
			var url = this.prgInfo['vod_url'].substring(this.prgInfo['vod_url'].lastIndexOf("/")+1,this.prgInfo['vod_url'].toString().length);
			url = url.split(".")[0];
			var ret = null;

			if(this.prgInfo['resolquality_type']==1){//임베디드 HD는 540*464로 퍼가지게 수정 2009.02.12 전설희
				var newWidth="448";
				var newHeight="385";


			}else{
				var newWidth="540";
				var newHeight="353";
				//var newHeight="338";
			}

			switch(type){
				case  'flashV1' : {
					this.flashV1 = null;
					this.flashV1 = new pandora.util.StringBuffer();
					this.flashV1.append('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="'+newWidth+'" height="'+newHeight+'" id="movie" align="middle">');
					this.flashV1.append('<param name="quality" value="high" />');
					this.flashV1.append('<param name="movie" value="' + variable.getChild('embedPlayer') + '/userid='+this.prgInfo['ch_userid']+'&url='+url+'&prgid='+prg_id+'&lang=' + chInfoJson['clientLang'] + '&res='+this.prgInfo['resolquality_type']+'"></param>');
					this.flashV1.append('<param name="wmode" value="window"></param>');
					this.flashV1.append('<param name="allowFullScreen" value="true" />');
					this.flashV1.append('<param name="allowScriptAccess" value="always" />');
					this.flashV1.append('<embed');
					this.flashV1.append(' src="' + variable.getChild('embedPlayer') + '/userid='+this.prgInfo['ch_userid']+'&url='+url+'&prgid='+prg_id+'&lang=' + chInfoJson['clientLang'] + '&res='+this.prgInfo['resolquality_type']+'"');
					this.flashV1.append(' type="application/x-shockwave-flash" ');
					this.flashV1.append(' wmode="window" ');
					this.flashV1.append(' allowScriptAccess="always"');
					this.flashV1.append(' allowFullScreen="true"');
					this.flashV1.append(' pluginspage="http://www.macromedia.com/go/getflashplayer"');
					this.flashV1.append(' width="'+newWidth+'" height="'+newHeight+'"></embed>');
					this.flashV1.append('</object>');
					ret = this.flashV1.toString();
				}; break;

				case 'flashV2' : {
					this.flashV2 = null;
					this.flashV2 = new pandora.util.StringBuffer();
//					this.flashV2.append(variable.getChild('chHost')+"channel/video.ptv?ch_userid="+this.prgInfo['ch_userid']+"#prgid="+prg_id+"&categid=all&page=1");		
					this.flashV2.append(variable.getChild('mainHost')+"my."+this.prgInfo['ch_userid']+"/"+prg_id);
					ret = this.flashV2.toString();
				}; break;

				case 'flashV3' : {
					this.flashV3 = null;
					this.flashV3 = new pandora.util.StringBuffer();
					this.flashV3.append(variable.getChild('embedPlayer') + '/userid='+this.prgInfo['ch_userid']+'&url='+url+'&prgid='+prg_id+'&lang=' + chInfoJson['clientLang']);
					ret = this.flashV3.toString();
				}; break;
			}
			return ret;
		}

	};

//Object.extend(cTShare.prototype, pandora.util.share.prototype);

cTShare.__instance__ = null;
cTShare.getInstance = function () {
	if (this.__instance__ == null) {
		this.__instance__ = new cTShare();
	}
	return this.__instance__;
};

function flashGetFun(type) {
	var shareObj = cTShare.getInstance();
	switch (type) {
		case "scrap":
			shareObj.doPopScrap();
			break;
		case "copy_end":
			shareObj.doPopScrap();
			break;
		default:
			shareObj.doPopCopy();
			break;
	}
}