/* rollover */
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");
				this.setAttribute("src", this.getAttribute("hsrc"));
			}
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute("src").replace("_on"+ftype, ftype);
				this.setAttribute("src", sTempSrc);
			}
		}
	}
}

// Tab Content
function initTabMenu(tabContainerID, order) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	var arr = new Array ();
	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 += "ov";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;

		arr[i] = new Array ( thismenu.href.split("#")[1], thismenu );
	}

	if ( order && order != '') {
		for ( i=0; i<arr.length; i++ ) {
			if ( arr[i][0] == order ) {
				arr[i][1].onclick();
				break;
			}
		}
	}
	else {
		if (tabContainer.first)
			tabContainer.first.onclick();
	}
}

/* setPng24 */
function setPng24(obj) {
	obj.width=obj.height=1;
	obj.className=obj.className.replace(/\bpng24\b/i,'');
	obj.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src+"',sizingMethod='image');"
	obj.src='';  
	return '';
}

/* 점프메뉴 */
var theTarget = "_blank";
function globalSite(){
	window.open(document.getElementById('globalWebsite').value,theTarget);
}

// zoom image
var popbackground="white" //팝업 배경색상
var windowtitle="이미지 확대보기"  //팝업윈도우 제목
var css='* {margin:0; padding:0;}'

function detectexist(obj){ return (typeof obj !="undefined")
}

function jkpopimage(imgpath, popwidth, popheight){

function getpos(){
	leftpos=0;
	toppos=0;
	settings = 'height='+popheight+',width='+popwidth+',top='+toppos+',left='+leftpos+',scrollbars='
	}
getpos()

var winattributes='width='+popwidth+',height='+popheight+',resizable=yes,left='+leftpos+',top='+toppos
var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"'

	if (typeof jkpopwin=="undefined" || jkpopwin.closed)
		jkpopwin=window.open("","",winattributes)
	else {
		jkpopwin.resizeTo(popwidth, popheight)
	}

	jkpopwin.document.open()
	jkpopwin.document.write('<html><head><title>'+windowtitle+'</title><style type="text/css">'+css+'</style></head><body '+bodyattribute+'><img src="'+imgpath+'"></body></html>')
	jkpopwin.document.close()
	jkpopwin.focus()
}
