
/*	±ÛÀÚÈ®´ëÃà¼Ò */	
var currentFontSize = 3;
function zoomUtil(state, e){
	var idx;
	var arrFontSize = new Array();

	arrFontSize[0] = "75%";
	arrFontSize[1] = "85%";
	arrFontSize[2] = "95%";
	arrFontSize[3] = "100%";
	arrFontSize[4] = "110%";
	arrFontSize[5] = "120%";
	arrFontSize[6] = "130%";
	
	var e = e || window.event;
	if (e) {
		if (state == "plus") {		
			if (currentFontSize < 6 ) {
				idx = currentFontSize + 1;
				currentFontSize = idx;
			}else{
				idx = 6;
				currentFontSize = idx;
			}			
		} else if (state == "default") {
			idx = 1;
			currentFontSize = idx;
		} else if (state == "minus") {			
			if ( currentFontSize >= 1) {
				idx = currentFontSize - 1;
				currentFontSize = idx;
			}else{
				idx = 0;
				currentFontSize = idx;
			}
		}		
	}
	document.body.style.fontSize = arrFontSize[idx];
	return false;
}


//onload
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}


/*Äü¸Þ´º ½ºÅ©¸³Æ®*/
function initMoving(target, position, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = position;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;

	if (typeof(window.pageYOffset) == "number") {
		obj.getTop = function() {
			return window.pageYOffset;
		}
	} else if (typeof(document.documentElement.scrollTop) == "number") {
		obj.getTop = function() {
			return document.documentElement.scrollTop;
		}
	} else {
		obj.getTop = function() {
			return 0;
		}
	}

	if (self.innerHeight) {
		obj.getHeight = function() {
			return self.innerHeight;
		}
	} else if(document.documentElement.clientHeight) {
		obj.getHeight = function() {
			return document.documentElement.clientHeight;
		}
	} else {
		obj.getHeight = function() {
			return 500;
		}
	}

	obj.move = setInterval(function() {
		if (obj.initTop > 0) {
			pos = obj.getTop() + obj.initTop;
		} else {
			pos = obj.getTop() + obj.getHeight() + obj.initTop;
			//pos = obj.getTop() + obj.getHeight() / 2 - 15;
		}

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit;
		if (pos < obj.topLimit)
			pos = obj.topLimit;

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 30)
}


function isAccess(e) {
	
	var keynum;
	var ismouseClick = 1;
	
	if (window.event) {		//IE & Safari
		keynum = e.keyCode;
		
		//SafariÀÇ °æ¿ì ¸¶¿ì½ºÅ¬¸¯Àº keynum 0 ÀÌ ³Ñ¾î¿È
		if (event.button == 0 || keynum == 0){
			ismouseClick = 0;
		}		
		
	} else if ( e.which ){		// Netscape/Firefox/Opera
		keynum = e.which;
		
		if (keynum == 1) {
			ismouseClick = 0;
		}		
		
	}
	
	//¸¶¿ì½º Å¬¸¯ÀÌ°Å³ª ¿£ÅÍÅ°¸¦ ´©¸¥°æ¿ì true°ª ¹ÝÈ¯
	if ( ismouseClick == 0 || keynum == 13 ) {
		return true;
	} else {
		return false;
	}
}

//contents print
function jsPrintContent(e)
{
	if (isAccess(e)) {
		var width = 760;
		var height =600;
		var x, y;
		var screen_width  = screen.width;
		var screen_height = screen.height;
		x = (screen_width  / 2) - (width  / 2);
		y = (screen_height / 2) - (height / 2);
		var pop = window.open ( "/pop_print_eng.jsp","print","width=" + width + ", height=" + height + ", left=" + x + ", top=" + y + ", toolbar=no, status=no, menubar=no, scrollbars=yes, resizable=yes");
		pop.focus();
	}
	return false;
}


function w_close() {
	window.close();
}


/* poupup open */
function pOpen(url, n, w, h, s, r) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+s+',resizable='+r;
	var win = window.open(url, n, winprops);
	win.focus();
}

/* Img RollOver */

function imgOver(id) {
	
	over = document.getElementById(id);
	over.src = over.src.replace(id+'.gif',id+'_on.gif');
}
function imgOut(id) {
	out = document.getElementById(id);
	out.src = out.src.replace(id+'_on.gif',id+'.gif');
}

function imageOver() {
	this.src = this.src.replace(".gif", "_on.gif");
}
function imageOut(imgEl) {
	imgEl.src = imgEl.src.replace("_on.gif", ".gif");
}


/* Popup */
function popKatri(obj) {
	if (obj.length=='1') {
		obj = '0'+obj;
	}
	var url;
	url = 'popup_06_' + obj;
	window.open('/katri/'+url+'.jsp','pop06','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=450');
}

function popKatriResult(obj) {
	var url;
	url = 'popup_04_0' + obj;
	window.open('/katri/'+url+'.jsp','pop04','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=750,height=580');
}

