// -------------------------------------------------------------
// - ÇÁ·ÎÁ§Æ®¸í   : ÇÑµ¿´ë ÀÎÆ®¶ó³Ý ½Ã½ºÅÛ i3
// - ÇÁ·Î±×·¥¸í   : func.js
// - ÇÁ·Î±×·¥¼³¸í : Javascript Function ¸ðÀ½, i3¿¡¼­ »ç¿ëÇÏ´Â ÀÏ¹ÝÀûÀÎ Function ÅëÇÕ
// - ÇÁ·Î±×·¥¹öÀü : version 2.0
// - °³¹ß½Ã±â     : 2006³â 09¿ù 29ÀÏ
// - ÃÖÁ¾¼öÁ¤ÀÏ   : 2006³â 09¿ù 29ÀÏ
// - °ü·ÃµÈ Table : 
// - ÀÛ¼ºÀÚ       : CRA ÇüÁ¤¼®
// - ÀÛ¼ºÀÚÀÌ¸ÞÀÏ : hyungjs85@nate.com
// - ÃÖÁ¾°¨¼öÀÚ   : CRA ÇüÁ¤¼®
// -------------------------------------------------------------

// ¿òÁ÷ÀÌ´Â ¸Ç À§·Î ·¹ÀÌ¾î °ü·Ã ^^
var _scroll_topmargin=150;        // ÀÌµ¿ ¸Þ´ºÀÇ »ó´Ü ÇÑ°è ÇÈ¼¿
var _scroll_ing_topmargin=150;         // ¿òÁ÷ÀÌ´Â µµÁßÀÇ »ó´Ü°úÀÇ °£°Ý
var _scroll_activate_speed=1;        // ÃÊ±â ¿òÁ÷ÀÓÀ» °¨ÁöÇÏ´Â ½Ã°£Â÷ÀÌ (1/1000ÃÊ)
var _scroll_ing_activate_speed=3;        // ¿òÁ÷ÀÌ±â ½ÃÀÛÇÑ ÀÌÈÄ¿¡ °¨ÁöÇÏ´Â ½Ã°£Â÷ÀÌ (1/1000ÃÊ)

function getRef(id) {
		if (isDOM) return document.getElementById(id);
		if (isIE4) return document.all[id];
		if (isNS4) return document.layers[id];
}

var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS = navigator.appName == "Netscape";

function moveRightEdge() {
		var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;
		if (isNS4) {
				yMenuFrom   = divMenu.top;
				yMenuTo     = windows.pageYOffset+_scroll_ing_topmargin;
		} else if (isDOM) {
				yMenuFrom   = parseInt (divMenu.style.top, 10);
				yMenuTo     = (isNS ? window.pageYOffset : document.body.scrollTop)+_scroll_ing_topmargin;
		}
		if(yMenuTo<_scroll_topmargin) yMenuTo = _scroll_topmargin;

		timeoutNextCheck = _scroll_activate_speed;

		if (yMenuFrom != yMenuTo) {
				yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 10);
				if (yMenuTo < yMenuFrom) yOffset = -yOffset;
				if (isNS4) divMenu.top += yOffset;
				else if (isDOM) divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
				timeoutNextCheck = _scroll_ing_activate_speed;
		}
		setTimeout ("moveRightEdge()", timeoutNextCheck);
}

// Flash Object Ãâ·Â ´ã´ç
function printfo(s, d, w, h, t){
	return "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width="+w+" height="+h+" id="+d+"><param name=wmode value="+t+" /><param name=menu value=false /><param name=movie value="+s+" /><param name=quality value=high /><embed src="+s+" quality=high wmode="+t+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width="+w+" height="+h+"></embed></object>";
}

// write document contents
function dw(src){
	document.write(src);
}

// »õÃ¢ ¶ç¿ì±â
function newwin2(url,w,h,sb) {
	aw = screen.availWidth;
	ah = screen.availHeight;
	
	opts = "width="+w+",height="+h+",scrollbars=yes,resizable=no,toolbars=no,menubars=no,statusbars=no, top="+(ah/2-h)+",left="+(aw/2-w);
	mywin = window.open(url,"newWindow"+parseInt(w),opts);
}

// iframe Å©±â Á¶Á¤ °ü·Ã ¼Ò½º
var ifrContentsTimer;
function resizeRetry() {
	if(document.body.readyState == 'complete') { 
		clearInterval(ifrContentsTimer); 
	}else{ 
		resizeFrame();
	}
} 

function resizeFrame(){
	self.resizeTo(document.body.scrollWidth + (document.body.offsetWidth-document.body.clientWidth), parseInt(document.body.scrollHeight)+10); 
}

// Main È­¸é¿¡¼­ °øÁö»çÇ× ¸Þ´º º¯ÇÏ´Â ½ºÅ©¸³Æ®
function chgMenu(obj){
	var thisPage;

	for ( i = 1; i < 5; i++){
		thisPage = 'm'+i

		if( document.all[thisPage] != null){
			if( obj.name == thisPage ){
				document.all[thisPage].src = document.all[thisPage].src.replace("_off.gif", "_on.gif");
			}else{
				document.all[thisPage].src = document.all[thisPage].src.replace("_on.gif", "_off.gif");
			}
		}
	}
}

// ÇØ´ç °øÁö»çÇ× Ãâ·Â ½ºÅ©¸³Æ®
function view_notice(obj){
	var thisPage;

	for( i = 1 ; i <= 4; i++ ){
		thisPage = "m"+i;

		if( obj.name == thisPage )
			document.getElementById("notice"+i).style.display = '';
		else
			document.getElementById("notice"+i).style.display = 'none';
	}
	chgMenu(obj);
}

// °¢°¢ÀÇ Contents·Î ³Ñ¾î°¡´Â Function
function go_ctn( menu_id, contents_url ){
	switch( menu_id ){
		case 1: topFrame.location = "/main2/top.asp?id=mon"; break;
		case 2: topFrame.location = "/main2/top.asp?id=tue"; break;
		case 3: topFrame.location = "/main2/top.asp?id=wed"; break;
		case 4: topFrame.location = "/main2/top.asp?id=thu"; break;
		case 5: topFrame.location = "/main2/top.asp?id=fri"; break;
		case 6: topFrame.location = "/main2/top.asp?id=sun"; break;
		case 7: topFrame.location = "/main2/top.asp?id=sat"; break;
	}
	mainFrame.location = contents_url;
}

function display( id, n_cate ){
	if( id.charAt(0) == "/" ){
		document.getElementById("ifrm").src = id;
	}else{
		document.getElementById("ifrm").src = "/board2/craboard.asp?id="+id+"&category="+n_cate;
		document.getElementById("best_ifrm").src = "/board2/print_best.asp?id="+id;
	}
}