
/*
	메뉴 링크
*/
function menulink(sub)
{
   var url;
   var type1 = "";
   
   switch(sub)
   {
      //==================================top-main-===================================
      case  "info"   :  type1 = ""; url ="/act/?mid=ch_hstr";  break;   // 교회 발자취
      case  "preach" :  type1 = ""; url ="/tmp/preach_view.htm?code=preach&number=0";  break;   // 말씀과영상
      case  "mtnsv"  :  type1 = ""; url ="/act/?mid=ch_prsh";  break;   // 교구 섬김
      case  "lvnsh"  :  type1 = ""; url ="/act/?mid=ch_nws";   break;   // 사랑과나눔교회소식
      
      //==================================topmenu====================================
      case  "home"   : type1 = "";  url ="/act/";  break;   //home
        case "topmenu_01"    : type1 = "";  url ="/login/login2.php";   break; //login
        case "topmenu_01_1"	 : type1 = "";  url ="/login/logout.php";   break; //logout
        case "topmenu_02"    : type1 = "w";	url ="http://wmail.ansan1.org"; break; //webmail
        case "topmenu_03"    : type1 = "w";	url ="http://idisk.ansan1.org/main/login.php";  break; //help
        case "topmenu_04"    : type1 = "";  url ="/etc/sitemap.html";   break; //english
        case "topmenu_05"    : type1 = "w";	url ="/en/";                break; //english
        case "topmenu_06"    : type1 = "w";	url ="/ch/";                break; //chinese
        		
		//==================================교회소개====================================
		case	"inf_2012"				:	type1 = "";	url ="/info/inf_2012.htm";		break;	// 비전 2012
		case	"inf_ch_intr"			:	type1 = "";	url ="/act/?mid=ch_intr";			break;	// 교회 소개
		case	"inf_wrsh_intr"		:	type1 = "";	url ="/act/?mid=wrsh_intr";		break;	// 예배 소개
		case	"inf_ch_hstr"			:	type1 = "";	url ="/act/?mid=ch_hstr";			break;	// 교회 발자취
		case	"inf_srv_prsn"		:	type1 = "";	url ="/act/?mid=srv_prs";			break;	// 섬기는 사람들
		case	"inf_ch_ognz"			:	type1 = "";	url ="/act/?mid=ch_ognz";			break;	// 교회 조직
		//case	"inf_mnst_schd"	:	type1 = "";	url ="/info/mnst_schd.htm";	break;	// 목회 일정
		case	"inf_frst_vst"		:	type1 = "";	url ="/act/?mid=frst_vst";		break;	// 처음오신분
		case	"inf_nw_mmbr"			:	type1 = "";	url ="/info/nw_mmbr.htm";			break;	// 새가족 안내
		case	"inf_utln_mp"			:	type1 = "";	url ="/act/?mid=ch_map";			break;	// 약도 / 교통
		case	"inf_bus_tm"			:	type1 = "";	url ="/act/?mid=bus_lrd_dy";			break;	// 차량운행시간

		//==================================예배안내====================================

		//==================================섬기는사람==================================
		case	"srv_prs_pastr"	:	type1 = "";	url ="/act/?mid=srv_prs";		break;	// 담임목사
		case	"srv_prs_sbpst"	:	type1 = "";	url ="/act/?mid=srv_pstr";	break;	// 교역자-부목사
		case	"srv_prs_rlgis"	:	type1 = "";	url ="/act/?mid=srv_wrk";		break;	// 교역자-준전임
		case	"srv_prs_edsch"	:	type1 = "";	url ="/act/?mid=srv_edu";		break;	// 교회학교
		case	"srv_prs_prsby"	:	type1 = "";	url ="/act/?mid=srv_prsb";	break;	// 장로
		case	"srv_prs_msnry"	:	type1 = "";	url ="/act/?mid=srv_mssn";	break;	// 선교사

        //==================================말씀과영상==================================
        case "srm_lrd_dy_khn" : type1 = "";  url ="/tmp/preach_view.htm?code=preach&number=0";  break;  // 고훈-주일 url ="/act/?mid=srm_lrd_dy_khn";    break;  // 고훈-주일
        case "srm_wdn_khn"    : type1 = "";  url ="/tmp/preach_view.htm?code=preach2&number=0";  break;  // 고훈-수요
        case "srm_wdn"        : type1 = "";  url ="/tmp/preach_view.htm?code=preach3&number=0";  break;  // 설교-수요
        case "srm_lrd_nt"     : type1 = "";  url ="/tmp/preach_view.htm?code=preach4&number=0";  break;  // 설교-저녁
        case "srm_vgl"        : type1 = "";  url ="/tmp/preach_view.htm?code=preach5&number=0";  break;  // 설료-철야
        case "srm_yth"        : type1 = "";  url ="/tmp/preach_view.htm?code=preach6&number=0";  break;  // 설교-청년
        case "srm_lrd_dy"     : type1 = "";  url ="/tmp/preach_view.htm?code=preach7&number=0";  break;  // 설교-주일
        case "srm_choir"      : type1 = "";  url ="/act/?mid=srm_choir"; break;  // 성가
        case "srm_event"      : type1 = "";  url ="/act/?mid=srm_event"; break;  // 세미나
        
//==================================만남과섬김==================================
   case  "prsh_in"   :  type1 = ""; url ="/act/?mid=ch_prsh";  break;   // 교구섬김
		case	"mssn_sv"	:	type1 = "";	url ="/mtnsv/mssion_sv.htm";	break;	// 선교활동
		case	"ch_schl"	:	type1 = "";	url ="/mtnsv/ch_school.htm";	break;	// 교회학교
		case	"pras_sv"	:	type1 = "";	url ="/act/?mid=prs_sv";			break;	// 찬양섬김
		case	"scty_sv"	:	type1 = "";	url ="/act/?mid=scty_sv";			break;	// 사회봉사
		case	"dsbl_ms"	:	type1 = "";	url ="/act/?mid=dsbl_sv";			break;	// 장애인선교
		case	"frgn_ms"	:	type1 = "";	url ="/act/?mid=frgn_ms";			break;	// 외국인근로자선교
		case	"fstr_sv"	:	type1 = "";	url ="/mtnsv/foster_sv.htm";	break;	// 제자양육
		
   case  "prsh_in_01"   :  type1 = "w"; url ="/act/?mid=prsh_hm_01&prsh=01";  break;   // 01교구
   case  "prsh_in_02"   :  type1 = "w"; url ="/act/?mid=prsh_hm_02&prsh=02";  break;   // 02교구
   case  "prsh_in_03"   :  type1 = "w"; url ="/act/?mid=prsh_hm_03&prsh=03";  break;   // 03교구
   case  "prsh_in_04"   :  type1 = "w"; url ="/act/?mid=prsh_hm_04&prsh=04";  break;   // 04교구
   case  "prsh_in_05"   :  type1 = "w"; url ="/act/?mid=prsh_hm_05&prsh=05";  break;   // 05교구
   case  "prsh_in_06"   :  type1 = "w"; url ="/act/?mid=prsh_hm_06&prsh=06";  break;   // 06교구
   case  "prsh_in_07"   :  type1 = "w"; url ="/act/?mid=prsh_hm_07&prsh=07";  break;   // 07교구
   case  "prsh_in_08"   :  type1 = "w"; url ="/act/?mid=prsh_hm_08&prsh=08";  break;   // 08교구
   case  "prsh_in_09"   :  type1 = "w"; url ="/act/?mid=prsh_hm_09&prsh=09";  break;   // 09교구
   case  "prsh_in_10"   :  type1 = "w"; url ="/act/?mid=prsh_hm_10&prsh=10";  break;   // 10교구
   case  "prsh_in_11"   :  type1 = "w"; url ="/act/?mid=prsh_hm_11&prsh=11";  break;   // 11교구
   case  "prsh_in_12"   :  type1 = "w"; url ="/act/?mid=prsh_hm_12&prsh=12";  break;   // 12교구
   case  "prsh_in_13"   :  type1 = "w"; url ="/act/?mid=prsh_hm_13&prsh=13";  break;   // 13교구
   case  "prsh_in_14"   :  type1 = "w"; url ="/act/?mid=prsh_hm_14&prsh=14";  break;   // 14교구
   case  "prsh_in_15"   :  type1 = "w"; url ="/act/?mid=prsh_hm_15&prsh=15";  break;   // 15교구

//==================================사랑과나눔==================================
		case	"ch_nws"		:	type1 = "";	url ="/act/?mid=ch_nws";		break;	// 교회소식
		case	"int_pry"		:	type1 = "";	url ="/act/?mid=int_pry";		break;	// 중보기도Intercession
		case	"wrsh_mtrl"	:	type1 = "";	url ="/act/?mid=wrsh_mtrl";	break;	// 예배자료
		case	"lf_ptry"		:	type1 = "";	url ="/act/?mid=lf_ptry";		break;	// 생명의샘
		case	"on_cnsl"		:	type1 = "";	url ="/act/?mid=on_cnsl";		break;	// 온라인상담
		case	"brth_nws"     :	type1 = "";	url ="/act/?mid=brth_nws";	break;	// 교우소식
		case	"ch_assmb"	:	type1 = "";	url ="/act/?mid=ch_assmb";	break;	// 모임/모집
		case	"op_brd"		:	type1 = "";	url ="/act/?mid=op_brd";		break;	// 열린게시판
		case	"op_mtrl"		:	type1 = "";	url ="/act/?mid=op_mtrl";		break;	// 열린자료실
		case	"op_pht"		:	type1 = "";	url ="/act/?mid=op_pht";		break;	// 열린앨범
		
//==================================찬양위원회==================================
		case	"qlnk_agp"	:	type1 = "w";	url ="http://agape1.cafe24.com";						break;	// 아가페
		case	"qlnk_zon"	:	type1 = "w";	url ="http://jeilzion.cafe24.com";							break;	// 시온
		case	"qlnk_hlu"	:	type1 = "w";	url ="http://cafe.daum.net/ansan1h";					break;	// 할렐루야
		case	"qlnk_hsn"	:	type1 = "w";	url ="http://cafe.daum.net/hosannalove";			break;	// 호산나
		case	"qlnk_imm"	:	type1 = "w";	url ="http://cafe.daum.net/ansan1immanuel";	break;	// 임마누엘
		//case	"qlnk_mrn"	:	type1 = "w";	url ="/http://agape1.cafe24.com/";	break;	// 마라나타
		case	"qlnk_cnj"	:	type1 = "w";	url ="http://www.ansan1.org/bubu/";				break;	// 부부찬양대
		case	"qlnk_ebu"	:	type1 = "w";	url ="/http://agape1.cafe24.com/";						break;	// 어부중창단
		case	"qlnk_glr"	:	type1 = "w";	url ="http://cafe.daum.net/gloriasingers";				break;	// 글로리아 중창단
		//case	"qlnk_agp"	:	type1 = "w";	url ="/http://agape1.cafe24.com/";	break;	// 그루터기
		case	"qlnk_gabriel"	:	type1 = "w";	url ="http://cafe.naver.com/ansangabriel.cafe";	break;	// 가브리엘
		//case	"qlnk_agp"	:	type1 = "w";	url ="/http://agape1.cafe24.com/";	break;	// 예그린국악
		case	"qlink_wri"	:	type1 = "w";	url ="http://cafe.daum.net/loveurisori";				break;	// 우리소리찬양단 
		//case	"qlnk_agp"	:	type1 = "w";	url ="/http://agape1.cafe24.com/";	break;	// 은빛찬양단

//==================================부속기관==================================== 
		case 	"news"			:	type1 = "w"; url ="http://www.ansan1.org/newspaper";	break;	//	새벽지
		case 	"edu"				:	type1 = "w"; url ="http://www.ansan1.org/edu/";			break;	//	교육위원회
		case 	"edu4"				:	type1 = "w"; url ="http://edu4.ansan1.org/";						break;	//	교육4위원회
		case 	"asmind"			:	type1 = "w"; url ="http://asmind.ansan1.org/";					break;	//장애인선교위원회
		case 	"wmission"		:	type1 = "w"; url ="http://wmission.ansan1.org/";				break;	//해외선교위원회
		case 	"choji"				:	type1 = "w"; url ="http://choji.or.kr/";								break;	//초지종합복지관
		case 	"bitdoong"		:	type1 = "w"; url ="http://bitdoong.org/";							break;	//빛과둥지
		case 	"noin"				:	type1 = "w"; url ="http://ansanoins.org/";							break;	//안산시립노인전문요양원
		case 	"ch"					:	type1 = "w"; url ="http://asmind.ansan1.org/";					break;	//안산시청소년지원센타

//==================================교회생활====================================

//==================================열린광장====================================

//==================================문화교실====================================
		case		"clt_cls_ntc"	:	type1 = "";	url ="http://main.ansan1.org/act/?mid=clt_cls_ntc";	break;	// 공지사항
		case		"clt_cls_brd"	:	type1 = "";	url ="http://main.ansan1.org/act/?mid=clt_cls_brd";	break;	// 게시판
		case		"clt_cls_lct"	:	type1 = "";	url ="http://main.ansan1.org/cltcls/c_cls_lect.html";	break;	// 강좌
		case		"clt_cls_att"	:	type1 = "";	url ="http://main.ansan1.org/cltcls/c_cls_info.html";	break;	// 수강신청
		
//==================================웹서비스====================================

//==================================copywrite부분====================================

		case "footer_02" : type1 = ""; url ="/life/life62_01.html";break;//전화번호
		case "footer_03" : type1 = ""; url ="/life/life61_01.html";break;//사이버도우미
		case "footer_04" : type1 = ""; url ="/info/info53.html";break;//오시는길
		
//==================================각종 플레시 및 메뉴====================================
    // 우츨 퀵메뉴의 링크는 플래시 내에서 직접 하는 것으로 변경하였으므로 주석 처리함
    /*
    case "juser_guide_01" : type1 = ""; url ="/notice/list.php?bdno=001";break; //오른쪽 퀵메뉴1
		case "juser_guide_02" : type1 = ""; url ="/bbs/list.php?bbs_id=kwuFreeSpeech";break; //오른쪽 퀵메뉴2(자유게시판)
		case "juser_guide_03" : type1 = "w"; url ="http://cms.ansan1.org/";break; //오른쪽 퀵메뉴3(CMS)
		case "juser_guide_04" : type1 = "w"; url ="http://info.ansan1.org";break; //오른쪽 퀵메뉴4(인트라넷)
    */
		default	:	type1 = ""; url ="/act/"; break; //home
	}

	if( type1 == "w") {			//브라우져 새창으로 파일 링크걸때
		window.open(url);
	}
	else if ( type1 == "p"){		//팝업창 스타일로 링크 
		window.open(url, "팝업창명", "width=420, height=500,left=30,top=5 scrollbars=yes");
	}
	else if ( type1 == "p2"){	//팝업창 스타일로 링크 
		window.open(url, "팝업창명", "width=490, height=375,left=200,top=100 scrollbars=no");
	}
	else if ( type1 == "s"){		//링크
		window.open(url, "swc3");
	}
	else if (type1 == "j"){ // 자바스크립트 코드로 실행
		eval(url);
	}
	else {	//type값이 없을때는 일반적 링크
		location.href = url;
	}
}

/*
	플레시 상단 메뉴 링크
*/
function link(menuId){
  var strMenu = "";

  switch(menuId){
    case "1_0":
      strMenu  = "info";
      break;
    case "2_0":
      strMenu  = "preach";
      break;
    case "3_0":
      strMenu  = "mtnsv";
      break;
      case "4_0":
      strMenu  = "lvnsh";
      break;
    default:
      strMenu  = "info";
  }

  menulink(strMenu);
}


/*
	메인 게시판 링크
*/
function whenDetailN(module, docNum) {
	location.href = "/act/?mid="+module+"&document_srl="+docNum;
}

/*
	설교동영상 링크
*/
function moveLink(mvCode, mvNum) {
	location.href = "/tmp/preach_view.htm?code="+mvCode+"&number="+mvNum;
}













//일반 팝업창
function OpenWin(p_sURL,p_sWidth,p_sHeight){
	newWin = open(p_sURL,"new","width="+p_sWidth+",height="+p_sHeight+",left=250,top=180,scrollbars=0");
	newWin.focus();
}

// 공지사항 새창
function openwindow(theURL,winName,features)
{
	window.open(theURL,winName, 'width=600, height=640, toolbar=no, status=yes, resizable=no, scrollbars=yes, topmargin=0, leftmargin=0, marginwidth=0, marginheight=0, left=100, top=100');
}





//iframe height 자동 늘어나기
function frame_init()
{
	if( typeof(parent.reSize) != "undefined"){
		parent.reSize();
		var locate = parent.document.location.href;
	}
		
}

function reSize(){
	if ( typeof(ifrm) != "undefined") {
		var objBody = ifrm.document.body;
		var objFrame = document.all["ifrm"];
	
		objFrame.style.height = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
		//objFrame.style.width = '100%';
	}
}

function getTargetOpen(theURL,winName)
{
  window.open(theURL,winName);
}




function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}



// flashWrite(파일경로, 가로, 세로, 아이디, 배경색, 윈도우모드)
function flashWrite(url,w,h,id,bg,win)
{
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"
	+"<param name='movie' value='"+url+"' />"
	+"<param name='wmode' value='"+win+"' />"
	+"<param name='menu' value='false' />"
	+"<param name='quality' value='high' />"
	+"<param name='bgcolor' value='"+bg+"' />"
	+"<embed src='"+url+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"
	+"</object>";
	document.write(flashStr);
}



// 배열 랜덤으로 섞기 - phpschool id maggot made (조금 수정)
function array_shuffle(arr){
  return arr.concat().sort( 
    function(){return Math.random() - Math.random();} 
  ); 
}


// 팝업 띄우기
function open_popup(w_url, w_name, w_width, w_height, w_align, w_scroll){
  var w_left;
  var w_top;

  switch(w_align){
    // 좌측 상단
    case "topleft":
    case "lefttop":
    case "tl":
    case "lt":
      w_left = 0;
      w_top = 0;
      break;

    // 우측 상단
    case "topright":
    case "righttop":
    case "tr":
    case "rt":
      w_left = screen.width - w_width;
      w_top = 0;
      break;

    // 좌측 하단
    case "bottomleft":
    case "leftbottom":
    case "bl":
    case "lb":
      w_left = 0;
      w_top = screen.height - w_height - 80;
      break;

    // 우측 하단
    case "bottomright":
    case "rightbottom":
    case "br":
    case "rb":
      w_left = screen.width - w_width - 80;
      w_top = screen.height - w_height - 80;
      break;

    // 중앙 - 기본값
    case "center":
    case "c":
    default:
      w_left = (screen.width - w_width) / 2;
      w_top = (screen.height - w_height) / 2;
      break;
  }

  var w_option = "width=" + w_width + ",height=" + w_height + ",left=" + w_left + ",top=" + w_top;

  // 스크롤바 유무 설정
  if(w_scroll == "Y" || w_scroll == "y"){
    w_option = w_option + ",scrollbars=yes";
  }

  return window.open(w_url, w_name, w_option);
}


// 로그인 팝업 띄우기
function open_login(redirect_url){
  open_popup("/login/login1.php?redirect_url="+redirect_url, "win_login", 300, 167, "c");
}

// 인증서 로그인 팝업 띄우기
function open_pki_login(redirect_url, gubun_code, member_no){
  // 사용자 구분 인자가 설정되지 않은 경우 "" 로 초기화
  if(typeof(gubun_code) == "undefined"){
    gubun_code = "";
  }

  // 개인번호 인자가 설정되지 않은 경우 "" 로 초기화
  if(typeof(member_no) == "undefined"){
    member_no = "";
  }
  open_popup("/login/pki_login.html?redirect_url="+redirect_url+"&gubun_code="+gubun_code+"&member_no="+member_no, "win_pki_login", 600, 520, "c");
}

// 플래시에서 스크롤 돌아가게...
/*
function scroll(delta) {scrollspeed=delta*20; setTimeout('scrollspeed=0',50);}

var speed, currentpos=curpos1=0,alt=1,curpos2=-1

function initialize(){
  if (window.scrollspeed!=0){
    speed=window.scrollspeed
    scrollwindow()
    }
}

function scrollwindow(){
  temp=(document.all)? document.body.scrollTop : window.pageYOffset
  alt=(alt==0)? 1 : 0
  if (alt==0)
  curpos1=temp
  else
  curpos2=temp

  window.scrollBy(0,speed)
}

setInterval("initialize()",5);
*/
