
function live_popup(f_live) {

	if (f_live == "flash") {
	    var win_open = window.open('/KO/Media/Viewer/FmsLive.asp?live='+f_live,'fms','left=0,top=0,width=400,height=300,scrollbars=no,status=no,resizable=no');
	} else {
	    var win_open = window.open('/KO/Media/Viewer/LiveFile.asp?live='+f_live,'fms','left=0,top=0,width=400,height=300,scrollbars=no,status=no,resizable=no');
	} 
	win_open.focus();
	
}

function live_popup_24h(f_live) {

        var win_open = window.open('/KO/Media/Viewer/Live24File.asp?live='+f_live,'fms','left=0,top=0,width=400,height=300,scrollbars=no,status=no,resizable=no');
	win_open.focus();
	
}


function live_p2p() {

        var win_open = window.open('/KO/Media/p2p/MANMIN_Kor.html','p2p','left=0,top=0,width=790,height=800,scrollbars=yes,status=no,resizable=no');
	win_open.focus();
	
}

function live_p2p_cn() {

        var win_open = window.open('/KO/Media/p2p/MANMIN_Chi.html','p2p','left=0,top=0,width=790,height=800,scrollbars=yes,status=no,resizable=no');
	win_open.focus();
	
}
	
function hd_open(nFileNum) {
    vod_win = window.open('/KO/Media/Viewer/hd_popup.asp?FileNum='+nFileNum,'vod','left=0,top=0,width=1024,height=768,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes');
    vod_win.focus();
}

function hd_open_time(nTimeNum,nFileNum) {
    vod_win = window.open('/KO/Media/Viewer/hd_popup.asp?FileNum='+nFileNum+'&TimeNum='+nTimeNum,'vod','left=0,top=0,width=1024,height=768,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes');
    vod_win.focus();
}

function fms_popup(f_nm){

        if (f_nm ==107239999 ) { //Ã¢¸³27ÁÖ³â HD
            hd_open()	
        } else {
	    window.open('/KO/Media/Viewer/fms.asp?PlayType=fms&FileNum='+f_nm,'fms','left=0,top=0,width=1024,height=700,status=no,scrollbars=no,resizable=no');
	}
	
	
}

function media_Open_main( f_nm , speed )
{
	var mediaVOD_player = window.open('/KO/Media/Viewer/fms.asp?PlayType=fms&FileNum='+f_nm+"&Speed="+speed,'fms','left=0,top=0,width=1024,height=700,status=no,scrollbars=no,resizable=no');
	mediaVOD_player.focus();
}

function zzim_popup(f_nm) {
    	window.open('/KO/Media/Viewer/fms.asp?PlayType=fms&ZzimCatg=day&ZzimNum=' + f_nm, 'fms', 'left=0,top=0,width=1024,height=700,status=no,scrollbars=no,resizable=no');
}

function zzim_popup2(f_nm) {
    	window.open('/KO/Media/Viewer/fms.asp?PlayType=fms&ZzimCatg=new&ZzimNum=' + f_nm, 'fms', 'left=0,top=0,width=1024,height=700,status=no,scrollbars=no,resizable=no');
}

function zzim_popup3(f_nm) {
    	window.open('/KO/Media/Viewer/fms.asp?PlayType=fms&ZzimCatg=week&ZzimNum=' + f_nm, 'fms', 'left=0,top=0,width=1024,height=700,status=no,scrollbars=no,resizable=no');
}


function daum_Open()
{
	//var mediaVOD_player = window.open("../Media/DaumLiveFile.asp",'mediaDaum','left=50,top=50,width=640,height=550,status=yes,scrollbars=no,resizable=no');
	//mediaVOD_player.focus();
	var mediaVOD_player = window.open("/KO/Media/Viewer/daumlive.html",'mediaDaum','left=0,top=0,width=640,height=550,status=yes,scrollbars=no,resizable=no');
	mediaVOD_player.focus();
}


function daum_Open2(mLang)
{
	var mediaVOD_player = window.open(mLang+"/Media/DaumLiveFile.asp",'mediaDaum','left=50,top=50,width=640,height=565,status=yes,scrollbars=no,resizable=no');
	mediaVOD_player.focus();
}

// flash live
function media_flive_Open(mArg)
{
	var mediaLive = window.open("../../Media/Viewer/FmsLive.asp?live="+mArg,'fms','left=0,top=0,width=400,height=300,status=no,scrollbars=no,resizable=no');
	mediaLive.focus();
}

// normal live
function media_live_Open(mArg,mPlayType,mServer)
{	
	var mediaVOD_player = window.open("../../Media/Viewer/LiveFile.asp?live="+mArg+'&playtype='+mPlayType+'&mServer='+mServer,'fms','left=0,top=0,width=400,height=300,status=no,scrollbars=no,resizable=no');
	mediaVOD_player.focus();
}

function media_live_Open4(mLang,mArg)
{
	var mediaVOD_player = window.open(mLang+"/Media/LiveFile.asp?mBroadArg="+mArg,'mediaVOD','left=50,top=50,width=798,height=514,status=yes,scrollbars=no,resizable=no');
	mediaVOD_player.focus();
}

function media_flive_Open4(mLang,mArg)
{
	var mediaVOD_player = window.open(mLang+"/Media/FLiveFile.asp?mBroadArg="+mArg,'mediaVOD','left=50,top=50,width=889,height=575,status=yes,scrollbars=no,resizable=no');
	mediaVOD_player.focus();
}



/* À©µµ¿ì ¹Ìµð¾î ÇÃ·¹ÀÌ¾î »ç¿ë½Ã : ´º½º(VodTime) ÆË¾÷*/
function news_Open(TimeNum)
{
	try {
	//var network = window.open("../Media/news_default.asp?TimeNum="+TimeNum,'news'+TimeNum,'width=700,height=510,status=yes,scrollbars = no,resizable=yes');
	
	var network = window.open("../Media/VodTime.asp?TimeNum="+TimeNum,'news','left=50,top=50,width=700,height=450,status=yes,scrollbars = no,resizable=no');
	network.focus();
	}catch(e){}
}

/* À©µµ¿ì ¹Ìµð¾î ÇÃ·¹ÀÌ¾î »ç¿ë½Ã : ÇÁ·Î±×·¥  */
function media_vod_Open( filenum)
{	
	var vodfile_player = window.open("../Media/default.asp?FileNum="+filenum,'pgm','width=680,height=410,status=yes,scrollbars = no,resizable=no');
	vodfile_player.focus();
}

/* À©µµ¿ì ¹Ìµð¾î ÇÃ·¹ÀÌ¾î »ç¿ë½Ã : VODFile */
function media_Open( f_nm , speed , playtype )
{
	var mediaVOD_player = window.open('/KO/Media/Viewer/fms.asp?PlayType='+playtype+'&FileNum='+f_nm+"&Speed="+speed,'fms','left=0,top=0,width=1024,height=700,status=no,scrollbars=no,resizable=no');
	mediaVOD_player.focus();
}

function media_Album_Open( cat_seq , speed , playtype, c_type )
{
	var mediaVOD_player = window.open('/KO/Media/Viewer/fms.asp?PlayType='+playtype+'&cat_seq='+cat_seq+'&Speed='+speed+'&c_type='+c_type,'fms','left=0,top=0,width=743,height=545,status=no,scrollbars=no,resizable=no');
	mediaVOD_player.focus();
}

function favorite_save( cat_seq , t_no )
{
	//var open_win = window.open('/KO/Media/saveFavoriteList_open.asp?cat_seq='+cat_seq,'album','left=0,top=0,width=380,height=190,status=no,scrollbars=no,resizable=no');
	ifr_favorite.location.href = '/KO/Media/saveFavoriteList_ifr.asp?cat_seq='+cat_seq+"&t_no="+t_no;
	
}

function album_save( cat_seq )
{
	var yn = confirm("¼±ÅÃÇÏ½Å ¾Ù¹üÀ» °¡Á®¿À½Ã°Ú½À´Ï±î?");
	if (yn) {
	    var open_win = window.open('/KO/Media/saveMyList_open.asp?cat_seq='+cat_seq,'album','left=0,top=0,width=380,height=190,status=no,scrollbars=no,resizable=no');
	    open_win.focus();
	}
}

function media_Open_root( filenum , speed, lang_root)
{
	var mediaVOD_player = window.open(lang_root + "/Media/VodFile.asp?FileNum="+filenum+"&Speed="+speed,'mediaVOD','left=50,top=50,width=320,height=313,status=yes,scrollbars=no,resizable=no');
	mediaVOD_player.focus();
}	

function media_Open_mission( filenum , servicenum, speed, mission_yn )
{
	var mediaVOD_player = window.open("/KO/Media/Viewer/fms.asp?FileNum="+filenum+"&ServiceNum="+servicenum+"&Speed="+speed+"&mission_yn="+mission_yn,'mediaVOD','left=50,top=50,width=320,height=313,status=yes,scrollbars = no,resizable=no');
	mediaVOD_player.focus();
}

function media_Open_event( filenum , speed )
{
	var mediaVOD_player = window.open("../Media/VodFileEvent.asp?FileNum="+filenum+"&Speed="+speed,'mediaVOD','left=50,top=50,width=320,height=313,status=yes,scrollbars=no,resizable=no');
	mediaVOD_player.focus();
}

function media_Open_sermon_help( f_nm , speed , playtype, help_seq )
{
	var mediaVOD_player = window.open("/KO/Media/Viewer/fms.asp?PlayType='+playtype+'&FileNum="+f_nm+"&Speed="+speed+"&help_seq="+help_seq,'fms','left=0,top=0,width=1024,height=700,status=no,scrollbars=no,resizable=no');
	mediaVOD_player.focus();
}

/* À©µµ¿ì ¹Ìµð¾î ÇÃ·¹ÀÌ¾î »ç¿ë½Ã : AUDIO */
function media_AudioOpen( AlbumID )
{
	var mediaAudio_player = window.open("../Media/AudioFile.asp?AlbumID="+AlbumID,'mediaAUDIO','width=400,height=500,status=yes,scrollbars = no,resizable=no');
	mediaAudio_player.focus();
}


/* À©µµ¿ì ¹Ìµð¾î ÇÃ·¹ÀÌ¾î »ç¿ë½Ã : VodTime  */
function media_vod_Open2(timenum, f_nm, playtype, p_codenum)
{	
	var mediaVOD_player = window.open('/KO/Media/Viewer/fms.asp?PlayType='+playtype+'&FileNum='+f_nm+"&timenum="+timenum+"&p_codenum="+p_codenum,'fms','left=0,top=0,width=1024,height=800,status=no,scrollbars=no,resizable=no');
	mediaVOD_player.focus();
}

function media_vod_Open3(timenum, filenum)
{	
	var vodtime_player = window.open("../Media/VodFile.asp?TimeNum="+timenum+"&FileNum="+filenum,'mediaVOD','left=50,top=50,width=0,height=0,status=yes,scrollbars = no,resizable=no');
	vodtime_player.focus();
}

function media_vod_Open2_main(timenum, filenum)
{	
	var vodtime_player = window.open("../Media/VodFile.asp?TimeNum="+timenum+"&FileNum="+filenum,'mediaVOD','left=50,top=50,width=0,height=0,status=yes,scrollbars = no,resizable=no');
	vodtime_player.focus();
}


/* ÇÃ·¡½¬ »ç¿ë½Ã : FlashFile */
function flash_Open( filenum , speed )
{//alert(filenum);
	var flash_player = window.open("../../Media/FlashFile.asp?FileNum="+filenum+"&Speed="+speed,'flashVOD','width=720,height=486,status=yes,scrollbars = no,resizable=yes');
	flash_player.focus();
}

/* ÇÃ·¡½¬ »ç¿ë½Ã : FlashFile */
function flashData_Open( filenum , speed )
{//alert(filenum);
	var flash_player = window.open("../Media/FlashData.asp?FileNum="+filenum+"&Speed="+speed,'flashVOD','width=720,height=486,status=yes,scrollbars = no,resizable=yes');
	flash_player.focus();
}

/* ÇÃ·¡½¬ °íÈ­Áú */
function fms_vod(tempArg,tempCodeNum) {
    //var flash_player = window.open('../../Media/fms_live.asp?FileNum='+tempArg + '&CodeNum=' + tempCodeNum,'flashHighVOD','left=10,top=10,width=843,height=774,toolbar=no,location=no,status=yes,menubar=no,scrollbars=no,resizable=no');
    var flash_player = window.open('../../Media/fms_live.asp?FileNum='+tempArg + '&CodeNum=' + tempCodeNum,'flashHighVOD','left=10,top=10,width=853,height=809,toolbar=no,location=no,status=yes,menubar=no,scrollbars=no,resizable=no');
    flash_player.focus();
}


/* ¸¸¹Î³×Æ®¿÷ »ç¿ë½Ã*/
function network_Open()
{
	try {
	var network = window.open("../Church/default.asp",'network','width=770,height=570,status=yes,scrollbars=yes,resizable=yes');
	network.focus();
	}catch(e){}
}

/* ÈÄ¿øÆË¾÷ »ç¿ë½Ã*/
function offering_Open()
{
	try {
	var offering = window.open('../Event/offering/form.asp','mission','width=550,height=720,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no')
	offering.focus();
	}catch(e){}

	
}

var g_LANG_DIR = "/KO"; 
try { 
	g_LANG_DIR = document.URL.substring( parseURL(0).length, parseURL(1).length );
	g_LANG_DIR = g_LANG_DIR.toUpperCase().substring(0,3);
	
}catch(e){}

function parseURL(u_Cnt)
{
	var openURL = "";
	var tmStr = "";
	var tmCnt = -2;
	
	var cURL = document.URL;

	for (var i=0; i<cURL.length; i++)
	{
		if(cURL.substring(i, i+1) == "/")
		{
			openURL += tmStr;
			tmStr = "";
			
			if(tmCnt >= u_Cnt && u_Cnt > -1) break;
			
			tmCnt++;
		}

		tmStr += cURL.substring(i, i+1);
	}

	return openURL;
}

function WritePageList()
{
	
	try 
	{	
		//alert( PageSize + "   "+ TotalRow );
		if (PageListArea) 
		{
			if (TotalRow > 1 )
			{
				var tm = parseInt(TotalRow/PageSize) ;								
				tm = (TotalRow%PageSize) > 0 ? tm+1 : tm ;
				PageListArea.innerHTML = getPageList( "gotoPage", NowPage, tm, TotalRow ) ;
				//PageListArea.innerHTML = _getPageList( "gotoPage", NowPage, PageSize, TotalRow ) ;
			}
		}

  		if (PageListArea) {
  			
  			var tmN = ( NowPage * PageSize) < TotalRow ?  PageSize :(( ((NowPage-1) * PageSize) - TotalRow)*-1) ;
  			
  			var tmPage =  "<b><font color='#9A9292'>Total:</font><font color='#FF8643'>"+TotalRow +"</font></b>&nbsp;<b><font color='#9A9292'>Current:</font><font color='#FF8643'>"+tmN +"</font></b>";  			
  			//PageInfoArea.innerHTML =  tmPage;
  			
  			tmPage = "";
			tmPage = (TotalPage ==0 ) ? tmPage+ "" : tmPage  + " <span>[<strong>"+NowPage +"</strong></strong>/" + TotalPage+"]</span>";
			PageListArea.innerHTML += "&nbsp;&nbsp;"+tmPage ;
		}	
	}
	catch(e)
	{
		//alert (' Error Page Info ');
	}
	
}


var mPopup = "";


function getPageList( FunctioName,  NowPage, TotalPage, TotalRow) 
{
	
	if (mGubun=='WORLDMISSION') {
	
		imgArrowLeft1  = "btn3_arrow_left1.jpg";   //¿ÞÂÊ
		imgArrowRight1 = "btn3_arrow_right2.jpg"; //¿À¸¥ÂÊ
		
		imgArrowLeft2 = "btn3_arrow_left.jpg";    //¸Ç¿ÞÂÊ
		imgArrowRight2 = "btn3_arrow_right1.jpg"; //¸Ç¿À¸¥ÂÊ
		
		var imgURL = "../";
	
	} else if (mGubun=='VIEWER' || mGubun=='COMMUNITY' || mGubun=='INTRODUCTION' || mGubun=='SEARCH') {
	
		imgArrowLeft1  = "btn2_arrow_left1.gif";  //¿ÞÂÊ
		imgArrowRight1 = "btn2_arrow_right1.gif"; //¿À¸¥ÂÊ
		
		imgArrowLeft2 = "btn2_arrow_left.gif";    //¸Ç¿ÞÂÊ
		imgArrowRight2 = "btn2_arrow_right2.gif"; //¸Ç¿À¸¥ÂÊ	
		
		var imgURL = "";
	
	}

	else {
	
		imgArrowLeft1  = "btn2_arrow_left1.gif";  //¿ÞÂÊ
		imgArrowRight1 = "btn2_arrow_right1.gif"; //¿À¸¥ÂÊ
		
		imgArrowLeft2 = "btn2_arrow_left.gif";    //¸Ç¿ÞÂÊ
		imgArrowRight2 = "btn2_arrow_right2.gif"; //¸Ç¿À¸¥ÂÊ	
		
		var imgURL = "../";
	
	}
	
	
        // added by Joshua 2009.02.14
	if (mPopup == "FMS_MEDIA") {
	    i_KeyVal = 5;    // 5ÆäÀÌÁö¾¿¸¸ º¸¿©ÁÜ (°íÈ­Áú ºä¾î)
	} else {
	    i_KeyVal = 10;
	}
	
	
	if (TotalPage < 1)
		return "";
	var str ="";
	var KeyVal = i_KeyVal;
	var StartPageNum =1 ;
	
	//try {
		if (NowPage >=KeyVal) 
		{
			if ( parseInt(NowPage%KeyVal) == 0 ) { // ¿¹)10ÀÇ ¹è¼ö
				StartPageNum = parseInt(NowPage - (i_KeyVal-1)) ;
			} else {
				StartPageNum = (NowPage < KeyVal) ? NowPage :  (parseInt(NowPage/KeyVal) *i_KeyVal +1)  ;
			}
		}
		
		var EndPageNum = (StartPageNum + KeyVal - 1) < TotalPage ? (StartPageNum + KeyVal - 1) : TotalPage ;
		
		if ( EndPageNum > 1 )
		{
					
			for (var i=StartPageNum ; i <= EndPageNum ;  i++)	
			{     
				if (NowPage == i)			
				   str +=  "<a href=javascript:"+FunctioName+"("+i+") class=sect>"+i+"</a> " ;				
				else
				   str +=  "<a href=javascript:"+FunctioName+"("+i+")>"+i+"</a> " ;
			}
		
			if ( StartPageNum > i_KeyVal ) 
			str =  "<a href=javascript:"+FunctioName+"("+parseInt(StartPageNum-1)+") ><img src='"+ imgURL +"../Common/img/btn/"+ imgArrowLeft1 +"' width='10' height='10' border='0'></a> " + str ;
			
			if ( EndPageNum < TotalPage ) 
			str =  str + "<a href=javascript:"+FunctioName+"("+parseInt(EndPageNum+1)+") ><img src='"+ imgURL +"../Common/img/btn/"+ imgArrowRight1 +"' width='10' height='10' border='0'></a> " ;
		
			//¸ÇÃ³À½
			if (1 != StartPageNum)			
				str =  "<a href=javascript:"+FunctioName+"(1) ><img src='"+ imgURL +"../Common/img/btn/"+ imgArrowLeft2 +"' width='10' height='10' border='0'></a>&nbsp;" + str ;
			else
				str =  "<img src='"+ imgURL +"../Common/img/btn/"+ imgArrowLeft2 +"' width='10' height='10' border='0'>&nbsp;" + str ;
			//¸Ç³ªÁß
			if (TotalPage != EndPageNum)						
				str =  str + "   <a href=javascript:"+FunctioName+"("+TotalPage+") ><img src='"+ imgURL +"../Common/img/btn/"+ imgArrowRight2 +"' width='10' height='10' border='0'></a>" ;
			else
				str =  str + "   <img src='"+ imgURL +"../Common/img/btn/"+ imgArrowRight2 +"' width='10' height='10' border='0'>" ;
		}

	//}catch(e){ }
	return  str;
}
function _getPageList( FunctioName,  NowPage, PageSize, TotalRow) 
{
//<input type="hidden" name="NowPage" value="1">
//<input type="hidden" name="PageSize" value="5">
//<input type="hidden" name="TotalRow" value="11">

	if (PageSize < 1)
		return "";
	var str ="";
	
	
        // added by Joshua 2009.02.14
	if (mPopup == "FMS_MEDIA") {
	    i_KeyVal = 5;    // 5ÆäÀÌÁö¾¿¸¸ º¸¿©ÁÜ (ÇÃ·¡½Ã °íÈ­Áú ºä¾î)
	} else {
	    i_KeyVal = 10;
	}	
	
	
	var KeyVal = i_KeyVal ;
	
	
	var StartPageNum =1 ;
	try {
		if (NowPage >=KeyVal) 
		{
			if ( parseInt(NowPage%KeyVal) == 0 ) // ¿¹)10ÀÇ ¹è¼ö
				//StartPageNum = parseInt(NowPage - 9) ;
				StartPageNum = parseInt(NowPage - i_KeyVal-1) ;
			else
				//StartPageNum = (NowPage < KeyVal) ? NowPage :  (parseInt(NowPage/KeyVal) *10 +1)  ;
				StartPageNum = (NowPage < KeyVal) ? NowPage :  (parseInt(NowPage/KeyVal) *i_KeyVal +1)  ;
		}
		
		var TotalPage = parseInt(TotalRow / PageSize ) ;		
		TotalPage = ( TotalRow % PageSize  ) > 0 ? TotalPage + 1 : TotalPage ;
		
		var EndPageNum = TotalPage ;
		if ( TotalPage > 1 )
		{
			for (var i=StartPageNum ; i <= EndPageNum ;  i++)	
			{     
				if (NowPage == i)			
					str +=  "<a  href=javascript:"+FunctioName+"("+i+") class=PAGE><b><font color='#FF8643' size='3'>"+i+"&nbsp;</font></b></a> " ;				
				else
				str +=  "<a href=javascript:"+FunctioName+"("+i+") class=PAGE>"+i+"&nbsp;</a> " ;		
			}		
		
		
			//ÀÌÀü ÆäÀÌÁö
			if (NowPage == 1)
				str =  "<img src='../Common/img/btn_pre_gray.gif' width='10' height='10' border='0'> " + str ;
			else
				str =  "<a title='Previous' href=javascript:"+FunctioName+"("+(parseInt(NowPage)-1)+") class=PAGE1><img src='../Common/img/btn_pre.gif' width='10' height='10' border='0'></a> " + str ;
			
			//´ÙÀ½ ÆäÀÌÁö
			if (NowPage == TotalPage)
				str =  str + "<img src='../Common/img/btn_next_gray.gif' width='10' height='10' border='0'> " ;
			else
				str =  str + "<a title='Next' href=javascript:"+FunctioName+"("+(parseInt(NowPage)+1)+") class=PAGE1><img src='../Common/img/btn_next.gif' width='10' height='10' border='0'></a> " ;
			
			//¸ÇÃ³À½
			if (NowPage == 1)
				str =  "<img src='../Common/img/btn_first_gray.gif' width='10' height='10' border='0'>&nbsp;" + str ;
			else
				str =  "<a href=javascript:"+FunctioName+"(1) class=PAGE1><img src='../Common/img/btn_first.gif' width='10' height='10' border='0'></a>&nbsp;" + str ;
			
			//¸Ç³ªÁß
			if (NowPage == TotalPage)
				str =  str + "<img src='../Common/img/btn_final_gray.gif' width='10' height='10' border='0'>" ;
			else
				str =  str + "<a href=javascript:"+FunctioName+"("+TotalPage+") class=PAGE1><img src='../Common/img/btn_final.gif' width='10' height='10' border='0'></a>" ;
		}

	}catch(e){ }
	return  str;	
}



function WritePageMiniList()
{
	try 
	{	
		
		if (PageListArea) 
		{
			if (TotalRow > 1 )
			{
				var tm = parseInt(TotalRow/PageSize) ;								
				tm = (TotalRow%PageSize) > 0 ? tm+1 : tm ;
				PageListMiniArea.innerHTML = getPageMiniList( "gotoMiniPage", NowPage, tm, TotalRow ) ;				
			}
		}

  		if (PageListArea) {
  			
  			var tmN = ( NowPage * PageSize) < TotalRow ?  PageSize :(( ((NowPage-1) * PageSize) - TotalRow)*-1) ;
  			
  			var tmPage;
  			
  			tmPage = "";
			tmPage = (TotalPage ==0 ) ? tmPage+ "" : tmPage  + " [<b><font color='#FF8643' size='2'>"+NowPage +"</font></b>/" + TotalPage+"]"; 			
			PageListMiniArea.innerHTML += "&nbsp;&nbsp;"+tmPage ;
		}	
	}
	catch(e)
	{
		alert (' Error Page Info ');
	}
}


function getPageMiniList( FunctioName,  NowPage, TotalPage, TotalRow) 
{
	if (TotalPage < 1)
		return "";
	var str ="";
	var KeyVal = 10 ;
	var StartPageNum =1 ;
	
	try {
		if (NowPage >=KeyVal) 
		{
			if ( parseInt(NowPage%KeyVal) == 0 ) // ¿¹)10ÀÇ ¹è¼ö
				 StartPageNum = parseInt(NowPage - 9) ;
			else
				StartPageNum = (NowPage < KeyVal) ? NowPage :  (parseInt(NowPage/KeyVal) *10 +1)  ;
		}
		
		var EndPageNum = (StartPageNum + KeyVal - 1) < TotalPage ? (StartPageNum + KeyVal - 1) : TotalPage ;
		
		if ( EndPageNum > 1 )
		{
			if ( StartPageNum > 10 ) 
			str =  "<a href=javascript:"+FunctioName+"("+parseInt(StartPageNum-1)+") class=PAGE1><img src='../Common/img/btn_pre.gif' width='10' height='10' border='0'></a> " + str ;
			
			if ( EndPageNum < TotalPage ) 
			str =  str + "<a href=javascript:"+FunctioName+"("+parseInt(EndPageNum+1)+") class=PAGE1><img src='../Common/img/btn_next.gif' width='10' height='10' border='0'></a> " ;		
			
		}

	}catch(e){ }
	return  str;
}


/* Ã¼Å© ¹Ú½º ¼±ÅÃ*/
function CheckAll(form, objName)
{//alert(objName);
	if (!form[objName])
	return ;
	
	if ( form[objName].length > 1 )
	{
		var tmChk = !(form[objName][0].checked);
		for(var i=0; i <form[objName].length; i++)
		{
			form[objName][i].checked = tmChk ;
		}
	}
	else
	{
		form[objName].checked = !(form[objName].checked);
	}
	
	CheckEach( form, objName ) ;
}

function CheckEach( form, objName )
{
	try {
		var tmCnt = parseInt( Check_Count(form, objName) ) ;
		if (tmCnt > 1 )
			AllViewButtonArea.style.display = 'block';
		else {		
			AllViewButtonArea.style.display = 'none';
			form.AllChk.checked = false;
		}
	}catch(e){}
}
function Check_Count(form, objName)
{
	if (!form[objName])
	return -1;
	
	var cnt = 0;
	if ( form[objName].length > 1 )
	{
		for(var i=0; i <form[objName].length; i++)
		{
			if (form[objName][i].checked)
				cnt ++;
		}
	}
	else
	{
		if ( form[objName].checked )
			cnt ++;
	}
	
	return cnt;
}

function OnMoreArea(idx)
{
//alert(MoreArea.length);
//idx = document.PageForm.PageSize.value * ( document.PageForm.NowPage.value -1) ;

	try {
				if (MoreArea.length >1)
				{
						if (idx ==-1)//all
						{
							for(var i=0; i<MoreArea.length; i++)
							{
								if ( MoreArea[i].style.display =='none')
									MoreArea[i].style.display ='block';
								else
									MoreArea[i].style.display ='none';
							}
						}
						else
						{
							if ( MoreArea[idx].style.display =='none')
								MoreArea[idx].style.display ='block';
							else
								MoreArea[idx].style.display ='none';
						}
				}
				else
				{
						if (idx ==-1)//all
						{
							if ( MoreArea.style.display =='none')
								MoreArea.style.display ='block';
							else
								MoreArea.style.display ='none';
								
							/*for(var i=0; i<MoreArea.length; i++)
							{
								if ( MoreArea.style.display =='none')
									MoreArea.style.display ='block';
								else
									MoreArea.style.display ='none';
							}*/
						}
						else
						{
							if ( MoreArea.style.display =='none')
								MoreArea.style.display ='block';
							else
								MoreArea.style.display ='none';
						}
				}
	}catch(e){ alert(idx + 'more' + MoreArea.length);}
}



/* ÄíÅ° °ü·Ã ÇÔ¼ö */
function delCookie(name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function setCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}


function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function getCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

/* ÆùÆ® °ü·Ã ÇÔ¼ö */
var view_fontSize = 12 ;

//try {	view_fontSize = parseInt(getCookie("view_fontSize")); }catch(e){}

function initFont() { 

	if ( (view_fontSize < 12) || (view_fontSize > 20) || (isNaN(view_fontSize) == true)) {
		view_fontSize = 12;	
	}

	setFont(view_fontSize);
}

function setFont(view_fontSize) { 	
	
	try {	
		if (viewBody.length > 1 ) {
			for (var i=0; i< viewBody.length ; i++)
				viewBody[i].style.fontSize = view_fontSize+"px";
				viewBody[i].style.lineHeight = (6+parseInt(view_fontSize))+"px";	
				
		}
		else
		{
			document.getElementById("viewBody").style.fontSize = view_fontSize+"px";
			document.getElementById("viewBody").style.lineHeight = (6+parseInt(view_fontSize))+"px";
		
		}				
		setFontCookie(view_fontSize);
		
	}catch(e){
		document.getElementById("viewBody").style.fontSize = view_fontSize+"px";	
		document.getElementById("viewBody").style.lineHeight = (6+parseInt(view_fontSize))+"px";
		setFontCookie(view_fontSize);
	}
}	

function setFontCookie(view_fontSize)
{
	var expiry = new Date();
	var path = "/";
	var domain = ".manmintv.org";
	var secure = "";


	expiry.setTime(expiry.getTime() + 90 * (24 * 60 * 60 * 1000));

	setCookie("view_fontSize",view_fontSize,expiry,path,domain,secure);
}	

function fontPlus() {		
	
	if (view_fontSize < 17) {
		view_fontSize = view_fontSize + 1; 		
		setFont(view_fontSize); 
	}
}

function fontMinus() {
	if (view_fontSize > 9) {
		view_fontSize = view_fontSize - 1; 
		setFont(view_fontSize); 
	}
}	

function print()
{
	//alert( document.getElementById("viewBody").innerHTML);
	try{
	
	var newWin = window.open("../Common/print.htm", "", "width=820,height=400,scrollbars=yes,resizable=yes");
	
	}catch(e){alert(' Print Failed' );}
	
}


function print2()
{
	
	//alert( document.getElementById("PrintArea_Body").innerHTML);
	try{
	
	var newWin = window.open("../../Common/print.htm", "", "width=820,height=600,scrollbars=yes,resizable=yes");
	
	}catch(e){alert(' Print Failed' );}
	
}


function print3()
{
	
	//alert( document.getElementById("PrintArea_Body").innerHTML);
	try{
	
	var newWin = window.open("../Common/print.htm", "", "width=820,height=600,scrollbars=yes,resizable=yes");
	
	}catch(e){alert(' Print Failed' );}
	
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenu2(targ,selObj,restore){ //v3.0
  location.href="board.asp?head_title=" + selObj.options[selObj.selectedIndex].value;
  //eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function openwin_bible() {
  window.open('http://manmintv.co.kr/bible/','bible','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=50, top=50, width=680,height=560');
}

function openwin_ebible() {
  window.open('http://manmintv.co.kr/ebible/','bible','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=50, top=50, width=680,height=560');
}

function gallery_open_main(tempFlag) {
    //var photo_gallery = window.open('../Gallery/gallery.asp?'+tempFlag,'gallery','width=820,height=780,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no');
    var photo_gallery = window.open('../Gallery/gallery.asp?'+tempFlag,'gallery','width=1024,height=740,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
    photo_gallery.focus();
}

function gallery_open(tempFlag) {
    var photo_gallery = window.open('../../Gallery/gallery.asp?'+tempFlag,'gallery','width=1024,height=740,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
    photo_gallery.focus();
}

function openwin_guide(theURL) {
    window.open(theURL,"01",'width=1000,height=650,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
}

function banner_open1() {
    window.open('../Event/offering/form.asp','mission','width=550,height=720,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
}

function view_banner(nArg) {

     //rb_banner.style.top = document.body.scrollTop + 130;
     if (nArg==1) {
     	show_banner.style.visibility = "visible";
     	show_banner.style.display = "block";
     } else {
     	show_banner.style.visibility = "hidden";
     }

}

function openwin_faq(theURL) {
    window.open(theURL, "faq1", 'width=500,height=290,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
}

function openwin_pod(theURL) {
    window.open(theURL,"ipod",'left=5,top=5,width=574,height=850,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no');
}

/************* Language Selection ***************/
var open_flag = 0;
function open_lang_menu() {
        
	document.getElementById('s_menu2').style.display="block";
}


function open_lang_menu_show() {
	
	document.all('s_menu2').style.display = 'none';
	
}

function open_lang_menu_hide() {
	
	document.all('s_menu2').style.display = 'none';
	
}
/************* Language Selection ***************/


/************* Live Broadcasting ***************/
var open_live_flag = 0;
function open_live_menu() {

	//if (open_live_flag == 0) {
	    document.all('s_live1').style.visibility = 'visible';
	    open_live_flag = 1;
	//} else {
	//    document.all('s_live1').style.visibility = 'hidden';
	//    open_live_flag = 0;
	//}
	
}

function open_live_menu_show() {
	document.all('s_live1').style.visibility = 'visible';
	open_live_flag = 1;
}

function open_live_menu_hide() {
	document.all('s_live1').style.visibility = 'hidden';
	open_live_flag = 0;
}
/************* Live Broadcasting ***************/

function page_login(targetURL) { 

	window.open("/KO/Member/pop_login.asp?nowurl=" + targetURL,"pop_login","width=300,height=230");

}

function win_open_cookie(tempArg) {

	var todayDate = new Date();
	var name = "win_open";
	var value = "open";
	var expires = todayDate.toGMTString();
	
	
	if (tempArg == 1) { // ÆË¾÷Ã¢ ¶ä

		todayDate.setDate( todayDate.getDate() + 0 );
		document.cookie = name + "=" + escape( value ) + "; path=/;";
		
	} else if (tempArg == 2) { // ÆË¾÷Ã¢ ´ÝÈû

		todayDate.setDate( todayDate.getDate() - 1 );
		document.cookie = name + "= " + "; expires=" + todayDate.toGMTString() + "; path=/";
		
	} else {
		
		document.cookie = name + "=" + escape (value) +
		((expires) ? "; expires=" + expires : "");
		
	}	
	
	
	
}


// PhotoGallery ¿¡¼­ »ç¿ë
function sendPhotoSNS(type,msg,nowurl,gubun) {

	var t_type = type;
	var t_msg = msg;
	var t_nowurl = nowurl;
	var gubun;
	
	if (gubun == 'LIST') {
            sendSNS(t_type,t_msg,nowurl);
	} else {

	    var PhotoNum = document.PageForm.PhotoNum.value;
	    var PhotoSeq = document.PageForm.PhotoSeq.value;
	    var s_SectionType = document.PageForm.s_SectionType.value;
	    var cPage = document.PageForm.NowPage.value;
	    t_nowurl = "http://www.manmintv.org/KO/gallery/photo_view.asp?PhotoNum="+PhotoNum+"&page="+cPage+"&PhotoSeq="+PhotoSeq+"&s_SectionType="+s_SectionType;		
	    sendSNS(t_type,t_msg,t_nowurl);
	   
	}
	
}


// ¼³±³µî ¿¡¼­ »ç¿ë
function sendNormalSNS(type,msg,nowurl,gubun) {
	
	var t_type = type;
	var t_msg = msg;
	var t_nowurl = nowurl;
	var gubun;
	
        sendSNS(t_type,t_msg,nowurl);
	
}


// windows media popup¿¡¼­ »ç¿ë
function sendMakeSNS(type,msg,nowurl) {
	
	var t_type = type;
	var t_msg = msg;
	var t_nowurl = nowurl;
	var gubun;
	
        sendSNS(t_type,t_msg,nowurl);

}


// chksong, chksermon ÀÏ¶§ »ç¿ë
function sendCheckSNS(type,msg,nowurl) {
	
	//alert(top.ifr_tp.document.frm1.Media_URL.value);
	
	msg = top.ifr_tp.document.frm1.Media_TITLE.value;
	var chk_value = top.ifr_tp.document.frm1.FileNum.value;
	var nowurl = nowurl + chk_value;
	
	var t_type = type;
	var t_msg = msg;
	var t_nowurl = nowurl;
	var gubun;
	
        sendSNS(t_type,t_msg,nowurl);

}


function sendSNS(type,msg,url) {

	
	/*
	var apiCallUrl = "http://api.bit.ly/v3/shorten"
	               + "?version=2.0.1"
	               + "&login=manmintv"
	               + "&apiKey=R_21a7c463bce6271ade166f02dfeec5a1"
	               + "&callback=?"
	               + "&longUrl="+encodeURIComponent(window.location.href);
	*/
	             
	var apiCallUrl = "http://api.bit.ly/v3/shorten"
	               + "?version=2.0.1"
	               + "&login=manmintv"
	               + "&apiKey=R_21a7c463bce6271ade166f02dfeec5a1"
	               + "&callback=?"
	               + "&longUrl="+encodeURIComponent(url);


	jQuery.getJSON(
	    apiCallUrl,
	    function(data) {
	        if(data.status_txt == "OK") {
	        	var sendUrl;
	        	var shortUrl = data.data["url"];
			
			switch(type) {
				
				
				case "tw":
				 	var href = "http://twitter.com/home?status=" + encodeURIComponent(msg) + " " + encodeURIComponent(shortUrl);
				 	var win = window.open(href, 'twitter', '');
				 	if (win)
				 	{
				  		win.focus();
				 	}	      
				 	break;
				 	
				 case "me":

					var tag = 'MANMIN TV';
					var href = "http://me2day.net/posts/new?new_post[body]=" + encodeURIComponent(msg) + " " + encodeURIComponent(shortUrl) + "&new_post[tags]=" + encodeURIComponent(tag);
				 	var win = window.open(href, 'me2Day', '');
				 	if (win) {
				  		win.focus();
				 	}				 
				 	
				 	break;
				 	
				 case "fa":

					//var href = "http://www.facebook.com/sharer.php?u=" + encodeURIComponent(shortUrl);
					var href = "http://www.facebook.com/sharer.php?u=" + encodeURIComponent(shortUrl) + '&t=' + encodeURIComponent(msg);
				 	var win = window.open(href, 'facebook', '');
				 	if(win) 
				 	{
				  		win.focus();
				 	}				 
				 	break;
				 	
				 case "yo":

					//function YozmDaum(link,prefix,parameter) 
					//{
						
					var link = shortUrl;
					var prefix = msg;
					var parameter = 'MANMIN TV';
						
						var href = "http://yozm.daum.net/api/popup/prePost?link=" + encodeURIComponent(link) + "&prefix=" + encodeURIComponent(prefix) + "&parameter=" + encodeURIComponent(parameter);
					 	var win = window.open(href, 'yozmSend', 'width=466, height=356');
					 	if (win) {
					  		win.focus();
					 	}
					//}
				 
				 	break;
				 	
		 	
		 	
		 	}  	
		
		
		}

	    }

	);
	

}







//Æ®À§ÅÍ °Ô½ÃÇÏ±â
function twitter(msg,url)
{
 	var href = "http://twitter.com/home?status=" + encodeURIComponent(msg) + " " + encodeURIComponent(url);
 	var win = window.open(href, 'twitter', '');
 	if (win)
 	{
  		win.focus();
 	}
}


//ÆäÀÌ½ººÏ °Ô½ÃÇÏ±â
function facebook(url) 
{
	var href = "http://www.facebook.com/sharer.php?u=" + url;
 	var win = window.open(href, 'facebook', '');
 	if(win) 
 	{
  		win.focus();
 	}
}


//¹ÌÅõµ¥ÀÌ °Ô½ÃÇÏ±â
function Me2Day(msg,url,tag) 
{
	var href = "http://me2day.net/posts/new?new_post[body]=" + encodeURIComponent(msg) + " " + encodeURIComponent(url) + "&new_post[tags]=" + encodeURIComponent(tag);
 	var win = window.open(href, 'me2Day', '');
 	if (win) {
  		win.focus();
 	}
}


//´ÙÀ½ ¿äÁò °Ô½ÃÇÏ±â
function YozmDaum(link,prefix,parameter) 
{
	var href = "http://yozm.daum.net/api/popup/prePost?link=" + encodeURIComponent(link) + "&prefix=" + encodeURIComponent(prefix) + "&parameter=" + encodeURIComponent(parameter);
 	var win = window.open(href, 'yozmSend', 'width=466, height=356');
 	if (win) {
  		win.focus();
 	}
}
 

function SNS(t,u,ds,o) {
 	var d = encodeURIComponent(ds);
 	switch (t) {
 		case 't':
  			window.open('http://twitter.com/share?url=' + u + '&text=' + d,o, 'width=600 height=300');
  			break;
 		case 'm':
  			window.open('http://me2day.net/posts/new?new_post[body]=' + d + ' ' + u + '&new_post[tags]=o',o);
  			break;
 		case 'y':
  			window.open('http://yozm.daum.net/api/popup/prePost?prefix=' + d + '&link=' + u,o, 'width=466 height=356');
  			break;
 		case 'f':
  			window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u),o,'resizable=no width=600 height=300');
  			break;
 	}
}


function urlCopy(url) {

	window.clipboardData.setData('Text',url);
	alert("ÁÖ¼Ò°¡ º¹»ç µÇ¾ú½À´Ï´Ù. \nCtrl + V·Î ºÙ¿©³Ö±â ÇÏ¼¼¿ä.");

}


function pdfMake(url,t_sermonnum) {

	var theURL = "/KO/Common/pdfmaking.asp?url="+url+"&t_sermonnum="+t_sermonnum;

	var w_pdf = window.open(theURL, "pdf", 'width=500,height=290,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
	w_pdf.focus();

}


function content_mail(t_txt,t_url,gubun) {

	if (gubun == 'PHOTO_VIEW') {

	    var PhotoNum = document.PageForm.PhotoNum.value;
	    var PhotoSeq = document.PageForm.PhotoSeq.value;
	    var s_SectionType = document.PageForm.s_SectionType.value;
	    var cPage = document.PageForm.NowPage.value;
	    t_url = "http://www.manmintv.org/KO/gallery/photo_view.asp?PhotoNum="+PhotoNum+"&page="+cPage+"&PhotoSeq="+PhotoSeq+"&s_SectionType="+s_SectionType;		
	   
	}
	
	
	var apiCallUrl = "http://api.bit.ly/v3/shorten"
	               + "?version=2.0.1"
	               + "&login=manmintv"
	               + "&apiKey=R_21a7c463bce6271ade166f02dfeec5a1"
	               + "&callback=?"
	               + "&longUrl="+encodeURIComponent(t_url);
	

	jQuery.getJSON(
	    apiCallUrl,
	    function(data) {

	        if(data.status_txt == "OK") {
	        	var sendUrl;
	        	var shortUrl = data.data["url"];
	        	
	
			mailurl = "/KO/Common/content_mail_ko.asp?t_txt="+t_txt+"&t_url="+encodeURIComponent(shortUrl);
			var p_content = window.open(mailurl, 'WinMail','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=0,top=0,width=480,height=370');	
			p_content.focus();
				        	
	        	
		}

	    }

	);	
	

	
}

// chksermon, chksong
function urlCheckCopy(nowurl) {
        
	var chk_value = top.ifr_tp.document.frm1.FileNum.value;
	var nowurl = nowurl + chk_value;
	
	window.clipboardData.setData('Text',nowurl);
	alert("ÁÖ¼Ò°¡ º¹»ç µÇ¾ú½À´Ï´Ù. \nCtrl + V·Î ºÙ¿©³Ö±â ÇÏ¼¼¿ä.");

}

// chksermon, chksong
function content_check_mail(t_txt,t_url) {

	var msg = top.ifr_tp.document.frm1.Media_TITLE.value;
	var chk_value = top.ifr_tp.document.frm1.FileNum.value;
	var nowurl = t_url + chk_value;
	
	mailurl = "/KO/Common/content_mail_ko.asp?t_txt="+msg+"&t_url="+encodeURIComponent(nowurl);
	var p_content = window.open(mailurl, 'WinMail','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=0,top=0,width=602,height=427');	
	p_content.focus();
	
}


function scrap(t_txt,t_url,t_gubun,t_filenum) {
	
	var scrap_url = "/KO/Common/scrap_ko.asp?t_txt="+t_txt+"&t_url="+encodeURIComponent(t_url)+"&t_gubun="+t_gubun+"&t_filenum="+t_filenum;
	var p_scrap = window.open(scrap_url, 'WinScrap','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=0,top=0,width=602,height=427');	
	p_scrap.focus();

	
}





