

// »ó´Ü¸Þ´º ¸ÞÀÎÆäÀÌÁö¿ë
function TopLinkMain(num){
    switch(num){
	case 1 : // »ç¾÷¾È³»
        location.href = "../division/divi_open.aspx"; break; 
	case 101 :
        location.href = "../division/stati_db.aspx"; break; 
	case 102 :
        location.href = "../division/work_divi.aspx"; break; 
	case 103 :
        location.href = "../division/facil_open.aspx"; break; 
	case 104 :
        location.href = "../division/schola_purpo.aspx"; break; 
	case 105 :
        location.href = "../division/physic_info.aspx"; break; 
	case 106 :
        location.href = "../division/over_info.aspx"; break; 



	case 2 : // ÀÚ·á½Ç
        location.href = "../database/law_db.aspx"; break; 
	case 201 :
        location.href = "../database/law_db.aspx"; break; 
	case 202 :
        location.href = "../database/conve_law.aspx"; break; 
	case 203 :
        location.href = "../database/publication.aspx"; break; 
	case 204 :
        location.href = "../database/statist_db.aspx"; break; 
	case 205 :
        location.href = "../database/foreign_db.aspx"; break;
	case 206 :
        location.href = "../database/photo_db.aspx"; break;
	case 207 :
        location.href = "../database/relate_form.aspx"; break;
				

	case 3 : // ¾Ë¸²¸¶´ç
        location.href = "../notifica/notice.aspx"; break; 
	case 301 :
        location.href = "../notifica/notice.aspx"; break; 
	case 302 :
        location.href = "../notifica/news_clip.aspx"; break; 
	case 303 :
        location.href = "../notifica/monthly.aspx"; break; 
	case 304 :
        location.href = "../notifica/didimdol.aspx"; break; 


	case 4 : // Âü¿©¸¶´ç
        location.href = "../participa/consulting.aspx"; break; 
	case 401 :
        location.href = "../participa/consulting.aspx"; break; 
	case 402 :
        location.href = "../participa/event.aspx"; break; 
	case 403 :
        location.href = "../participa/free_note.aspx"; break; 
	case 404 :
        location.href = "../participa/survey.aspx"; break; 
	case 405 :
        location.href = "../joinclub/joinclub001.aspx"; break;


	case 5 : // °³¹ß¿ø¾È³»
        location.href = "../intro/chairman.aspx"; break; 
	case 501 :
        location.href = "../intro/chairman.aspx"; break; 
	case 502 :
        location.href = "../intro/public.aspx"; break; 
	case 503 :
        location.href = "../intro/establish.aspx"; break; 
	case 504 :
        location.href = "../intro/organi.aspx"; break; 
	case 505 :
        location.href = "../intro/identity.aspx"; break; 
	case 506 :
        location.href = "../intro/location.aspx"; break;	
	case 507 :
        location.href = "../intro/certification.aspx"; break;	
		}
    return;
}



/* --- ¼­ºê¸Þ´º º¸¿©Áö´Â ½ºÅ©¸³Æ® --- */

function Switch_top(MenuID){
	var ID = document.getElementById(MenuID);

	 document.getElementById("SM01").className = 'sm HLayer';
	 document.getElementById("SM02").className = 'sm HLayer';
	 document.getElementById("SM03").className = 'sm HLayer';
	 document.getElementById("SM04").className = 'sm HLayer';
	 document.getElementById("SM05").className = 'sm HLayer';
	// document.getElementById("SM06").className = 'sm HLayer';//


	ID.className = 'sm VLayer';
}



/* --- ¸ÞÀÎ ¸Þ´º ÀÌµ¿ ½ºÅ©¸³Æ® --- */


var tTopRefresh = null;
if(!Function.call) Function.prototype.call = function() {
	if (!arguments[0]) {
		return this();
	}
	
	var baseObj = arguments[0];
	var d = new Date();
	var tempFuncName = 'f' + d.getTime();
	var args = new Array();
	
	baseObj[tempFuncName] = this;
	for(var i = 1; i < arguments.length; i++) {
		args[i-1] = 'arguments[' + i + ']';
	}
	eval('baseObj[tempFuncName](' + args.join(',') + ')');
	baseObj[tempFuncName] = null;

}
if(!Function.apply) Function.prototype.apply = function() {
	if (!arguments[0]) {
		return this();
	}
	var baseObj = arguments[0];
	var d = new Date();
	var tempFuncName = 'f' + d.getTime();
	var args = new Array();
	
	baseObj[tempFuncName] = this;
	if (arguments[1]) {
		for (var i = 0; i < arguments[1].length; i++) {
			args[i] = 'arguments[1][' + i + ']';
		}
	}
	eval('baseObj[tempFuncName](' + args.join(',') + ')');
	baseObj[tempFuncName] = null;
}
function ForceError(msg, url, lno){
	var parm = document.location.toString();
	if (parm.indexOf('?debug')>=0) alert('ÁÖ¼Ò:'+url+'\n¶óÀÎ:'+lno+'\n¿¡·¯¸Þ½ÃÁö:'+msg);
	return true;
}
window.onerror = ForceError;
//document.domain='www.seoul.go.kr';
function loadScript(src, ord) {
	var s = document.getElementsByTagName('HEAD')[0].appendChild(document.createElement('script'));
	s.type = 'text/javascript';
	s.src = src + (ord ? ' &ord=' + ord : '');
}






var TimeIterator = function (obj) {
	this.objTimeout = null;
	this.bStop = false;
	this._waitingTime = 0;
    this.id = TimeIterator.list.length;
    TimeIterator.list[this.id] = obj;
}
TimeIterator.list = new Array();
TimeIterator.prototype.start = function() {
	if (this.objTimeout) clearTimeout(this.objTimeout);
	this.bStop = false;
	this.objTimeout = setTimeout('TimeIterator.list["' + this.id + '"]._iterate();', this.getWaitingTime());
}
TimeIterator.prototype.stop = function() {
	if (this.objTimeout) clearTimeout(this.objTimeout);
	this.bStop = true;
}

TimeIterator.prototype._iterate = function() {
	this.iterate();
	if(this.bStop) return;
	this.objTimeout = setTimeout('TimeIterator.list["' + this.id + '"]._iterate();', this.getWaitingTime());
}
TimeIterator.prototype.setWaitingTime = function(msec) {
	this._waitingTime = msec
}
TimeIterator.prototype.getWaitingTime = function() {
	return this._waitingTime;
}
TimeIterator.prototype.inheritTo = function(obj) {
    for (var p in this) {
        obj[p] = this[p];
    }
}

var ParagraphScroller = function (pIdList) {
    var ti = new TimeIterator(this);
    ti.inheritTo(this); 

	this.objParent = null;
	this.pIdList = pIdList;
	this.objParagraphList = null;
	this.objCloneList = null;
	this.clickedId = '';

	this.bWorking = false;
	this.bCloneCreated = false;
	//const
	this.SHOW_CLONE = true;
	this.SHOW_ORIGNAL = false;
	this.SCROLL_ENABLE = true;
	this.SCROLL_DISABLE = false;

	//config
	this.hSpace = 7;
	this.scrollStep = 30;
	this.scrollCount = 0;
	this.scrollInfoList = null;
	this.objTimeIteratorList = new Array();

	this.setWaitingTime(0);
};
ParagraphScroller.prototype.iterate = function() {
	this.scroll();
}

ParagraphScroller.prototype.reArrange = function () {
	var len = this.objParagraphList.length;
	var posTop = ParagraphInfo.top;
	for (var i = 0; i < len; i++) {
		this.objParagraphList[i].style.top = posTop + 'px';
		this.pIdList[i] = this.objParagraphList[i].id;
		posTop += ParagraphInfo.heightList[this.objParagraphList[i].id] + ParagraphInfo.space;
	}
	draptSetCookie('layout', this.pIdList.join());
	this.bWorking = false;
}

ParagraphScroller.prototype.scroll = function () {
	var len = this.scrollInfoList.length;
	if(this.scrollCount  >= this.scrollStep) {
		//scroll end
		for (var i=0; i < len; i++) {
			var scrollInfo = this.scrollInfoList[i];

			scrollInfo.obj.style.top = scrollInfo.to + "px";
		}
		this.reArrange();
		this.stop();
		return;
	} else {
		for (var i=0; i < len; i++) {
			var scrollInfo = this.scrollInfoList[i];
			var displacement = Math.round(Math.sin(this.scrollCount/this.scrollStep * Math.PI / 2)  * scrollInfo.dist);
			var curPos = scrollInfo.from + displacement;
			scrollInfo.obj.style.top = curPos + "px";
		}
	}
	this.scrollCount++;
}

ParagraphScroller.prototype.initScroll = function () {
	this.scrollInfoList = new Array();
	var idx = 0;
	var top = ParagraphInfo.top;
	for ( var i = 0; i < this.objParagraphList.length; i++ ) {
		var objParagraph = this.objParagraphList[i];
		var to = top;
		var from = objParagraph.offsetTop;
		
		if (from != to) {
			//add scrollInfo
			var scrollInfo = new Object();
			scrollInfo.obj = objParagraph;
			scrollInfo.from = from;
			scrollInfo.to = to;
			scrollInfo.dist = to - from;
			this.scrollCount = 0;
			this.scrollInfoList[idx++] = scrollInfo;
		}
		top += ParagraphInfo.heightList[objParagraph.id] + ParagraphInfo.space;
	}
}

ParagraphScroller.prototype.move = function( bUseScroll ) {
	if ( bUseScroll ) {
		this.initScroll();
		this.start();
	} else {
		this.reArrange();
	}
}
ParagraphScroller.prototype.clickUp = function( id ) {
	this.clickedId = id;
	var objList = this.objParagraphList;
	var idx;
	for (idx = objList.length - 1; idx >= 0 && objList[idx].id != id; idx--); //search id's index (position);

	if(idx == 0) { // first position.
		//scroll
		var first = objList[0];
		var len = objList.length - 1;
		for (var i = 0; i < len; i++) {
			objList[i] = objList[i+1];
		}
		objList[i] = first;
	} else {
		//swap position
		var tmp = objList[idx];
		objList[idx] = objList[idx - 1];
		objList[idx - 1] = tmp;
	}
	this.move(this.SCROLL_ENABLE);
}

ParagraphScroller.prototype.handlerClickUp = function() {
	var objScroller = this.pScroller;
	if( objScroller.bWorking ) return;
	objScroller.bWorking = true;
	objScroller.clickUp.call(objScroller, this.paragraphId);
}

ParagraphScroller.prototype.init = function () {
	this.objParagraphList = new Array();
	for ( var i = this.pIdList.length - 1; i >= 0; i-- ) {
		//regist event handler
		var objParagraph = document.getElementById(this.pIdList[i]);
		this.objParagraphList[i] = objParagraph;
		var objList = objParagraph.getElementsByTagName("span");
		for (var j=0; j < objList.length; j++) {
			if(objList[j].className == "icon_up") {
				objList[j].onclick = this.handlerClickUp;
				objList[j].pScroller = this;
				objList[j].paragraphId = this.pIdList[i];
			}
		}
	}
	this.objParent = this.objParagraphList[0].parentNode;
	this.objParent.style.height = this.objParent.offsetHeight + 'px';
	var objList = this.objParagraphList;
}

var init = function() {
	if(inited) return;

	var paragraphScroller = new ParagraphScroller(ParagraphInfo.layout.split(','));
	paragraphScroller.init();
}
setTimeout('init()',6000);


//  ÆË¾÷ °ü·Ã ½ÃÀÛ  //


function SwitchDayNight(){
	nowDate = new Date();
	nowHour = nowDate.getHours();
	nowSec = nowDate.getSeconds();
/*
	if( nowSec%2==1 ) {
		document.getElementById("SeoulMainRenew").className = "SeoulMainday";
	}
	else {
		document.getElementById("SeoulMainRenew").className = "SeoulMainnight";
	}
*/
	if(nowHour > 5 && nowHour < 19)
		document.getElementById("SeoulMainRenew").className = "SeoulMainday";
	else
		document.getElementById("SeoulMainRenew").className = "SeoulMainnight";
	
}


function PZView(){
	document.getElementById('pz_btn').style.display = 'none';
	document.getElementById('SeoulMainVisual').innerHTML="<embed src='/v2007/fla/"+PZMainLeftFlashName()+"' width='244' height='401' wmode='transparent' allowScriptAccess='always' menu='false' quality='best' align='middle'></embed>";
	document.getElementById('pz_big').style.display = 'block';
}
function PZHidden(){
	document.getElementById('pz_big').style.display = 'none';
	document.getElementById('PZPlus').style.display = 'none';
	document.getElementById('SeoulMainVisual').innerHTML="<embed src='/v2007/fla/"+PZMainLeftFlashName()+"' width='244' height='401' wmode='' allowScriptAccess='always' menu='false' quality='best' align='middle'></embed>";
	document.getElementById('pz_btn').style.display = 'block';
}


function PZPlusViewSC(){
	document.getElementById('PZPlusRe').style.display = 'block';
	document.getElementById('PZPlusDIVRe').innerHTML = '<iframe src=\"http://app.seoul.go.kr/html/r/GH_MAIN_00001_list.html\" frameborder=\"0\" scrolling=\"no\" width=\"458\" height=\"115\"></iframe>';
}
// http://app.seoul.go.kr/html/r/GH_MAIN_00001_list.html
function PZPlusHiddenSC(){
	document.getElementById('PZPlusRe').style.display = 'none';
}

function PopupList(mid,tid)
{
    for (var i=1; i < tid ; i++) {
		if (document.getElementById('menu' + i).style.display == 'block')
			document.getElementById('menu' + i).style.display = 'none';
			document.getElementById('tmenu' + i).className = 'title';
    }
    document.getElementById('menu' + mid).style.display = 'block';
	document.getElementById('tmenu' + mid).className = 'titlev';
//alert(document.getElementById('menu' + menuid).className);

}






/* ---  DESC : ±ÛÀÚÅ©±â, ±ÛÀÚ»ö, ¹è°æ»ö ¼³Á¤ --- */
                                                   


function f_setFace(){
	var objs_td		= new Array();
	var objs_th		= new Array();
	var	objs_a		= new Array();
	var	objs_span	= new Array();
	var objs_p		= new Array();
	var objs_div		= new Array();
/*
	var iCntFrames = parent.frames.length;


	if (iCntFrames == 0 )
	{
		iCntFrames = 1;
	}

	for(a=0; a<iCntFrames; a++)
	{
		// mainÈ­¸é frame ¼ö : 3, subÈ­¸é frame ¼ö :3, bottom(¸Þ´º¹Ù·Î°¡±â) È¯°æº¯È­ ¾ÈÇÔ
		if(iCntFrames >= 3)
		{
			objs_td = parent.frames[a].document.getElementsByTagName("td");
			objs_a = parent.frames[a].document.getElementsByTagName("a");
			objs_span = parent.frames[a].document.getElementsByTagName("span");
			objs_p = parent.frames[a].document.getElementsByTagName("p");
		}
		else
		{*/
			objs_td = document.getElementsByTagName("td");
			objs_th = document.getElementsByTagName("th");
			objs_a = document.getElementsByTagName("a");
			objs_span = document.getElementsByTagName("span");
			objs_p = document.getElementsByTagName("div");
//			objs_li = document.getElementsByTagName("li");
		//}

		for (i=0;i<objs_td.length;i++) 
		{
			//objs_td[i].style.fontSize=fontSize+'px';
			objs_td[i].style.color=fontColor[fontColorIndex];
			objs_td[i].style.backgroundColor=bgColor[bgColorIndex];
		}
		for (i=0;i<objs_th.length;i++) 
		{
			//objs_th[i].style.fontSize=fontSize+'px';
			objs_th[i].style.color=fontColor[fontColorIndex];
			objs_th[i].style.backgroundColor=bgColor[bgColorIndex];
		}
		for (i=0;i<objs_a.length;i++) 
		{
			//objs_a[i].style.fontSize=fontSize+'px';
			objs_a[i].style.color=fontColor[fontColorIndex];
			objs_a[i].style.backgroundColor=bgColor[bgColorIndex];
		} 
		for (i=0;i<objs_span.length;i++) 
		{
			//objs_span[i].style.fontSize=fontSize+'px';
			objs_span[i].style.color=fontColor[fontColorIndex];
			objs_span[i].style.backgroundColor=bgColor[bgColorIndex];
		} 
		for (i=0;i<objs_p.length;i++) 
		{
			//objs_p[i].style.fontSize=fontSize+'px';
			objs_p[i].style.color=fontColor[fontColorIndex];
			objs_p[i].style.backgroundColor=bgColor[bgColorIndex];
		}
/*		for (i=0;i<objs_li.length;i++) 
		{
			//objs_p[i].style.fontSize=fontSize+'px';
			objs_li[i].style.color=fontColor[fontColorIndex];
			objs_li[i].style.backgroundColor=bgColor[bgColorIndex];
		}
*/

	//}

	// mainÈ­¸é frame ¼ö : 3, subÈ­¸é frame ¼ö :4, bottom(¸Þ´º¹Ù·Î°¡±â) È¯°æº¯È­ ¾ÈÇÔ
	/*if( iCntFrames >= 3)
	{
		if ( parent.frames[0].document.all['select2'] == "[object]" )
		{
			parent.frames[0].document.frmMain.select2.selectedIndex = parseInt(fontColorIndex);
			parent.frames[0].document.frmMain.select.selectedIndex = parseInt(bgColorIndex);
		}
	}
	else
	{*/
		if ( document.all['select2'] == "[object]" )
		{
			document.all['select2'].selectedIndex = parseInt(fontColorIndex);
			document.all['select'].selectedIndex = parseInt(bgColorIndex);
		}
	//}

	//setCookie("fontSize", fontSize, 1);
	setCookie("fontColorIndex", fontColorIndex, 1);
	setCookie("bgColorIndex", bgColorIndex, 1);	
}




function ColorSetLoad(){
	document.getElementById('UtilBoxColor').style.display='block';
	colorSet2();
}

function UtilBoxColorClose(){
	document.getElementById('ColorSetDiv').innerHTML = "";
	document.getElementById('UtilBoxColor').style.display='none';
}
//±ÛÀÚ»öÁöÁ¤
function colorSet2(){
	try {
		pDoc = document.body.innerHTML;
			var strTmp = "";
				strTmp += "<script language='javascript'> \n";			
				strTmp += " function newbgColor(color) \n";
				strTmp += " { \n";
				strTmp += "   document.bgColor=color \n";
				strTmp += " } \n";
				strTmp += " function newfgColor(color) \n";
				strTmp += " { \n";
				strTmp += "   document.fgColor=color \n";
				strTmp += " } \n";
				strTmp += "</script> \n";			
				strTmp += "<ul class=\"ColorSetDiv\">\n";			
				strTmp += "<li>\n";			
				strTmp += "<select name='select2' id='select5' class='td' onChange='f_setFontColor2(this.value);' tabindex='20' title='±ÛÀÚ»ö ¼±ÅÃ'>\n";
				strTmp += "<option selected>±ÛÀÚ»ö</option>\n";
				strTmp += "<option value='1'>±âº»»ö</option>\n";
				strTmp += "<option value='2'>³ë¶õ»ö</option>\n";
				strTmp += "<option value='3'>ÇÏ¾á»ö</option>\n";
				strTmp += "<option value='4'>ÆÄ¶õ»ö</option>\n";
				strTmp += "<option value='5'>»¡°­»ö</option>\n";
				strTmp += "<option value='6'>º¸¶ó»ö</option>\n";
				strTmp += "<option value='7'>ÃÊ·Ï»ö</option>\n";
				strTmp += "</select>\n";
				strTmp += "</li>\n";
				strTmp += "<li>\n";
				strTmp += "<select name='select' id='select7' class='td' onChange='f_setBgColor2(this.value);' tabindex='20' title='¹ÙÅÁ»ö ¼±ÅÃ'>\n";
				strTmp += "<option selected>¹ÙÅÁ»ö</option>\n";
				strTmp += "<option value='1'>±âº»»ö</option>\n";
				strTmp += "<option value='2'>°ËÁ¤»ö</option>\n";
				strTmp += "<option value='3'>ÆÄ¶õ»ö</option>\n";
				strTmp += "<option value='4'>»¡°­»ö</option>\n";
				strTmp += "<option value='5'>º¸¶ó»ö</option>\n";
				strTmp += "<option value='6'>ÃÊ·Ï»ö</option>\n";
				strTmp += "</select>\n";
				strTmp += "</li>\n";	
				strTmp += "</ul>\n";	

// 			var printWinId = window.open('','','width=200,height=200,top=50,left=370,scrollbars=yes');
//      printWinId.document.open();
//      printWinId.document.write(strTmp);
//      printWinId.document.close(); 
			document.getElementById('ColorSetDiv').innerHTML = strTmp;
	} catch(e) {
	}

} 














