// 숫자형 문자에 있는 콤마 삭제
String.prototype = Object.extend(String.prototype, {
	stripComma : function() {
		var str = this;
		while(str.indexOf(",") > -1) {
			str = str.replace(",", "");
		}
		return str;
	}
});

// 숫자에 콤마 추가
Number.prototype = Object.extend(Number.prototype, {
	addComma : function() {
		var str = this.toString();
		var iNum = str.stripComma();
		var aNum = iNum.split(".");

		var num = "";
		for(var i=0;i<aNum[0].length;i++) {
			if(i > 1 && ((i+1) % 3) == 1) {
				num = "," + num;
			}
			num = aNum[0].substr(aNum[0].length-i-1, 1) + num;
		}

		if(aNum.length > 1) {
			return num + "." + aNum[1];
		} else {
			return num;
		}
	}
});

Ajax._observers = [];	/* static array */
Ajax.Request.prototype = Object.extend(Ajax.Request.prototype, {
	/* private
	 * dulicated Request is aborting process & push in Ajax._observers array
	 * @param	{string}	url
	 */
	_manageDupleRequest: function(url) {
		var x = Ajax._observers;

		for(var i=0; i<x.length; i++) {
			var o = x[i];
			if (o['url'] == url) {
				o.transport.abort();
				o = null;			/*	referenced by Ajax._observers.
										So object reference is remove */
				x.splice(i,1);
				break;
			}
		}
		x.push(this);
	},

	/* Ajax.Request initialize method
	 * call manageXHR
	 * @param	{string}	url
	 * @param	{object}	options
	 */
	initialize: function(url, options) {
		this.transport = Ajax.getTransport();
		this.setOptions(options);
		this._manageDupleRequest(url);
		this.request(url);
	}
});

/* onReadyState change responder callback methods
 * fire callback Event by reference to Ajax.Request.Events
 */
Ajax.Responders.register({
  onComplete: function(transport) {
  	var x = Ajax._observers;

	for(var i=0; i<x.length; i++) {
		var o = x[i];
		if (o == transport) {
			o = null;
			x.splice(i,1);
			break;
		}
	}
  }
});

// model
pandora.util.model.prototype = {
	_targetID : null,
	_json : null,
	_super : null,

	initialize : function(){
	},

	_getTargetID : function(){
		return this._targetID;
	},

	setUI : function(html){
		$(this._getTargetID()).update(html);
	}
};

// storage
pandora.util.storage.prototype = {
	_local : null,
//	_beType : new Array(String, Hash, Array, Object),
	_temp : [],

	_getLocal : function(){
		return this._local;
	},

	initialize : function(){
		this._local = new Hash();
	},

	appendData : function(obj){
		this._local.merge(obj);
	},

	appendHash : function(key, value){
		this._local.merge( {key:null} );
		this._local[key] = value;
		return this._local[key];
	},

	getChild : function(child){
		return this._getLocal()[child];
	},

	isKey : function(key){
		if(typeof (this._getLocal()[key]) == 'undefined') return false;
		else return true;
	},

	size : function(){
		return this._getLocal().keys().length;
	},

	update : function(dest, value){
		this._local[dest] = value;
//		for(i in this._beType){
//			if(this._getLocal()[dest] instanceof this._beType[i]) {
//				if(value instanceof this._beType[i]) this._getLocal()[dest] = value;
//				else throw new Error("pandora.util.localstorage.update : Object type error");
//			}
//
//		}
	},

	update2 : function(key, iterator, cond, value){
		var target = this._getLocal()[key][iterator];
		for(var i=0; i<target.length; i++){
			if(target[i]['prg_id'].toString() == cond) target[i]['ment_cnt'] = value;
		}
	},

	update3 : function(value) {
		var stKeys = this._getLocal().keys();
		for(var i=0;i<stKeys.length;i++) {
			if(stKeys[i].indexOf("page") > -1 && stKeys[i].indexOf("prg_id") > -1) {
				if(stKeys[i]['prgList']) {
					for(var j=0;i<stKeys[i]['prgList'].length;j++) {
						if(stKeys[i]['prgList'][j]['prg_id'] == value['prg_id']) {
							Object.extend(stKeys[i]['prgList'][j], value);
							break;
						}
					}
				}
			}
		}
	},

	remove : function(dest){
		this._getLocal().remove(dest);
	},

	clear : function(){
		this._local = null;
		this.initialize();
	}
};

var Storage = Class.create();
Object.extend(Storage.prototype, new pandora.util.storage());

var cStorageMgr = Class.create();
	cStorageMgr._instance_ = null;
	cStorageMgr.getInstance = function(){
			if(this._instance_==null) this._instance_ = new Storage();
			return this._instance_;
	};

// board
//defined abscrat class by namespace
pandora.util.board.prototype = {
	_targetID : null,
	_super : null,
	_loadId : null,

	initialize : function(){
	},

	_getTargetID : function(){
		return this._targetID;
	},

	setUI : function(html){
		$(this._targetID).update('');
		$(this._targetID).update(html);
	},

	loadingStart : function(id,type){
		this._loadId = id;
		switch(type) {
			case "text" :
					$(this._loadId).addClassName('page_next');
					$(this._loadId).update("<img src='"+variable.getChild("designHost").toString()+"/img/waiting.gif' border='0' width='14px' height='14px'>")
				break;
			case "img" :
					$(this._loadId).src = variable.getChild("designHost").toString()+"/img/waiting.gif";
				break;
		}
	},

	loadingStop : function(){
		$(this._loadId).update('');
	}
};

//defined BoardPage class
var BoardPage = Class.create();
	BoardPage.prototype = {
		_bbsCurrPage : null,
		_bbsPageSize : null,
		_bbsLimit : null,
		_bbsTotal : null,
		_evtObj : null,
		_isEvt : false,
		nowEvt : null,
		prevEvt : null,
		totPage : null,

		setPagingInfo : function(target, currPage, pageSize, limit, obj){
			this._targetID = target;
			this._bbsCurrPage = currPage;
			this._bbsPageSize = pageSize;
			this._bbsLimit = limit;
			this._super = obj;
			this._evtObj = new BoardEvent();
		},

		getID : function(){
			return this._getTargetID();
		},

		getPagingInfo : function(total){
			this._bbsTotal = total;
			this.totPage = Math.ceil(this._bbsTotal / this._bbsLimit);

			var totBlock = Math.ceil(this.totPage / this._bbsPageSize);
			var iStart = 1;
			var iEnd = 0;
			var iBlockNumber = 0;
			var sPaging = new pandora.util.StringBuffer();
			var target = this._getTargetID();
			var evArr = new pandora.util.StringBuffer();

			if(this.totPage > this._bbsPageSize) {
				iBlockNumber = Math.floor((this._bbsCurrPage-1) / this._bbsPageSize);
				iStart = (iBlockNumber * this._bbsPageSize) + 1;
			}

			sPaging.append('<table border="0" align="center" cellpadding="0" cellspacing="5"><tr>');
			iEnd = iStart + this._bbsPageSize;
			if(iBlockNumber == 0 && this._bbsPageSize == 1 && iBlockNumber != (totBlock-1)) {
				sPaging.append('<td class="page"><a><img class="icon_left_no" src="'+ variable['skinHost'] +'static/blank.gif"/></a></td>');
			}else if(iBlockNumber > 0) {
				sPaging.append('<td class="page"><a title="previous page" style="cursor:pointer"><img class="icon_left" src="'+ variable['skinHost'] +'static/blank.gif" id="'+target+'_'+(iStart-1)+'" /></a></td>');
				evArr.append(target+"_"+(iStart-1));
			}
			for(var i=iStart;i<iEnd;i++) {
				if(i > this.totPage) break;
				if(this._bbsPageSize!=1){
					if(i == this._bbsCurrPage) sPaging.append('<td class="page_on">'+i+'</td>');
					else {
						sPaging.append('<td class="page"><a id="'+target+'_'+i+'" class="number">'+i+'</a></td>');
						evArr.append(target+"_"+i);
					}
				}
			}

			if(iBlockNumber == (totBlock-1) && this._bbsPageSize == 1 && iBlockNumber != 0) {
				sPaging.append('<td class="page"><a><img class="icon_right_no" src="'+ variable['skinHost'] +'static/blank.gif"/></a></td>');
			}else if(iBlockNumber < (totBlock-1)) {
				sPaging.append('<td class="page"><a title="next page" style="cursor:pointer"><img class="icon_right" src="'+ variable['skinHost'] +'static/blank.gif" id="'+target+'_'+i+'" /></a></td>');
				evArr.append(target+"_"+i);
			}

			sPaging.append('</tr></table>');

			if(!this._isEvt){ // no event...
				this.setUI(sPaging.toString());
				if(evArr!=""){
					this.nowEvt = evArr.toComma().split(", ");
					this.setEventListener(this.nowEvt, "set");
				}
			}else{
				this.nowEvt = evArr.toComma().split(", ");
				if(this.prevEvt!="") this.setEventListener(this.prevEvt, "remove");
				this.setUI(sPaging.toString());
				if(this.nowEvt!="") this.setEventListener(this.nowEvt, "set");
			}

			this.prevEvt = this.nowEvt;
			sPaging = null;
		},

		getPagingInfo2 : function(total){
			this._bbsTotal = total;
			this.totPage = Math.ceil(this._bbsTotal / this._bbsLimit);

			var totBlock = Math.ceil(this.totPage / this._bbsPageSize);
			var iStart = 1;
			var iEnd = 0;
			var iBlockNumber = 0;
			var sPaging = new pandora.util.StringBuffer();
			var target = this._getTargetID();
			var evArr = new pandora.util.StringBuffer();

			if(this.totPage > this._bbsPageSize) {
				iBlockNumber = Math.floor((this._bbsCurrPage-1) / this._bbsPageSize);
				iStart = (iBlockNumber * this._bbsPageSize) + 1;
			}

			iEnd = iStart + this._bbsPageSize;
			if(iBlockNumber == 0 && this._bbsPageSize == 1 && iBlockNumber != (totBlock-1)) {
				sPaging.append('<a><img class="icon_left_no page" src="'+ variable['skinHost'] +'static/blank.gif"/></a>');
			}else if(iBlockNumber > 0) {
				sPaging.append('<a title="previous page" style="cursor:pointer"><img class="icon_left page" src="'+ variable['skinHost'] +'static/blank.gif" id="'+target+'_'+(iStart-1)+'" /></a>');
				evArr.append(target+"_"+(iStart-1));
			}
			for(var i=iStart;i<iEnd;i++) {
				if(i > this.totPage) break;
				if(this._bbsPageSize!=1){
					if(i == this._bbsCurrPage) sPaging.append(i);
					else {
						sPaging.append('<a id="'+target+'_'+i+'" class="number">'+i+'</a>');
						evArr.append(target+"_"+i);
					}
				}
			}

			if(iBlockNumber == (totBlock-1) && this._bbsPageSize == 1 && iBlockNumber != 0) {
				sPaging.append('<a><img class="icon_right_no page" src="'+ variable['skinHost'] +'static/blank.gif"/></a>');
			}else if(iBlockNumber < (totBlock-1)) {
				sPaging.append('<a title="next page" style="cursor:pointer"><img class="icon_right page" src="'+ variable['skinHost'] +'static/blank.gif" id="'+target+'_'+i+'" /></a>');
				evArr.append(target+"_"+i);
			}

			sPaging.append('');

			if(!this._isEvt){ // no event...
				this.setUI(sPaging.toString());
				if(evArr!=""){
					this.nowEvt = evArr.toComma().split(", ");
					this.setEventListener(this.nowEvt, "set");
				}
			}else{
				this.nowEvt = evArr.toComma().split(", ");
				if(this.prevEvt!="") this.setEventListener(this.prevEvt, "remove");
				this.setUI(sPaging.toString());
				if(this.nowEvt!="") this.setEventListener(this.nowEvt, "set");
			}

			this.prevEvt = this.nowEvt;
			sPaging = null;
		},

		eventFunc : function(event){
			var el = Event.element(event);
			switch(el.tagName.toUpperCase()) {
				case "A" : this.loadingStart(el.id,'text');
					break;
				case "IMG" : this.loadingStart(el.id,'img');
					break;
			}
			this._super.doMovePage(el.id.substring(el.id.lastIndexOf("_")+1, el.id.toString().length), this._getTargetID());
		},

		setEventListener : function(arr,flag){
			this._isEvt = true;
			this._evtObj.setEventListener(arr, this, flag);
		}
	};
//defined concreate class extended abstract class
Object.extend(BoardPage.prototype, new pandora.util.board());

var cBoardPageMgr = Class.create();
	cBoardPageMgr._instance_ = null;
	cBoardPageMgr.getInstance = function(tag){
			if(this._instance_==null) this._instance_ = new BoardPage();
			else {
					if(tag=='new') this._instance_ = new BoardPage();
				}
			return this._instance_;
	};

var BoardList = Class.create();
	BoardList.prototype = {
		_col : null,
		_row : null,
		_UI : null,
		_data : null,
		_backData : null,
		_dest : null,
		_evtObj : null,
		_isEvt : null,
		_execFunc : null,
		_evtArr : null,
		_uqId : null,
		nowEvt : null,
		oneJSON : null,
		_evt : null,
		isBR : null,
		BRName : null,

		setListType : function(target, col, row, UI, dest, func, evtArr, uqid, obj){
			this._targetID = target;
			this._col = col;
			this._row = row;
			this._UI = UI;
			this._dest = dest;
			this._super = obj;
			this._evtArr = evtArr;
			this._uqId = uqid;
			this._execFunc = func;
			this._evtObj = new BoardEvent();
			this.isBR = arguments[9];
			this.BRName = arguments[10];

			Object.extend(Template.prototype, {
				evaluate : function(object, dest, size, flag){
				 return this.template.gsub(this.pattern, function(match) {
				  var before = match[1];
				  if (before == '\\') return match[2];
				  if(dest!=undefined) {
					//if(match[3] == "title" || match[3] == "contents" || match[3] == "categ_name") {
					if(match[3] == "title" || match[3] == "categ_name") {
						var str = before + String.interpret(object[match[3]]);
						if(flag==undefined) return str.truncate(size);
						else return str.wordBreak(size);
					}
					else return before + String.interpret(object[match[3]]);
				 }
				  else return before + String.interpret(object[match[3]]);
				});
			}})
		},

		getListType : function(data, callback){
//alert(Object.toJSON(data));
			this._data = data;
			var count = 0;
			var tmp = "";
			var oList = new pandora.util.StringBuffer();
			var evArr = new pandora.util.StringBuffer();
			var tmpStr = "";
			var tmp_row = 0;
			var tmp_col = 0;
			var t_row = (this._data['total']) ?  parseInt(this._data['total'].toString(), 10) : ((this._data['prg_tot']) ? parseInt(this._data['prg_tot']) : ((this._data['ch_tot']) ? parseInt(this._data['ch_tot'])  :  parseInt(this._data['tot'].toString(), 10)));
			var rlyChk = false;
			var xwidth = 0;

			var chkBox = "";

			if(arguments[2]=="search") oList.append("<div><table border='0' cellspacing='0' cellpadding='0'>");
			else if(arguments[2]=="search2") oList.append("<div style='position: relative; width:100%'><table width='100%' border='0' cellspacing='0' cellpadding='0' style='margin-top:15px'>");
			else oList.append("<div><table border='0' cellspacing='0' cellpadding='0' width='100%'>");

			if(this._row > t_row ) tmp_row = t_row;
			else tmp_row = this._row;

			if(this._row > this._data[this._dest].length) tmp_row = this._data[this._dest].length;


			if(this._col >this._data[this._dest].length) tmp_col = this._data[this._dest].length;
			else tmp_col = this._col;

			var xwidth = Math.ceil(100 / tmp_col);

			var mod = this._data[this._dest].length%this._col;
			var mfl = Math.ceil(this._data[this._dest].length/this._col);

			if(mfl==1) tmp_row = 1;
			else tmp_row = mfl;

			for(var tr=0; tr<tmp_row; tr++){
				oList.append("<tr>");

				if(tmp_row-1==tr && mod>0) tmp_col = mod;

				for(var td=0; td<tmp_col; td++){
					count = td + tr * this._col;

					if(count==0 && typeof(this._super._isStart)!="undefined" &&!this._super._isStart) {
						this._super.setClickPrgId(this._data[this._dest][count][this._uqId]);
					}

					try{
						if(this.isBR!=undefined || this.isBR!=null) {
							if(!this.isBR) this._data[this._dest][count][this.BRName] = this._data[this._dest][count][this.BRName].toString().replace(/<br>/gi,"&nbsp;");
						}

						try{
							if(this._data[this._dest][count]['regdate'].toString().indexOf("/")>-1) this._data[this._dest][count]['regdate'] = cGMT.getGMT(this._data[this._dest][count]['regdate']);

						}catch(e){}

						if(this._uqId=="ch_userid"){
							this._data[this._dest][count]['ch_thumb'] = getChThumbnail(this._data[this._dest][count]['ch_userid'],'s');
							this._data[this._dest][count]['seq'] = ((this._super.page._bbsCurrPage-1)*(this._row*this._col))+(count+1);
						}

						// 체크 박스 활성 비 활성
						if (this._uqId == "prg_id" && this._super._clickCategory != "cate_all") {
							chkBox = "chkBox"; //_" + this._data[this._dest][count]["prg_id"].toString();
							this._data[this._dest][count][chkBox] = "";
							if (chInfoJson['mychannel'] == 1) {
								this._data[this._dest][count][chkBox] = '<input id="chk_' + this._data[this._dest][count]["prg_id"].toString() + '" type="checkbox" style="vertical-align:middle" value=""> ';
							}
						}

						if(this._uqId=="ment_id") tmpStr = this._UI.evaluate(this._data[this._dest][count],'contents',45,"wordbreak");
						else if(this._uqId=="prgID") tmpStr = this._UI.evaluate(this._data[this._dest][count],'title',15,"wordbreak");
						else if(this._uqId=="categ_id") tmpStr = this._UI.evaluate(this._data[this._dest][count],'categ_name',15,"wordbreak");
						else if(this._uqId=="iic_prgID") tmpStr = this._UI.evaluate(this._data[this._dest][count],'title',15,"wordbreak");
						else tmpStr = this._UI.evaluate(this._data[this._dest][count]);

						if(this._uqId=="ment_id"){
							rlyChk = false;
							//var img = '&nbsp;<a><img id="rlyDel_'+this._data[this._dest][count][this._uqId]+'" src="'+variable.getChild('chImg').toString()+'/btn_x.gif" width="12" height="12" border="0" align="absmiddle"></a>';
							var img = '<a><img id="rlyDel_'+this._data[this._dest][count][this._uqId]+'" class="icon_del2" src="'+variable.getChild("blankImg")+'" border="0" align="absmiddle"></a>';

							if(this._super.login_userid=="null"){
								tmpStr = tmpStr.replace(/rlyDImg/g,img);
								rlyChk = true;
							}else{
								if(this._super.login_userid ==this._super.chInfo.getInfo('ch_userid').toString()){
									tmpStr = tmpStr.replace(/rlyDImg/g,img);
									rlyChk = true;
								}else{
									if(this._super.login_userid==this._data[this._dest][count]['writer']){
										tmpStr = tmpStr.replace(/rlyDImg/g,img);
										rlyChk = true;
									}else{
										tmpStr = tmpStr.replace(/rlyDImg/g,"");
										rlyChk = false;
									}
								}
							}
						}
/*
						if (this._uqId == "prg_id") {
							// 타이틀 변경
							if (this._data[this._dest][count]["status"].toString() == "30010") { // 스크랩일 경우 타이틀 앞에 [펌] 이라고 붙여 준다.
								this._data[this._dest][count]["title"] = oLang.get('video_title_scrap') + "펌" + this._data[this._dest][count]["title"];
//								this._data[this._dest][count]["title"] = "[펌] " + this._data[this._dest][count]["title"];
							}
						}
*/

					}catch(e){
						tmpStr = "&nbsp;"
					}
					if(arguments[2]=="search2") oList.append("<td valign='top' width='"+xwidth+"%' align='center'>"+tmpStr+"</td>");
					else oList.append("<td valign='top'>"+tmpStr+"</td>");

					if(this._uqId=="ment_id"){
						for(var i=0; i<this._evtArr.length; i++){
							if(rlyChk){
								evArr.append(this._evtArr[i].toString()+"_"+this._data[this._dest][count][this._uqId]);
							}else{
								if(i==0) evArr.append(this._evtArr[i].toString()+"_"+this._data[this._dest][count][this._uqId]);
							}
						}
					}else{
						for(var i=0; i<this._evtArr.length; i++){
//							if (this._evtArr[i].indexOf("over_") > -1) {
//								evArr.append(this._evtArr[i].toString().replace("over_", "")+"_"+this._data[this._dest][count][this._uqId]);
//							} else if (this._evtArr[i].indexOf("out_") > -1) {
//								evArr.append(this._evtArr[i].toString().replace("out_", "")+"_"+this._data[this._dest][count][this._uqId]);
//							} else {
								evArr.append(this._evtArr[i].toString()+"_"+this._data[this._dest][count][this._uqId]);
//							}
						}
					}
				}
				oList.append("</tr>");
			}
			oList.append("</table></div>");

			//if(this._targetID!="reply_content") this._super.json = data;
			if(this._targetID=="ch_program_list") this._super.json = data;
			if(typeof(this._super._isStart)!="undefined" && !this._super._isStart) this._super._isStart = true;

			this.nowEvt = evArr.toComma().split(", ");

			// no event...
			if(this._isEvt && this.prevEvt!="") this.setEventListener(this.prevEvt, "remove");

			this.setUI(oList.toString());

			if(this.nowEvt!="") this.setEventListener(this.nowEvt, "set");

			this.prevEvt = this.nowEvt;

			oList = null;
			if(callback!=undefined) callback(this._data[this._dest]);
		},

		getListType2 : function(data, callback){
//alert(Object.toJSON(data));
			this._data = data;
			var count = 0;
			var tmp = "";
			var oList = new pandora.util.StringBuffer();
			var evArr = new pandora.util.StringBuffer();
			var tmpStr = "";
			var tmp_row = 0;
			var tmp_col = 0;
			var t_row = (this._data['total']) ?  parseInt(this._data['total'].toString(), 10) : ((this._data['prg_tot']) ? parseInt(this._data['prg_tot']) : ((this._data['ch_tot']) ? parseInt(this._data['ch_tot'])  :  parseInt(this._data['tot'].toString(), 10)));
			var rlyChk = false;
			var xwidth = 0;

			var chkBox = "";

			oList.append("");

			if(this._row > t_row ) tmp_row = t_row;
			else tmp_row = this._row;

			if(this._row > this._data[this._dest].length) tmp_row = this._data[this._dest].length;


			if(this._col >this._data[this._dest].length) tmp_col = this._data[this._dest].length;
			else tmp_col = this._col;

			var xwidth = Math.ceil(100 / tmp_col);

			var mod = this._data[this._dest].length%this._col;
			var mfl = Math.ceil(this._data[this._dest].length/this._col);

			if(mfl==1) tmp_row = 1;
			else tmp_row = mfl;

			for(var tr=0; tr<tmp_row; tr++){

				if(tmp_row-1==tr && mod>0) tmp_col = mod;

				for(var td=0; td<tmp_col; td++){
					count = td + tr * this._col;

					if(count==0 && typeof(this._super._isStart)!="undefined" &&!this._super._isStart) {
						this._super.setClickPrgId(this._data[this._dest][count][this._uqId]);
					}

					try{
						if(this.isBR!=undefined || this.isBR!=null) {
							if(!this.isBR) this._data[this._dest][count][this.BRName] = this._data[this._dest][count][this.BRName].toString().replace(/<br>/gi,"&nbsp;");
						}


						if(this._uqId=="ch_userid"){
							this._data[this._dest][count]['ch_thumb'] = getChThumbnail(this._data[this._dest][count]['ch_userid'],'s');
							this._data[this._dest][count]['seq'] = ((this._super.page._bbsCurrPage-1)*(this._row*this._col))+(count+1);
						}

						// 체크 박스 활성 비 활성
						if (this._uqId == "prg_id" && this._super._clickCategory != "cate_all") {
							chkBox = "chkBox"; //_" + this._data[this._dest][count]["prg_id"].toString();
							this._data[this._dest][count][chkBox] = "";
							if (chInfoJson['mychannel'] == 1) {
								this._data[this._dest][count][chkBox] = '<input id="chk_' + this._data[this._dest][count]["prg_id"].toString() + '" type="checkbox" style="vertical-align:middle" value=""> ';
							}
						}

						if(this._uqId=="ment_id") tmpStr = this._UI.evaluate(this._data[this._dest][count],'contents',45,"wordbreak");
						else if(this._uqId=="prgID") tmpStr = this._UI.evaluate(this._data[this._dest][count],'title',15,"wordbreak");
						else if(this._uqId=="categ_id") tmpStr = this._UI.evaluate(this._data[this._dest][count],'categ_name',15,"wordbreak");
						else if(this._uqId=="iic_prgID") tmpStr = this._UI.evaluate(this._data[this._dest][count],'title',15,"wordbreak");
						else tmpStr = this._UI.evaluate(this._data[this._dest][count]);

						if(this._uqId=="ment_id"){
							rlyChk = false;
							var img = '<a><img id="rlyDel_'+this._data[this._dest][count][this._uqId]+'" class="icon_del2" src="'+variable.getChild("blankImg")+'" border="0" align="absmiddle"></a>';

							if(this._super.login_userid=="null"){
								tmpStr = tmpStr.replace(/rlyDImg/g,img);
								rlyChk = true;
							}else{
								if(this._super.login_userid ==this._super.chInfo.getInfo('ch_userid').toString()){
									tmpStr = tmpStr.replace(/rlyDImg/g,img);
									rlyChk = true;
								}else{
									if(this._super.login_userid==this._data[this._dest][count]['writer']){
										tmpStr = tmpStr.replace(/rlyDImg/g,img);
										rlyChk = true;
									}else{
										tmpStr = tmpStr.replace(/rlyDImg/g,"");
										rlyChk = false;
									}
								}
							}
						}

					}catch(e){
						tmpStr = "&nbsp;"
					}
					
					oList.append(tmpStr);

					if(this._uqId=="ment_id"){
						for(var i=0; i<this._evtArr.length; i++){
							if(rlyChk){
								evArr.append(this._evtArr[i].toString()+"_"+this._data[this._dest][count][this._uqId]);
							}else{
								if(i==0) evArr.append(this._evtArr[i].toString()+"_"+this._data[this._dest][count][this._uqId]);
							}
						}
					}else{
						for(var i=0; i<this._evtArr.length; i++){
//							if (this._evtArr[i].indexOf("over_") > -1) {
//								evArr.append(this._evtArr[i].toString().replace("over_", "")+"_"+this._data[this._dest][count][this._uqId]);
//							} else if (this._evtArr[i].indexOf("out_") > -1) {
//								evArr.append(this._evtArr[i].toString().replace("out_", "")+"_"+this._data[this._dest][count][this._uqId]);
//							} else {
								evArr.append(this._evtArr[i].toString()+"_"+this._data[this._dest][count][this._uqId]);
//							}
						}
					}
				}
			}


			//if(this._targetID!="reply_content") this._super.json = data;
			if(this._targetID=="ch_program_list") this._super.json = data;
			if(typeof(this._super._isStart)!="undefined" && !this._super._isStart) this._super._isStart = true;

			this.nowEvt = evArr.toComma().split(", ");

			// no event...
			if(this._isEvt && this.prevEvt!="") this.setEventListener(this.prevEvt, "remove");

			this.setUI(oList.toString());

			if(this.nowEvt!="") this.setEventListener(this.nowEvt, "set");

			this.prevEvt = this.nowEvt;

			oList = null;
			if(callback!=undefined) callback(this._data[this._dest]);
		},


		doPlay : function(prg_id, idStr, evt){
			this._evt = evt;
			this._execFunc(prg_id, idStr, evt);
		},

		getOneJSON : function(target, prg_id){
			var ret = null;
			for(var i=0; i<this._data[this._dest].length; i++){
				if(this._data[this._dest][i][target] == prg_id) ret = this._data[this._dest][i];
			}
			return ret;
		},

		eventFunc : function(event){
			var el = Event.element(event);
			if (event.type == "click") {
				this.doPlay(el.id.substring(el.id.indexOf("_")+1, el.id.toString().length), el.id.substring(0, el.id.indexOf("_")),event);
			} else {
				//alert(event.type);
			}
		},

		setEventListener : function(arr, flag){
			this._isEvt = true;
			try{this._evtObj.setEventListener(arr, this, flag);}catch(e){}
		}

	};
Object.extend(BoardList.prototype, new pandora.util.board());

var cBoardListMgr = Class.create();
	cBoardListMgr._instance_ = null;
	cBoardListMgr.getInstance = function(tag){
			if(this._instance_==null) this._instance_ = new BoardList();
			else {
					if(tag=='new') this._instance_ = new BoardList();
				}
			return this._instance_;
	};


var BoardEvent = Class.create();
	BoardEvent.prototype = {
		_super : null,

		initialize : function(){
		},

		setEventListener : function(arr,obj,flag){
			this._super = obj;
			this._super.evt = this._super.eventFunc.bindAsEventListener(this._super);
			var eventStatus = "click";
			for(var i=0; i<arr.length; i++){
				switch(true) {
					case (arr[i].indexOf("over_") > -1) :
							eventStatus = "mouseover";
							arr[i] = arr[i].replace("over_", "")
							//this._super.evt = this._super.eventFunc.bindAsEventListener(this._super);
						break;
					case (arr[i].indexOf("out_") > -1) :
							eventStatus = "mouseout";
							arr[i] = arr[i].replace("out_", "")
							//this._super.evt = this._super.eventFunc.bindAsEventListener(this._super);
						break;
					default :	eventStatus = "click";
				}

				switch(flag) {
					case "set" : Event.observe(arr[i], eventStatus, this._super.evt);
						break;
					case "remove" :
						if($(arr[i])) {
							Event.stopObserving(arr[i], eventStatus, this._super.evt);
						}
						break;
				}
			}
		}
	};

// variable
var rsCode = null;
var rsCategory = null;
var rsLanguage = {};
var rsLangPage = {};

/* public
* 글로벌 오브젝트로 변경
*/
var serverAddr = document.location.href;
var serverAddrAr = document.location.href.split("/");
var domAddr1 = serverAddrAr[2].split(".");
var domAddr = domAddr1[0];

if (domAddr == "g2w" || domAddr == "g2c" || domAddr == "g2u" || domAddr == "g2s" || domAddr == "g2sh" || domAddr == "ggroups" || domAddr == "glive" || domAddr == "gmember" || domAddr == "gmobile" || domAddr == "g2s" || domAddr == "ginfo" || domAddr == "ggroups" || domAddr == "gshow" || domAddr == "gmini" || domAddr == "ginterface" || domAddr == "gsong" || domAddr == "gcupiplay" || domAddr == "grealname" || domAddr == "gkeyword" || domAddr == "gblog" || domAddr == "gcom" || domAddr == "gevent" || domAddr == "gimg3" || domAddr == "gdownload" || domAddr == "gm" || domAddr == "g2m" || domAddr == "g2flv" || domAddr == "gpch") {
	var thisVersion = "test";
} else {
	var thisVersion = "service";
}

if (thisVersion == "test") {
	var variable = {

		mainHost	: 'http://g2w.pandora.tv/',
		srvHost		: 'http://g2w.pandora.tv/',
		chHost		: 'http://g2c.pandora.tv/',
		thumbOriHost: 'http://thumb.pandora.tv/',
		thumbHost	: 'http://imguser.pandora.tv/',
		designHost	: 'http://imgcdn.pandora.tv/gimg/',
		skinHost	: 'http://imgcdn.pandora.tv/',
		vodHost		: 'http://flvorg.pandora.tv/flv/_user/',	// http://flvorg.pandora.tv/global/flv/_user/
		mp4Host		: 'http://flvorg.pandora.tv/hd/_user/',	// http://flvorg.pandora.tv/global/mp4/_user/
		uploadHost	: 'http://g2u.pandora.tv/',
		searchHost	: 'http://g2s.pandora.tv/',
		shareHost	: 'http://g2sh.pandora.tv/',

		cupiHost	: 'http://gcupiplay.pandora.tv/',
		groupsHost	: 'http://ggroups.pandora.tv/',
		liveHost	: 'http://glive.pandora.tv/',
		songHost	: 'http://gsong.pandora.tv/',
		miniHost	: 'http://gmini.pandora.tv/',
		infoHost	: 'http://ginfo.pandora.tv/',
		eventHost	: 'http://gevent.pandora.tv/',
		mobileHost	: 'http://gmobile.pandora.tv/',
		showHost	: 'http://gshow.pandora.tv/',
		downloadHost: 'http://gdownload.pandora.tv/',
		apiHost		: 'http://ginterface.pandora.tv/',

		chPlayer		: 'http://imgcdn.pandora.tv/gplayer/pandora_CGplayer.swf',
		chPlayer		: 'http://channel1.pandora.tv/test/player/test_pandora_CGplayer.swf',
		chDefaultImg: 'http://imgcdn.pandora.tv/static/ch_thumb.gif',
		chDefaultImg77: 'http://imgcdn.pandora.tv/static/no_mythumb.gif',
		prgDefaultImg: 'http://imgcdn.pandora.tv/static/prg_thumb.gif',
		blankImg	: 'http://imgcdn.pandora.tv/static/blank.gif',

		getChild	: function(key) {
			if(key == "vodHost" || key == "mp4Host") {
				var ipCtr = oCookie.get("ipCountry");
				if(ipCtr == "-" || ipCtr == "") {	// ipCountry?? ??v?? ????...
					ipCtr = oCookie.get("browserLang") || "KR";
					if(ipCtr.toUpperCase() == "KO") ipCtr = "KR";
				}
				if(ipCtr.toUpperCase() == "KR") {
					return this[key].replace("http://flvorg.", "http://flvcdn.");
				} else {
					return this[key].replace("http://flvorg.", "http://flvg.");
				}
			} else {
				return this[key];
			}
		}
	};
} else {
	var variable = {

		mainHost	: 'http://www.pandora.tv/',
		srvHost		: 'http://www.pandora.tv/',
		chHost		: 'http://channel.pandora.tv/',
		thumbOriHost: 'http://thumb.pandora.tv/',
		thumbHost	: 'http://imguser.pandora.tv/',
		designHost	: 'http://imgcdn.pandora.tv/gimg/',
		skinHost	: 'http://imgcdn.pandora.tv/',
		vodHost		: 'http://flvorg.pandora.tv/flv/_user/',
		mp4Host		: 'http://flvorg.pandora.tv/hd/_user/',
		uploadHost	: 'http://up.pandora.tv/',
		searchHost	: 'http://search.pandora.tv/',
		shareHost	: 'http://embed.pandora.tv/',


		cupiHost	: 'http://cupiplay.pandora.tv/',
		groupsHost	: 'http://groups.pandora.tv/',
		liveHost	: 'http://live.pandora.tv/',
		songHost	: 'http://song.pandora.tv/',
		miniHost	: 'http://mini.pandora.tv/',
		infoHost	: 'http://info.pandora.tv/',
		eventHost	: 'http://event.pandora.tv/',
		mobileHost	: 'http://mobile.pandora.tv/',
		showHost	: 'http://show.pandora.tv/',
		downloadHost: 'http://download.pandora.tv/',
		apiHost		: 'http://interface.pandora.tv/',

		//swfName		: 'http://imgcdn.pandora.tv/gplayer/player1/pandora_CGplayer.swf',
		chPlayer		: 'http://imgcdn.pandora.tv/gplayer/pandora_CGplayer_jjb.swf',
		chDefaultImg: 'http://imgcdn.pandora.tv/static/ch_thumb.gif',
		prgDefaultImg: 'http://imgcdn.pandora.tv/static/prg_thumb.gif',
		blankImg	: 'http://imgcdn.pandora.tv/static/blank.gif',

		getChild	: function(key) {
			if(key == "vodHost" || key == "mp4Host") {
				var ipCtr = oCookie.get("ipCountry") || "KR";
				if(ipCtr.toUpperCase() == "KR") {
					return this[key].replace("http://flvorg.", "http://flvcdn.");
				} else {
					return this[key].replace("http://flvorg.", "http://flvg.");
				}
			} else {
				return this[key];
			}
		}
	};
}

if (thisVersion == "test") {
	Object.extend(variable, {
		vodThumbImg	: variable.thumbHost + 'pandora/',
		chthumb		: variable.thumbHost + 'pandora/_channel_img',
		chOrithumb	: variable.thumbOriHost + 'pandora/_channel_img',
		chImg		: variable.designHost + 'img/channel',
		vod			: variable.designHost + 'player',

		chPLImg		: variable.designHost + 'img/channel/playlist/',
		chPLVer		: 'v001',
		pathChIsapi : "/json/v003/",
		isapiPath	: "json/v003/",			// 앞쪽에 호스트를 쓸때 사용
		isapiExt : ".dll",

		chAdminImg	: variable.designHost + 'img/myaccount',
		defaultImg	: variable.designHost + 'img',
		//embedPlayer	: "http://imgcdn.pandora.tv/flv/player/pandora_global_player.swf",//'http://flvcdn.pandora.tv/flv/player/swf5/pandora_player.swf',
		embedPlayer : 'http://imgcdn.pandora.tv/gplayer/pandora_EGplayer.swf',//'http://flvcdn.pandora.tv/flv/player/swf5/pandora_player.swf',
		flvPlayer	: 'flvPlayer',
		hdPlayer	: 'hdPlayer'
	});
} else {
	Object.extend(variable, {
		vodThumbImg	: variable.thumbHost + 'pandora/',
		chthumb		: variable.thumbHost + 'pandora/_channel_img',
		chOrithumb	: variable.thumbOriHost + 'pandora/_channel_img',
		chImg		: variable.designHost + 'img/channel',
		vod			: variable.designHost + 'player',

		chPLImg		: variable.designHost + 'img/channel/playlist/',
		chPLVer		: 'v001',
		pathChIsapi : "/json/v003/",
		isapiPath	: "json/v003/",			// 앞쪽에 호스트를 쓸때 사용
		isapiExt : ".dll",

		chAdminImg	: variable.designHost + 'img/myaccount',
		defaultImg	: variable.designHost + 'img',
		//embedPlayer	: "http://imgcdn.pandora.tv/flv/player/pandora_global_player.swf",//'http://flvcdn.pandora.tv/flv/player/swf5/pandora_player.swf',
		embedPlayer : 'http://imgcdn.pandora.tv/gplayer/pandora_EGplayer.swf',//'http://flvcdn.pandora.tv/flv/player/swf5/pandora_player.swf',
		embedPlayer : 'http://flvr.pandora.tv/flv2pan/',//'http://flvcdn.pandora.tv/flv/player/swf5/pandora_player.swf',
		embedPlayer : 'http://flvr.pandora.tv/flv2pan/flvmovie.dll',//'http://flvcdn.pandora.tv/flv/player/swf5/pandora_player.swf', 2008-06-09 smith.oh 수정 18일까지만 사용
		flvPlayer	: 'flvPlayer',
		hdPlayer	: 'hdPlayer'
	});
}

// etc
pandora.util.StringBuffer.prototype = {
	_buffer : null,
	initialize : function(){
		this._buffer = new Array();
	},
	append : function(obj){
		this._buffer.push(obj);
	},
	toString : function(){
		return this._buffer.join("");
	},
	toComma : function(){
		return this._buffer.join(", ");
	}
};

pandora.util.number.prototype = {
	currency : function(val){
		var str = val.value;
		var Re = /[^0-9]/g;
		var ReN = /(-?[0-9]+)([0-9]{3})/;
			str = str.replace(Re,'');

		while (ReN.test(str)) {
			str = str.replace(ReN, "$1,$2");
		}
		return str;
	}
};

pandora.util.string.prototype = {
	initialize : function(){
	},

	specialCheck : function(str){
		var chk = false;
		var val = str.value;
		var Re = /[~!@\#$%<>?^&*\()\=\-+_,.;:|\/\"\'\\\[\]\{\}]/gi;

		if(Re.test(val)){
			chk = true;
			str = val.replace(Re,'');
		}
		return chk;
	}
};

var cStringMgr = Class.create();
	cStringMgr._instance_ = null;
	cStringMgr.getInstance = function(){
			if(this._instance_==null) this._instance_ = new pandora.util.string();
			return this._instance_;
	};
var string = cStringMgr.getInstance();

var rsGMTlang = {
	gb : { "end" : " ago", "sec" : "second",  "min" : "minute",  "hour" : "hour",  "day" : "day",  "week" : "week",  "month" : "month",  "year" : "year" },
	ko : { "end" : "전", "sec" : "초",  "min" : "분",  "hour" : "시간",  "day" : "일",  "week" : "주",  "month" : "개월", "year" : "년" },
	en : { "end" : " ago", "sec" : "second",  "min" : "minute",  "hour" : "hour",  "day" : "day",  "week" : "week",  "month" : "month",  "year" : "year" },
	jp : { "end" : "前", "sec" : "秒",  "min" : "分",  "hour" : "時間",  "day" : "日",  "week" : "週",  "month" : "ヶ月", "year" : "年" },
	cn : { "end" : "前", "sec" : "秒",  "min" : "分以",  "hour" : "小?以",  "day" : "日以",  "week" : "周以",  "month" : "月以", "year" : "年以" }
};

pandora.util.time.prototype = {
	initialize : function(){},

	toHour : function(min){
		var tmp = parseInt(min / 60,10);
		var tmp2 = parseInt(min%60,10);
		return tmp+":"+tmp2;
	},

	makeGMT : function(t, key) {
		var la = chInfoJson['clientLang'];
		var lang = rsGMTlang[la], f = '';
		if(t > 1 && ( la == 'en' || la == 'gb')) f = 's ';
		return lang[key] + f + lang['end'];
	},

	getGMT : function(t) {
		if(!t) { return ''; }
		if(t.indexOf('/') == -1) return t;
		var tt = t.split('/');
		return tt[0] + " " + this.makeGMT(tt[0], tt[1]);
	},

	getTimeFormat : function(time){
		if(time.indexOf(":") == -1){
			var t = parseInt(time) / 1000;
			var d = '';

			if( t >= 3600 ){
				if(Math.floor(t / 3600) < 10)  d+= "0";
				d += Math.floor( t / 3600)  + ":" ;
				t -= Math.floor( t / 3600 ) * 3600;
			}else d += "00:";
			if( t >= 60 )	{
				if (Math.floor(t / 60) < 10) d += "0";
				d += Math.floor(t / 60) + ":";
				t -= Math.floor(t / 60) * 60;
			}else d += "00:";
			if (t < 10) d += "0";
			d += t;
		}else{
			d = time;
		}
		return d;
	},

	getDateFormat : function(date, gb){
		var yyyy = null;
		var mm = null;
		var dd = null;

		if(typeof(date)=='undefined') {alert('date parameter is undefined'); return;}
		if(date==''||date==null) {
			alert('date parameter is null or empty');
			return;
		}else{
			var arrTmp = date.split(gb);
			yyyy = arrTmp[0];
			mm = arrTmp[1];
			dd = arrTmp[2];

			if(date.indexOf(gb)!=-1 && chInfoJson['clientLang'] == 'en'){
				switch(mm){
					case "01" : {mm = 'January'; break;}
					case "02" : {mm = 'February'; break;}
					case "03" : {mm = 'March'; break;}
					case "04" : {mm = 'April'; break;}
					case "05" : {mm = 'May'; break;}
					case "06" : {mm = 'June'; break;}
					case "07" : {mm = 'July'; break;}
					case "08" : {mm = 'August'; break;}
					case "09" : {mm = 'September'; break;}
					case "10" : {mm = 'October'; break;}
					case "11" : {mm = 'November'; break;}
					case "12" : {mm = 'December'; break;}
				}
				return mm+" "+dd+", "+yyyy;
			}else{
				return date;
			}
		}
	}
};
var cGMTMgr = Class.create();
	cGMTMgr._instance_ = null;
	cGMTMgr.getInstance = function(){
			if(this._instance_==null) this._instance_ = new pandora.util.time();
			return this._instance_;
	};
var cGMT = cGMTMgr.getInstance();

/**
 * @author rhio.kim
 * @usage 'wordBreakTest'.wordBreak(10); //-> wordBreakT est
 * @usage '가나다라마바사'.wordBreak(3);  //-> 가나다 라마바 사
 */
Object.extend(String.prototype, {
	wordBreak : function(n, spl) {
		var length	= this.length, tmp = '', tcnt = 0;
//		if(length <= n || Prototype.Browser.IE) return this;
		// ie에서 안되서 조건절에서 제거 함 2008-04-03 smith.oh
		if(length <= n) return this;
		var sPoint = Math.round(length/n + 0.5);

		for(var i=0; i<sPoint; i++) {
			var j = i*n;
			var str = this.slice(j, j+n);
//			var k = str._cnt1ByteChar();

			if(!spl) spl = '<i style="font-size:0px;"> </i>';
			tmp += str+spl;
		}
		return tmp;
	},

	_cnt1ByteChar : function() {
		var cnt = 0;
		for(var i=0, length=this.length; i<length; i++) {
			var s = charCodeAt(this[i]);
			if( s <127 && ( s < 64 && s > 90 ) ) cnt++;
		}
		return cnt;
	},

	/* add by rhio.kim 2007.12.27 문자열 byte length 체크 */
	byteLen : function(len) {
		var tlen = 0, len = len || 0;
		for(var i=0, limit=this.length; i<limit; i++) {
			var oneChar = this.charAt(i);
			tlen += ( escape(oneChar).length > 4 ) ? 2 : 1;
		}
		return tlen;
	}
});

pandora.util.dom.prototype = {
	initialize : function(){},
	appendInput : function(argName, argValue) {
		var iType = arguments[2] ? arguments[2] : "hidden";
		switch(true) {
			case Prototype.Browser.IE :
					var oInput = document.createElement("<input type=\"" + iType + "\" name=\"" + argName + "\" value=\"" + argValue + "\">");
				break;
			default :
				var oInput = document.createElement("INPUT");
				with(oInput) {
					type = iType;
					name = argName;
					value = argValue;
				}
		}

		with(oInput) {
			if(iType.toLowerCase() == "text") className = "upload_input";
			if(arguments[3]) id = argName + "_" + arguments[3];
		}

		return oInput;
	},

	appendSelect : function(argName, argItem, argSelect) {
		var oSelect = document.createElement("SELECT");
		oSelect.name = argName ;
		if(arguments[3]) oSelect.id = argName + "_" + arguments[3] ;
		if(arguments[4]) oSelect.style.width = arguments[4] ;

		for(var i = 0 ; i < argItem.length ; i++)	{
			var oOption = document.createElement("OPTION");
			oOption.text = argItem[i][1] ;
			oOption.value = argItem[i][0] ;
			oSelect.options.add(oOption) ;
			if(oOption.value == argSelect) oSelect.options[i].selected = true ;
		}
		return oSelect ;
	},

	resetSelect : function(oSelect, argItem, argSelect) {
		for(var i=oSelect.options.length-1;i>=0;i--) {
			oSelect.remove(i);
		}
		for(var i=0;i<argItem.length;i++) {
			var oOption = document.createElement("OPTION");
			oOption.text = argItem[i][1] ;
			oOption.value = argItem[i][0] ;
			oSelect.options.add(oOption) ;
			if(oOption.value == argSelect) oSelect.options[i].selected = true ;
		}
	},

	appendTextarea : function(argName) {
		switch(true) {
			case Prototype.Browser.IE :
					var oText = document.createElement("<TEXTAREA name=\"" + argName + "\">");
				break;
			default :
				var oText = document.createElement("TEXTAREA");
				oText.name = argName ;
		}
		if(arguments[1]) oText.id = argName + "_" + arguments[1];
		if(arguments[2]) oText.style.width = arguments[2];
		if(arguments[3]) oText.style.height = arguments[3];

		return oText ;
	}
};

var dom = new pandora.util.dom();

/**
 * @projectDescription ExtendArray used Prototype.js
 * 프로토 타입 익스텐션 입니다. 배열의 원활한 이동과 추가 삭제를 돕는 javascript Array 객체에 메서드를 확장하여 사용할 수 있습니다.
 * @author ecru.kim@pandora.tv
 * @version v 0.1.18
 *
 * @sdoc
 * @namespace TArrayList
 * @description
 */
Object.extend(Array.prototype, {
	ptv_without: function() {
		var values = new Array();
		for(var i=0;i<arguments.length;i++) {
			if(arguments[i].constructor == Array) { values = values.concat(arguments[i]); }
			else values[values.length] = arguments[i];
		}

		return this.select(function(value) {
		  return !values.include(value);
		});
	}
});


/* public
 * 썸네일 경로
 */
function getChThumbnail(argUserid, type) {
	var path = variable.getChild("chthumb") + "/";
	if(argUserid) {
		for(var i=0;i<2;i++) {
			path += argUserid.substr(i, 1) + "/";
		}

		path += argUserid + "/";
		switch(type) {
			case "m" : path += "logo.gif"; break;
			case "s" : default : path += "logo_s.gif";
		}
	} else {
		path += "g/u/e/guest/guest.gif";
	}

	return path;
}

function getVodThumbnail(argUserid, argPrgid) {
	argUserid = argUserid.toLowerCase();
	var noPrgid = 30800000 ;// 로컬 통합 정책시 적용되는 기준 프로그램 아이디...
	var arrSizeDir = new Array("_channel_img_sm", "_channel_img");
	var path = variable.getChild("vodThumbImg");

	if(arguments[2] != undefined && (arguments[2].toUpperCase() == "M")) {
		path += arrSizeDir[1] + "/";
	} else {
		path += arrSizeDir[0] + "/";
	}

	if(argUserid && argPrgid) {
		for(var i=0;i<2;i++) {
			path += argUserid.substr(i, 1) + "/";
		}

		path += argUserid + "/";
		if(argPrgid > noPrgid) {
			var leng = String(argPrgid).length;
			path += String(argPrgid).substring(leng, leng-2) + "/";
		}
		path += "vod_thumb_" + argPrgid + ".jpg";

	} else {
		path += "g/u/guest/guest.gif";
	}
	return path;
}

//썸네일 큰이미지보기
/*
 * onmouseover ="bigThumb.v(event, [ch_userid], [prg_id])"
 * onmouseout  ="bigThumb.h()"
 * onmousemove ="bigThumb.v(event)"
 */
var bigThumb = {
	v : function (e, ch_userid, prg_id, tn) {
		return false;
		if (!$("POP_THUMB")) {
			return;
		}
		if (document.documentElement.scrollTop) {
			$("POP_THUMB").style.top = e.clientY+document.documentElement.scrollTop-105+'px';
		}
		else {
			$("POP_THUMB").style.top = e.clientY+document.body.scrollTop-105+'px';
		}
		$("POP_THUMB").style.left = e.clientX + 50 + 'px';
		$("POP_THUMB").style.display = "block";
		if (ch_userid&&prg_id) {
			if (tn) {
				$("bigThumbImg").src = tn;
			}
			else {
				$("bigThumbImg").src = getVodThumbnail(ch_userid, prg_id,'M');
			}
			$("bigThumbImg").onerror = function () {
				$("bigThumbImg").src = variable.getChild('skinHost') + "static/prg_thumb_on.gif";
			}
		}
	},
	h : function () {
		return false;
		if (!$("POP_THUMB")) {
			return;
		}
		$("POP_THUMB").style.display = "none";
	}
};


//클립보드[4대브라우저]
/*
 * copyText( text, [msg])
 * text : 카피할 텍스트
 * msg : 카피후 출력메세지
 */
function copyText(text, msg) {
	try {
		if (window.clipboardData) {
			window.clipboardData.setData("Text", text);
			if (msg) { window.alert(msg); }
		}
	}
	catch (e) {
		var request_uri = 'http://imgcdn.pandora.tv/gimg/so/_clipboard.swf';
		try {
			var oCopy = null;
			if(!(oCopy = $("flashcopier"))){
				oCopy = document.createElement('div');
				oCopy.id = "flashcopier";
				document.body.appendChild(oCopy);
			}
			oCopy.innerHTML = "";
			oCopy.innerHTML = '<embed src="'+request_uri+'" FlashVars="clipboard='+encodeURIComponent(text)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
			if (msg) { alert(msg); }
		}
		catch (e) {
		}
	}
}

//즐겨찾기
function bookMark(addthis_url, addthis_title) {
	addthis_url = decodeURIComponent(addthis_url);
	addthis_title = decodeURIComponent(addthis_title);
	if (document.all) window.external.AddFavorite(addthis_url,addthis_title);
	else window.sidebar.addPanel(addthis_title,addthis_url,'');
}

/* add by rhio.kim 2007.12.21
 * 영상 URL 생성 함수
 */
function getVodurl(argUserid, argPrgid, argFid, argType) {
	argUserid = argUserid.substring(0, 12).toLowerCase();	//flv경로에 12자리까지만 허용...
	var prgId		= parseInt(argPrgid || 0, 10);
	var argType		= argType || 'flv';
	var path		= (argType == 'flv') ? 'vodHost' : 'mp4Host' ;

	path = variable.getChild(path) + argUserid.substr(0,1) + '/' + argUserid.substr(1,1) + '/' + argUserid + '/';
	if(prgId >= 30800000) path += argPrgid.substr(argPrgid.length-2,2) +'/';
	path += argFid + '.flv';

	return path;
}


// 2008-02-19 김강산 성인인증 함수
// 2008-03-13 오현섭 수정 mode 가 없을 경우 로그인 페이지로 보내기

/* 2008-03-29 김강산 성인인증 재작업
	로직: 국내회원 -> 성인컨텐츠 접근 -> 로그인 여부 체크(로그인 시킴) -> 성인인증 여부 체크 (성인인증 시킴) -> 주민등록번호 디비 저장 -> 컨텐츠 접근 가능 여부 체크 (보여줌, 안보여줌)
*/
function glb_auth(returl, mode, isCh, isNew) {
	if (!returl || returl == undefined) {
		returl = document.location.href;
	}

	var needGoAdult = false; // 로그인 한 다음 성인인증 페이지 가서 주민등록번호 저장 시킬지 여부

	try {
		switch (mode) {
			case "adult":
				if (oCookie.get("glb_mem[userid]")) {
					adult_go(returl, isNew);
					return;
				} else {
					if (oCookie.get("ipCountry") != "KR" && oCookie.get("browserLang") != "ko") {
						adult_go(returl, isNew);
						return;
					} else {
						needGoAdult = true;
					}
				}
			break;
		}
	}
	catch (e) {
	}



	var lang = {ko:'로그인이 필요한 서비스 입니다.로그인을 하시겠습니까?', en:'You must Login', jp:'ログインが必要なサービスです。ログインしますか？', cn:'"?登?', gb:'You must Login'};
	if (confirm(lang[chInfoJson['clientLang']])) {
		if (needGoAdult == true) {
			var goUrl = variable.getChild('mainHost') + "sign/signup.ptv?needGoAdult=true&retUrl=" + escape(returl);
		} else {
			var goUrl = variable.getChild('mainHost') + "sign/signup.ptv?retUrl=" + escape(returl);
		}

		if (isNew) {
			window.open(goUrl+escape("&isNew="+isNew), "", "");
		} else {
			top.location.href = goUrl;
		}

		return true;
	} else {
		if (isCh) {
			return false;
		} else {
			history.go(-1);
		}
	}
}

function adult_go(returl, isNew) {
	var adult_auth_url = "http://member.pandora.tv/global_member/?print=adult&returl=";

	if (oCookie.get("adult_check") == null || oCookie.get("adult_check") == "n") {

		var goUrl = adult_auth_url+escape(returl);
	} else {
		var goUrl = returl;
		//return oCookie.get("adult_check");
	}

	if (isNew) {
		window.open(goUrl+escape("&isNew="+isNew), "", "");
	} else {
		top.location.href = goUrl;
	}
}
// 2008-02-19 끝

// 2008-03-07 오현섭 댓글 미리 보기 클래스 추가
//**********************************************************************************************************//
/* 사용 법 - channel_service/common/ch/pandora.ch.program.prg.js 참고 하세요
해당 js에서 set 함수에서

this.commentPrev = cPrgCommentPrev.getInstance();
this.commentPrev.set();

윗 두줄을 추가 해 주시고
Mouse Over, Move, Out 3개의 이벤트를 동시에 걸어 줍니다. 아래 3줄

this.commentPrev.callComment(evt);
this.commentPrev.moveCommentDiv(evt);
this.commentPrev.hideCommentDiv(evt);
*/
var commentPrev = Class.create();
commentPrev.prototype = {
	currDivId : null,
	w : 0,
	designNew : null,

	initialize : function(){
	}


	, set : function(arg1){
		this.oDomain = document.domain;
		this.el = null;
		this.divStatus = false;
		this.storage = cStorageMgr.getInstance();
		if (arg1 && isNaN(arg1)==false) {
			this.w = parseInt(arg1, 10);
		}
		this.commentCnt = 0;
		this.designNew = {};

		this.prg_id = "";
		this.ch_userid = "";
		this.mCnt = "";
		this.lot = "channel";

		// 리스트
		var design = [];
		design.push('<div  class="pop_div" style="position:absolute;z-index:999;left:10px;">');
		design.push('	<div class="playlist">');
		design.push('	<div class="reply_title">');
//		design.push('			<!--span style="float:right;"><A id="cList_#{prg_id}">답글달기</A></span-->');
		design.push('			<strong>#{title}</strong></div>');

		design.push('		<div style="padding:5px">');
		design.push('			<ul class="reply">#{viewCommList}</ul>');
		design.push('		</div>');
		design.push('	</div>');
		design.push('</div>');

		this.designNew.cBox = design.join('');

		this.currDivId = "cL_div";

		var oDiv = document.createElement("DIV");
		oDiv.style.position = "absolute";
		oDiv.style.zIndex = "999";
		oDiv.style.width = "0px";
		oDiv.style.height = "0px";
		oDiv.style.display = "inline";
		oDiv.id = this.currDivId;

		document.body.appendChild(oDiv);
	}

	, callComment : function (evt, prg_id, ch_userid, mCnt, lot) {
		this.divStatus = true;
		this.el = Event.element(evt);

		if (prg_id && ch_userid) { // 파라미터 값 참조
			this.mCnt = mCnt;
			this.prg_id = prg_id;
			this.ch_userid = ch_userid;
			var sKey = "div_" + this.prg_id.toString();
			this.lot = chInfoJson["currMenu"];
		} else { // 채널정보 참조
			this.mCnt = this.el.readAttribute("mentCnt");

			 this.prg_id = this.el.id.replace("prg_","");
			this.ch_userid = chInfoJson["ch_userid"];

			var sKey = "div_" + this.prg_id;
		}

		if (lot) {
			this.lot = lot;
		} else {
			this.lot = chInfoJson["currMenu"];
		}

		if (this.mCnt == 0 && this.mCnt.length > 0) {
//			try {console.log("덧글수 없음");} catch(e) {}
			return false;
		}

		var storageData = "";

		if (this.storage.isKey(sKey)) {
			var sObj = this.storage.getChild(sKey);
			if (sObj["commCnt"] > 0) {
				if (this.divStatus == true) {
					this.openComment(sObj);
				}
			} else {
	//			try { console.log("노 데이터"); } catch(e) {}
			}

//			this.viewComment( this.storage.getChild(sKey), 1);
		} else {
			var jsonObj = Object.toJSON({ch_userid:this.ch_userid, pid:this.prg_id});
			if (!$("null_div")) {
				var id = "null_div";
				var oDiv = document.createElement("DIV");
				oDiv.id = id;
				oDiv.style.display = "none";
				document.body.appendChild(oDiv);
			}

			document.domain = "pandora.tv";
			$("null_div").innerHTML = '<iframe src="' + variable.getChild("chHost") + 'php/commLimit.ptv?ch_userid=' + this.ch_userid + '&pid=' + this.prg_id.replace("prg_","") + '&menu='+chInfoJson['currMenu']+'"></iframe>';
		}
	}

	, viewComment : function (json, type) {
		var sKey = "div_" + this.prg_id.toString();

		var obj = "{'"+ sKey +"':" + Object.toJSON(json) + "}";
		this.storage.appendData( obj.evalJSON() );

		if (json["commCnt"] > 0) {
			if (this.divStatus == true) {
				this.openComment(json);
			}
		} else {
//			try { console.log("노 데이터"); } catch(e) {}
		}

	}

	, openComment : function (obj) {
//		this.currDivId = "div_" + obj["prg_id"];
		var langText = {ko:"답글 미리보기",en:"Preview Comment",cn:"?看??",jp:"書き?まれたコメントを見る。",gb:"Preview Comment"};

		obj['title'] = langText[chInfoJson['clientLang']];

		if (obj["commCnt"] == 0) {
			// 스토리지에 담기
			return false;
		}

		var leftPx = 0;

		if (this.lot == "channel") {
			var ifr_height = new Array();
			ifr_height[1] = 36;
			ifr_height[2] = 52;
			ifr_height[3] = 72;
			ifr_height[4] = 84;
			ifr_height[5] = 100;

			leftPx = 615;
			if (document.body.clientWidth > 970) {
				leftPx = parseInt(leftPx + ( (parseInt(document.body.clientWidth, 10) - 970) / 2), 10);
			}
		} else {
			leftPx = 150;
			if (chInfoJson['currMenu'] != "PSEARCH") {
				if (document.body.clientWidth > 970) {
					leftPx = parseInt(leftPx + ( (parseInt(document.body.clientWidth, 10) - 970) / 2), 10) + this.w;
				}
			}
		}
		this.commentCnt = 0;
		$(this.currDivId).style.left = leftPx;

		var design = [], tmp = new Template(this.designNew.cBox);

		var viewCommList = "";
		for (var i=0; i<obj['commCnt']; i++) {
			if (chInfoJson['currMenu'] == "VIDEO") {
				viewCommList += "<li>" + obj['commList_'+i].truncate(26) +"</li>";
			} else {
				viewCommList += "<li>" + obj['commList_'+i].truncate(34) +"</li>";
			}
		}
		obj['viewCommList'] = viewCommList;

		design.push(tmp.evaluate(obj));
		$(this.currDivId).style.display = "inline";

		$(this.currDivId).update(design.join(''));
	}

	, moveCommentDiv : function (obj) {
		if (this.currDivId) {
			$(this.currDivId).style.top = Event.pointerY(obj) + 5;
		}
	}

	, hideCommentDiv : function () {
		this.divStatus = false;
		$(this.currDivId).style.display = "none";
	}

	, commentView : function () {
		try {
			var objStr = this.currDivId.replace("div_", "ifr_");
			var obj = $(objStr);
			obj.style.display = "inline";
			obj.height = obj.contentWindow.document.body.scrollHeight;
			obj.width = obj.contentWindow.document.body.scrollWidth;
		} catch (e) {
		}
	}
};

var cPrgCommentPrev = Class.create();
	cPrgCommentPrev._instance_ = null;
	cPrgCommentPrev.getInstance = function(tag){
			if(this._instance_==null) this._instance_ = new commentPrev();
			else {
					if(tag=='new') this._instance_ = new commentPrev();
				}
			return this._instance_;
	};
//**********************************************************************************************************//


//**********************************************************************************************************//
var gPopMemo = Class.create();
gPopMemo.prototype = {
	initialize : function(){
		this.click_userid = null;
		this.tooltipLang = {
			"gb" : {
				"tool_menu" : ["Go to Channel", "View Profile", "Send message", "Manage viewers"],
				"tool_menu2_field" :["Recipient", "Content", "Save to Sent Messages."],
				"tool_menu2_alert" : ["Cannot send messages to yourself.", "Cannot exceed 500 bytes.\r\nExcess bytes will automatically be deleted.", "Enter text.", "Message Sent", "Failed to send", "System Error", "로그인을 하셔야 쪽지를 보내실수 있습니다."],
				"tool_menu2_btnValue" : ["Close", "Send"]
			}, "ko" : {
				"tool_menu" : ["채널바로가기", "프로필보기", "쪽지보내기", "시청자관리"],
				"tool_menu2_field" :["받는사람", "내용", "보낸쪽지함에 저장"],
				"tool_menu2_alert" : ["본인에게는 쪽지를 보낼수 없습니다.", "최대 500 바이트까지 남기실 수 있습니다.\r\n초과된 바이트는 자동으로 삭제됩니다.", "내용을 입력해 주세요.", "쪽지 보내기 성공", "쪽지 보내기 실패", "시스템 장애발생", "로그인을 하셔야 쪽지를 보내실수 있습니다."],
				"tool_menu2_btnValue" : ["닫기", "보내기"]
			}, "en" : {
				"tool_menu" : ["Go to Channel", "View Profile", "Send message", "Manage viewers"],
				"tool_menu2_field" :["Recipient", "Content", "Save to Sent Messages."],
				"tool_menu2_alert" : ["Cannot send messages to yourself.", "Cannot exceed 500 bytes.\r\nExcess bytes will automatically be deleted.", "Enter text.", "Message Sent", "Failed to send", "System Error", "로그인을 하셔야 쪽지를 보내실수 있습니다."],
				"tool_menu2_btnValue" : ["Close", "Send"]
			}, "jp" : {
				"tool_menu" : ["チャンネルへ行く", "プロフィ?ルを見る", "メッセ?ジを送信", "視?者管理"],
				"tool_menu2_field" :["收件人", "?容", "保存到草稿箱"],
				"tool_menu2_alert" : ["本人にはメッセ?ジが送信できません。", "最大５００バイトまでメッセ?ジの作成ができます。\r\n超過されたバイトは自動的に削除されます。", "メッセ?ジを入力してください。", "送信?み", "送信失敗", "システムの通信エラ?", "로그인을 하셔야 쪽지를 보내실수 있습니다."],
				"tool_menu2_btnValue" : ["閉じる", "送信"]
			}, "cn" : {
				"tool_menu" : ["直接去?道", "收看?介", "?信息", "管理收看人"],
				"tool_menu2_field" :["受取人", "メッセ?ジ", "送信?みに保存"],
				"tool_menu2_alert" : ["不能?送到自己", "不能超?500bytes。\r\n如果超?，超?的?容自??除。", "??入?容", "?送成功", "?送失?", "系?障碍", "로그인을 하셔야 쪽지를 보내실수 있습니다."],
				"tool_menu2_btnValue" : ["??", "?送"]
			}
		}

		//send Memo
		this.popMemoHTML = new pandora.util.StringBuffer();

		this.popMemoHTML.append('<div style="padding:5px;">');
		this.popMemoHTML.append('<div style="float:right">(<span id="nbytes">0</span>/500byte)</div>');
		this.popMemoHTML.append('<strong>'+this.tooltipLang[chInfoJson['clientLang']]['tool_menu2_field'][0]+' : <span id="clickUSerId"></span> </strong>');
		this.popMemoHTML.append('</div>');
		this.popMemoHTML.append("<textarea name=\"textarea\" id=\"keyLength\" cols=\"\" rows=\"\" style=\"width:100%; height:40px\" onclick=\"javascript:setAutoPlay('click');\"></textarea>");
		this.popMemoHTML.append('<div><input name="checkbox" type="checkbox" id="saveOk"> '+this.tooltipLang[chInfoJson['clientLang']]['tool_menu2_field'][2]+'</div>');
		this.popMemoHTML.append('<div  style="padding:5px; text-align:center"><input id="btnSend" type="button" value="'+this.tooltipLang[chInfoJson['clientLang']]['tool_menu2_btnValue'][1]+'"> &nbsp; <input type="button" id="btnClosePopMemo" value=" '+this.tooltipLang[chInfoJson['clientLang']]['tool_menu2_btnValue'][0]+' "></div>');

		this.storage = cStorageMgr.getInstance();
		this.layerPop = cLayerPop.getInstance();

		this.login_userid = decodeURIComponent(oCookie.get('glb_mem[userid]'));
		this.login_usernick = decodeURIComponent(oCookie.get('glb_mem[nickname]'));

		this.oDomain = document.domain;
	},


	set : function(arg1){
	},

	gMemoOpen : function(evt,click_userid) {
		this.click_userid = click_userid;

		if(oCookie.get('glb_mem[userid]') == null || oCookie.get('glb_mem[userid]') == undefined || !oCookie.get('glb_mem[userid]') ) {
			alert(this.tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][6]);
			return;
		}

		if(decodeURIComponent(oCookie.get('glb_mem[userid]')) == this.click_userid)	{
			alert(this.tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][0]);
			return;
		}
		var _cy = 152;//Event.pointerY(evt);
		var _cy = 1;//Event.pointerY(evt);

//		this.layerPop.set(this.popMemoHTML, this.gPopMemoRemoveEventListener.bindAsEventListener(this), this, 1, this.tooltipLang[chInfoJson['clientLang']]['tool_menu'][2], 350, "", _cy, document.body.clientWidth/2+132);
		this.layerPop.set(this.popMemoHTML, this.gPopMemoRemoveEventListener.bindAsEventListener(this), this, 1, this.tooltipLang[chInfoJson['clientLang']]['tool_menu'][2], 350, "", _cy, 0);
		this.gPopMemoSetEventListener();
		$("clickUSerId").innerHTML = this.click_userid;
	},

	gPopMemoSetEventListener : function() {
		Event.observe('btnClosePopMemo', "click", this.eventPopMemo.bindAsEventListener(this));
		if(oCookie.get('glb_mem[userid]') != "pandoratv") Event.observe('keyLength', "keyup", this.checkMemoLength.bindAsEventListener(this));
		Event.observe('btnSend', "click", this.sendMemo.bindAsEventListener(this));
	},

	gPopMemoRemoveEventListener : function() {
		var evtPop = this.eventPopMemo.bindAsEventListener(this);
		Event.stopObserving('btnClosePopMemo', "click", evtPop);

		var evtPop1 = this.checkMemoLength.bindAsEventListener(this);
		if(oCookie.get('glb_mem[userid]') != "pandoratv") Event.stopObserving('keyLength', "keyup", evtPop1);

		var evtPop2 = this.sendMemo.bindAsEventListener(this);
		Event.stopObserving('btnSend', "click", evtPop2);
	},

	eventPopMemo : function() {
		this.layerPop.closePopup();
	},

	checkMemoLength : function()	{
		var bytes = 0;
		var message = $F('keyLength');
		var lenStr = 500;

		for (var i=0; i<message.length; i++) {
			var m = message.charAt(i);
			if (escape(m).length > 4) {
				bytes += 2;
			} else if (m != "\r") {
				bytes++;
			}
		}

		$('nbytes').innerHTML = bytes;
		if (bytes > lenStr) {
			alert(this.tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][1]);

			var inc = 0;
			bytes = 0;
			var msg = "";
			for (var i=0; i<message.length; i++) {
				m = message.charAt(i);
				if (escape(m).length > 4) {
					inc = 2;
				} else if (m != "\r") {
					inc = 1;
				}
				if ((bytes + inc) > lenStr) {
					break;
				}
				bytes += inc;
				msg += m;
			}
			$('nbytes').innerHTML = bytes;
			$('keyLength').value = msg;
		}
	},

	sendMemo : function ()	{
		if($F('keyLength').strip() == "")	{
			alert(this.tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][2]);
			$('keyLength').value = "";
			$('keyLength').focus();
			return;
		}

		var saveOk = ($('saveOk').checked==true)?'1':'0';
		this.sendJSON('0', this.click_userid, $F('keyLength'),saveOk);
	},

	sendJSON : function(option, memberStr, body, saveOk)	{
		var url = variable.getChild("pathChIsapi") + "GMemo.dll/Send";
		var obj = Object.toJSON({userid:this.login_userid, nickname:this.login_usernick, option:option, r_userid:memberStr, body: body, save_ok:saveOk});
		new Ajax.Request(url, {
			method : 'post',
			parameters : {'json':obj},
			onSuccess : function(res){
				this._json = res.responseText.evalJSON();
				this.sendAfter(this._json);
			}.bind(this),
			onException : function(res){
				throw new Error("Exception : ToolTip memo send json fail");
			}
		});
	},

	sendAfter : function(json)	{
		var resultSend = json.isSend;

		switch(resultSend)	{
			case "1" :
				if(this.pageInfo == "1")	{
					//remove send memo_list in storage
					for(var i = 1; i <= this._super._super.saveSendMemoPage; i ++)	{
						if(this._super.storage.isKey('sm_page_'+i)) this._super.storage.remove('sm_page_'+i);
					}
				} else if(this.pageInfo == "2")	{
					//remove memo_list in storage
					var totPage = Math.ceil(this._super.page._bbsTotal / this._super.page._bbsLimit);
					for(var i = 1; i <= totPage; i ++)	{
						if(this._super.storage.isKey('sm_page_'+i)) this._super.storage.remove('sm_page_'+i);
					}
				}

				alert(this.tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][3]);
				this.layerPop.closePopup();
			break;

			case "0" : alert(this.tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][4]); break;
			case "-1" : alert(this.tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][5]); break;
		}
	}

};

var gMemo = null;
function gMemoFunc (evt, click_userid) {
	if (!gMemo || gMemo == null) {
		gMemo = new gPopMemo();
	}
	gMemo.gMemoOpen(evt, click_userid);
};


//**********************************************************************************************************//
//	channel type layer
//**********************************************************************************************************//
var gChannelType = Class.create();
gChannelType.prototype = {
	chTypeLang : null,
	_height : 0,
	_mode : null,
	chType : null,
	isCh : false,

	initialize : function(){
		this.chTypeLang = {
			"gb" : {
				"info1" : "Video files of ",
				"info2" : " members constantly receive special attention from various media and the press.",
				"moreLink" : "Benefits and how to participate",
				"close" : "Close",
				"desc_info1" : "There are 8 different Specialized Channel in Pandora TV.  They are ",
				"desc_info2" : ".",
				"desc0" : "Members who are selected for ",
				"desc1" : ", will receive the following benefits.",
				"desc2" : "ㆍ",
				"desc3" : " Icon in My Channel and My Video List will be given. ",
				"desc4" : "ㆍ You can earn <a id=\"isCupi\">CUPI</a>  five times faster. ",
				"desc5" : "ㆍ You can continue enjoying these extra benefits <BR>&nbsp;&nbsp;&nbsp;&nbsp;by uploading 3 or more self produced video files.",
				"desc6" : "ㆍ Video files of",
				"desc7" : " members constantly receive special attention from various media and the press.<BR>&nbsp;&nbsp;&nbsp;&nbsp;It’s only a matter of time until you become famous through your own video file.",
				"desc8" : "Do you want to be a part of it? ",
				"desc9" : "Be active, be creative.  You will be contacted by a talent scout in no times~~ You could be the next person in a spotlight.",
				"isType1" : "What is ",
				"isType2" : "?"
			}, "ko" : {
				"info1" : "",
				"info2" : "회원들의 영상은 각 언론사, 방송사에서 주목하고 있습니다.",
				"moreLink" : "혜택 및 참여방법 보기",
				"close" : "Close",
				"desc_info1" : "판도라TV에는 ",
				"desc_info2" : " 의 성향이 있습니다.",
				"desc0" : "",
				"desc1" : "에 선발된 회원들께는 아래와 같은 혜택이 주어집니다.",
				"desc2" : "ㆍ 내 채널과 내 영상 리스트에 ",
				"desc3" : " 아이콘이 노출됩니다. ",
				"desc4" : "ㆍ <a id=\"isCupi\" title=\"클릭하시면, 새창에서 열립니다.\">큐피</a> 적립이 무려 5배 입니다. ",
				"desc5" : "ㆍ 한달 동안 직접 제작한 영상을 3개 이상 업로드 하시면, <BR>&nbsp;&nbsp;&nbsp;&nbsp;이 혜택을 계속 누리실 수 있습니다.",
				"desc6" : "ㆍ ",
				"desc7" : "회원들의 영상은 각 언론사, 방송사에서 주목하고 있습니다.<BR>&nbsp;&nbsp;&nbsp;&nbsp;동영상으로 유명해 지는 건 이제 시간문제 입니다. ",
				"desc8" : "참여하고 싶으세요?",
				"desc9" : "열심히 활동하여 운영자의 눈에 띄면, 바로 스카웃 제의가 들어갑니다~ 다음은 당신이 주인공 입니다!",
				"isType1" : "",
				"isType2" : "란?"
			}, "en" : {
				"info1" : "Video files of ",
				"info2" : " members constantly receive special attention from various media and the press.",
				"moreLink" : "Benefits and how to participate",
				"close" : "Close",
				"desc_info1" : "There are 8 different Specialized Channel in Pandora TV.  They are ",
				"desc_info2" : ".",
				"desc0" : "Members who are selected for ",
				"desc1" : ", will receive the following benefits.",
				"desc2" : "ㆍ",
				"desc3" : " Icon in My Channel and My Video List will be given. ",
				"desc4" : "ㆍ You can earn <a id=\"isCupi\">CUPI</a>  five times faster. ",
				"desc5" : "ㆍ You can continue enjoying these extra benefits <BR>&nbsp;&nbsp;&nbsp;&nbsp;by uploading 3 or more self produced video files.",
				"desc6" : "ㆍ Video files of",
				"desc7" : " members constantly receive special attention from various media and the press. <BR>&nbsp;&nbsp;&nbsp;&nbsp;It’s only a matter of time until you become famous through your own video file.",
				"desc8" : "Do you want to be a part of it? ",
				"desc9" : "Be active, be creative.  You will be contacted by a talent scout in no times~~ You could be the next person in a spotlight.",
				"isType1" : "What is ",
				"isType2" : "?"
			}, "jp" : {
				"info1" : "",
				"info2" : "?員?の映像は各マスコミやテレビ局が注目しています。 ",
				"moreLink" : "特典および?加方法を見る",
				"close" : "保存",
				"desc_info1" : "パンドラTVでは、",
				"desc_info2" : "という傾向があります。 ",
				"desc0" : "",
				"desc1" : "に選定された?員?には下記のような特典が?えられます。",
				"desc2" : "ㆍ イチャンネルと映像リストに",
				"desc3" : "アイコンがが表示されます。 ",
				"desc4" : "ㆍ<a id=\"isCupi\"> キュ?ピ</a>の積み立てがなんと５倍になります。 ",
				"desc5" : "ㆍ 一ヶ月の間、直接制作した映像を３個以上アップロ?ドすれば、<BR>&nbsp;&nbsp;&nbsp;&nbsp;この特典がずっと?きます。 ",
				"desc6" : "? ",
				"desc7" : "?員?の映像は各マスコミやテレビ局が注目しています。 <BR>&nbsp;&nbsp;&nbsp;&nbsp;動?で有名になるのはもはや時間の問題です。",
				"desc8" : "?加してみませんか。",
				"desc9" : "頑張っているところを運?者の目に留まれば、直ちにスカウトの申し出が?ます～。次はあなたが主人公です！",
				"isType1" : "",
				"isType2" : "とは？"
			}, "cn" : {
				"info1" : "",
				"info2" : "??的??得到各新?社和?播局的?目。因??而出名只是????。",
				"moreLink" : "?看?惠???方法",
				"close" : "保存",
				"desc_info1" : "潘多拉TV中有制作、",
				"desc_info2" : "等?向。",
				"desc0" : "",
				"desc1" : "中?出的??可以享受以下?惠。",
				"desc2" : "ㆍ 在我的?道和我的播放目?里表示",
				"desc3" : "??。",
				"desc4" : "ㆍ <a id=\"isCupi\"> CUPI</a> ?累可?到5倍。",
				"desc5" : "ㆍ 一?月?，上?3?以上直接制作的??，<BR>&nbsp;&nbsp;&nbsp;&nbsp;就可以??享受??惠。",
				"desc6" : "? ",
				"desc7" : "??的??得到各新?社和?播局的?目。<BR>&nbsp;&nbsp;&nbsp;&nbsp;因??而出名只是????。",
				"desc8" : "想???？",
				"desc9" : "???加而引起??者的注意?，?上就可得到?聘建?。接下?，?就可以成?主人公。",
				"isType1" : "",
				"isType2" : "?？"
			}
		}
		this.layerPop = cLayerPop.getInstance();
	},

	set : function(evt, ch_type) {
		this._mode = null;
		this.chType = (ch_type) ? ch_type : chInfoJson.ch_type ;
		this.isCh = (ch_type) ? false : true;
		this._height = 50;
		this._cx = Event.pointerX(evt);
		this._cy = Event.pointerY(evt);
		var types = '';
		for(var i=0, len=oCode.get("chInclination").length; i<len; i++) {
			if(i>0) types += ", ";
			types += oCode.get("chInclination")[i][1];
		}

		this.popChTypeHTML = new pandora.util.StringBuffer();
		this.popChTypeHTML.append('<div class="playlist" style="width:430px;">');
		this.popChTypeHTML.append('	<div style="padding:10px;">');
		this.popChTypeHTML.append('		<strong>'+oCode.getCodeName(oCode.get("chInclination"), this.chType, 2)+'</strong><br>');
		if(this.chType != '20010') this.popChTypeHTML.append(this.chTypeLang[chInfoJson['clientLang']]['info1']+'"'+oCode.getCodeName(oCode.get("chInclination"), this.chType)+'" '+this.chTypeLang[chInfoJson['clientLang']]['info2']);
		this.popChTypeHTML.append('	  <div style="margin-top:20px">');
		this.popChTypeHTML.append('			<div style=" float:right"><a id="chTypeClose">'+this.chTypeLang[chInfoJson['clientLang']]['close']+'<img src="'+variable.getChild("blankImg")+'" class="icon_close" ></a></div>');
		if(this.chType != '20010') this.popChTypeHTML.append('			<a id="chTypeLink">'+this.chTypeLang[chInfoJson['clientLang']]['moreLink']+'</a>');
		else this.popChTypeHTML.append('&nbsp;');
		this.popChTypeHTML.append('	  </div>');
		this.popChTypeHTML.append('	</div>');
		this.popChTypeHTML.append('</div>');

		this.popChTypeDescHTML = new pandora.util.StringBuffer();
		this.popChTypeDescHTML.append('<div class="playlist" style="width:430px;">');
		this.popChTypeDescHTML.append('  <div style="padding:10px;"> ');
		this.popChTypeDescHTML.append(	this.chTypeLang[chInfoJson['clientLang']]['desc_info1']+' <strong>'+types+'</strong>'+this.chTypeLang[chInfoJson['clientLang']]['desc_info2']);
		this.popChTypeDescHTML.append('	<P><strong>"'+oCode.getCodeName(oCode.get("chInclination"), this.chType)+'"'+this.chTypeLang[chInfoJson['clientLang']]['desc1']+'</strong></P>');
		this.popChTypeDescHTML.append('	<p>'+this.chTypeLang[chInfoJson['clientLang']]['desc2']+'"'+oCode.getCodeName(oCode.get("chInclination"), this.chType)+'"'+this.chTypeLang[chInfoJson['clientLang']]['desc3']);
		if(chInfoJson.clientLang == 'ko') {
			this.popChTypeDescHTML.append('<BR>'+this.chTypeLang[chInfoJson['clientLang']]['desc4']);
		}
		this.popChTypeDescHTML.append('<BR>'+this.chTypeLang[chInfoJson['clientLang']]['desc5']+'<BR>'+this.chTypeLang[chInfoJson['clientLang']]['desc6']+'"'+oCode.getCodeName(oCode.get("chInclination"), this.chType)+'" '+this.chTypeLang[chInfoJson['clientLang']]['desc7']+'</p>');
		this.popChTypeDescHTML.append('	<P><strong>'+this.chTypeLang[chInfoJson['clientLang']]['desc8']+'</strong><br>'+this.chTypeLang[chInfoJson['clientLang']]['desc9']+'</P>');
		this.popChTypeDescHTML.append('	<div style="margin-top:20px">');
		this.popChTypeDescHTML.append('		<div style=" float:right"> <a id="chTypeClose">'+this.chTypeLang[chInfoJson['clientLang']]['close']+'<img src="'+variable.getChild("blankImg")+'" class="icon_close" ></a></div>');
		this.popChTypeDescHTML.append('	  <a id="chTypeLink">'+this.chTypeLang[chInfoJson['clientLang']]['isType1']+' "'+oCode.getCodeName(oCode.get("chInclination"), this.chType)+'"'+this.chTypeLang[chInfoJson['clientLang']]['isType2']+'</a> </div>');
		this.popChTypeDescHTML.append('  </div>');
		this.popChTypeDescHTML.append('</div>');


		this.chTypeArr = new Array("chTypeClose", "chTypeLink", "isCupi");
		this.popChType();
	},

	popChType : function() {
		this._mode = (this._mode == 'info') ? 'desc' : 'info' ;
		var _HTML = (this._mode == 'info') ? this.popChTypeHTML : this.popChTypeDescHTML ;

		if(this._cx + 115 > document.body.clientWidth) this._lx = document.body.clientWidth - 115;
		else this._lx = this._cx;
		if(this._cy + parseInt(this._height)/2 > document.body.scrollHeight) this._ly = document.body.scrollHeight - parseInt(this._height) - 30;
		else this._ly = this._cy - this._height/2 - 30;

		this.layerPop.set(_HTML, this.gChtypeEventListener.bind(this,"remove"), this, 3, '', 440, '', this._ly, this._lx);
		this.gChtypeEventListener("set");
	},

	gChtypeEventListener : function(flag) {
		if(flag=="set") this._chTypeEvt = this.eventChtype.bindAsEventListener(this);
		for(var i=0; i<this.chTypeArr.length; i++) {
			if($(this.chTypeArr[i])) {
				if(flag=="set") Event.observe(this.chTypeArr[i], 'click', this._chTypeEvt);
				else if(flag=="remove") Event.stopObserving(this.chTypeArr[i], 'click', this._chTypeEvt);
			}
		}
	},

	eventChtype : function(evt) {
		this.layerPop.closePopup();

		var el = Event.element(evt);
		switch(el.id) {
			case 'chTypeLink' :
				if(this.isCh) {	// 채널일때는 새창
					window.open(variable.getChild("infoHost")+'?m=faq_view&b_code=F03&s_code=02&faq_id=47&faq_index=3', '_blank');
				} else {
					this.popChType();
				}
			break;
			case 'isCupi' :
				window.open(variable.getChild('cupiHost')+'new_usehow.php', '_blank');
			break;
		}
	}
};

var gChType = null;
function gChTypeFunc (evt, ch_typ) {
	if (!gChType || gChType == null) {
		gChType = new gChannelType();
	}
	gChType.set(evt, ch_typ);
}
//**********************************************************************************************************//

//**********************************************************************************************************//
function imgError(oImg, imgSrc) {
	/*
	채널 img :: http://imgcdn.pandora.tv/static/ch_thumb.gif
	프로그램 img :: http://imgcdn.pandora.tv/static/prg_thumb.gif
	*/

	oImg.style.display = "none";
	// 채널 이미지중... _s 가 없을 경우 이 함수를 태워서 큰 썸네일로 교체해 준다.
	if (oImg.src.indexOf("logo_s.gif") > -1 ) {
		imgSrc = oImg.src.replace("logo_s.gif", "logo.gif");
	}
	var EN = oImg.getAttribute("errNo");
	if (EN == null || !EN) {
		oImg.setAttribute("errNo", 0);
	}

	if (!imgSrc) {
		oImg.onerror = function () {};
		return false;
	}

	oImg.src = imgSrc;

	if(oImg.errNo > 1) {
		oImg.onerror = function () {};
		return false;
	}

	oImg.style.display = "inline";
	oImg.errNo++; // = oImg.errNo + 1;
}
//**********************************************************************************************************//


// time to seconde : 00:00:00 --> 0
function getTime2Sec(argTime) {
	var sec = 0;
	var tmp = argTime.split(":");
	var len = tmp.length - 1;
	for(var i=len;i>=0;i--) {
		switch(len-i) {
			case 0 : sec = parseInt(tmp[i], 10);
				break;
			case 1 : sec += parseInt(tmp[i], 10) * 60;
				break;
			case 2 : sec += parseInt(tmp[i], 10) * (60 * 60);
				break;
		}
	}
	return sec;
}


// 2008-03-14 auto link
function autoLink(str) {
	if(str.length > 0) {
		var regURL = new RegExp("(http|https|ftp|telnet|news|irc)://([-/.a-zA-Z0-9_~#%$?&=:200-377()]+)","gi");
		var regEmail = new RegExp("([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+\.[a-z0-9-]+)","gi");
//		str = str.replace(regURL,"<a href='$1://$2' target='_blank'>$1://$2</a>").replace(regEmail,"<a href='mailto:$1'>$1</a>");	// 2008-04-18 edina.kim. mailto뺌
		str = str.replace(regURL,"<a href='$1://$2' target='_blank'>$1://$2</a>");
	}

	return str;
}


// dynamic loader add by rhio.kim 2008.03.18
function loadJS(path, charset1) {
	if (charset1 == undefined) {
		charset1 = "utf-8";
	}
	var oScript = document.createElement("SCRIPT");
		with(oScript) {
			setAttribute("type", "text/javascript");
			setAttribute("language", "javascript");
			setAttribute("charset", charset1);
			setAttribute("src", path);
		}
		document.getElementsByTagName('head')[0].appendChild(oScript);
}

function goPhone(ch_userid, prg_id, lot) {
	var msg2 = {'ko':'차단된 팝업창을 허용해 주세요.', 'en':'Allow pop-ups', 'jp':'遮?されたポップアップウィンドウを許可してください。', 'cn':'?允?被?截的?出?口', 'gb':'Allow pop-ups'};
	if (!lot || lot == undefined) {
		lot = "channel";
	}
	var newWin = window.open( variable.getChild('mobileHost') + "w2p/callback_send_form.ptv?userid=" + ch_userid + "&prg_id="+prg_id+"&from_code=" + lot, "phone", "width=250, height=400");

	if (newWin == null) {
		alert(msg2[chInfoJson['clientLang']]);
	} else {
		newWin.focus();
	}
}

function goGift(ch_no) {
	var msg2 = {'ko':'차단된 팝업창을 허용해 주세요.', 'en':'Allow pop-ups', 'jp':'遮?されたポップアップウィンドウを許可してください。', 'cn':'?允?被?截的?出?口', 'gb':'Allow pop-ups'};
	if (!ch_no) {
		alert('parameter error');
		return false;
	}
	var newWin = window.open( variable.getChild('mobileHost') + "8800/gift/gift_info_popup.ptv?ch_no=" + ch_no, "gift", "width=250, height=400");

	if (newWin == null) {
		alert(msg2[chInfoJson['clientLang']]);
	} else {
		newWin.focus();
	}
}

function go_live(userid) {
	document.location.href = variable.getChild('liveHost') + "viewer.ptv?redirect=live&ch_userid="+userid;
}

function mini_live(str) {
	$('objMini').innerHTML = '<OBJECT id="PandoraMini" classid="clsid:A5FF02F7-B98E-428A-9B23-2B7B7DD2FFFD" width="0" height="0" align="center" hspace="0" vspace="0"></OBJECT>';
	var objID = 'PandoraMini';
	try {
		if (typeof(document.all(objID))!="undefined" && document.all(objID).object!=null) {
			PandoraMini.InputMini('livemini', 'livemini', str, 'Null');
			return;
		} else {
			if (confirm("라이브 프로그램이 설치 되지 않았습니다. \n지금 다운로드 페이지로 이동하시겠습니까?")) {
				document.location.href = variable.getChild('downloadHost');
			}
			return;
		}
	} catch(E) {}
}

function miniobjchk(objID) {
	$("objMini").innerHTML = '<OBJECT id="PandoraMini" classid="clsid:A5FF02F7-B98E-428A-9B23-2B7B7DD2FFFD" width="0" height="0" align="center" hspace="0" vspace="0"></OBJECT>';
	try {
		if (typeof(document.all(objID))!="undefined" && document.all(objID).object!=null) {
			PandoraMini.InputMini('livemini', 'livemini', 'null', 'Cast');
			return;
		} else {
			go_mini_down();
			return;
		}
	} catch(E) {}
}

function PopUpLinker(sitecode, memid) {
	winOpenCenter(variable.getChild('liveHost') + "VimLiveP2P/linkedlive.asp?sitecode="+sitecode+"&djid="+memid, "liveShare", 440, 300, "no");
}

function winOpenCenter(url, n, w, h, s) {
	var msg2 = {'ko':'차단된 팝업창을 허용해 주세요.', 'en':'Allow pop-ups', 'jp':'遮?されたポップアップウィンドウを許可してください。', 'cn':'?允?被?截的?出?口', 'gb':'Allow pop-ups'};
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+s+',resizable';
	var win = window.open(url, n, winprops);
	if (win == null) {
		alert(msg2[chInfoJson['clientLang']]);
	} else {
		if (parseInt(navigator.appVersion) >= 4) {
			win.focus();
		}
	}
}

function inputMini(prg_id, title, runtime, ch_userid, status){
	if (!prg_id || !title || !runtime || !ch_userid) {
		alert('parameter error \ninputMini(prg_id, title, runtime, ch_userid)');
		return;
	}

	var noInputMini = {'ko':'스크랩된 영상은 미니에 담을수 없습니다.', 'en':'스크랩된 영상은 미니에 담을수 없습니다.', 'jp':'스크랩된 영상은 미니에 담을수 없습니다.', 'cn':'스크랩된 영상은 미니에 담을수 없습니다.', 'gb':'스크랩된 영상은 미니에 담을수 없습니다.'};
	var msg1 = {'ko':'미니를 설치하셔야 미니담기가 가능합니다 \n\n 미니 설치페이지로 이동합니다.', 'en':'미니를 설치하셔야 미니담기가 가능합니다 \n\n 미니 설치페이지로 이동합니다.', 'jp':'미니를 설치하셔야 미니담기가 가능합니다 \n\n 미니 설치페이지로 이동합니다.', 'cn':'미니를 설치하셔야 미니담기가 가능합니다 \n\n 미니 설치페이지로 이동합니다.', 'gb':'미니를 설치하셔야 미니담기가 가능합니다 \n\n 미니 설치페이지로 이동합니다.'};
	var msg2 = {'ko':'차단된 팝업창을 허용해 주세요.', 'en':'Allow pop-ups', 'jp':'遮?されたポップアップウィンドウを許可してください。', 'cn':'?允?被?截的?出?口', 'gb':'Allow pop-ups'};

	if (status == "30010") {
		alert(noInputMini[chInfoJson['clientLang']]);
		return;
	}
	try{
		if (Prototype.Browser.IE) {
			var mmini = new ActiveXObject("PandoraTVMiniAX.PandoraTVMini");
			toMini(prg_id,title,runtime,ch_userid,mmini);
		} else if(Prototype.Browser.Gecko) {
			if(!$('embed1')) {
				var miniPluginObj = '<embed id="embed1" type="application/pandora.tv-miniexecute-plugin" width=0 height=0></embed>';
				var divMiniPlugin = document.createElement("DIV");
				document.body.appendChild(divMiniPlugin);
				divMiniPlugin.innerHTML = miniPluginObj;
			}
			setTimeout(function(){
				var _isPlugin = false;
				for (plugin = 0; plugin < navigator.plugins.length; plugin++) {
					if (navigator.plugins[plugin].name == 'mini execute plugin') {
						_isPlugin = true;
					}
				}
				if(!_isPlugin) {
					alert(msg1[chInfoJson['clientLang']]);
				} else {
					if((navigator.appName == 'Netscape')||(navigator.appName == 'Opera')) {
						mimetype = navigator.mimeTypes["application/pandora.tv-miniexecute-plugin"];
						if (mimetype) {
							var mmini = panvastater;
						} else {
						  alert(msg1[chInfoJson['clientLang']]+'-not install');
						}
					  } else {
						document.write('파이어 폭스에서만 정상작동합니다.');
					  }
					  toMini(prg_id,title,runtime,ch_userid,mmini);
				}}.bind(this), 500);
		}
	} catch(e) {
		alert(msg1[chInfoJson['clientLang']]);
		windowName = open(variable.getChild('downloadHost'),"","");
		if(windowName==null)   {
			alert(msg2[chInfoJson['clientLang']]);
		}
	}
}

function toMini(prg_id,title,runtime,ch_userid,mmini) {
	mmini.InputMini(prg_id,title,runtime,ch_userid);
}


function vodLink (type, ch_userid, prgid, size, fid){
	/*
		type :: 1 => Embed object, 2 : vod Link
		ch_userid :: channel user ID
		prgid :: vod programe uniq ID
		size :: {w:width, h:height}
		url :: fid [ programe uniq ID 암호화
	*/
	var ret = null;
	var flashHtml = "";
	if (!type || !ch_userid || !prgid) {
		return "need to param";
	}

	if (!size) {
		size = {w:448, h:385};
	}
	var fUrl = variable.getChild('embedPlayer') + '/userid='+ ch_userid + '&prgid=' + prgid + '&lang=' + chInfoJson['clientLang'] + '&url=' + fid;
	switch(type){
		case '1' :
			flashHtml += '<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="'+size['w']+'" height="'+size['h']+'" id="movie" align="middle">';
			flashHtml += '<param name="quality" value="high" />';
			flashHtml += '<param name="movie" value="' + fUrl + '"></param>';
			flashHtml += '<param name="wmode" value="window"></param>';
			flashHtml += '<param name="allowFullScreen" value="true" />';
			flashHtml += '<param name="allowScriptAccess" value="always" />';
			flashHtml += '<embed';
			flashHtml += ' src="' + fUrl + '"';
			flashHtml += ' type="application/x-shockwave-flash" ';
			flashHtml += ' wmode="window" ';
			flashHtml += ' allowScriptAccess="always"';
			flashHtml += ' allowFullScreen="true"';
			flashHtml += ' pluginspage="http://www.macromedia.com/go/getflashplayer"';
			flashHtml += ' width="'+size['w']+'"';
			flashHtml += ' height="'+size['h']+'"></embed>';
			flashHtml += '</object>';
		break;

		// 오현섭 수정 2008-06-24
		case '2' :
			flashHtml = variable.getChild('mainHost')+"my."+ ch_userid+"/"+prgid;
		break;
	}
	return flashHtml;
}

function adverView(iName, size) {
	var objIfr = document.getElementById(iName);
	objIfr.style.display = "inline";
	try {
		objIfr.height = objIfr.contentWindow.document.body.scrollHeight;
		objIfr.width = objIfr.contentWindow.document.body.scrollWidth;
	} catch (e) {
		try {
			objIfr.height = size["h"];
			objIfr.width = size["w"];
		} catch (e) {}
	}
}



function getStreamDtcImg() {
	var result = "http://";
	var localHost = "127.0.0.1";
	var localPort = "56830";
	var img = "/blank.gif";

	var tmpTime = new Date();
	var dummy = tmpTime.getYear() + "" + tmpTime.getMonth() + tmpTime.getDate() + tmpTime.getHours() + tmpTime.getMinutes() + tmpTime.getSeconds();

	var tmp = localHost.split(".");
	for(var i=1;i<tmp.length;i++) {
		var zeroCnt = Math.floor(Math.random() * 20);
		var zero = "";
		if(zeroCnt < 6) zeroCnt = 6;
		for(var j=0;j<zeroCnt;j++) {
			zero += "0";
		}
		tmp[i] = zero + tmp[i];
	}
	result += tmp.join(".");
	result += (localPort == "80") ? "" : ":" + localPort;
	result += img + "?" + dummy;

	return result;
}


function getRandom(arg) {
	switch(arg) {
		case undefined : return Math.floor(Math.random() * 1000);
		default :
			switch(typeof(arg)) {
				case "number" : return Math.floor(Math.random() * arg);
				default :
					if(isNaN(arg) == false) {
						return Math.floor(Math.random() * parseInt(arg, 10));
					} else {
						return false;
					}
			}
	}
}

/* add by rhio.kim 2008.03.28
 * @param	{Array}	array
 * @return	Randomized Array
 */
function getRandomArr(arr){
	var i = arr.length;
	if (i <= 1) return arr;

	while (--i) {
		var j = Math.floor(Math.random() * (i + 1));

		var ti = arr[i];
		var tj = arr[j];
		arr[i] = tj;
		arr[j] = ti;
	}

	return arr;
}


/* add by rhio.kim 2008.03.27
 * 브라우저 타이틀 동적으로 부여
 */
function bwTitle(msg) {
	var tt = document.getElementsByTagName('title')[0];
		tt.text = msg + ' :: PandoraTV';
}

// html
Object.extend(pandora.util.Html.prototype, pandora.util.storage.prototype);

var cHtmlMgr = Class.create();
	cHtmlMgr._instance_ = null;
	cHtmlMgr.getInstance = function(){
			if(this._instance_==null) this._instance_ = new pandora.util.Html();
			return this._instance_;
	};

var html = cHtmlMgr.getInstance();

// history
pandora.util.history.Base.prototype = {
	locator : null,
	flag : false,
	currentKey : "",
	options : null,
	callback : null,
	timer : null,
	interval: null,

	initialize : function(options){
		this.interval = 200;
		this.options = Object.extend(options||{});
		this.callback = this.options.callback || Prototype.emtpyfunction;

		if(Prototype.Browser.IE) this.locator = new pandora.util.history.IE('HistoryIFrame', 'blank.html');
		else this.locator = new pandora.util.history.ETC();
		this.currentKey = "";
	},

	add : function(key){
		this.flag = true;
		clearTimeout(this.timer);
		this.locator.save(key);
		this.currentKey = this.locator.load();
		this.timer = setTimeout(this.check.bind(this), this.interval);
		this.flag = false;
	},

	get : function(){
		return this.locator.load();
	},

	check: function(){
		if(!this.flag){
			var load = this.locator.load();
			if(load!=this.currentKey){
				if(this.currentKey!="") {
					if(this.currentKey!=undefined) {
//						this.callback(load);
					}
				}
				this.currentKey = load;
			}
		}
		this.timer = setTimeout(this.check.bind(this), this.interval);
	}
};

pandora.util.history.IE.prototype = {
	id : null,
	src : null,
	url : null,

	initialize : function(id, src){
		this.id = id || 'HHdle';
		this.src = src || '';
		this.url = '';
		//document.write('<iframe src="'+this.src+'" id="'+this.id+'" name="'+this.id+'" style="display: none;"></iframe>');
		document.write('<iframe id="'+this.id+'" name="'+this.id+'" style="display: none;"></iframe>');
	},

	save: function(key){
		var target = $(this.id);
		if (target) {
			target.setAttribute('src', this.src + '?' + key);
			window.location.href = this.url + '#' + key;
		}
	},

	load: function(){
		try {
			return (document.frames[this.id].location.href || '?').split('?')[1];
		}catch(e){
			return '';
		}
	},

	load2 : function(){
		try {
			return window.location.hash.substring(1) || '';
		}catch(e){
			return '';
		}
	}
};

pandora.util.history.ETC.prototype = {
	initialize : function(){
	},

	save : function(key){
		window.location.hash = key;
	},

	load : function(){
		return window.location.hash.substring(1) || '';
	}
};

var cHistoryMgr = Class.create();
	cHistoryMgr._instance_ = null;
	cHistoryMgr.getInstance = function(options){
			if(this._instance_==null) this._instance_ = new pandora.util.history.Base(options);
			return this._instance_;
	};


// cookie
pandora.util.cookie.prototype = {
	initialize : function(){
	},

	// set cookie value
	set : function (sName, sValue, expireSeconds) {
		var sDomain = ".pandora.tv";
		var todayDate = new Date();
		var ExpireTime = new Date(todayDate.getTime()+expireSeconds*1000);
		document.cookie = sName + "=" + sValue + ";" + ((expireSeconds) ? "expires=" + ExpireTime.toGMTString() + ";" : "") + "domain=" + sDomain + ";path=/;";
	},

	// get cookie value
	get : function (sName) {
		var aCookie = document.cookie.split("; ");
		for (var i=0; i < aCookie.length; i++) {
			var aCrumb = aCookie[i].split("=");
			if (sName == aCrumb[0]) {
				return aCrumb[1];
			}
		}
		return null;
	},

	// delete cookie
	destroy : function (sName) {
		this.set(sName, "", 0);
	},

	// update cookie
	update : function (expireSeconds) {
		var CookieList = document.cookie.split("; ");
		for(var i=0;i<CookieList.length;i++) {
			var Cookies = CookieList[i].split("=");
			if(Cookies[0] == "SavedID") {
				continue;
			}
			this.set(Cookies[0], Cookies[1], expireSeconds);
		}
	}
};

var oCookie = new pandora.util.cookie();

/********************************************************************************
 * @projectDescription Macromedia Flash player - TSharedObject
 *
 * @author riho.kim@pandora.tv, tizie80@nate.com
 * @messanger (msn)kim2000version@hotmail.com, (nate)tizie80@nate.com
 * @site blog.ecmas4.com
 * @version 0.0.1
 * @usage var TClass = ;
 *
 * @sdoc
 * @namespace TSharedObject
 * @import %designHost%/so/sharedObj.swf
 ***********************************************************************************/
var TSharedObject = Class.create();
	TSharedObject.prototype = {
		/* interface */
		_globalStore : null,

		/* flash version */
		_version : null,

		/* public */
		isLoaded : false,

		/* private */
		isIE : !!(window.attachEvent && !window.opera),

		initialize : function() {},

		/* private
		 * swf onLoade callback
		 */
		_isLoaded : function(v) {
			this.isLoaded = true;
			this._version = v;
		},

		/* private */
		_create : function() {
			document.domain = "pandora.tv";
			var tag = [];
			var codeBase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0';//9,0,115,0';
			var classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';

			switch(this.isIE) {
				case true :
						tag.push('<div style="position:absolute;top:-100px">');
						tag.push('<object id="globalStorage__" codebase="'+ codeBase +'" width="0" height="0" align="middle" classid="'+classid+'" >');
						tag.push('<param name="movie" value="'+ variable['designHost'] +'so/_shared.swf" />');
//						tag.push('<param name="movie" value="http://imgcdn.pandora.tv/ptv_img/shared2.swf" />');
						tag.push('<param name="quality" value="high" />');
						tag.push('<param name="play" value="true" />');
						tag.push('<param name="loop" value="true" />');
						tag.push('<param name="scale" value="showall" />');
						tag.push('<param name="wmode" value="window" />');
						tag.push('<param name="devicefont" value="false" />');
						tag.push('<param name="bgcolor" value="#000000" />');
						tag.push('<param name="menu" value="true" />');
						tag.push('<param name="allowFullScreen" value="true" />');
						tag.push('<param name="allowScriptAccess" value="always" />');
						tag.push('<param name="salign" value="" />');
						tag.push('</object>');
						tag.push('<div>');
				break;
				default:
						tag.push('<div style="position:absolute;top:-100px">');
						tag.push('<embed id="globalStorage__" name="globalStorage__" width="0" height="0" src="'+ variable['designHost'] +'so/_shared.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" play="true" loop="true" scale="showall" wmode="window" devicefont="false" bgcolor="#000000" menu="true" allowFullScreen="true" allowScriptAccess="always" salign="" type="application/x-shockwave-flash" > </embed>');
						tag.push('<div>');
				break;
			}

			new Insertion.Bottom(document.body, tag.join(''));
		},

		/* public */
		setup: function(){
			/* exist Shared Object Movie */
			if(this._globalStore != null) return true;

			this._create();

			this._globalStore = (this.isIE) ? window['globalStorage__'] : document['globalStorage__'];
		},

		/** public
		 * SharedObject.data[key] = value; use in Action script
		 * @param {String} key
		 * @param {String} value
		 * @param {String} so	Shared-Object filename
		 */
		setItem : function(key, value, so) {
			var value = encodeURIComponent(value);
			return this._globalStore.setItem(key, value, so);
		},

		/** public
		 *
		 * @param {String} key
		 * @param {String} so	Shared-Object filename
		 */
		getItem : function(key, so) {
			return decodeURIComponent(this._globalStore.getItem(key, so));
		},

		/** public
		 *
		 * @param {String} key
		 * @param {String} so	Shared-Object filename
		 */
		removeItem : function(key, so) {
			return this._globalStore.removeItem(key, so);
		}
	};

	/* singleton pattern */
	TSharedObject.__instance__ = null;
	TSharedObject.getInstance = function () {
		return (this.__instance__ == null)
			? this.__instance__ = new TSharedObject()
			: this.__instance__;
	};

	var SharedObject = TSharedObject.getInstance();

// layerpop
/** implementation Class */
pandora.util.layerpop.prototype  = {
	_dragMode : false,
	_skinLayerId : null,
	_layerId : null,
	_topLayerId : null,

	_oHtml : null,
	_removeEventFuncName : null,
	_layerTitle : null,
	_layerOption : null,
	_layerWidth : null,
	_layerHeight : null,
	_layerTop : null,
	_layerLeft : null,
	_bodyWidth : null,
	_bodyHeight : null,

	_evtClosePop : null,
	_evtBgClose : null,
	_evtChangeMode1 : null,
	_evtSetLayerPosition : null,
	_evtChangeMode2 : null,
	_evtNotDrag : null,
	_evtResizeWindow : null,
	_evtBodyClick : null,

	_lx : 0,
	_ly : 0,
	_prevX : 0,
	_prevY : 0,

	_endRight : null,
	_endBottom : null,

	_rnd : 0,
	initialize : function() {},

	//option => "1" : 레이어 바깥 클릭시 답힘, "2" : 레이어 안쪽 닫힘 버튼 클릭시만 닫힘, "3" : 움직이지 않는 레이어(레이어 바깥 클릭시 닫힘)

	set : function(oHtml, removeEventFuncName, obj, option, title, layerWidth, layerHeight, layerTop, layerLeft, skinlayerid) {
		this._super = obj;
		this._removeEventFuncName = removeEventFuncName;
		this._oHtml = oHtml.toString();
		this._layerTitle = title;
		this._layerOption = option.toString();
		this._layerWidth = layerWidth;
		this._layerHeight = layerHeight;
		this._layerTop = layerTop;
		this._layerLeft = layerLeft;

		var rnd = "";
		try {
			var now=new Date();
			var timestamp=(now.getTime()/1000).toFixed();
			if ($('layerPopup')) rnd = timestamp;
		}
		catch (e) {
		}

		this._skinLayerId		= (rnd) ? 'layerPopup' + rnd : 'layerPopup';
		this._topLayerId		= (rnd) ? "topLayer" + rnd : "topLayer";
		this._layerId			= (rnd) ? "oPop" + rnd : "oPop";
		this._targetID			= (rnd) ? "content_id" + rnd : "content_id";
		this._topHiddenLayerId	= (rnd) ? "topHiddenLayer" + rnd : "topHiddenLayer";
		this._btnClose			= (rnd) ? "btnClose" + rnd : "btnClose";
		this._handle			= (rnd) ? "handle" + rnd : "handle";
		this._popTitle			= (rnd) ? "popTitle" + rnd : "popTitle";
		this._OperaBlur			= (rnd) ? "OperaBlur" + rnd : "OperaBlur";

		if($(this._layerId)) this.closePopup();
		this.setBackLayer();

		this._bodyWidth = document.body.clientWidth;
		if(document.body.clientHeight >= document.body.scrollHeight)	{
			this._bodyHeight = document.body.clientHeight;
		} else {
			this._bodyHeight = document.body.scrollHeight;
		}
		this.setPosition();
		this.showLayout();
	},

	setBackLayer : function()	{
		new Insertion.Bottom(document.body,'<div id="'+this._skinLayerId+'"></div>');

		var oStringBuffer = new pandora.util.StringBuffer();

		switch(this._layerOption)	{
			case "1" :
				/*
				this._topLayerId = 'topLayer';
				this._layerId = 'oPop';
				this._targetID = 'content_id';
				*/

				oStringBuffer.append('<div id="'+this._topLayerId+'" style="position:absolute;z-index:998;"></div>');
				oStringBuffer.append('<div id="'+this._layerId+'" style="display:none;position:absolute;z-index:999;left:0px;top:0px;">');
				oStringBuffer.append('<div  class="playlist">');
				oStringBuffer.append('	<div class="playlist_title" id="'+this._handle+'" style="height:20px;cursor:pointer">');
				oStringBuffer.append('		<div class="layer_close"><a id="'+this._btnClose+'"><span class="icon_close"></span></a></div>');
				oStringBuffer.append('		<div id="'+this._popTitle+'">'+this._layerTitle+'</div>');
				oStringBuffer.append('	</div>');
				oStringBuffer.append('	<div id="'+this._targetID+'" style="padding:5px 10px;background-color:#ffffff"></div>');
				oStringBuffer.append('</div>');
				if(Prototype.Browser.Opera) oStringBuffer.append('<div id="'+this._OperaBlur+'" style="position:absolute;visibility:hidden;width:0px;height:0px;"><form><input type="text" style="width:0px;height:0px;"></form></div></div>');
				break;
			case "2" :
				/*
				this._topLayerId = 'topLayer';
				this._layerId = 'oPop';
				this._targetID = 'content_id';
				this._topHiddenLayerId = 'topHiddenLayer';
				*/

				oStringBuffer.append('<div id="'+this._topLayerId+'" style="position:absolute;z-index:998;"></div>');
				oStringBuffer.append('<div id="'+this._topHiddenLayerId+'" style="position:absolute;z-index:997;"></div>');
				oStringBuffer.append('<div id="'+this._layerId+'" class="playlist" style="display:none;position:absolute;z-index:999;left:0px;top:0px;">');
				oStringBuffer.append('	<div class="playlist_title" id="'+this._handle+'" style="height:20px;cursor:pointer">');
				oStringBuffer.append('		<div class="layer_close"><a style="cursor:pointer"><img src="'+variable.getChild('defaultImg')+'/icon_close.gif" border="0" id="'+this._btnClose+'"></a></div>');
				oStringBuffer.append('		<div id="'+this._popTitle+'">'+this._layerTitle+'</div>');
				oStringBuffer.append('	</div>');
				oStringBuffer.append('	<div id="'+this._targetID+'" style="padding:5px 10px;background-color:#ffffff"></div>');
				oStringBuffer.append('</div>');
				if(Prototype.Browser.Opera) oStringBuffer.append('<div id="'+this._OperaBlur+'" style="position:absolute;visibility:hidden;width:0px;height:0px;"><form><input type="text" style="width:0px;height:0px;"></form></div>');
				break;
			case "3" :
				/*
				this._layerId = 'oPop';
				this._targetID = 'content_id';
				*/

				oStringBuffer.append('<div id="'+this._layerId+'" style="display:none;position:absolute;z-index:999;left:0px;top:0px;">');
				oStringBuffer.append('	<div id="'+this._targetID+'"></div>');
				oStringBuffer.append('</div>');
				break;
			case "4" :
				/*
				this._layerId = 'oPop';
				this._targetID = 'content_id';
				*/

				oStringBuffer.append('<div id="'+this._topLayerId+'" style="position:absolute;z-index:998;"></div>');
				oStringBuffer.append('<div id="'+this._layerId+'" style="display:none;position:absolute;z-index:999;left:0px;top:0px;">');
				oStringBuffer.append('<div  class="playlist" style="width:100%">');
				oStringBuffer.append('	<div class="playlist_title" id="'+this._handle+'" style="height:20px;cursor:pointer">');
				oStringBuffer.append('		<span class="icon_close" style="float:right" id="'+this._btnClose+'"></span>');
				oStringBuffer.append('		<div id="'+this._popTitle+'">'+this._layerTitle+'</div>');
				oStringBuffer.append('	</div>');
				oStringBuffer.append('	<div id="'+this._targetID+'" style="padding:5px 10px;background-color:#ffffff"></div>');
				oStringBuffer.append('</div>');
				oStringBuffer.append('</div>');
				break;
			case "5" : // 타이틀 없는 움직이지 않는 레이어 창
				oStringBuffer.append('<div id="'+this._topLayerId+'" style="position:absolute;z-index:998;"></div>');
				oStringBuffer.append('<div id="'+this._layerId+'" style="display:none;position:absolute;z-index:999;left:0px;top:0px;">');
				oStringBuffer.append('	<div  class="playlist">');
				oStringBuffer.append('		<div id="'+this._targetID+'"></div>');
				oStringBuffer.append('	</div>');
				oStringBuffer.append('</div>');
				break;
		}

		$(this._skinLayerId).innerHTML = oStringBuffer;
		oStringBuffer = null;
	},

	setPosition : function ()	{
		$(this._layerId).style.width = this._layerWidth + "px";
		$(this._layerId).style.height = this._layerHeight;
		this._endRight = this._bodyWidth - parseInt($(this._layerId).style.width, 10);
		this._endBottom = this._bodyHeight - parseInt($(this._layerId).style.height, 10);

		if(this._layerTop != null && this._layerTop != "")	{
			var posInitTop = this._layerTop;
		} else {
			var posInitTop = Math.floor((this._bodyHeight - parseInt($(this._layerId).style.height, 10)) / 2);
		}
		if(this._layerLeft != null && this._layerLeft != "")	{
			var posInitLeft = this._layerLeft;
		} else {
			var posInitLeft = Math.floor((this._bodyWidth - parseInt($(this._layerId).style.width, 10)) / 2);
		}
		with($(this._layerId).style) {
			position = "absolute";
			left = posInitLeft + "px";
			top = posInitTop + "px";
		}

		this._lx = $(this._layerId).style.left.replace(/px*$/,"");
		this._ly = $(this._layerId).style.top.replace(/px*$/,"");
	},

	showLayout : function()	{
		this._rnd++;
		$(this._layerId).show();
		this.setTopLayer();
		this.setUI(this._oHtml);
		this._oHtml = null;

		try {
			this.setEventListener();
		}
		catch (e) {
		}

	},

	closePopup : function()	{
		try {
			this.removeEventListener();
		}
		catch (e) {
		}

		try {
			this._removeEventFuncName();
		}
		catch (e) {
		}

		try {
			$(this._skinLayerId).remove();
		}
		catch (e) {
			try{console.log('remove fail');}catch(e){}
		}

	},

	setTopLayer : function()	{
		if(this._layerOption != '3' && this._layerOption != '4' && this._layerOption != '5')	{
			$(this._topLayerId).setStyle({
				'left' : '0px',
				'top' : '0px',
				'width' : (document.body.clientWidth + "px")
			});
		}

		if(this._layerOption == '2')	{
			var  transparent = '0.01';

			$(this._topHiddenLayerId).setStyle({
				'left' : '0px',
				'top' : '0px',
				'width' : (this._bodyWidth + "px"),
				'height' : (this._bodyHeight + "px"),
				'background' : '#000',
				'opacity' : transparent
			});
		}
	},

	topLayerOpen : function()	{
		var height = this._bodyHeight;

		$(this._topLayerId).style.height = height + 'px';
		$(this._topLayerId).style.display = 'block';
	},

	setLayerPosition : function (event) {
		if(this._dragMode)	{
			var x = Event.pointerX(event);
			var y = Event.pointerY(event);

			if(this._prevX!=0 && this._prevY!=0){
				this._lx = this._lx-(this._prevX-x);
				this._ly = this._ly-(this._prevY-y);

				if(this._lx <= 0 ) this._lx = 1;
				if(this._lx > this._endRight) this._lx = this._endRight;
				if(this._ly <= 0 ) this._ly = 1;
				if(this._ly > this._endBottom) this._ly = this._endBottom;
			}
			this._prevX = x;
			this._prevY = y;

			if(Prototype.Browser.Opera)	{
				var tmp = "";
				(tmp = $('OperaBlur')).style.pixelLeft = x;
				tmp.style.pixelTop = y;
				(tmp = tmp.children[0].children[0]).focus();
				tmp.blur();
			}

			$(this._layerId).style.left = this._lx+'px';
			$(this._layerId).style.top = this._ly+'px';
		}
	},

	bgClose : function()	{
		$(this._topLayerId).style.display = 'none';
	},

	changeMode1 : function()	{
		this._prevX = 0;
		this._prevY = 0;
		this._dragMode = false;
		this.bgClose();
	},

	changeMode2 : function()	{
		this._prevX = 0;
		this._prevY = 0;
		this._dragMode = true;
		this.topLayerOpen();
	},

	notDrag : function()	{
		return false;
	},

	resizeWindow : function()	{
		this._bodyWidth = document.body.clientWidth;
		this._bodyHeight = document.body.clientHeight;

		if((parseInt(this._lx)) + parseInt($(this._layerId).style.width) > this._bodyWidth)	{
			if(this._bodyWidth - parseInt($(this._layerId).style.width) > 0)	{
				var xPosition = this._bodyWidth - parseInt($(this._layerId).style.width);
			} else {
				var xPosition = 1;
			}
			this._lx = xPosition;
			$(this._layerId).style.left = xPosition+"px";
		}

		if((parseInt(this._ly)) + parseInt($(this._layerId).style.height) > this._bodyHeight)	{
			if(this._bodyHeight - parseInt($(this._layerId).style.height) > 0)	{
				var yPosition = this._bodyHeight - parseInt($(this._layerId).style.height);
			} else {
				var yPosition = 1;
			}
			this._ly = yPosition;
			$(this._layerId).style.top = yPosition+"px";
		}
		this._bodyWidth = document.body.clientWidth;
		if(document.body.clientHeight >= document.body.scrollHeight)	{
			this._bodyHeight = document.body.clientHeight;
		} else {
			this._bodyHeight = document.body.scrollHeight;
		}

		this.setTopLayer();
		this._endRight = this._bodyWidth - parseInt($(this._layerId).style.width, 10);
		this._endBottom = this._bodyHeight - parseInt($(this._layerId).style.height, 10);
	},

	bodyClick : function(evt2) {
		var pointerX = Event.pointerX(evt2);
		var pointerY = Event.pointerY(evt2);
		if($(this._layerId) && !Position.within($(this._layerId), pointerX, pointerY)) this.closePopup();
	},

	setEventListener : function() {
		this._evtClosePop = this.closePopup.bindAsEventListener(this);
		this._evtBgClose = this.bgClose.bindAsEventListener(this);
		this._evtChangeMode1 = this.changeMode1.bindAsEventListener(this);
		this._evtSetLayerPosition = this.setLayerPosition.bindAsEventListener(this);
		this._evtChangeMode2 = this.changeMode2.bindAsEventListener(this);
		this._evtNotDrag = this.notDrag.bindAsEventListener(this);
		this._evtResizeWindow = this.resizeWindow.bindAsEventListener(this);
		this._evtBodyClick = this.bodyClick.bindAsEventListener(this);

		if(this._layerOption != "3") {
			if ($(this._btnClose)) Event.observe(this._btnClose, "click", this._evtClosePop);
			if ($(this._topLayerId)) Event.observe(this._topLayerId, "mouseup", this._evtChangeMode1);
			if ($(this._topLayerId)) Event.observe(this._topLayerId, "mousemove", this._evtSetLayerPosition);
			if ($(this._topLayerId)) Event.observe(this._topLayerId, "click", this._evtBgClose);
			if ($(this._layerId)) Event.observe(this._layerId, "mouseup", this._evtChangeMode1);
			if ($(this._layerId)) Event.observe(this._layerId, "mousemove", this._evtSetLayerPosition);
			if(Prototype.Browser.IE) if ($(this._handle)) Event.observe(this._handle, "selectstart", this._evtNotDrag);
			if ($(this._handle)) Event.observe(this._handle, "mousedown", this._evtChangeMode2);
			if ($(this._handle)) Event.observe(this._handle, "mouseup", this._evtChangeMode1);
			if ($(this._handle)) Event.observe(this._handle, "mousemove", this._evtSetLayerPosition);
			Event.observe(window, "resize", this._evtResizeWindow);
		}
		if(this._layerOption != "2") {
			Event.observe(document.body, "mousedown", this._evtBodyClick);
		}
	},

	removeEventListener : function() {
		if(this._layerOption != "3") {
			if ($(this._btnClose)) Event.stopObserving(this._btnClose, "click", this._evtClosePop);
			if ($(this._topLayerId)) Event.stopObserving(this._topLayerId, "click", this._evtBgClose);
			if ($(this._topLayerId)) Event.stopObserving(this._topLayerId, "mouseup", this._evtChangeMode1);
			if ($(this._topLayerId)) Event.stopObserving(this._topLayerId, "mousemove", this._evtSetLayerPosition);
			if ($(this._layerId)) Event.stopObserving(this._layerId, "mouseup", this._evtChangeMode1);
			if ($(this._layerId)) Event.stopObserving(this._layerId, "mousemove", this._evtSetLayerPosition);
			if(Prototype.Browser.IE) if ($(this._handle)) Event.stopObserving(this._handle, "selectstart", this._evtNotDrag);
			if ($(this._handle)) Event.stopObserving(this._handle, "mousedown", this._evtChangeMode2);
			if ($(this._handle)) Event.stopObserving(this._handle, "mouseup", this._evtChangeMode1);
			if ($(this._handle)) Event.stopObserving(this._handle, "mousemove", this._evtSetLayerPosition);
			Event.stopObserving(window, "resize", this._evtResizeWindow);
		}
		if(this._layerOption != "2") Event.stopObserving(document.body, "mousedown", this._evtBodyClick);
	}
};

Object.extend(pandora.util.layerpop.prototype , pandora.util.model.prototype);

/** Single Pattern - get only once Instance */
var cLayerPop = Class.create();
	cLayerPop._instance_ = null;
	cLayerPop.getInstance = function(dis) {
		if(this._instance_ == null || dis == "new") this._instance_ = new pandora.util.layerpop();
		return this._instance_;
	};


// ToolTip
//language
var tooltipLang = {
	"gb" : {
		"tool_menu" : ["Go to Channel", "View Profile", "Send message", "Manage viewers"],
		"tool_menu1_field" : ["Channel Name", "VJ Name", "Channel Number"],
		"tool_menu1_btnValue" : ["Close"],
		"tool_menu1_alert" : ["Channel Name does not exist.", "Channel introduction does not exist."],
		"tool_menu2_field" :["Recipient", "Content", "Save to Sent Messages."],
		"tool_menu2_btnValue" : ["Close", "Send"],
		"tool_menu2_alert" : ["Cannot send messages to yourself.", "Cannot exceed 500 bytes.\r\nExcess bytes will automatically be deleted.", "Enter text.", "Message Sent", "Failed to send", "System Error", "로그인을 하셔야 쪽지를 보내실수 있습니다."],
		"tool_menu3_btnValue" : ["Close", "Edit"],
		"tool_menu3_alert" : ["Edited" , "Failed to edit"]
	},
	"ko" : {
		"tool_menu" : ["채널바로가기", "프로필보기", "쪽지보내기", "시청자관리"],
		"tool_menu1_field" : ["채널명", "VJ명", "채널번호"],
		"tool_menu1_btnValue" : ["닫기"],
		"tool_menu1_alert" : ["채널명이 없습니다.", "채널소개가 없습니다."],
		"tool_menu2_field" :["받는사람", "내용", "보낸쪽지함에 저장"],
		"tool_menu2_btnValue" : ["닫기", "보내기"],
		"tool_menu2_alert" : ["본인에게는 쪽지를 보낼수 없습니다.", "최대 500 바이트까지 남기실 수 있습니다.\r\n초과된 바이트는 자동으로 삭제됩니다.", "내용을 입력해 주세요.", "쪽지 보내기 성공", "쪽지 보내기 실패", "시스템 장애발생", "로그인을 하셔야 쪽지를 보내실수 있습니다."],
		"tool_menu3_btnValue" : ["닫기", "변경"],
		"tool_menu3_alert" : ["변경되었습니다." , "변경실패"]
	},
	"en" : {
		"tool_menu" : ["Go to Channel", "View Profile", "Send message", "Manage viewers"],
		"tool_menu1_field" : ["Channel Name", "VJ Name", "Channel Number"],
		"tool_menu1_btnValue" : ["Close"],
		"tool_menu1_alert" : ["Channel Name does not exist.", "Channel introduction does not exist."],
		"tool_menu2_field" :["Recipient", "Content", "Save to Sent Messages."],
		"tool_menu2_btnValue" : ["Close", "Send"],
		"tool_menu2_alert" : ["Cannot send messages to yourself.", "Cannot exceed 500 bytes.\r\nExcess bytes will automatically be deleted.", "Enter text.", "Message Sent", "Failed to send", "System Error", "로그인을 하셔야 쪽지를 보내실수 있습니다."],
		"tool_menu3_btnValue" : ["Close", "Edit"],
		"tool_menu3_alert" : ["Edited" , "Failed to edit"]
	},
	"jp" : {
		"tool_menu" : ["チャンネルへ行く", "プロフィールを見る", "メッセージを送信", "視聴者管理"],
		"tool_menu1_field" : ["チャンネルタイトル", "VJ名", "チャンネル番号"],
		"tool_menu1_btnValue" : ["閉じる"],
		"tool_menu1_alert" : ["チャンネルタイトルがありません。", "チャンネル紹介がありません。"],
		"tool_menu2_field" :["受取人", "メッセージ", "送信済みに保存"],
		"tool_menu2_btnValue" : ["閉じる", "送信"],
		"tool_menu2_alert" : ["本人にはメッセージが送信できません。", "最大５００バイトまでメッセージの作成ができます。\r\n超過されたバイトは自動的に削除されます。", "メッセージを入力してください。", "送信済み", "送信失敗", "システムの通信エラー", "로그인을 하셔야 쪽지를 보내실수 있습니다."],
		"tool_menu3_btnValue" : ["閉じる", "変更"],
		"tool_menu3_alert" : ["変更しました。" , "変更失敗"]
	},
	"cn" : {
		"tool_menu" : ["直接去频道", "收看简介", "发信息", "管理收看人"],
		"tool_menu1_field" : ["频道名", "VJ名", "频道号码"],
		"tool_menu1_btnValue" : ["关闭"],
		"tool_menu1_alert" : ["没有频道名", "没有频道介绍"],
		"tool_menu2_field" :["收件人", "内容", "保存到草稿箱"],
		"tool_menu2_btnValue" : ["关闭", "发送"],
		"tool_menu2_alert" : ["不能发送到自己", "不能超过500bytes。\r\n如果超过，超过的内容自动删除。", "请输入内容", "发送成功", "发送失败", "系统障碍", "로그인을 하셔야 쪽지를 보내실수 있습니다."],
		"tool_menu3_btnValue" : ["关闭", "修改"],
		"tool_menu3_alert" : ["已修改" , "修改失败"]
	}
};


//context menu
var contextHTML = new pandora.util.StringBuffer();
	contextHTML.append('<table width="150" height="100" border="0" cellpadding="0" cellspacing="0" >');
	contextHTML.append('<tr><td width="6px" style="background:url('+variable.getChild("defaultImg")+'/icon_left.gif) no-repeat 0 50% ">&nbsp;</td><td style="background:#ffffff; border-top:2px solid #999999; border-right:2px solid #999999;border-bottom:2px solid #999999">');
	contextHTML.append('<table border="0" cellspacing="0" cellpadding="0">');
	contextHTML.append('<tr><td height="22"><a id="lnkChannel" style="width:100%; padding:5px 3px 3px 6px"><img class="icon_ch" align="absmiddle" src="'+ variable['skinHost'] +'static/blank.gif"/> '+tooltipLang[chInfoJson['clientLang']]['tool_menu'][0]+'</a></td></tr>');
	contextHTML.append('<tr><td height="22"><a id="lnkProfile" style="width:100%; padding:5px 3px 3px 6px"><img class="icon_profile" align="absmiddle" src="'+ variable['skinHost'] +'static/blank.gif"/> '+tooltipLang[chInfoJson['clientLang']]['tool_menu'][1]+'</a></td></tr>');
	contextHTML.append('<tr><td height="22"><a id="lnkMemo" style="width:100%; padding:5px 3px 3px 6px"><img class="icon_memo_send" align="absmiddle" src="'+ variable['skinHost'] +'static/blank.gif"/> '+tooltipLang[chInfoJson['clientLang']]['tool_menu'][2]+'</a></td></tr>');
	contextHTML.append('<tr><td height="22"><a id="lnkAudience" style="width:100%; padding:5 3 3 6"><img class="icon_admin" align="absmiddle" src="'+ variable['skinHost'] +'static/blank.gif"/> '+tooltipLang[chInfoJson['clientLang']]['tool_menu'][3]+'</a></td></tr>');
	contextHTML.append('</table></td></tr></table>');

var contextHTML2 = new pandora.util.StringBuffer();
	contextHTML2.append('<table width="150" height="75" border="0" cellpadding="0" cellspacing="0" >');
	contextHTML2.append('<tr><td width="6px" style="background:url('+variable.getChild("defaultImg")+'/icon_left.gif) no-repeat 0 50% ">&nbsp;</td><td style="background:#ffffff; border-top:2px solid #999999; border-right:2px solid #999999;border-bottom:2px solid #999999">');
	contextHTML2.append('<table border="0" cellspacing="0" cellpadding="0">');
	contextHTML2.append('<tr><td height="22"><a id="lnkChannel" style="width:100%; padding:5px 3px 3px 6px"><img class="icon_ch" align="absmiddle" src="'+ variable['skinHost'] +'static/blank.gif"/> '+tooltipLang[chInfoJson['clientLang']]['tool_menu'][0]+'</a></td></tr>');
	contextHTML2.append('<tr><td height="22"><a id="lnkProfile" style="width:100%; padding:5px 3px 3px 6px"><img class="icon_profile" align="absmiddle" src="'+ variable['skinHost'] +'static/blank.gif"/> '+tooltipLang[chInfoJson['clientLang']]['tool_menu'][1]+'</a></td></tr>');
	contextHTML2.append('<tr><td height="22"><a id="lnkMemo" style="width:100%; padding:5px 3px 3px 6px"><img class="icon_memo_send" align="absmiddle" src="'+ variable['skinHost'] +'static/blank.gif"/> '+tooltipLang[chInfoJson['clientLang']]['tool_menu'][2]+'</a></td></tr>');
	contextHTML2.append('</table></td></tr></table>');

var contextHTML3 = new pandora.util.StringBuffer();
	contextHTML3.append('<table width="150" height="50" border="0" cellpadding="0" cellspacing="0" >');
	contextHTML3.append('<tr><td width="6px" style="background:url('+variable.getChild("defaultImg")+'/icon_left.gif) no-repeat 0 50% ">&nbsp;</td><td style="background:#ffffff; border-top:2px solid #999999; border-right:2px solid #999999;border-bottom:2px solid #999999">');
	contextHTML3.append('<table border="0" cellspacing="0" cellpadding="0">');
	contextHTML3.append('<tr><td height="22"><a id="lnkChannel" style="width:100%; padding:5px 3px 3px 6px"><img class="icon_ch" align="absmiddle" src="'+ variable['skinHost'] +'static/blank.gif"/> '+tooltipLang[chInfoJson['clientLang']]['tool_menu'][0]+'</a></td></tr>');
	contextHTML3.append('<tr><td height="22"><a id="lnkProfile" style="width:100%; padding:5px 3px 3px 6px"><img class="icon_profile" align="absmiddle" src="'+ variable['skinHost'] +'static/blank.gif"/> '+tooltipLang[chInfoJson['clientLang']]['tool_menu'][1]+'</a></td></tr>');
	contextHTML3.append('</table></td></tr></table>');

//profile
var popProfileHTML = new pandora.util.StringBuffer();
	popProfileHTML.append('<div style="padding:5px; text-align:center">');
	popProfileHTML.append('<div style="padding:8px; border-bottom:1px solid #c3c3c3; line-height:160%;">');
	popProfileHTML.append('<table border="0" cellspacing="0" cellpadding="0" style="margin-bottom:10px">');
	popProfileHTML.append('<tr>');
	popProfileHTML.append('<td width="80" valign="top"><img id="chImg"  onerror="javascript:imgError(this,\'http://imgcdn.pandora.tv/static/ch_thumb.gif\');" width="76" height="76"></td>');
	popProfileHTML.append('<td><table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td>'+tooltipLang[chInfoJson['clientLang']]['tool_menu1_field'][0]+'</td><td>: <span id="chName"></span></td>');
	popProfileHTML.append('</tr><tr>');
	popProfileHTML.append('<td>'+tooltipLang[chInfoJson['clientLang']]['tool_menu1_field'][1]+'</td>');
	popProfileHTML.append('<td>: <span id="chNickName"></span></td>');
	popProfileHTML.append('</tr><tr>');
	popProfileHTML.append('<td>'+tooltipLang[chInfoJson['clientLang']]['tool_menu1_field'][2]+'</td>');
	popProfileHTML.append('<td>: CH.<span id="chNo"></span></td>');
	popProfileHTML.append('</tr></table></td></tr></table>');
	popProfileHTML.append('<textarea id="chDesc" style="width:300px; height:150px; overflow:auto" readonly></textarea>');
	popProfileHTML.append('</div></div>');
	popProfileHTML.append('<div style="padding:5px; text-align:center"><input type="button" id="btnClosePopProfile" value=" '+tooltipLang[chInfoJson['clientLang']]['tool_menu1_btnValue'][0]+' "></div>');

//send Memo
var popMemoHTML = new pandora.util.StringBuffer();

	popMemoHTML.append('<div style="padding:5px;">');
	popMemoHTML.append('<div style="float:right">(<span id="nbytes">0</span>/500byte)</div>');
	popMemoHTML.append('<strong>'+tooltipLang[chInfoJson['clientLang']]['tool_menu2_field'][0]+' : <span id="clickUSerId"></span> </strong>');
	popMemoHTML.append('</div>');
	popMemoHTML.append('<textarea name="textarea" id="keyLength" cols="" rows="" style="width:100%; height:150px"></textarea>');
	popMemoHTML.append('<div><input name="checkbox" type="checkbox" id="saveOk"> '+tooltipLang[chInfoJson['clientLang']]['tool_menu2_field'][2]+'</div>');
	popMemoHTML.append('<div  style="padding:5px; text-align:center"><input id="btnSend" type="button" value="'+tooltipLang[chInfoJson['clientLang']]['tool_menu2_btnValue'][1]+'"> &nbsp; <input type="button" id="btnClosePopMemo" value=" '+tooltipLang[chInfoJson['clientLang']]['tool_menu2_btnValue'][0]+' "></div>');

/*
	popMemoHTML.append('<table border="0" cellspacing="0" cellpadding="5">');
	popMemoHTML.append('<tr><td align="right"><strong>'+tooltipLang[chInfoJson['clientLang']]['tool_menu2_field'][0]+'</strong></td><td><b><span id="clickUSerId"></span><b></td></tr>');
	popMemoHTML.append('<tr><td align="right"><strong>'+tooltipLang[chInfoJson['clientLang']]['tool_menu2_field'][1]+'</strong></td><td>');
	popMemoHTML.append('<textarea name="textarea" id="keyLength" style="width:400px; height:150px"></textarea>');
	popMemoHTML.append('</td></tr><tr><td>&nbsp;</td><td><div style="width:400px">');
	popMemoHTML.append('<div style="float:right">(<span id="nbytes">0</span>/500byte)</div>');
	popMemoHTML.append('<input type="checkbox" name="checkbox" id="saveOk"> '+tooltipLang[chInfoJson['clientLang']]['tool_menu2_field'][2]+'</div>');
	popMemoHTML.append('<div style="width:400px; text-align:center; margin-top:10px;">');
	popMemoHTML.append('<input id="btnSend" type="button" value="'+tooltipLang[chInfoJson['clientLang']]['tool_menu2_btnValue'][1]+'"> &nbsp; <input type="button" id="btnClosePopMemo" value=" '+tooltipLang[chInfoJson['clientLang']]['tool_menu2_btnValue'][0]+' ">');
	popMemoHTML.append('</div></td></tr></table>');
*/
//audience
/*var popAudienceHTML = new pandora.util.StringBuffer();
	popAudienceHTML.append('<div style="padding:5px; text-align:center">');
	popAudienceHTML.append('<div style="padding:8px; border-bottom:1px solid #c3c3c3; line-height:160%">');
	popAudienceHTML.append('<div style="padding:5px"><select id="modPub">');
	for(var i=0; i < oCode.get("viewLevel").length; i++){
		popAudienceHTML.append('<option value="'+oCode.get("viewLevel")[i][0]+'">'+oCode.get("viewLevel")[i][1]+'</option>');
	}
	popAudienceHTML.append('</select>&nbsp;<input type="button" id="btnModPub" value="'+tooltipLang[chInfoJson['clientLang']]['tool_menu3_btnValue'][1]+'"></div>');
	popAudienceHTML.append('</div></div>');
	popAudienceHTML.append('<div style="padding:5px; text-align:center"><input type="button" id="btnClosePopAudience" value=" '+tooltipLang[chInfoJson['clientLang']]['tool_menu3_btnValue'][0]+' "></div>');
	*/

pandora.util.toolTip.prototype = {
	_audFlag : null,
	_centerFlag : null,
	_arrBgClick : null,
	_arrClick : null,
	_evtObj : null,

	_cx : null,
	_cy : null,
	_lx : null,
	_ly : null,
	_height : null,

	click_userid : null,
	pageInfo : null,
	layerPop : null,
	ohtml : null,
	storage : null,

	popAudienceHTML:null,

	set : function(obj, click_userid, evt, pageInfo, audFlag, centerFlag) {
		this.popAudienceHTML = new pandora.util.StringBuffer();
		this.popAudienceHTML.append('<div style="padding:5px; text-align:center">');
		this.popAudienceHTML.append('<div style="padding:8px; border-bottom:1px solid #c3c3c3; line-height:160%">');
		this.popAudienceHTML.append('<div style="padding:5px"><select id="modPub">');
		for(var i=0; i < oCode.get("viewLevel").length; i++){
			this.popAudienceHTML.append('<option value="'+oCode.get("viewLevel")[i][0]+'">'+oCode.get("viewLevel")[i][1]+'</option>');
		}
		this.popAudienceHTML.append('</select>&nbsp;<input type="button" id="btnModPub" value="'+tooltipLang[chInfoJson['clientLang']]['tool_menu3_btnValue'][1]+'"></div>');
		this.popAudienceHTML.append('</div></div>');
		this.popAudienceHTML.append('<div style="padding:5px; text-align:center"><input type="button" id="btnClosePopAudience" value=" '+tooltipLang[chInfoJson['clientLang']]['tool_menu3_btnValue'][0]+' "></div>');

		if(click_userid == '') return;

		//set login user information
		this.login_userid = decodeURIComponent(oCookie.get('glb_mem[userid]'));
		this.login_usernick = decodeURIComponent(oCookie.get('glb_mem[nickname]'));

		if(click_userid == this.login_userid) return;
		this._super = obj;
		this.click_userid = click_userid;

		this._cx = Event.pointerX(evt);
		this._cy = Event.pointerY(evt);

		this.pageInfo = pageInfo;
		if(typeof audFlag=='undefined') this._audFlag = false;
		else this._audFlag = audFlag;

		if(typeof centerFlag=='undefined') this._centerFlag = true;
		else this._centerFlag = centerFlag;

		this._arrClick = new Array('lnkChannel', 'lnkProfile', 'lnkMemo');

		//set layer popup
		this.layerPop = cLayerPop.getInstance();

		//set Storage
		this.storage = cStorageMgr.getInstance();

		if(this.login_userid == "")	{
			this.ohtml = contextHTML3.toString();
			this._arrClick.without('lnkMemo');
			this._height = 50;
			this.createDiv();
		} else {
			if(this._audFlag == true && chInfoJson.mychannel == '1'){
				if(this.storage.isKey("tt_"+this.login_userid+"_"+this.click_userid)){
					this.showAudience(this.storage.getChild("tt_"+this.login_userid+"_"+this.click_userid));
				}else{
					//var url = "/json/v001/maudience.dll/flag";
					/* modify by rhio.kim 2008.03.11 */
					var url = variable.getChild("pathChIsapi") + 'maudience' + variable.getChild("isapiExt") + '/flag';
					var obj = Object.toJSON({'userId':this.login_userid,'audId':this.click_userid});

					new Ajax.Request(url, {
						method : 'post',
						parameters : {'json':obj},
						onSuccess : function(res){
							var resultJson = res.responseText.evalJSON();
							this.showAudience(resultJson.isAud.toString());
						}.bind(this),
						onFailure : function() { alert('Error : isAudience Failure'); }
					});
				}
			}else{
				this.ohtml = contextHTML2.toString();
				this._height = 75;
				this.createDiv();
			}
		}
	},

	showAudience : function(flag) {
		if(!this.storage.isKey("tt_"+this.login_userid+"_"+this.click_userid)){
			var obj = "{'tt_"+this.login_userid+"_"+this.click_userid+"':"+flag+"}";
			this.storage.appendData(obj.evalJSON());
		}
		if(flag == "1"){
			this.ohtml = contextHTML.toString();
			this._height = 100;
			if(this._arrClick.indexOf('lnkAudience') == -1) this._arrClick.push('lnkAudience');
		}else{
			this.ohtml = contextHTML2.toString();
			this._height = 75;
		}
		this.createDiv();
	},

	createDiv : function(){
		this._evtObj = new ToolTipEvent();

		if(this._cx + 115 > document.body.clientWidth) this._lx = document.body.clientWidth - 115;
		else this._lx = this._cx;
		if(this._cy + parseInt(this._height)/2 > document.body.scrollHeight) this._ly = document.body.scrollHeight - parseInt(this._height);
		else this._ly = this._cy - this._height/2;

		this.layerPop.set(this.ohtml, this.removeEventListener.bind(this), this, 3, '', 115, this._height, this._ly, this._lx);
		this.setEventListener();
	},

	eventFunc : function(evt) {
		var el = Event.element(evt);
		this.actionDiv(el.id);
	},

	actionDiv : function(id) {
		try { this.layerPop.closePopup(); } catch (e) { }
		switch(id){
			case "lnkChannel"	: {
//										window.open(variable.getChild("chHost")+'channel/video.ptv?ch_userid='+this.click_userid,'_new','');
										location.replace(variable.getChild("chHost")+'channel/video.ptv?ch_userid='+this.click_userid);
										break;
										}

			case "lnkMemo"	: {
										if(oCookie.get('glb_mem[userid]') == null || oCookie.get('glb_mem[userid]') == undefined || !oCookie.get('glb_mem[userid]'))	{
											alert(tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][6]);
											return;
										}

										if(oCookie.get('glb_mem[userid]') == this.click_userid)	{
											alert(tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][0]);
											return;
										}

										if(this._centerFlag) this.layerPop.set(popMemoHTML, this.popMemoRemoveEventListener.bind(this), this, 2, tooltipLang[chInfoJson['clientLang']]['tool_menu'][2], 353, 280);
										else this.layerPop.set(popMemoHTML, this.popMemoRemoveEventListener.bind(this), this, 1, tooltipLang[chInfoJson['clientLang']]['tool_menu'][2], 353, "", this._cy, document.body.clientWidth/2+132);

										$('clickUSerId').innerHTML = this.click_userid;
										this.popMemoSetEventListener();
										break;
										}

			case "lnkProfile"	: {
										//var url = "/json/v001/mbaseinfo.dll/oview";
										/* modify by rhio.kim 2008.03.11 */
										var url = variable.getChild("pathChIsapi") + 'mbaseinfo' + variable.getChild("isapiExt") + '/oview';

										var obj = Object.toJSON({'userId':this.click_userid});
										new Ajax.Request(url, {
											method : 'post',
											parameters : {'json':obj},
											onSuccess : function(res){
												this._json = res.responseText.evalJSON();
												this.setProfileUI(this._json);
											}.bind(this),
											onFailure : function() { alert('Error : channel baseInfo. view'); }
										});

										if(this._centerFlag) this.layerPop.set(popProfileHTML, this.popProfileRemoveEventListener.bind(this), this, 1, tooltipLang[chInfoJson['clientLang']]['tool_menu'][1], 353, 340);
										else this.layerPop.set(popProfileHTML, this.popProfileRemoveEventListener.bind(this), this, 1, tooltipLang[chInfoJson['clientLang']]['tool_menu'][1], 353, "", this._cy, document.body.clientWidth/2+132);
										this.popProfileSetEventListener();
										break;
										}
			case "lnkAudience"	: {
										//var url = "/json/v001/maudience.dll/view";
										/* modify by rhio.kim 2008.03.11 */
										var url = variable.getChild("pathChIsapi") + 'maudience' + variable.getChild("isapiExt") + '/view';

										var obj = Object.toJSON({'userId':this.login_userid,'audId':this.click_userid});
										new Ajax.Request(url, {
											method : 'post',
											parameters : {'json':obj},
											onSuccess : function(res){
												var resultJson = res.responseText.evalJSON();
												this.setAudiencePub(resultJson);
											}.bind(this),
											onFailure : function() { alert('Error : audience pub. view'); }
										});

										if(this._centerFlag) this.layerPop.set(this.popAudienceHTML, this.popAudienceRemoveEventListener.bind(this), this, 2, tooltipLang[chInfoJson['clientLang']]['tool_menu'][3], 250, 140);
										else this.layerPop.set(this.popAudienceHTML, this.popAudienceRemoveEventListener.bind(this), this, 2, tooltipLang[chInfoJson['clientLang']]['tool_menu'][3], 250, 140, this._cy, document.body.clientWidth/2+132);
										this.popAudienceSetEventListener();
										break;
										}
		}
	},

	setEventListener : function() {
		this._evtObj.setEventListener(this._arrClick,this,'set');
	},

	removeEventListener : function() {
		this._evtObj.setEventListener(this._arrClick,this,'remove');
	},

	setProfileUI : function(json)	{
		$('chImg').src = getChThumbnail(this.click_userid, 'm');
		if(json.chName == "") json.chName = tooltipLang[chInfoJson['clientLang']]['tool_menu1_alert'][0];
		$('chName').innerHTML = json.chName;
		$('chNickName').innerHTML = json.nickName;
		$('chNo').innerHTML = json.chNo;
		if(json.chDesc == "") json.chDesc = tooltipLang[chInfoJson['clientLang']]['tool_menu1_alert'][1];
		$('chDesc').innerHTML = json.chDesc;
	},

	//set Memo event function
	eventPopMemo : function() {
		this.layerPop.closePopup();
	},

	checkMemoLength : function()	{
		var bytes = 0;
		var message = $F('keyLength');
		var lenStr = 500;

		for (var i=0; i<message.length; i++) {
			var m = message.charAt(i);
			if (escape(m).length > 4) {
				bytes += 2;
			} else if (m != "\r") {
				bytes++;
			}
		}

		$('nbytes').innerHTML = bytes;
		if (bytes > lenStr) {
			alert(tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][1]);

			var inc = 0;
			bytes = 0;
			var msg = "";
			for (var i=0; i<message.length; i++) {
				m = message.charAt(i);
				if (escape(m).length > 4) {
					inc = 2;
				} else if (m != "\r") {
					inc = 1;
				}
				if ((bytes + inc) > lenStr) {
					break;
				}
				bytes += inc;
				msg += m;
			}
			$('nbytes').innerHTML = bytes;
			$('keyLength').value = msg;
		}
	},

	sendMemo : function ()	{
		if($F('keyLength').strip() == "")	{
			alert(tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][2]);
			$('keyLength').value = "";
			$('keyLength').focus();
			return;
		}

		var saveOk = ($('saveOk').checked==true)?'1':'0';
		this.sendJSON('0', this.click_userid, $F('keyLength'),saveOk);
	},

	sendJSON : function(option, memberStr, body, saveOk)	{
		var url = variable.getChild("pathChIsapi") + "GMemo.dll/Send";
		var obj = Object.toJSON({userid:this.login_userid, nickname:this.login_usernick, option:option, r_userid:memberStr, body: body, save_ok:saveOk});

		new Ajax.Request(url, {
			method : 'post',
			parameters : {'json':obj},
			onSuccess : function(res){
				this._json = res.responseText.evalJSON();
				this.sendAfter(this._json);
			}.bind(this),
			onException : function(res){
				throw new Error("Exception : ToolTip memo send json fail");
			}
		});
	},

	sendAfter : function(json)	{
		var resultSend = json.isSend;

		switch(resultSend)	{
			case "1" :
				if(this.pageInfo == "1")	{
					//remove send memo_list in storage
					for(var i = 1; i <= this._super._super.saveSendMemoPage; i ++)	{
						if(this._super.storage.isKey('sm_page_'+i)) this._super.storage.remove('sm_page_'+i);
					}
				} else if(this.pageInfo == "2")	{
					//remove memo_list in storage
					var totPage = Math.ceil(this._super.page._bbsTotal / this._super.page._bbsLimit);
					for(var i = 1; i <= totPage; i ++)	{
						if(this._super.storage.isKey('sm_page_'+i)) this._super.storage.remove('sm_page_'+i);
					}
				}

				alert(tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][3]);
				this.layerPop.closePopup();
			break;

			case "0" : alert(tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][4]); break;
			case "-1" : alert(tooltipLang[chInfoJson['clientLang']]['tool_menu2_alert'][5]); break;
		}
	},

	setAudiencePub : function(json){
		var eSel = $('modPub');
		var val = json.audPub.toString();
		for(var i=0; i<eSel.options.length; i++){
			if(eSel.options[i].value == val){
				eSel.options[i].selected = true;
			}
		}
	},

	modAudiencePub : function() {
		var eSel = $('modPub');
		var val = eSel.options[eSel.options.selectedIndex].value;
		var arrAudId = new Array(this.click_userid);

		//var url = "/json/v001/maudience.dll/modify";
		/* modify by rhio.kim 2008.03.11 */
		var url = variable.getChild("pathChIsapi") + 'maudience' + variable.getChild("isapiExt") + '/modify';

		var obj = Object.toJSON({'userId':this.login_userid, 'audPub':val, 'audId':arrAudId});
		new Ajax.Request(url, {
			method : 'post',
			parameters : {'json':obj},
			onSuccess : function(res){
				var resultJson = res.responseText.evalJSON();
				if(resultJson.isModify == '1'){
					alert(tooltipLang[chInfoJson['clientLang']]['tool_menu3_alert'][0]);
				}else if(resultJson.isModify == '0'){
					alert(tooltipLang[chInfoJson['clientLang']]['tool_menu3_alert'][1]);
				}else{
					alert('Error');
				}
			}.bind(this),
			onException : function(res){
				throw new Error("Exception : ToolTip memo send json fail");
			}
		});
	},

	popMemoSetEventListener : function() {
		Event.observe('btnClosePopMemo', "click", this.eventPopMemo.bindAsEventListener(this));
		Event.observe('keyLength', "keyup", this.checkMemoLength.bindAsEventListener(this));
		Event.observe('btnSend', "click", this.sendMemo.bindAsEventListener(this));
	},

	popMemoRemoveEventListener : function() {
		var evtPop = this.eventPopMemo.bindAsEventListener(this);
		Event.stopObserving('btnClosePopMemo', "click", evtPop);

		var evtPop1 = this.checkMemoLength.bindAsEventListener(this);
		Event.stopObserving('keyLength', "keyup", evtPop1);

		var evtPop2 = this.sendMemo.bindAsEventListener(this);
		Event.stopObserving('btnSend', "click", evtPop2);
	},

	//set Profile event function
	eventPopProfile : function() {
		this.layerPop.closePopup();
	},

	popProfileSetEventListener : function() {
		Event.observe('btnClosePopProfile', "click", this.eventPopProfile.bindAsEventListener(this));
	},

	popProfileRemoveEventListener : function() {
		var evtPop = this.eventPopProfile.bindAsEventListener(this);
		Event.stopObserving('btnClosePopProfile', "click", evtPop);
	},

	//set Audience evet function
	eventPopAudience : function() {
		this.layerPop.closePopup();
	},

	popAudienceSetEventListener : function() {
		Event.observe('btnModPub', "click", this.modAudiencePub.bindAsEventListener(this));
		Event.observe('btnClosePopAudience', "click", this.eventPopAudience.bindAsEventListener(this));
	},

	popAudienceRemoveEventListener : function() {
		var evtPop = this.modAudiencePub.bindAsEventListener(this);
		Event.stopObserving('btnModPub', "click", evtPop);

		var evtPop1 = this.eventPopAudience.bindAsEventListener(this);
		Event.stopObserving('btnClosePopAudience', "click", evtPop1);
	}
};

Object.extend(pandora.util.toolTip.prototype, pandora.util.model.prototype);

/** Single Pattern - get only once Instance */
var cToolTipMgr = Class.create();
    cToolTipMgr._instance_ = null;
    cToolTipMgr.getInstance = function(tag){
		if(this._instance_==null) this._instance_ = new pandora.util.toolTip();
		else {
				if(tag=='new') this._instance_ = new pandora.util.toolTip();
			}
		return this._instance_;
	};

//ToolTipEvent - set EventListener
var ToolTipEvent = Class.create();
ToolTipEvent.prototype = {
	_super : null,

	initialize : function(){
	},

	setEventListener : function(arr,obj,flag){
		this._super = obj;
		this._super.evt = this._super.eventFunc.bindAsEventListener(this._super);

		for(var i=0; i<arr.length; i++){
			if(flag=="set") Event.observe(arr[i], 'click', this._super.evt);
			else if(flag=="remove") Event.stopObserving(arr[i], 'click', this._super.evt);
		}
	}
};

/* ============================================
	edina.kim 2008.08.20
	썸네일 플래시 관련. 모두담기(미니담기,플레이리스트 추가) 관련
============================================  */
var gAllAddList = Class.create();
gAllAddList.prototype = {
	initialize : function(){
		this.chTypeLang = {
			"gb" : {
				"addmini" : "Add to Mini",
				"addPlaylist" : "Add to playlist"
			}, "ko" : {
				"addmini" : "미니담기",
				"addPlaylist" : "플레이리스트추가"
			}, "en" : {
				"addmini" : "Add to Mini",
				"addPlaylist" : "Add to playlist"
			}, "jp" : {
				"addmini" : "ミニ追加",
				"addPlaylist" : "プレイリストに追加"
			}, "cn" : {
				"addmini" : "添加到MINI",
				"addPlaylist" : "添加播放目录"
			}
		}
	},

	set : function() {
		this.popLayer();
	},

	layerPopInstance : function() {
		if(this.layerPop) {
			this.layerPop.closePopup();
		}
		return cLayerPop.getInstance();
	},

	popLayer : function() {
		this.layerPop = this.layerPopInstance();

		var pos = Position.cumulativeOffset($('ADD_CTRL'));
		var top = pos[1];
		var left = pos[0]-41;

		var popAddHTML = new pandora.util.StringBuffer();
		popAddHTML.append('<div class="add_mini">');
		popAddHTML.append('	  <ul>');
		if(chInfoJson['clientLang'] == 'ko') {
			popAddHTML.append('		<li><a id="allAddMini" href="#">'+this.chTypeLang[chInfoJson['clientLang']]['addmini']+'</a> <a><img id="helpAddMini" src="http://imgcdn.pandora.tv/static/icon_q3.gif" alt="" ></a></li>');
		}
		popAddHTML.append('		<li><a id="allAddPlaylist" href="#">'+this.chTypeLang[chInfoJson['clientLang']]['addPlaylist']+'</a> <a><img id="helpAddPlaylist" src="http://imgcdn.pandora.tv/static/icon_q3.gif" alt="" ></a></li>');
		popAddHTML.append('	  </ul>');
		popAddHTML.append('</div>');

		if(chInfoJson['clientLang'] == 'ko') {
			this.addEvtArr = new Array("allAddMini", "allAddPlaylist", "helpAddMini", "helpAddPlaylist");
		} else {
			this.addEvtArr = new Array("allAddPlaylist", "helpAddPlaylist");
		}

		this.layerPop.set(popAddHTML, this.gAllAddEventListener.bind(this,"remove"), this, 3, '', 150, 80, top, left);
		this.gAllAddEventListener("set");
	},

	gAllAddEventListener : function(flag) {
		if(flag=="set") this._addEvt = this.eventAllAdd.bindAsEventListener(this);
		for(var i=0; i<this.addEvtArr.length; i++) {
			if($(this.addEvtArr[i])) {
				if(flag=="set") Event.observe(this.addEvtArr[i], 'click', this._addEvt);
				else if(flag=="remove") Event.stopObserving(this.addEvtArr[i], 'click', this._addEvt);
			}
		}
	},

	eventAllAdd : function(evt) {
		var el = Event.element(evt);

		switch(el.id) {
			case 'allAddMini' :
				addMini('all');
			break;
			case 'allAddPlaylist' :
				addPlaylist('all');
			break;
			case 'helpAddMini' :
				window.open(variable.getChild('downloadHost')+'?mode=mini', '_blank');
			break;
			case 'helpAddPlaylist' :
				window.open(variable.getChild('infoHost')+'?m=faq_view&b_code=F03&s_code=01&faq_id=93&faq_index=13', '_blank');
			break;
		}
	}
};

var gAllAdd = null;
function gAllAddFunc (evt, ch_typ) {
	if (!gAllAdd || gAllAdd == null) {
		gAllAdd = new gAllAddList();
	}
	gAllAdd.set(evt);
}

/*  미니담기
	prgid's type이 number 이면 썸네일에서 호출, string 이면 모두담기
*/
function addMini(prgid) {
	var noInputMini = {'ko':'스크랩된 영상 또는 잘못된 영상은 미니담기에서 제외됩니다', 'en':'Scrapped videos or failed videos are exempted from [Add to mini]', 'jp':'スクラップされた動画や不完全な動画は“ミニに追加”機能の使用ができません。', 'cn':'转贴的视频与再生有问题的视频不添加Mini目录', 'gb':'Scrapped videos or failed videos are exempted from [Add to mini]'};
	var msg1 = {'ko':'미니를 설치하셔야 미니담기가 가능합니다 \n\n 미니 설치페이지로 이동합니다.', 'en':'미니를 설치하셔야 미니담기가 가능합니다 \n\n 미니 설치페이지로 이동합니다.', 'jp':'미니를 설치하셔야 미니담기가 가능합니다 \n\n 미니베타3 설치페이지로 이동합니다.', 'cn':'미니베타3를 설치하셔야 미니담기가 가능합니다 \n\n 미니베타3 설치페이지로 이동합니다.', 'gb':'미니베타3를 설치하셔야 미니담기가 가능합니다 \n\n 미니베타3 설치페이지로 이동합니다.'};
	var msg2 = {'ko':'차단된 팝업창을 허용해 주세요.', 'en':'Allow pop-ups', 'jp':'遮?されたポップアップウィンドウを許可してください。', 'cn':'?允?被?截的?出?口', 'gb':'Allow pop-ups'};

	try{
		if (Prototype.Browser.IE) {
			var mmini = new ActiveXObject("PandoraTVMiniAX.PandoraTVMini");
			inMini(prgid, mmini);
		} else if(Prototype.Browser.Gecko) {
			if(!$('embed1')) {
				var miniPluginObj = '<embed id="embed1" type="application/pandora.tv-miniexecute-plugin" width=0 height=0></embed>';
				var divMiniPlugin = document.createElement("DIV");
				document.body.appendChild(divMiniPlugin);
				divMiniPlugin.innerHTML = miniPluginObj;
			}
			setTimeout(function(){
				var _isPlugin = false;
				for (plugin = 0; plugin < navigator.plugins.length; plugin++) {
					if (navigator.plugins[plugin].name == 'mini execute plugin') {
						_isPlugin = true;
					}
				}
				if(!_isPlugin) {
					alert(msg1[chInfoJson['clientLang']]);
				} else {
					if((navigator.appName == 'Netscape')||(navigator.appName == 'Opera')) {
						mimetype = navigator.mimeTypes["application/pandora.tv-miniexecute-plugin"];
						if (mimetype) {
							var mmini = panvastater;
						} else {
						  alert(msg1[chInfoJson['clientLang']]+'-not install');
						}
					  } else {
						document.write('파이어 폭스에서만 정상작동합니다.');
					  }
					  inMini(prgid, mmini);
				}}.bind(this), 500);
		}
	} catch(e) {
		alert(msg1[chInfoJson['clientLang']]);
		windowName = open(variable.getChild('downloadHost'),"","");
		if(windowName==null)   {
			alert(msg2[chInfoJson['clientLang']]);
		}
	}
}

function inMini(prgid, mmini) {
	var _json = null;
	var _errMsg = false;
	if(typeof(prgid)=='number') {
		_json = getOneData(prgid);
		if(!_errMsg) {	 // 한번만 메세지 뿌리고 계속 진행
			if (!_json['prgid'] || !_json['title'] || !_json['runtime'] || !_json['ch_userid']) {
				alert(noInputMini[chInfoJson['clientLang']]);
			}
		}
		mmini.InputMini(_json['prgid'], _json['title'], _json['runtime'], _json['ch_userid']);
	} else {
		var allData = getAllData();

		for(var i=0,len=allData.length;i<len;i++) {
			_json = allData[i];
			if(i==0) {
				mmini.InputMiniAdd( _json['prgid'], _json['title'], _json['runtime'], _json['ch_userid'], true );
			} else {
				mmini.InputMiniAdd( _json['prgid'], _json['title'], _json['runtime'], _json['ch_userid'], false );
			}
		}
		var miniCategName = getMiniCategName();
		mmini.InputMini( '**SET**', miniCategName, '', '' );
	}
}
/*  플레이리스트 추가
	prgid's type이 number 이면 썸네일에서 호출, string 이면 모두담기
*/
function addPlaylist(prgid) {
	var _json = null;
	if(typeof(prgid)=='number') {
		_json = getOneData(prgid);
		_prgBagInstance.append(_json['prgid'], _json['title'], _json['runtime'], _json['nickname'], _json['ch_userid']);
	} else {
		var allData = getAllData();
		for(var i=allData.length-1;i>=0;i--) {
			_json = allData[i];
			_prgBagInstance.append(_json['prgid'], _json['title'], _json['runtime'], _json['nickname'], _json['ch_userid']);
		}
	}
}
/* 썸네일 tag return */
function getThumbHtml (json) {
	var isImg = false;
	var swfUrl = "http://imgcdn.pandora.tv/gplayer/default_thumb.swf";
	var _thumb = '', _rurl = '', _target = '';
	var thumbHtml = "";

	// thumb
	if(json['thumbnail_path']) _thumb = (json['thumbnail_sm_path'])? json['thumbnail_sm_path'] : json['thumbnail_path'];
	else _thumb = getVodThumbnail(json['ch_userid'], json['prgid']);

	// hd
	_rurl = (json['resol'] == 2)? 'http://imgcdn.pandora.tv/static/icon_hd3.gif' : '';

	// target
	_target = (json['target']) ? json['target'] : '_blank';

	if(isImg) {
		var onerrImg = variable.getChild('skinHost')+"static/prg_thumb.gif";
		if(!json['vlink'].include('http://')) {
			var param = _target.split(',');
			json['vlink'] = 'javascript:'+json['vlink']+'(\''+param[0]+'\',\''+param[1]+'\');';
			_target = '';
		}
		thumbHtml += '<a href="' + json['vlink'] + '" target="'+_target+'"><img src="' + _thumb + '" width="100" height="75" border="0" onerror="this.src=\''+onerrImg+'\'" onmouseover="try{bigThumb.v(event, \''+json['ch_userid']+'\',\''+json['prgid']+'\', \''+_thumb+'\');}catch(e){};" onmousemove="try{bigThumb.v(event);}catch(e){};" onmouseout="bigThumb.h()"></a>';
	} else {
		thumbHtml += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="100" height="75" id="movie" align="middle">';
		thumbHtml += '<param name="quality" value="high" />';
		thumbHtml += '<param name="movie" value="'+swfUrl+'?ch_userid='+json['ch_userid']+'&prg_id='+json['prgid']+'&turl='+_thumb+'&lang='+chInfoJson.clientLang+'&link='+encodeURIComponent(json['vlink'])+'&rurl='+_rurl+'&target='+_target+'"/>';
		thumbHtml += '<param name="wmode" value="transparent"></param>';
		thumbHtml += '<param name="allowFullScreen" value="true" />';
		thumbHtml += '<param name="allowScriptAccess" value="always" />';
		thumbHtml += '<embed src="'+swfUrl+'?ch_userid='+json['ch_userid']+'&prg_id='+json['prgid']+'&turl='+_thumb+'&lang='+chInfoJson.clientLang+'&link='+encodeURIComponent(json['vlink'])+'&rurl='+_rurl+'&target='+_target+'" type="application/x-shockwave-flash" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" pluginspage="http://www.macromedia.com/go/getflashplayer" width="100" height="75"></embed>';
		thumbHtml += '</object>';
	}

	return thumbHtml;
}

var sharedWindow = null;
function _addPlaylist(json, type) {
	if (type != "open") {
		var sharedList = eval(SharedObject.getItem("glb_bsk")) || [];
		var exists = null;

		if (type == "array") {
			var e = 0;
			var newJson = [];
			if (sharedList.length >= 20) {
				exists = "over";
			} else {
				var jLength = sharedList.length;
				for (var i=0; i<json.length; i++) {
					if (jLength == 0) {
						sharedList.push(json[i]);
					} else {
						var ok = false;
						for (var j=0; j<jLength; j++) {
							if (sharedList[j][0] == json[i][0]) {
								exists = "mexists";
								e++;
								ok = true;
								break;
							}
						}

						if (ok == false) {
							sharedList.push(json[i]);
						}
					}
				}
			}
		} else {
			if (sharedList.length >= 20) {
				exists = "over";
			} else {
				for (var i=0; i<sharedList.length; i++) {
					if (sharedList[i][0] == json[0]) {
						exists = "exists";
						break;
					}
				}
			}

			if (exists == null) {
				sharedList.push(json);
			}
		}


		switch (exists) {
			case "exists" :
			case "oever" :
				SharedObject.setItem("glb_bsk_exists", exists.inspect());
			break;

			default:
//				sharedList.push(newJson);
				SharedObject.setItem("glb_bsk", sharedList.inspect());

				var extTxt = exists + "-" + e;

				SharedObject.setItem("glb_bsk_exists", extTxt.inspect());
			break;
		}
	} else {
		try {
			console.log('open');
		}
		catch (e) {
		}
	}
	var top = parseInt(window.screen.height, 10) - 306;
	var left = parseInt(window.screen.width, 10) - 300;

	sharedWindow = window.open("", "sharedWin", "toolbar=no, directories=no, status=no, menubar=no, scrollbars=no, width=300px, height=306px, left=" + left + "px, top=" + top + "px");

	var msg2 = {'ko':'차단된 팝업창을 허용해 주세요.', 'en':'Allow pop-ups', 'jp':'遮?されたポップアップウィンドウを許可してください。', 'cn':'?允?被?截的?出?口', 'gb':'Allow pop-ups'};
	if (sharedWindow == null) {
		alert(msg2[chInfoJson['clientLang']]);
		return;
	}
	sharedWindow.location.href = "http://www.pandora.tv/share/";
	sharedWindow.focus();
}

var eolasPatch = {
	/* 사용 방법은 
		eolasPath.init();
		이러면 되지만 전부를 찾아서 하는거라 비추천이고
		eolasPath.init(해당 영역 object); 즉,, 이건 해당 영역에 플래시 뿌리고 나서 바로 실행해 주면 됨.. 이걸 군대 군대 사용 하시길 바랍니다.
	*/
	__embed_target_id : null,
	__embed_tags : null,
	__target : null,
	__flash_force_objs : {},
	init : function(id) {
		return;
		if(navigator.userAgent.toLowerCase().indexOf('ie')==-1){
			return;
		}

		if (id == undefined) {
			this.__target = document;
		} else {
			this.__target = id;
		}

		this.__target = document;
		this.__embed_tags = {object:true,embed:false,applet:false};
//				this.__target = document.getElementById(this.__embed_target_id);

		if(this.__embed_tags.object===true){
			//object 패치
			var objs = this.__target.getElementsByTagName('object');
			var i = objs.length;
			while(i-->0){
				this._inner(objs[i]);
			}
		}
	},

	_inner : function(obj) {
		try {
			obj.insertAdjacentHTML('beforeBegin',obj.outerHTML);
			obj.parentNode.removeChild(obj);
		} catch (e) { }
	}
}
