/****************************************************************
** URL 정리
****************************************************************/
function urlParse(url) {
	var strLocation = url.split('?');
	var strResult = new Array();
	var i =0;

	if(strLocation.length > 1) {
		strsplitLocation = strLocation[1].split('&');

		for(i=0; i<strsplitLocation.length; i++) {
			strsplitLocation[i] = strsplitLocation[i].split('=');

			if(strsplitLocation[i][1] != 'undefined') {
				strResult[i] = strsplitLocation[i][0] + "=" + strsplitLocation[i][1];
			}
		}
	}
	result = strLocation[0] + "?" + strResult.join('&');
	return result;
}

/****************************************************************
** 메인서브 이동
****************************************************************/
function goMain( id, mode, type, met, vt, category, no ) {
	Url = "main_sub.html?mTop=" + id + "&mode=" + mode + "&type=" + type + "&met=" + met + "&vt=" + vt +"&category=" + category + "&no=" + no;
	xUrl = urlParse(Url);
	top.location.href = xUrl;
}


/* 새 창 띄우기 */
function PopWin( Url, Xsize, Ysize, Scroll )
{
	var opt = "toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,copyhistory=1,"

	if( Xsize  == null ) Xsize  = 500
	if( Ysize  == null ) Ysize  = 400
	if( Scroll == null ) Scroll = 1

	opt = "width=" + Xsize + ",height=" + Ysize + ",scrollbars=" + Scroll
	newWindow = window.open( Url, 'popSub', opt)
	newWindow.focus()
}

/* 링크된 텍스트 칼라 바꾸기 */
function setHover( color )
{
    var object = window.event.srcElement

    object.defaultColor = object.style.color
    object.style.color = color

	if( object.title )
	{
		window.status = object.title
	}

    object.onmouseout = function()
    {
        object.style.color = object.defaultColor

		if( object.title )
		{
			window.status = ''
		}
    }

	return true
}

/* 마우스 오버 이미지 바꾸기 */
var overImage = new Array(900);

for( var i = 0; i < 900; i++ )
overImage[i] = new Image();


overImage[1].src = 'img/titleSubB1000_01e.gif';
overImage[2].src = 'img/titleSubB1000_02e.gif';
overImage[3].src = 'img/titleSubB1000_03e.gif';
overImage[4].src = 'img/titleSubB1000_04e.gif';

overImage[11].src = 'img/titleSubA3000_01e.gif';
overImage[12].src = 'img/titleSubA3000_02e.gif';
overImage[13].src = 'img/titleSubA3000_03e.gif';

overImage[811].src = 'inner/skin/common_skin/board/media/icon/btn_titleAe.gif';
overImage[812].src = 'inner/skin/common_skin/board/media/icon/btn_titleBe.gif';
overImage[813].src = 'inner/skin/common_skin/board/media/icon/btn_titleCe.gif';
overImage[814].src = 'inner/skin/common_skin/board/media/icon/btn_titleDe.gif';
overImage[815].src = 'inner/skin/common_skin/board/media/icon/btn_mediaAe.gif';
overImage[816].src = 'inner/skin/common_skin/board/media/icon/btn_mediaBe.gif';
overImage[817].src = 'inner/skin/common_skin/board/media/icon/btn_mediaCe.gif';

function inner_rolloverMenu( num, image )
{
	if( !image.gimaSet )
	image.defaultSrc = image.src;
	image.src = overImage[num].src;

	if( !image.gimaSet )
	{
		image.onmouseout = function()
		{
			image.src = image.defaultSrc;
			image.gimaSet = true;
		}
	}
}


/* 스크롤해도 따라다니는 메뉴 */
var gimaTimerID = null;
var gimaMarginTop = 340;      // 웹브라우저 창과 스크롤메뉴 간의 간격
var gimaDefaultTop = 350;    // Html 창과 스크롤메뉴 간의 간격( Head Html의 높이 )
var gimaScrollSpeed = 10;    // 스크롤되는 속도 (클수록 늦게 움직임)
var gimaActivateSpeed = 240; // 스크롤감지 속도 (클수록 늦게 감지)

function gimaStart() {
	gimaTimerID = setTimeout( "gimaReflashStaticMenu()", gimaActivateSpeed );
}

window.attachEvent('onload',gimaStart);


function gimaReflashStaticMenu()
{
    var gimaReflashSpeed;
    var gimaStartPoint = parseInt( gimaBox.style.top, 10 );
    var gimaEndPoint = document.body.scrollTop + gimaMarginTop;
    if( gimaEndPoint < gimaDefaultTop ) gimaEndPoint = gimaDefaultTop;

    gimaReflashSpeed = gimaActivateSpeed;

    if( gimaStartPoint != gimaEndPoint )
    {
        var gimaScrollAmount = Math.ceil( Math.abs( gimaEndPoint - gimaStartPoint ) / 15 );
        gimaBox.style.top = parseInt(gimaBox.style.top, 10) + (( gimaEndPoint < gimaStartPoint ) ? -gimaScrollAmount : gimaScrollAmount );
        gimaReflashSpeed = gimaScrollSpeed;
    }

    gimaTimerID = setTimeout( "gimaReflashStaticMenu()", gimaScrollSpeed );
}

function InnerShowMent(mode, mid) {
	if( document.all['ment'+mode+mid].style.display == 'none' ) document.all['ment'+mode+mid].style.display = 'block';
	else document.all['ment'+mode+mid].style.display = 'none';
}


/* 점프메뉴 */
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  if( selObj.options[selObj.selectedIndex].value != '' )
      window.open( selObj.options[selObj.selectedIndex].value );
  if (restore) selObj.selectedIndex=0;
}
/************************ 탭 스위칭 by Uks.. ****************************/
function fn_main_list(sInline,bImage, mEvent) {

	/****************************************
	** 서브문화강좌 **
	****************************************/
	if(bImage == 1) {

		objNews1 = $('programSi');
		objNews2 = $('programAd');
		objNews3 = $('programSs');

		sImage = "img/inc/all_over.gif";
		BsImage1 = "img/inc/p1_out.gif";
		BsImage2 = "img/inc/p2_out.gif";
		BsImage3 = "img/inc/p3_out.gif";

	} else if(bImage == 2) {

		objNews1 = $('programAllViews');
		objNews2 = $('programAd');
		objNews3 = $('programSs');

		sImage = "img/inc/p1_over.gif";
		BsImage1 = "img/inc/all_out.gif";
		BsImage2 = "img/inc/p2_out.gif";
		BsImage3 = "img/inc/p3_out.gif";

	} else if(bImage == 3) {

		objNews1 = $('programAllViews');
		objNews2 = $('programSi');
		objNews3 = $('programSs');

		sImage = "img/inc/p2_over.gif";
		BsImage1 = "img/inc/all_out.gif";
		BsImage2 = "img/inc/p1_out.gif";
		BsImage3 = "img/inc/p3_out.gif";

	} else if(bImage == 4) {

		objNews1 = $('programAllViews');
		objNews2 = $('programSi');
		objNews3 = $('programAd');

		sImage = "img/inc/p3_over.gif";
		BsImage1 = "img/inc/all_out.gif";
		BsImage2 = "img/inc/p1_out.gif";
		BsImage3 = "img/inc/p2_out.gif";


	} else if(bImage == 5) {

		objNews1 = $('programhuSi');
		objNews2 = $('programhuAd');
		objNews3 = $('programhuSs');
		objNews4 = $('programNew');

		sImage = "img/inc/all_over.gif";
		BsImage1 = "img/inc/p15_out.gif";
		BsImage2 = "img/inc/p25_out.gif";
		BsImage3 = "img/inc/p35_out.gif";
		BsImage4 = "img/inc/p45_out.gif";
	} else if(bImage == 6) {

		objNews1 = $('programhuAllViews');
		objNews2 = $('programhuAd');
		objNews3 = $('programhuSs');
		objNews4 = $('programNew');

		sImage = "img/inc/p15_over.gif";
		BsImage1 = "img/inc/all_out.gif";
		BsImage2 = "img/inc/p25_out.gif";
		BsImage3 = "img/inc/p35_out.gif";
		BsImage4 = "img/inc/p45_out.gif";
	} else if(bImage == 7) {

		objNews1 = $('programhuAllViews');
		objNews2 = $('programhuSi');
		objNews3 = $('programhuSs');
		objNews4 = $('programNew');

		sImage = "img/inc/p25_over.gif";
		BsImage1 = "img/inc/all_out.gif";
		BsImage2 = "img/inc/p15_out.gif";
		BsImage3 = "img/inc/p35_out.gif";
		BsImage4 = "img/inc/p45_out.gif";
	} else if(bImage == 8) {

		objNews1 = $('programhuAllViews');
		objNews2 = $('programhuSi');
		objNews3 = $('programhuAd');
		objNews4 = $('programNew');

		sImage = "img/inc/p35_over.gif";
		BsImage1 = "img/inc/all_out.gif";
		BsImage2 = "img/inc/p15_out.gif";
		BsImage3 = "img/inc/p25_out.gif";
		BsImage4 = "img/inc/p45_out.gif";
	} else if(bImage == 9) {

		objNews1 = $('programsamSi');
		objNews2 = $('programsamAd');
		objNews3 = $('programsamSs');


		sImage = "img/inc/all_over.gif";
		BsImage1 = "img/inc/p17_out.gif";
		BsImage2 = "img/inc/p2_out.gif";
		BsImage3 = "img/inc/p3_out.gif";

	} else if(bImage == 10) {

		objNews1 = $('programsamAllViews');
		objNews2 = $('programsamAd');
		objNews3 = $('programsamSs');
    
		sImage = "img/inc/p17_over.gif";
		BsImage1 = "img/inc/all_out.gif";
		BsImage2 = "img/inc/p2_out.gif";
		BsImage3 = "img/inc/p3_out.gif";

	} else if(bImage == 11) {

		objNews1 = $('programsamAllViews');
		objNews2 = $('programsamSi');
		objNews3 = $('programsamSs');

		sImage = "img/inc/p2_over.gif";
		BsImage1 = "img/inc/all_out.gif";
		BsImage2 = "img/inc/p17_out.gif";
		BsImage3 = "img/inc/p3_out.gif";

	} else if(bImage == 12) {

		objNews1 = $('programsamAllViews');
		objNews2 = $('programsamSi');
		objNews3 = $('programsamAd');

		sImage = "img/inc/p3_over.gif";
		BsImage1 = "img/inc/all_out.gif";
		BsImage2 = "img/inc/p17_out.gif";
		BsImage3 = "img/inc/p2_out.gif";

	} else if(bImage == 13) {
		objNews1 = $('programhuAllViews');
		objNews2 = $('programhuSi');
		objNews3 = $('programhuAd');
		objNews4 = $('programhuSs');

		sImage = "img/inc/p45_over.gif";
		BsImage1 = "img/inc/all_out.gif";
		BsImage2 = "img/inc/p15_out.gif";
		BsImage3 = "img/inc/p25_out.gif";
		BsImage4 = "img/inc/p35_out.gif";
    }
	/****************************************
	** 요 까지~ **
	****************************************/
	try {
		mEvent.srcElement.src = sImage;
	} catch (e) {
		mEvent.target.src = sImage;
	}
	if(typeof( objNews1 ) != "undefined") objNews1.src = BsImage1;
	if(typeof( objNews2 ) != "undefined") objNews2.src = BsImage2;
	if(typeof( objNews3 ) != "undefined") objNews3.src = BsImage3;
	if(typeof( objNews4 ) != "undefined") objNews4.src = BsImage4;

	/****************************************
	** 행사 갤러리 **
	****************************************/
	if(sInline == 'pannel_programAllViews') {
	  Element.show('pannel_programAllViews');
	  Element.hide('pannel_programSi');
	  Element.hide('pannel_programAd');
	  Element.hide('pannel_programSs');

	} else if(sInline == 'pannel_programSi') {
	  Element.hide('pannel_programAllViews');
	  Element.show('pannel_programSi');
	  Element.hide('pannel_programAd');
	  Element.hide('pannel_programSs');

	} else if(sInline == 'pannel_programAd') {
	  Element.hide('pannel_programAllViews');
	  Element.hide('pannel_programSi');
	  Element.show('pannel_programAd');
	  Element.hide('pannel_programSs');

	} else if(sInline == 'pannel_programSs') {
	  Element.hide('pannel_programAllViews');
	  Element.hide('pannel_programSi');
	  Element.hide('pannel_programAd');
	  Element.show('pannel_programSs');

	} else if(sInline == 'pannel_programhuAllViews') {
	  Element.show('pannel_programhuAllViews');
	  Element.hide('pannel_programhuSi');
	  Element.hide('pannel_programhuAd');
	  Element.hide('pannel_programhuSs');
	  Element.hide('pannel_programNew');

	} else if(sInline == 'pannel_programhuSi') {
	  Element.hide('pannel_programhuAllViews');
	  Element.show('pannel_programhuSi');
	  Element.hide('pannel_programhuAd');
	  Element.hide('pannel_programhuSs');
	  Element.hide('pannel_programNew');

	} else if(sInline == 'pannel_programhuAd') {
	  Element.hide('pannel_programhuAllViews');
	  Element.hide('pannel_programhuSi');
	  Element.show('pannel_programhuAd');
	  Element.hide('pannel_programhuSs');
	  Element.hide('pannel_programNew');

	} else if(sInline == 'pannel_programhuSs') {
	  Element.hide('pannel_programhuAllViews');
	  Element.hide('pannel_programhuSi');
	  Element.hide('pannel_programhuAd');
	  Element.show('pannel_programhuSs');
	  Element.hide('pannel_programNew');

	} else if(sInline == 'pannel_programNew') {
	  Element.hide('pannel_programhuAllViews');
	  Element.hide('pannel_programhuSi');
	  Element.hide('pannel_programhuAd');
	  Element.hide('pannel_programhuSs');
	  Element.show('pannel_programNew');

    } else if(sInline == 'pannel_programsamAllViews') {
	  Element.show('pannel_programsamAllViews');
	  Element.hide('pannel_programsamSi');
	  Element.hide('pannel_programsamAd');
	  Element.hide('pannel_programsamSs');

	} else if(sInline == 'pannel_programsamSi') {
	  Element.hide('pannel_programsamAllViews');
	  Element.show('pannel_programsamSi');
	  Element.hide('pannel_programsamAd');
	  Element.hide('pannel_programsamSs');

	} else if(sInline == 'pannel_programsamAd') {
	  Element.hide('pannel_programsamAllViews');
	  Element.hide('pannel_programsamSi');
	  Element.show('pannel_programsamAd');
	  Element.hide('pannel_programsamSs');

	} else if(sInline == 'pannel_programsamSs') {
	  Element.hide('pannel_programsamAllViews');
	  Element.hide('pannel_programsamSi');
	  Element.hide('pannel_programsamAd');
	  Element.show('pannel_programsamSs');
  }

  return false;
}
