﻿/*##########################################################################################
                                    메뉴 코드
##########################################################################################*/
function topOn(tabid,a) {
	for (i=1;i<=10;i++) {
		if(i<10){inn="0"+i;} else {inn=""+i;}
		topMenu = document.getElementById("top"+tabid+"m"+i);
		topContent = document.getElementById("top"+tabid+"c"+i);
		if (topMenu) { //객체가존재하면
			if (topMenu.tagName=="IMG") { topMenu.src = topMenu.src.replace("on0" + i + ".gif", "off0" + i + ".gif"); } //이미지일때
			if (topMenu.tagName=="A") { topMenu.className=""; } //앵커일때
		}
		if (topContent) { topContent.style.display="none"; }
	}
	if(a<10){ann="0"+a;} else {ann=""+a;}
	topMenu = document.getElementById("top"+tabid+"m"+a);
	topContent = document.getElementById("top"+tabid+"c"+a);
	//alert(topMenu.tagName);
	if (topMenu) { //객체가존재하면
		if (topMenu.tagName=="IMG") { topMenu.src = topMenu.src.replace("off0" + a + ".gif", "on0" + a + ".gif"); } //이미지일때
		if (topMenu.tagName=="A") { topMenu.className="on"; } //앵커일때
	}
	if (topContent) { topContent.style.display="block"; }
	topMore = document.getElementById("top"+tabid+"more");
}


/*##########################################################################################
                                    디자이너 코드
##########################################################################################*/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



/******************************************************************************
(1) 개요			:  한줄 의견 달기
(2) 파라미터값		:  
(3) 리턴값			:  
*******************************************************************************/
//리플등록
function cf_reply_write()
{
	var f = document.cmn_frame;
	if (f.reply.value==''){
		alert('내용을 넣어주세요'); f.reply.focus(); return;
	}
	f.cmd.value='write';
	f.action="/sub/songpa_sub_replay_proc.asp";
	f.submit();
}

//리플삭제
function reply_delete(seq)
{
	var f = document.cmn_frame;
	if(confirm("시청자 의견을 삭제 하시겠습니까?!!")){
		f.cmd.value='delete';
		f.method="post"
		f.seq.value=seq;
		f.action="/sub/songpa_sub_replay_proc.asp";
		f.submit();
	}
}


/******************************************************************************
(1) 개요			:  로그인 확인
(2) 파라미터값		:  
(3) 리턴값			:  
*******************************************************************************/
function cf_Login()
{
	alert("먼저 로그인을 하세요..");
	location.href="";
}

/******************************************************************************
(1) 개요			:  검색
(2) 파라미터값		:  
(3) 리턴값			:  
*******************************************************************************/
function f_CmnSearch()
{
	var f = document.cmn_frame;
	if (!f.searchString.value)
	{
		alert("검색어를 적어주세요");
		f.searchString.focus();
		return;
	}

	f.action = "/search/search.asp";
	f.submit();
}

function f_GoTag(strTag, strGubun)
{
//	테그 혹은 검색어 일경우 분기페이지에서 로그 기록을 하고 해당 검색 페이지로 보냄
//	alert(strTag +' | '+ strGubun)
	location.href = "/common/Page/cmn_TagKeyword.asp?Tag="+strTag+"&searGubun="+strGubun
}

function f_rss(strTag)
{
	window.clipboardData.setData('Text', strTag);

	alert("복사가 완료 되었습니다.\n사용하시는 RSS프로그램에 붙여넣기(Ctrl+V)하세요.");
}

function f_postpop(strIdx)
{
	window.open('/common/player/Cmn_Posting_Pop.asp?vodIdx='+strIdx,'postpop','width=400, height=400')
}

/******************************************************************************
(1) 개요			:  TAB메뉴
(2) 파라미터값		:  
(3) 리턴값			:  
*******************************************************************************/
function f_Tablayer(num, cnt, mType)
{
	for (i=1; i<=cnt; i++)
	{
		tLayer = document.getElementById("tab"+mType+""+i);
		tImg = document.getElementById("tab"+mType+"Img"+i);
		if (num == i)
		{
			tLayer.style.display = "block";
//			alert("선택- 변경전 :"+tImg.src);
			tImg.src = tImg.src.replace("_off", "_on");
//			alert("선택- 변경후 :"+tImg.src);
		}
		else
		{
			tLayer.style.display = "none";
//			alert("비선택- 변경전 :"+tImg.src);
			tImg.src = tImg.src.replace("_on", "_off");
//			alert("비선택- 변경후 :"+tImg.src);
		}
	}
}

function f_Main()
{
	f_Tablayer(1, 3, 'm');
	f_Tablayer(1, 2, 'l');
	f_Tablayer(1, 2, 'C');
	f_Tablayer(1, 2, 'R');
	
//	document.getElementById("oMediaPlayer").Volume = 1;
}

/************************************************************************
(1) 개요			:  메인동영상 기사보기 
(2) 파라미터값		:  
(3) 리턴값			:  
************************************************************************/
function f_MainContentOpen()
{
	//기사 원문보기
	mainContLayer = document.getElementById("mainContent");
	mainContLayer.style.display = "block";	
}

function f_MainContentClose()
{
	//기사 원문보기
	mainContLayer = document.getElementById("mainContent");
	mainContLayer.style.display = "none";	
}

/************************************************************************
(1) 개요			:  플래쉬 
(2) 파라미터값		:  
(3) 리턴값			:  
************************************************************************/
function cf_Flash(url, width, height, Content)
{
    var str = "";
    if (navigator.appName == "Microsoft Internet Explorer") 
	{
		 str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"  width="'+ width +'" height="'+ height +'" id="introFlash" title="'+Content+'">';
    }
	else 
	{
		 str = '<object type="application/x-shockwave-flash" data="'+url+'" id="introFlash" width="'+ width +'" height="'+ height +'" title="'+Content+'">';
    }

    str += '<param name="movie" value="'+url+'" />';
	str += "<param name=\"quality\" value=\"high\" />";
	str += "<param name=\"wmode\" value=\"transparent\" />";

	if (Content)
	{
		str += Content;
	}
	
    str += '</object>';
	
    document.write(str);
}

/************************************************************************
(1) 개요			:  서브 
(2) 파라미터값		:  
(3) 리턴값			:  
************************************************************************/
var vodCnt = '';

function insertText(i) {
	document.getElementById('VodList').innerHTML = ctnt[i];
	vodCnt = i;
}

function f_Next() {
	vodCnt = vodCnt + 1;
	if (vodCnt > 3) { vodCnt =1 }
	document.getElementById('VodList').innerHTML = ctnt[vodCnt];
}

function f_Prev() {
	vodCnt = vodCnt - 1;
	if (vodCnt < 1 ) { vodCnt =3 }
	document.getElementById('VodList').innerHTML = ctnt[vodCnt];
}


/************************************************************************
(1) 개요			:  하단 관련사이트 바로가기 
(2) 파라미터값		:  
(3) 리턴값			:  
************************************************************************/
function cf_SiteLocation(name)
{ 
	var obj = document.getElementById(name);
	
	if(document.getElementById(name).value  == "")
	{
	}
	else
	{
		var URL = document.getElementById(name).value 
		window.open(URL,'win',''); 
	} 
}

/************************************************************************
(1) 개요			:  브라우저 정보체크
(2) 파라미터값		:  
(3) 리턴값			:  
************************************************************************/
function user_browser() {
	this.msie = false;		//MS-InternetExplorer
	this.netscape = false;	//Netscape
	this.firefox = false;	//FireFox
	this.safari = false;	//Safari
	this.opera = false;		//Opera
	this.chrome = false;	//google chrome
	this.other = false;		//기타 browser
	this.version = "";		//browser full version
	this.major = 0;		//browser major version

	var	rst = navigator.userAgent;
	var	idx_pos = 0;

	//if문의 순서유의 할 것
	if((idx_pos = rst.indexOf("MSIE")) != -1) { this.msie = true; }
	else if(rst.indexOf("Navigator") != -1) { this.netscape = true; }
	else if(rst.indexOf("Firefox") != -1) { this.firefox = true; }
	else if(rst.indexOf("Chrome") != -1) { this.chrome = true; }
	else if(rst.indexOf("Safari") != -1) { this.safari = true; }
	else if(idx_pos = rst.indexOf("Opera") != -1) { this.opera = true; }
	else { this.other = true; }

	this.version = (navigator.userAgent.match( /.+(?:MSIE|Firefox|Version|rv|it|ra|ie|Navigator|Chrome)[\/: ]([\d.]+)/ ) || [])[1];
	try { this.major = parseInt(this.version.substring(0, 1), 10); }
	catch(e) { this.major = 1; }

	return this;
}

/************************************************************************
(1) 개요			:  화면 확대 축소 함수 - 익스플로러용
(2) 파라미터값		:  
(3) 리턴값			:  
************************************************************************/
function cf_Zoom(param)
{
	if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1 && user_browser().version != "8.0")
	{
		if(document.body.style.zoom==null||document.body.style.zoom=="")
		{     
			zoomStat = 100;
		}
		
		if(param=="in")
		{
			zoomStat = zoomStat + 10;
		}
		else if(param=="")
		{
			zoomStat = 100;
		}
		else
		{
			zoomStat = zoomStat - 10;
		}
		
		if(zoomStat > 140)
		{
			zoomStat = 140;      
		}

		if(zoomStat < 60)
		{
			zoomStat = 60;
		}
		
		if (typeof param == "undefined" ) 
		{
			zoomStat = 100;
		}
		
  		document.body.style.zoom = zoomStat+"%";
	}
}

function cf_ZoomInfo(view)
{
	if(user_browser().msie == false)
	{
		if(view == 1)
		{
			document.getElementById('UtilBoxColor').style.display = 'block';
			document.getElementById('ColorSetDiv').innerHTML = "<table cellpadding='0' cellspacing='0' border='0'><tr><td width='180' height='90' align='center'><a href='javascript:cf_ZoomInfo(0);'><img src='/images/common/view.gif' alt='텍스트 크기를 확대 또는 축소하여 원하는 내용을 자세하게 보실 수 있습니다.'></a></td></tr></table>";
		}
		else
		{
			document.getElementById('UtilBoxColor').style.display = 'none';
			document.getElementById('ColorSetDiv').innerHTML = "";
		}
	}
	else if(user_browser().msie == true && user_browser().version == "8.0")
	{
		if(view == 1)
		{
			document.getElementById('UtilBoxColor').style.display = 'block';
			document.getElementById('ColorSetDiv').innerHTML = "<table cellpadding='0' cellspacing='0' border='0'><tr><td width='180' height='90' align='center'><a href='javascript:cf_ZoomInfo(0);'><img src='/images/common/view.gif' alt='텍스트 크기를 확대 또는 축소하여 원하는 내용을 자세하게 보실 수 있습니다.'></a></td></tr></table>";
		}
		else
		{
			document.getElementById('UtilBoxColor').style.display = 'none';
			document.getElementById('ColorSetDiv').innerHTML = "";
		}
	}
}


/************************************************************************
(1) 개요			:  화면 확대 축소 함수 - 파이어폭스용등등.. - 프레임변화 없이 Text만 커짐
(2) 파라미터값		:  
(3) 리턴값			:  
************************************************************************/
var currZoom = 100;
 
function screen_zoom(zmode)
{
	if (zmode == "zoomin") {
		currZoom += 5;
	}
	if (zmode == "zoomout") {
		currZoom -= 5;
	}
	if (zmode == "zoom100") {
		currZoom = 100;
	}
	if (currZoom < 100) {
		currZoom = 100;
	}
	arrayTemp = $("#wrap").find("a");
	for (i=0; i<arrayTemp.length; i++) {
		arrayTemp[i].style.fontSize = currZoom +"%";
	}
	arrayTemp = $("#wrap").find("h4");
	for (i=0; i<arrayTemp.length; i++) {
		arrayTemp[i].style.fontSize = currZoom +"%";
	}
	arrayTemp = $("#wrap").find("dt");
	for (i=0; i<arrayTemp.length; i++) {
		arrayTemp[i].style.fontSize = currZoom +"%";
	}
	arrayTemp = $("#wrap").find("dd");
	for (i=0; i<arrayTemp.length; i++) {
		arrayTemp[i].style.fontSize = currZoom +"%";
	}
	arrayTemp = $("#wrap").find("span");
	for (i=0; i<arrayTemp.length; i++) {
		arrayTemp[i].style.fontSize = currZoom +"%";
	}
	arrayTemp = $("#wrap").find("th");
	for (i=0; i<arrayTemp.length; i++) {
		arrayTemp[i].style.fontSize = currZoom +"%";
	}
	arrayTemp = $("#wrap").find("td");
	for (i=0; i<arrayTemp.length; i++) {
		arrayTemp[i].style.fontSize = currZoom +"%";
	}
}

function ScreenZoomIn() {
	var doc = document.body;
//	doc = document.getElementById("wrap");
 
	if (isNaN(doc.style.zoom) || "undefined" == doc.style.zoom || doc.style.zoom == 0) {
		doc.style.zoom = 1.05;
	}
	else { doc.style.zoom *= 1.05; }
}

function ScreenZoomOut() {
	var doc = document.body;
//	doc = document.getElementById("wrap");
 
	if (doc.style.zoom != 1) { doc.style.zoom /= 1.05; }
}
 
function ZoomIn() {
	if(user_browser().firefox || user_browser().netscape) {
		screen_zoom("zoomin");
	}
	else { ScreenZoomIn(); 
	}
}
 
function ZoomOut() {
	if(user_browser().firefox || user_browser().netscape) {
		screen_zoom("zoomout");
	}
	else { ScreenZoomOut(); 
	}
}

function changeLang(v) {
	var f=document.langform;
	f.lang.value=v;
	f.submit();
}


/************************************************************************
(1) 개요			:  WindowMedia Player 
(2) 파라미터값		:  
(3) 리턴값			:  
************************************************************************/
function cf_Mediaplayer()
{
}


/************************************************************************
(1) 개요			:  Silverlight Player II
(2) 파라미터값		:  
(3) 리턴값			:  531, 298
************************************************************************/
function cf_SilverlightPlayer(url, width, height, Content, mainSub)
{
    var str = "";
	str = '<object id="SongpaMediaPlayer" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="'+ width +'" height="'+ height +'" title="'+Content+'">';
    str += '<param name="source" value="/common/silverlight/VideoPlayer.xap"/>';
    str += '<param name="onError" value="onSilverlightError" />';
    str += '<param name="background" value="white" />';
    str += '<param name="initParams" value="cc=true,markers=true,markerpath=,m='+url+'" />';
    str += '<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">';
    str += '<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Microsoft Silverlight 다운로드" style="border-style:none"/>';
    str += '</a>';
    str += '</object>';
    str += '<iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>';
	
    document.write(str);
}

/************************************************************************
(1) 개요			:  동영상 플레이어 전체
(2) 파라미터값		:  
(3) 리턴값			:  531, 298
************************************************************************/
function cf_VodPlayer(url, width, height, Content, mainSub)
{
    var str = "";
    str += '<object id="SongpaMediaPlayer" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="'+width+'" height="'+height+'" title="'+Content+'">';
    str += '<param name="source" value="/common/silverlight/VideoPlayer.xap"/>';
    str += '<param name="onError" value="onSilverlightError" />';
    str += '<param name="background" value="white" />';
    str += '<param name="initParams" value="cc=true,markers=true,markerpath=,m='+url+'" />';
    str += '<param name="minRuntimeVersion" value="3.0.40624.0" />';
    str += '<param name="autoUpgrade" value="true" />';
    str += '';

	if(user_browser().msie == true)
	{
	    str += '<div id="showvodplayer" style="position:absolute;top:0px;left:'+(0+mainSub)+'px;z-index:10;width:200px;height:140px;"></div>';	
		str += '<!--[if IE]>';
	    str += '<object title="Silverlight MediaPlayer를 설치하면 종로구의 생생한정보를 고화질로 즐기실 수 있습니다." id="oMediaPlayer" name="oMediaPlayer" width="'+width+'" height="'+(height)+'" style="z-index:1" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">';
	    str += '<param name="filename" value="'+url+'" />';
	    str += '<param name="animationatstart" value="0" />';
	    str += '<param name="autostart" value="0" />';
		str += '<param name="Mute" value="0" />';
		str += '<param name="PreviewMode" value="1" />';
	    str += '<param name="balance" value="0" />';
	    str += '<param name="currentmarker" value="0" />';
	    str += '<param name="currentPosition" value="0" />';
	    str += '<param name="displaymode" value="0" />';
	    str += '<param name="enablecontextmenu" value="0" />';
	    str += '<param name="enabled" value="1" />';
	    str += '<param name="fullscreen" value="0" />';
	    str += '<param name="invokeurls" value="1" />';
	    str += '<param name="PlayCount" value="1" />';
	    str += '<param name="rate" value="1" />';
	    str += '<param name="showcontrols" value="1" />';
	    str += '<param name="showstatusbar" value="0" />';
	    str += '<param name="stretchtofit" value="1" />';
	    str += '<param name="transparentatstart" value="1" />';
	    str += '<param name="uimode" value="FULL" />';
	    str += '<param name="displaybackcolor" value="0" />';
	    str += '<param name="volume" value="100" />';
	    str += '종로구청 동영상 플레이어';
	    str += '</object>';
		str += '<![endif] -->';

		str += '<script type="text/javascript">';
		str += 'var Chk = Silverlight.isInstalled("3.0");'
		str += 'if(user_browser().msie == true && user_browser().version == "6.0" && Chk == true)';
		str += '{document.getElementById("oMediaPlayer").style.display = "none";}';
		str += '</script>';

	}
	else
	{
		str += '<!--[if !IE]> <-->';
	    str += '<object title="종로구청 동영상 플레이어" id="oMediaPlayer" type="application/x-ms-wmp" width="'+width+'" height="'+(height)+'" data="'+url+'">';
	    str += '<param name="filename" value="'+url+'" />';
	    str += '<param name="animationatstart" value="1" />';
	    str += '<param name="autostart" value="0" />';
	    str += '<param name="balance" value="0" />';
	    str += '<param name="currentmarker" value="0" />';
	    str += '<param name="currentPosition" value="0" />';
	    str += '<param name="displaymode" value="4" />';
	    str += '<param name="enablecontextmenu" value="0" />';
	    str += '<param name="enabled" value="1" />';
	    str += '<param name="fullscreen" value="0" />';
	    str += '<param name="invokeurls" value="1" />';
	    str += '<param name="PlayCount" value="1" />';
	    str += '<param name="rate" value="1" />';
	    str += '<param name="showcontrols" value="1" />';
	    str += '<param name="showstatusbar" value="0" />';
	    str += '<param name="stretchtofit" value="1" />';
	    str += '<param name="transparentatstart" value="1" />';
	    str += '<param name="uimode" value="FULL" />';
	    str += '<param name="displaybackcolor" value="0" />';
	    str += '<param name="Volume" value="0" />';
	    str += '<p style="z-index:30; position:absolute;left:0; bottom:10px; width:100%; text-align:center;"><span class="button black strong"><a href="/common/wmpfirefoxplugin.exe" target="_blank">파이어폭스용 윈도우 미디어 플레이어 프로그램 다운로드</a></span></p>';
	    str += '<script type="text/javascript">document.getElementById("showvodplayer").style.display = "none";</script>';
	    str += '</object>';
	    str += '<script type="text/javascript">document.getElementById("oMediaPlayer").style.zIndex = "20";</script>';
		str += '<!--><![endif]-->';
	}
	
    str += '<div id="divSilverlightdownload" style="z-index:20;position:absolute;left:0;top:0;">';
    str += '<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">';
    str += '<img src="/images2010/silverlight_'+mainSub+'.gif" alt="Silverlight MediaPlayer를 설치하면 종로구의 생생한정보를 고화질로 즐기실 수 있습니다." style="border-style:none"/>';
    str += '</a>';
    str += '</div>';

    str += '</object>';
    str += '<iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>';
	
	str += '';
	
    document.write(str);
}


