	/* 플래시 생성*/
	function flashHtml(url, objName, type, strWidth, strHeight) {
		var clientLang = chInfoJson['clientLang'];
		strWidth = ( strWidth ) ? strWidth : "100%";
		strHeight = ( strHeight ) ? strHeight : "100%";

		if (!type || type == undefined) {
			furl = url;
		} else {
			furl = "http://imgcdn.pandora.tv/gplayer/icf_player.swf?lang=" + clientLang + "&"+url;
		}

		if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) {
			var html = '<object name="'+objName+'" id="'+objName+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
				html+= 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + strWidth + '" height="' + strHeight + '">'
				html+= '<param name="wmode" value="transparent"></param>'
				html+= '<param name=movie value="' + furl + '"></param>';
				html+= '<param name=quality value=high></param>'
				html+= '<param name=bgcolor value=#FFFFFF></param>';
				html+= '<param name="allowScriptAccess" value="always"></param>';
				html+= '<param name="allowFullScreen" value="true"></param>';
				html+= '</object>';
		} else {
			var html = '<embed src="' + furl + '"';
				html+= 'quality="high" wmode="transparent" bgcolor="#FFFFFF" id="'+objName+'" name="'+objName+'" align="" width="' + strWidth + '" height="' + strHeight + '" type="application/x-shockwave-flash"';
				html+= 'PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" allowFullScreen="true"></embed>';
		}

		return html;
	}

	////////////////////////////////////////////////////////
	// 탑브랜딩 광고 함수
	var state2 = '1';	// 1 : 닫혀져 있는 모양, 2 :  펼처저 있는 모양
	var open_flag = false;

	/* 2010-06-04 배너 스크립트 수정 */
	var _GTimer;
	var _GTimer1;
	var auto;

	function topBrandingAdAction(json) {

		document.getElementById('topBranding').style.height = "80px";

		switch (json["kind"].toString()) {
			case "1" : // 컨닝 광고형
				var url = json["topBrandingurl"] + '?clickthru='+ encodeURIComponent(json["clickUrl"]);
				$("topBrandingDiv").innerHTML = flashHtml(url, 'icf');
				$("topBrandingDiv").show();

				setTimeout(function () {
					_GTimer = setInterval( function() { procSlideTBanner(2,80); }, 10);
				}, 2000);
			break;

			case "3" : // image
				var strImage = "<a href='" + json['clickUrl'] + "' target='_blank'><img src='" + json['topBrandingurl'] + "' border='0'></a>";
				$("topBrandingDiv").innerHTML = strImage;
				$("topBrandingDiv").show();

				setTimeout(function () {
					_GTimer = setInterval( function() { procSlideTBanner(2,80); }, 10);
				}, 2000);
			break;

			case "4" : // flash 일반
				var url = json["topBrandingurl"] + '?clickthru='+ encodeURIComponent(json["clickUrl"]);
				$("topBrandingDiv").innerHTML = flashHtml(url, 'icf');
				$("topBrandingDiv").show();

				setTimeout(function () {
					_GTimer = setInterval( function() { procSlideTBanner(2,80); }, 10);
				}, 2000);
			break;

			case "5" : // RealClick
				var strFrame = "<iframe width=\"970\" scrolling=\"no\" height=\"80\" frameborder=\"0\" align=\"middle\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\" src=\"http://www.pandora.tv/adver.adingo.ptv?adType=realclick\"></iframe>";
				$("topBrandingDiv").innerHTML = strFrame;
				$("topBrandingDiv").show();

				setTimeout(function () {
					_GTimer = setInterval( function() { procSlideTBanner(2,80); }, 10);
				}, 2000);
			break;
			
		}
		if (json["checkUrl"]) adCheck(json["checkUrl"]);
	}

	/* 2010-06-04 수정 */
	function procSlideTBanner(auto, maxSize){
		var oNTBan = document.getElementById('topBranding');

		document.getElementById('topBrandingDiv').style.height = "80px";

		var oh = parseInt(oNTBan.style.height);
		var scrollSpeed = 0;

		if(maxSize == 150) scrollSpeed = 15;
		else  scrollSpeed = 5;

		if (state2 == '1' ) {
			if(maxSize > oh){
			//	oNTBan.style.height = (oh + scrollSpeed) +'px';
				oNTBan.style.height = 80 +'px';
			} else {
				unloadSlideTBanner();
				state2 = '2';
			}
			if (auto == '1')
			{
				clearTimeout( _GTimer1 );
				_GTimer1 = setTimeout( function() { TopBann('2', maxSize); }, 5000 );
			}
		}
		else
		{
			if (auto != '')
			{
				clearTimeout( _GTimer1 );
			}
			if(0 < oh) {
			//	oNTBan.style.height = (oh - scrollSpeed) +'px';
				oNTBan.style.height = 80 +'px';
			} else {
				unloadSlideTBanner();
				state2 = '1';
			}
		}
	}
	/* 2010-06-04 수정 */

	function unloadSlideTBanner(){
		clearInterval( _GTimer );
		_GTimer = null;
	}

	function topBrandingExAdActionOpen() {
		var url = topBrandingAD["exturl"] + '?clickthru='+ encodeURIComponent(topBrandingAD["clickUrl"]);
		$("extopBrandingDiv").innerHTML = flashHtml(url, 'icf');
		$("topBrandingDiv").hide();
		$("extopBrandingDiv").show();
		$("topBranding").style.height = "80px";

		setTimeout(function () {
			state2 = '1';
			_GTimer = setInterval( function() { procSlideTBanner(2,150); }, 10);
		}, 500);
	}

	function topBrandingExAdActionClose() {
		$("topBranding").style.height = "0px";

		try {
			$("topBrandingDiv").hide();
			$("extopBrandingDiv").hide();
		} catch(e) {}

	}
	// 탑브랜딩 광고 함수
	////////////////////////////////////////////////////////


	////////////////////////////////////////////////////////
	// 컨닝 광고 함수
	function cunningAdAction(json) {
		switch (json["kind"].toString()) {
			case "1" : // 컨닝 광고형
				var url = json["cunningurl"] + '?clickthru='+ encodeURIComponent(json["clickUrl"]);
				$("cunningDiv").innerHTML = flashHtml(url, 'icf');
				$("cunningDiv").style.display = "block";
			break;
		}
		if (json["checkUrl"]) adCheck(json["checkUrl"]);
	}


	function cunningExAdActionOpen() {
		var url = cunningAD["exturl"] + '?clickthru='+ encodeURIComponent(cunningAD["clickUrl"]);
		$("excunningDiv").innerHTML = flashHtml(url, 'icf');
		$("excunningDiv").style.display = "block";
	}

	function cunningExAdActionClose() {
		$("excunningDiv").style.display = "none";
	}
	// 컨닝 광고 함수
	////////////////////////////////////////////////////////

	// icf(확장, 일반, 쉐이크) 광고 관련 함수들
	var exticfPlay = false;
	var extConf = "";
	var extIcfSet = "";
	var extIcfJson = {};
	var movieCenterAd = false;
	var adSettime = "";
	function extendIcfAction(json) {

		if (exticfPlay == true) {
			playerSet.startPlay();
			return;
		}

		try { clearTimeout(extConf); } catch(e) {}

		extIcfJson = json;

		switch (json["kind"].toString()) {
			case "15" : //	TC
			//	$('divPlayer').style.width	= "0px";
			//	$('divPlayer').style.height	= "0px";
				$("icfDiv").style.display	= "block";
				$("icfDiv").innerHTML = '<div style="text-align:left;padding-top:40px;"><table style="width:606px;"><tr><td style="padding-left:160px;"><IFRAME FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=300 HEIGHT=250 SRC="http://www.pandora.tv/adver.adingo.ptv?adType=us_icf"></IFRAME></td></tr></table></div>';

				setTimeout ( function(){
					$("icfDiv").style.display = "none";
					playerSet.startPlay();
				},5000);
			break;
			case "16" : //	microad
			//	$('divPlayer').style.width	= "0px";
			//	$('divPlayer').style.height	= "0px";
				$("icfDiv").style.display	= "block";
				$("icfDiv").innerHTML = '<div style="text-align:left;padding-top:40px;"><table style="width:606px;"><tr><td style="padding-left:160px;"><IFRAME FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=300 HEIGHT=250 SRC="http://www.pandora.tv/adver.adingo.ptv?adType=us_icf_microad"></IFRAME></td></tr></table></div>';

				setTimeout ( function(){
					$("icfDiv").style.display = "none";
					playerSet.startPlay();
				},5000);
			break;

		}
		try {
			if (json["checkUrl"]) adCheck(json["checkUrl"]);
		} catch(e) {}
	}

	function extendIcfClear() {
		clearInterval(adSettime);
		startPlay();
	}

	var rightAdView = false;
	function extIcfRightAd() {
		if (rightAdView == false && extIcfJson["kind"] == "2" && extIcfJson["rightadurl"]) {
			var html = flashHtml(extIcfJson["rightadurl"] + '?clickthru='+ encodeURIComponent(extIcfJson["clickUrl"]));
			$("flvIcf_1").innerHTML		= html;
			$("flvIcf_1").style.display = "block";

			try { $("flvIcf").style.display = "none"; } catch(e) {}
			rightAdView = true;
		}
	}

	function extIcfFloatAd() {
		if (extIcfJson["kind"] == "2" && extIcfJson["floatadurl"]) {
			try { $("flvIcf_1").style.display = "none"; } catch(e) {}
			var html = flashHtml(extIcfJson["floatadurl"] + '?clickthru='+ encodeURIComponent(extIcfJson["clickUrl"]));

			$("icf_left").innerHTML = html;
			$("icf_left").style.display = "block";
		/*
			$("flvIcf_2").innerHTML = html;
			$("flvIcf_2").style.display = "block";
		*/
		}
	}

	var ext_load = 0;
	function icfPlayer(ads_icfs) {
		try {
			$("icf").InitIcfList(ads_icfs);
		} catch (e) {
			if (ext_lode<100) {
				ext_lode++;
				setTimeout(function () {
					icfPlayer(ads_icfs)
				}, 3000);
			}else {
				startPlay();
			}
		}
	}
	// icf(확장, 일반, 쉐이크) 광고 함수들//

	// 슈퍼밴 닫기 (ray.kim : 2010-09-28)
	function EndFlash() {
		try { document.getElementById("flvIcf").style.display = "none"; } catch(e) {}
		startPlay(); // mplayer.new4.js 파일에 있음

		return true;
	}

	var microAdSlide_kind = "";
	function microAdSlide(kind,opt) {
		switch (opt) {
			case "allhide" :
				$("microAdDiv").style.display = "none";
				$("microAdDiv1").style.display = "none";
				$("microAdDiv").innerHTML = "";
			break;
			case "hide" :
				$("microAdDiv").style.display = "none";
				$("microAdDiv1").style.display = "inline";
				$("microAdDiv").innerHTML = "";
				microAdSlide_kind = kind;
			break;
			default : // close();
				kind = microAdSlide_kind ? microAdSlide_kind : kind;
				switch( kind ){
					case "14" :
						$("microAdDiv").innerHTML = "<table style=\"width:100%;\"><tr><td align=right width=468><img src=\"http://imgcdn.pandora.tv/ptv_img/icon_network_close.gif\" style=\"cursor:pointer;\" onclick=\"javascript:microAdSlide('14','hide');\" /></td></tr><tr><td style=\"text-align:center;\" align=center><iframe scrolling=\"no\" height=\"60\" frameborder=\"0\" width=\"468\" topmargin=\"0\" leftmargin=\"0\" allowtransparency=\"true\"  src=\"http://www.pandora.tv/adver.adingo.ptv?adType=us_slide\" marginheight=\"0\" marginwidth=\"0\" style=\"display: inline;\"></iframe></td></tr></table>";
						$("microAdDiv1").style.display = "none";
						$("microAdDiv").style.display = "inline";
					break;

					case "15" :
						$("microAdDiv").innerHTML = "<table style=\"width:100%;\"><tr><td align=right width=468><img src=\"http://imgcdn.pandora.tv/ptv_img/icon_network_close.gif\" style=\"cursor:pointer;\" onclick=\"javascript:microAdSlide('15','hide');\" /></td></tr><tr><td style=\"text-align:center;\" align=center><iframe scrolling=\"no\" height=\"60\" frameborder=\"0\" width=\"468\" topmargin=\"0\" leftmargin=\"0\" allowtransparency=\"true\"  src=\"http://www.pandora.tv/adver.adingo.ptv?adType=us_slide_microad\" marginheight=\"0\" marginwidth=\"0\" style=\"display: inline;\"></iframe></td></tr></table>";
						$("microAdDiv1").style.display = "none";
						$("microAdDiv").style.display = "inline";
					break;

					default :
						$("microAdDiv").innerHTML = "<table style=\"width:100%;\"><tr><td align=right width=468><img src=\"http://imgcdn.pandora.tv/ptv_img/icon_network_close.gif\" style=\"cursor:pointer;\" onclick=\"javascript:microAdSlide('14','hide');\" /></td></tr><tr><td style=\"text-align:center;\" align=center><iframe scrolling=\"no\" height=\"60\" frameborder=\"0\" width=\"468\" topmargin=\"0\" leftmargin=\"0\" allowtransparency=\"true\"  src=\"http://www.pandora.tv/adver.adingo.ptv?adType=us_slide_microad\" marginheight=\"0\" marginwidth=\"0\" style=\"display: inline;\"></iframe></td></tr></table>";
						$("microAdDiv1").style.display = "none";
						$("microAdDiv").style.display = "inline";
					break;
				}
			break;
		}
	}

	// 미니 광고 함수
	var miniAdJson = {};
	function miniAdAction(json) {
		miniAdJson = json;
		switch (json["kind"].toString()) {
			case "1" : // 미니 확장전 이미지 광고 (cbannerAd) href와 onmouseover가 들어감
				$("cbannerAd").innerHTML = "<a href=\"" + json["clickUrl"] + "\" target=\"_blank\" onmouseOver=\"miniAdExtStart()\"><img src=\"" + json["miniurl"] + "\" border=\"0\"></a>";
			break;

			case "2" : // 미니 플래시 광고 (cbannerAd) swf url에 파라미터로`clickthru` 와  들어감 --> miniAdExtStart()
				var url = json["miniurl"] + '?clickthru='+ encodeURIComponent(json["clickUrl"]);
				$("cbannerAd").innerHTML = flashHtml(url, 'icf');
			break;

			case "3" : // 확장이 아닌 일반 이미지 광고
				$("cbannerAd").innerHTML = "<a href=\"" + json["clickUrl"] + "\" target=\"_blank\" onmouseOver=\"miniAdExtStart()\"><img src=\"" + json["miniurl"] + "\" border=\"0\"></a>";
			break;

			case "4" : // 미니 플래시 확장 광고
				var url = json["miniurl"] + '?clickthru='+ encodeURIComponent(json["clickUrl"]);
				$("cbannerAd").style.width = "410px";
				$("cbannerAd").style.height = "150px";
				$("cbannerAd").innerHTML = flashHtml(url, 'icf');
			break;
		}
		if (json["checkUrl"]) adCheck(json["checkUrl"]);
	}

	function miniAdExtStart() {
		if (miniAdJson["exturl"]) {
			try { $("exicf").webMute('0'); } catch(e) {}
			try { $("flvPlayer").webMute('0'); } catch(e) {}

			var url = miniAdJson["exturl"] + '?clickthru='+ encodeURIComponent(miniAdJson["clickUrl"]);

			$("cbannerAdExt").innerHTML		= flashHtml(url, 'icf');
			$("cbannerAdExt").style.display = "block";
			setTimeout(function () {
				$("cbannerAd").style.display = "none";
			}, 1000);
		}
	}

	// 닫기 버튼일 경우
	function miniAdExtEnd() {
		try { $("exicf").webMute('1'); } catch(e) {}
		try { $("flvPlayer").webMute('1'); } catch(e) {}
		$("cbannerAdExt").innerHTML = "";
		$("cbannerAdExt").style.display = "none";
		$("cbannerAd").style.display = "block";
	}

	// 마우스아웃일 경우
	function miniAdOutEnd() {
		if(miniAdJson["closeTime"] > 0) {
			try { $("exicf").webMute('1'); } catch(e) {}
			try { $("flvPlayer").webMute('1'); } catch(e) {}
			try {
				setTimeout( function() {
					$("cbannerAdExt").innerHTML = "";
					$("cbannerAdExt").style.display = "none";
					$("cbannerAd").style.display = "block";
				}, miniAdJson["closeTime"] );
			} catch(e) {}
		}
	}
	// 미니 광고 함수 끝 //

	// ICF Ending Still : 광고 재생
	var endingJson = {};
	var setstartStill;
	function endingAction(json) {

		//$("endingDiv").style.top	= "-30px";
		$("endingDiv").style.display	= "block";

		switch (json["kind"].toString()) {
			case "1" : // 일반광고
				$("endingDiv").innerHTML = '<IFRAME FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=300 HEIGHT=250 SRC="http://www.pandora.tv/adver.adingo.ptv?adType=us_icf"></IFRAME>';
			break;
			case "2" : // 일반광고
				$("endingDiv").innerHTML = '<IFRAME FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=300 HEIGHT=250 SRC="http://www.pandora.tv/adver.adingo.ptv?adType=us_icf_microad"></IFRAME>';
			break;
		}
	/*
		setstartStill = setTimeout ( function(){
			$("endingDiv").style.display = "none";
			document.enddingPlayer.endingStart();
		},10000);
		*/
	}

	// ETC 광고 함수
	function etcFunctionAdAction(json) {
		switch (json["kind"].toString()) {
			case "1" : // 플레이어 상단 스킨 이미지형 광고
				if(json["clickUrl"])
					$("skinDiv").innerHTML = "<a href=\"" + json["clickUrl"] + "\" target=\"_blank\"><img src=\"" + json["playertopurl"] + "\" border=\"0\"></a>";
				else
					$("skinDiv").innerHTML = "<img src=\"" + json["playertopurl"] + "\" border=\"0\">";
			break;

			case "2" : // 플레이어 상단 스킨 플래시형 광고
				var url = json["playertopurl"] + '?clickthru='+ encodeURIComponent(json["clickUrl"]);
				$("skinDiv").innerHTML = flashHtml(url, 'icf');
			break;

			case "3" : // 왼쪽 날개 이미지형 광고
				if(json["clickUrl"])
					$("wingDiv").innerHTML = "<a href=\"" + json["clickUrl"] + "\" target=\"_blank\"><img src=\"" + json["leftwingurl"] + "\" border=\"0\"></a>";
				else
					$("wingDiv").innerHTML = "<img src=\"" + json["leftwingurl"] + "\" border=\"0\">";
				$("wingDiv").style.display = "block";
			break;

			case "4" : // 왼쪽 날개 플래시형 광고
				var url = json["leftwingurl"] + '?clickthru='+ encodeURIComponent(json["clickUrl"]);
				$("wingDiv").innerHTML = flashHtml(url, 'icf');
				$("wingDiv").style.display = "block";
			break;
		}

		if (json["checkUrl"]) adCheck(json["checkUrl"]);
	}

	// 미드롤광고
	function start_extend_ad(runtime, country, mCAd) {
		try {
			loadJS("http://ads.pandora.tv/NetInsight/text/pandora/pandora_channel/main@icf_midd");
			extIcfSet = "midroll";
		} catch (e) { startPlay(); }
	}
	// 미드롤광고

	//	2011-02-28 Quick 광고 추가 : dy.bueon
	function AdRightQuickFun( strV ) {
		if( strV['img'] ){
			$('adRightQuick').style.display = "block";
			$('adRightQuick').style.width = "55px";
			$('adRightQuick').style.height = "110px";
			$('adRightQuick').style.marginBottom = "5px";
			$('adRightQuick').innerHTML = "<a href='" + strV['clickurl'] + "' target='_blank'><img src='" + strV['img'] + "'></a><img src='" + strV['checkUrl'] + "' style='width:0px;height:0px;'>";
		}else {
			$('adRightQuick').style.display = "none";
		}
	}

	/*통통광고 스크립트 09.12.04 전설희*/
	var iter = 0;
	var setId = 0;
	var down = true;
	var up = false;
	var ltop=0;
	var tongnum=0;

	function handleClick() {
		loadJS("http://ads.pandora.tv/NetInsight/text/pandora/pandora_channel/main@tong_L");
		setTimeout("handleEnd()",40000);
	}
	function handleEnd(){
		document.getElementById('ball').style.display = "none";
		document.getElementById("handleArea").innerHTML = "";
		window.clearInterval(setId);
	}

	function handleView(json) {
		if (setId != 0)
		window.clearInterval(setId);
		if (document.getElementById('ball').style.display == "" || document.getElementById('ball').style.display == "inline")
		document.getElementById('ball').style.display = "none";
		document.getElementById('ball').style.top = 0;
		document.getElementById('ball').style.left = 5;
		iter = 0;
		var adHtml = '<a href="' + json.clickurl + '" target="_blank" onfocus="this.blur()"><img src="' + json.imgsrc + '" border="0" id="tongtong" alt="" class="" /></a>';
		adHtml += (json.cpurl) ? '<img src="' + json.cpurl + '" border="0" width="0" height="0">' : "";
		document.getElementById("handleArea").innerHTML = adHtml;
		document.getElementById('ball').style.display = "inline";
		setId = window.setInterval("tongtong()", 30);
	}
	function tongtong() {
		var tp	 =	 document.body.scrollTop || document.documentElement.scrollTop;
		var ht=document.body.clientHeight || document.documentElement.clientHeight;
		var etop = tp + ht - 215;

		if ((parseInt(document.getElementById('ball').style.top)+iter < etop) && down) {
			document.getElementById('ball').style.top = parseInt(document.getElementById('ball').style.top,10) + iter;
			iter++;
			return;
		}
		else {
			if ((parseInt(document.getElementById('ball').style.top)< etop) && down) {
			document.getElementById('ball').style.top = etop;
			tongnum++;
				if(tongnum==5){
					window.clearInterval(setId);
					ballMoveEvent();
				}
			return;
			}
			down = false;
			up = true;

			if (parseInt(document.getElementById('ball').style.top) > 0 && up && iter >= 0) {
				document.getElementById('ball').style.top = parseInt(document.getElementById('ball').style.top,10) - iter;
				iter--;
				if (iter%3 == 0){iter--;}
				return;
			}
			down = true;
			up = false;
		}
	}

	function ballMoveEvent() {
		var tp2	 =	 document.body.scrollTop || document.documentElement.scrollTop;
		var ht2=document.body.clientHeight || document.documentElement.clientHeight;
		var etop2 = tp2 + ht2 - 215;
		document.getElementById('ball').style.top	=	etop2 + "px";
		stopSet=setTimeout("ballMoveEvent()", 150);
	}
	/*통통광고 스크립트 09.12.04 전설희*/

	// 노출 광고 함수
	function adCheck(url) {
		var oImg = document.createElement("IMG");
		oImg.style.display = "none";
		oImg.src = url;

		document.body.appendChild(oImg);
	}

	function startPlay(){
		playerSet.startPlay();
	}
