var brow = new Is(); 

function Is() { 
	var agent = navigator.userAgent.toLowerCase(); 
	this.major = parseInt(navigator.appVersion); 
	this.minor = parseFloat(navigator.appVersion); 
	this.ns = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1))); 
	this.ns2 = (this.ns && (this.major == 2)); 
	this.ns3 = (this.ns && (this.major == 3)); 
	this.ns4 = (this.ns && (this.major == 4)); 
	this.ns5 = (this.ns && (this.major > 4)); 
	this.ns6 = (this.ns && (agent.indexOf('netscape6')!=-1) ); 
	this.ns7 = (this.ns && (agent.indexOf('netscape/7')!=-1) ); 
	this.ns7pr = (this.ns && (agent.indexOf('netscape/7.0b1')!=-1) ); 
	this.ns71 = (this.ns && (agent.indexOf('netscape/7.1')!=-1) ); 
	this.ns72 = (this.ns && (agent.indexOf('netscape/7.2')!=-1) ); 
	this.ie = (agent.indexOf("msie") != -1); 
	this.ie3 = (this.ie && (this.major == 2)); 
	this.ie4 = (this.ie && (this.major >= 4)); 
	this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1)); 
	this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1)); 
	this.ie6 = (this.ie && (agent.indexOf("msie 6.0")!=-1)); 
	this.ie7 = (this.ie && (agent.indexOf("msie 7.0")!=-1)); 
	this.opera = (agent.indexOf("opera") != -1); 
	this.pc  = (agent.indexOf("win") != -1); 
	this.mac = (agent.indexOf("mac")!=-1); //Mac detect 
	this.safari = (agent.indexOf("safari") != -1);
	this.firefox = (agent.indexOf("firefox") != -1);
	this.client = ( (navigator.userAgent.indexOf('AOL')!=-1) || (navigator.userAgent.indexOf('CS 2000')!=-1) )? 1 : 0; 
	this.moz = ( this.ns && (agent.indexOf("netscape/") == -1) ); 
	if (this.moz) this.ns = 0; 
} 

if ( brow.ie ) {
	var ie = true;
	var tbrow = "ie";

} else {
	var ie = false;
	var tbrow = "";
	if ( brow.opera ) tbrow = "opera";
	else if ( brow.opera ) tbrow = "opera";
	else if ( brow.ns ) tbrow = "netscape";
	else if ( brow.safari ) tbrow = "safari";
	else if ( brow.firefox ) tbrow = "firefox";

} 

function tabNavToggle(num) {
	document.getElementById('tabNav01').style.display = "none";
	document.getElementById('tabNav02').style.display = "none";
	document.getElementById('tabNav03').style.display = "none";
	document.getElementById('tabNav0' + num).style.display = "block";
}

var openMenuID="";	// ¿­·ÁÀÖ´Â ID¸¦ ÀúÀåÇÔ

function toggleSubMenu(idStr){
	mObj=document.getElementById(idStr);
	if(mObj){
		if (mObj.style.display=="none"){
			if(openMenuID){
				document.getElementById(openMenuID).style.display="none";
			}
			mObj.style.display="block";
			openMenuID=idStr;
		}else if (mObj.style.display=="block"){
			mObj.style.display="none";
			openMenuID="";
		}
	}
}

/*	±ÛÀÚÈ®´ëÃà¼Ò */	
var currentFontSize = 2;
 
function zoomUtil(state){
	var idx = currentFontSize;
	var arrFontSize = new Array();
	
	arrFontSize[0] = "9px";
	arrFontSize[1] = "11px";
	arrFontSize[2] = "12px";
	arrFontSize[3] = "13px";
	arrFontSize[4] = "14px";
	arrFontSize[5] = "15px";
	arrFontSize[6] = "16px";
	
	if(state == "plus"){		
		if(currentFontSize < 6 ){				
			idx = currentFontSize + 1;
			currentFontSize = idx;
		}
	}else if (state == "default"){
		idx = 2;
		currentFontSize = idx;
	}else if (state == "minus"){			
		if( currentFontSize >= 1){
			idx = currentFontSize - 1;
			currentFontSize = idx;
		}	
	}		
	
	if(navigator.userAgent.indexOf("MSIE") != -1){
		document.body.style.fontSize = arrFontSize[idx];
	}else{
		document.getElementsByTagName("BODY").style.fontSize = arrFontSize[idx];
	}
	
	return false;
}


String.prototype.toInteger = function() {
	return this.replace(/[^0-9]/g, '') * 1;
}

function followBanner(div_id, origin_top, limit_top, margin_top){
	var d, t, s, g, target_height;
	origin_top *= 1;
	limit_top *= 1;
	margin_top *= 1;
	
	d = document.getElementById(div_id);
	s = document.documentElement.scrollTop + "";
	
	target_height = s.toInteger() + margin_top;
	if(target_height < limit_top) {
		target_height = origin_top;
	}
	
	t = d.style.top.toInteger();
	
	if(t != target_height) {
		g = Math.ceil((t - target_height) / 5);
		if(g > 50) {
			g = 50;
		} else if (g < -50) {
			g = -50;
		}
		d.style.top = (t - g) + "px";
	}
	setTimeout("followBanner('"+div_id+"', '"+origin_top+"', '"+limit_top+"', '"+margin_top+"');", 1);
}

function initNavigation(seq) {
	var pathname = document.location.pathname;
	
	if (pathname == "/index.jsp" || pathname == "/") {
		nav = document.getElementById("topmenu");
	
	} else {
		nav = document.getElementById("Subtopmenu");

	}
	nav.menu = new Array();
	nav.current = null;
	nav.menuseq = 0;
	navLen = nav.childNodes.length;
	
	allA = nav.getElementsByTagName("a");

	for (k = 0; k < allA.length; k++) {		
		
		allA.item(k).onmouseover = allA.item(k).onfocus = function () {
			nav.isOver = true;
		}
		
		allA.item(k).onmouseout = allA.item(k).onblur = function () {
			nav.isOver = false;
			
			setTimeout(function () {
				
				if (nav.isOver == false) {
					
					if (nav.menu[seq]) {
						nav.menu[seq].onmouseover();
					
					}else if(nav.current) {			
						
						if (seq != 0)
							this.current.parentNode.className = this.current.parentNode.className.replace("", "");						
						
						if (nav.current.submenu)
							nav.current.submenu.style.display = "none";
						
						nav.current = null;			
					
					}
				
				}
			
			}, 1000);
			
		}
	
	}

	for (i = 0; i < navLen; i++) {
		navItem = nav.childNodes.item(i);

		if (navItem.tagName != "LI")
			continue;

		navAnchor = navItem.getElementsByTagName("a").item(0);
		navAnchor.submenu = navItem.getElementsByTagName("ul").item(0);
		
		navAnchor.onmouseover = navAnchor.onfocus = function () {
			
			if (nav.current) {		
				
				if (seq !=0)
					nav.current.parentNode.className = nav.current.parentNode.className.replace("", "");
				
				if (nav.current.submenu)
					nav.current.submenu.style.display = "none";
				
				nav.current = null;
			
			}
			
			if (nav.current != this) {
				
				if (seq !=0)
					this.submenu.parentNode.className +="";
				
				if (this.submenu) {
					this.submenu.style.display = "block";
				
				}
				nav.current = this;
			
			}
			nav.isOver = true;
		
		}
		nav.menuseq++;
		nav.menu[nav.menuseq] = navAnchor;
	
	}
	
	if (nav.menu[seq])
		nav.menu[seq].onmouseover();

}

function tabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on."+"gif", "."+"gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace("."+"gif", "_on."+"gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};
		thismenu.onfocus = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on."+"gif", "."+"gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace("."+"gif", "_on."+"gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}

function initRollovers() {
	
	if (!document.getElementById)
		return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
		
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				
				if (sTempSrc.substring(sTempSrc.lastIndexOf('.')-2 , sTempSrc.lastIndexOf('.')) != "on")
					this.setAttribute('src', this.getAttribute('hsrc'));

			}	
			
			aImages[i].onmouseout = function() {
				
				if (!sTempSrc)
					sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);
				
				this.setAttribute('src', sTempSrc);
			
			}

		
		}
	
	}

}

window.onload = initRollovers;

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 initTabMenu(tabID) {
	var tab = document.getElementById(tabID);
	var tabAnchor = tab.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tab;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		
		if (thismenu.imgEl) {
			thismenu.onfocus = function () {
				//this.onfocus();
			}

		}
		thismenu.onmouseover = thismenu.onfocus = tabMenuOver;
		
		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
		
	}
	tab.first.onmouseover();

}

function tabMenuOver() {
	currentmenu = this.container.current;
	
	if (currentmenu != this) {
		
		if (currentmenu) {
			currentmenu.targetEl.style.display = "none";
			
			if (currentmenu.imgEl) {
				currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on."+"gif", "."+"gif");
			
			} else {
				currentmenu.className = currentmenu.className.replace(" on", "");
			
			}
		
		}
		this.targetEl.style.display = "block";
		
		if (this.imgEl) {
			this.imgEl.src = this.imgEl.src.replace("."+"gif", "_on."+"gif");
		
		} else {
			this.className += " on";
		
		}		
		this.container.current = this;
	
	}
	return false;

}

var fS=100;

function fontPlus() { 
	
	if (fS < 300) {
		
		if ( ie )
			fS = fS + 5; 
		
		else 
			fS = fS + 2; 
		
		setFaceSize('+'); 
	
	} 

}

function fontMinus() { 
	
	if (fS > 100) {
		
		if ( ie )
			fS = fS - 5; 
		
		else
			fS = fS - 2; 

		setFaceSize('-'); 
	
	} 

}

function fontgibon() { 
	
	if (ie)
		fS = 100; 
	
	else
		fS = 100 ; 
	
	setFaceSize(); 

}

function setFaceSize(flag) {
	
	if (document.getElementById)
		fontObj = document.getElementById("c1") ;
	
	else if (document.all)
		fontObj = document.all("c1") ;
	
	starti = 0;
	endi = 0;
	
	if ( ie )
		document.body.style.zoom =  fS+'%';
	
	else {
		var x = document.getElementsByTagName('*');
		
		for ( i = 0; i < x.length; i++ ) {		
			
			if ( x[i].id == "c1" && starti == 0) {
				starti = i;
				break;

			}
		
		}
		var x = fontObj.getElementsByTagName('*');
		endi = (starti + x.length)-1;
		starti++;
		
		for ( j = starti; j <= endi; j++ )
			x[j].style.fontSize = fS+'%';
	
	}

}

function swf(src, w, h){
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="param" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="'+src+'">';
	html += '<param name="quality" value="high">';
	html += '<param name="bgcolor" value="#ffffff">';
	html += '<param name="menu" value="false">';
	html += '<param nmme="wmode" value="window">';
	html += '<param name="swliveconnect" value="true">';
	html += '<embed src="'+src+'" quality=high bgcolor="#ffffff" menu="false" width="'+w+'" height="'+h+'" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash" wmode="window"></embed>';
	html += '</object>';
	document.write(html);

}



var defMag = 100;
var curMag = 100;
var maxMag = 200;
var minMag = 100;
var unit = 5;

function calcMag (method) {

	if (method == "+") {
		curMag += unit;
		
		if (curMag > maxMag) curMag = maxMag;
	
	} else if (method == "n") {
		curMag = defMag;
	
	} else if (method == "-") {
		curMag -= unit;
		
		if (curMag < minMag) curMag = minMag;

	} 
	//alert(curMag);

	//jq("#canvas").css("zoom", curMag+"%");
	//document.getElementById("sitemesh_content").style.zoom=curMag+"%";
	$("body").css("position", "absolute").get(0).style.zoom=curMag+"%";
	//setCookie("zoomVal", curMag, 1);

}
/*
function calc_init() {

	if((GetCookie("zoomVal") != null) && (GetCookie("zoomVal") != "")) {
		curMag = GetCookie("zoomVal");
	
		if(!((curMag > minMag)&(curMag < maxMag)))
			curMag = defMag;
	
		setCookie("zoomVal", curMag, 1);
		calcMag('');
	
	} else {
		curMag = defMag;
		setCookie("zoomVal", curMag, 1);
		calcMag('');

	}

}

if ( window.attachEvent ) {
	window.attachEvent("onload", calc_init);

} else {
	window.addEventListener("load", calc_init, true);

}
*/

