<!--
	// mouse over , out  underline smith.oh 2008-12-03
	function ul(type, obj) {
		if (type == "over") {
			obj.style.textDecoration = 'underline';
		} else {
			obj.style.textDecoration = 'none';
		}
	}

	// Teg 검색으로 넘기기
	function tegSearch(obj) {
		var newWinSearch = window.open("http://search.pandora.tv/index.ptv?query="+encodeURIComponent(obj)+"&sq=KR");
	}

	// 즐겨찾기
	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,'');
	}

	// 선물하기
	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( this.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();
		}
	}

	/* Trim */
	function strTrim(str) {
		str = str.replace(/^ +/g, "");
		str = str.replace(/ +$/g, " ");
		str = str.replace(/ +/g, " ");

		return str;
	}

	/* 메모 글자 제한 */
	function updateCharter(obj,view_obj,max_cnt)
	{
		var str_cnt = 0;
		var tempStr, tempStr2;  
		var str_cnt_viewer = document.getElementById(view_obj);
		
		for(i=0; i<obj.value.length; i++)
		{
			tempStr = obj.value.charAt(i);
			if(escape(tempStr).length > 4) str_cnt += 1;
			else str_cnt += 0.5 ;
		}

		if (str_cnt > max_cnt){
			alert("최대 " + max_cnt + "자이므로 초과된 글자수는 자동으로 삭제됩니다.");	   
			str_cnt = 0;		
			tempStr2 = "";
			for(i = 0; i < obj.value.length; i++) 
			{
				tempStr = obj.value.charAt(i);  
				if(escape(tempStr).length > 4) str_cnt += 1;
				else str_cnt += 0.5;
				if (str_cnt > max_cnt)
				{
					if(escape(tempStr).length > 4) str_cnt -= 1;
					else str_cnt -= 0.5 ;   
					break;			  
				}
				else tempStr2 += tempStr;
			}	   
			obj.value = tempStr2;
		}
		str_cnt_viewer.innerHTML = parseInt(str_cnt);
	}

	/* textarea resizing + byte check */
	function resizeArea(curObj, min, max, limit, limitcnt){
		
		updateCharter(curObj,limit,300);
		
		textarea = curObj;
		if (navigator.userAgent.indexOf("SV1") > 0){   } 
		else if(navigator.userAgent.indexOf("MSIE 7")>0) {  }
		else { max = 300; }

		if (navigator.userAgent.indexOf("Chrome/2") > 0){
			scrollheight = curObj.scrollHeight - 4;
		}
		else { scrollheight = curObj.scrollHeight; }

		if(scrollheight<=min) {
			textarea.style.height = min + 'px';
			textarea.style.overflowY = "hidden";
		}else if(scrollheight>max){
			textarea.style.height = max + 'px';
			textarea.style.overflowY = "auto";
		}else{
			textarea.style.height = scrollheight + 'px';
			textarea.style.overflowY = "hidden";
		}
	}

	//클립보드[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) {
			}
		}
	}

	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", $.toJSON(exists));
				break;

				default:
					SharedObject.setItem("glb_bsk", $.toJSON(sharedList));

					var extTxt = exists + "-" + e;
					SharedObject.setItem("glb_bsk_exists", extTxt);
				break;
			}
		}

		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();
	}

	/*  플레이리스트 추가
		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']);
			}
		}
	}

	// 휴대폰 전송
	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( this.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 showLayer(obj) { document.getElementById(obj).style.display = "block"; }
	function hideLayer(obj) { document.getElementById(obj).style.display = "none"; }

	// 시간
	function realtime(num){
		var time,hour,min,sec,rtime;
		time = parseInt(num/1000);
		hour = parseInt(time/3600);

		if(hour<10){hour='0'+hour;}
		min = parseInt((time%3600)/60);

		if(min<10){min='0'+min;}
		sec = time%60;

		if(sec<10){sec='0'+sec;}
		rtime=hour+":"+min+":"+sec;

		return rtime;
	}

	// 미니2 담기
	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':'미니2를 설치하셔야 미니담기가 가능합니다 \n\n 미니2 설치페이지로 이동합니다.', 'en':'미니2를 설치하셔야 미니담기가 가능합니다 \n\n 미니2 설치페이지로 이동합니다.', 'jp':'미니2를 설치하셔야 미니담기가 가능합니다 \n\n 미니2 설치페이지로 이동합니다.', 'cn':'미니2를 설치하셔야 미니담기가 가능합니다 \n\n 미니2 설치페이지로 이동합니다.', 'gb':'미니2를 설치하셔야 미니담기가 가능합니다 \n\n 미니2 설치페이지로 이동합니다.'};
		var msg2 = {'ko':'차단된 팝업창을 허용해 주세요.', 'en':'Allow pop-ups', 'jp':'遮?されたポップアップウィンドウを許可してください。', 'cn':'?允?被?截的?出?口', 'gb':'Allow pop-ups'};

		if (status == "30010") {
			alert(noInputMini[chInfoJson['clientLang']]);
			return;
		}
		try{
			$.each($.browser, function(i) {
				if($.browser.msie) {
					var mmini = new ActiveXObject("PandoraTVMiniAX.PandoraTVMini");
					toMini(prg_id,title,runtime,ch_userid,mmini);
				} else if ($.browser.mozilla) {
					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(this.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 StyleOver(divName, overType) {
		if (overType == "over") $("#"+divName).addClass("over");
		else $("#"+divName).removeClass("over");
	}

	//**********************************************************************************************************//
	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;
	}
	//**********************************************************************************************************//

	// ====================================================
	// Movie START
	/* 영상 히트수 업데이트 */
	function prgHitAction () {
		clearTimeout(hitDelayInterval);	// 채널 로딩시 딜레이 되었던 히트 : 디레이 시간내에 다른 영상을 선택했을 수 있으므로...

		var prgInfo = this.getNextJson()["flvInfo"];

		var adult_chk = "n";
		if (prgInfo["db_adult_chk"] >= 18) {
			adult_chk = "y";
		}

		var rtime = prgInfo["real_runtime"].split(":");
		var runtime = ( parseInt(rtime[0], 10)*60*60*60 + parseInt(rtime[1], 10)*60*60 + parseInt(rtime[2], 10)*60 ) * 1000;

		var prg_pub = (prgInfo["prg_pub"]) ? prgInfo["prg_pub"].toString() : "0";
		var pstatus = (prgInfo["status"]) ? prgInfo["status"].toString() : "30003";
		var categ = (prgInfo["categ"]) ? prgInfo["categ"].toString() : "050061";
		var inputresol = (prgInfo["isHD"] == 2) ? "2" : "1";

		var obj = $.toJSON({'userid':prgInfo["userid"], 'prgid':this.prgid.toString(), 'status':pstatus, 'prg_pub':prg_pub, 'adult_chk':adult_chk, 'runtime':runtime.toString(),'categ':categ,'language':prgInfo["language"],'resol':inputresol});
		$('#hitJson').get(0).value = obj;

		var hitForm = document.getElementById('hitForm');

		with(hitForm) {
			hitForm.action = this.shareHost + this.isapiPath + "h_index.ptv";
			hitForm.method = "post";
			hitForm.target = "prgHitIfr";
			hitForm.submit();
		}

		if(parseInt(prgInfo["status"], 10) == 30010) {	// 스크랩 영상이면 원본 유저에게도 올려준다.
			var obj = $.toJSON({'userid':prgInfo['orgChUserid'], 'prgid':prgInfo['orgPrgid'], 'status':pstatus, 'prg_pub':prg_pub, 'adult_chk':adult_chk, 'runtime':runtime.toString(),'categ':categ,'language':prgInfo["language"],'resol':inputresol});
			$('#hitJson').get(0).value = obj;

			setTimeout(function(){
				with(hitForm) {
					hitForm.action = this.shareHost + this.isapiPath + "h_index.ptv";
					hitForm.method = "post";
					hitForm.target = "prgHitIfr";
					hitForm.submit();
				}
			}, 2000);
		}
	}

	/* 최근본 동영상에 담기 */
	function watchedVideo() {
		if ("1" == 16) {
			return;
		}
		try {
			var dat = SharedObject.getItem('vMovie');
			if(dat.indexOf("[object Object]") > -1) dat = dat.replace(/, \[object Object\]/g, '');	// shared object 보완 필요
			var tmp = eval(dat) || [];

			var prgInfo = param;//재생중인 영상 정보
			if (!chkDuplicate(tmp, prgInfo['prgid'])) {
				if (tmp.length > 20) tmp.shift();

				var appendData = [prgInfo['title'], prgInfo['prgid'], prgInfo["userid"], prgInfo['runtime'], chInfoJson['chname']];
				if(parseInt(prgInfo['status'], 10) == 30010 || parseInt(prgInfo['encode'], 10) == 30010) {
					appendData.push({prgid:prgInfo['orgPrgid'], chuserid:prgInfo['orgChUserid'], chname:prgInfo['chname']});
					// chname은 스크랩 영상의 정보를 가져올때 원본의 chname을 가져오고 있으므로 그대로 사용함. : alan - 20080821
				}
				tmp.push(appendData);

				SharedObject.setItem('vMovie', $.toJSON(tmp));
			}
		} catch (e) {
			if (watchedCnt < 10) {
				window.setTimeout(function() {watchedVideo();}, 200);
			} else {
				return;
			}
			watchedCnt++;
		}
	}

	/* 영상 체크 */
	function chkDuplicate(arr, prgid) {
		var duplicated = false;
		for(var i=0, limit=arr.length; i<limit; i++) {
			if(arr[i][1] == prgid) duplicated = true;
		}
		return (duplicated == true) ? true : false;
	}

	/* 최근본 동영상에 삭제 */
	function watchedVideo_DEL(prgid,obj) {
		var tmp = this.getSharedObject(obj);
		for(var i=0; i<tmp.length; i++) {
			if(tmp[i][1] == prgid || tmp[i][0] == prgid) {
				tmp.splice(i, 1);
			}
			else {
			}
		}
		SharedObject.setItem(obj,$.toJSON(tmp));

		if (obj == "glb_bsk") freeaddPlaylist.set(1, this.prgid);
		else freeRecent.set(1, this.prgid);
	}

	/* 최근본 동영상에 삭제 */
	function getSharedObject(key) {
		return eval(SharedObject.getItem(key)) || [];
	}

	function SetCookie (name,value,expires) { 
		var expires = new Date();
		var domain = "";
		var path = "/";
		expires.setDate(expires.getDate() + 365);

		document.cookie = name + "=" + escape (value) + 
		((expires) ? "; expires=" + expires.toGMTString() : "") + 
		((path) ? "; path=" + path : "") + 
		((domain) ? "; domain=" + domain : ""); 
	}

	function GetCookie(key) {
		var cookie = document.cookie;
		var first = cookie.indexOf(key+"=");
		//alert(cookie);
		if (first>=0) {
			var str = cookie.substring(first,cookie.length);
			var last = str.indexOf(";");
			if (last<0) {
				last = str.length;
			}
			str = str.substring(0,last).split("=");
			return unescape(str[1]);
		} else {
			return null;
		}
	}
	function getCookieVal (offset) {
		var endstr = document.cookie.i-dexOf (";", offset); 
		if (endstr == -1)
			endstr = document.cookie.length;
		return unescape(document.cookie.substring(offset, endstr));
	}
	// Movie END
	// ====================================================

	// 글자 제한
	function getStrCuts(str, max)
	{
		ns = str.substr(0, max);
		if (ns.length != str.length) {
			ns = ns + "...";
		}
		return ns;
	}
-->
