
/* ###########################################
                    Image RollOver
########################################### */

// image roll
function imgOver(imgEl) {
	imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}
function imgOut(imgEl) {
	imgEl.src = imgEl.src.replace("_on.gif", ".gif");
}

function full(url)
{
    var W = (screen.width) - 10;
    var H = (screen.height) - 50;
    window.open(url, "wireMuseum","width="+W.toString()+",height="+H.toString()+",resizable=no,left=0,top=0,screenX=0,screenY=0,scrollbars=no, menubar=no, titlebar=no, toolbar=no, status=no, directories=no");
 return;
}

// Flash ?
function FlashMenu(vUrl,obj,wid,hei,pageId) {
	var viewObj = '' +
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0" width="' + wid + '" height="' + hei + '" id="' + obj + '" align="middle">' +
	'<param name="movie" value="/korean/include/swf/'+ vUrl +'?catcode='+ pageId +'&xmlPath=/korean/include/swf/link.xml" />' +
	'<param name="wmode" value="transparent" />' +
	'<param name="quality" value="high" />' +
	'<param name="scale" value="noscale" />' +
	'<param name="salign" value="lt" />' +
	'<embed src="/korean/include/swf/'+ vUrl +'?catcode='+ pageId +'&xmlPath=/korean/include/swf/link.xml" wmode="transparent" quality="high" scale="noscale" salign="lt" width="' + wid + '" height="' + hei + '" name="' + obj + '" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' +
	'</object>';
	document.write(viewObj);
}

// Flash Object
function FlashEl(vUrl,obj,wid,hei) {
	var viewObj = '' +
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0" width="' + wid + '" height="' + hei + '" id="' + obj + '" align="top">' +
	'<param name="movie" value="'+ vUrl +'" />' +
	'<param name="wmode" value="window" />' +
	'<param name="quality" value="high" />' +
	'<param name="scale" value="noscale" />' +
	'<param name="salign" value="lt" />' +
	'<embed src="'+ vUrl +'" wmode="window" quality="high" width="' + wid + '" height="' + hei + '" name="' + obj + '" align="top" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' +
	'</object>';
	document.write(viewObj);
}

// Flash Product
function FlashPr(vImg) {
	var viewObj = '' +
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0" width="209" height="188" id="productViewer" align="top">' +
	'<param name="allowScriptAccess" value="sameDomain" />' +
	'<param name="movie" value="/korean/product/swf/productViewer.swf?filePath=/korean/product/img/&imgVar='+ vImg +'" />' +
	'<param name="quality" value="high" />' +
	'<embed src="/korean/product/swf/productViewer.swf?filePath=/korean/product/img/&imgVar='+ vImg +'" allowScriptAccess="sameDomain" quality="high" width="209" height="188" name="productViewer" align="top" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' +
	'</object>';
	document.write(viewObj);
}


// Flash QuickMenu
function topMove() {
	document.documentElement.scrollTop = 0;
}

/* ###########################################
                    List Toggle
########################################### */
function initView(listEl) {
	var listContainer	= document.getElementById(listEl);
	var listLine = listContainer.getElementsByTagName("tr");
	var listAnchor = listContainer.getElementsByTagName("a");
	
	for(i = 0; i < listLine.length/2-0.5; i++) {
		if (listLine.item(i*2+1).className = "line")
			thismenu = listLine.item(i*2+1);
		else
			continue;
	
		thismenu.container = listContainer;
		thismenu.targetEl = document.getElementById(listAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		
		thismenu.onclick = function () {
			if (listContainer.current == this) {
				this.targetEl.style.display = "none";
				listContainer.current = null;
			} else {
				if (listContainer.current) {
					listContainer.current.targetEl.style.display = "none";
				}
				this.targetEl.style.display = "block";
				listContainer.current = this;
			}
			return false;
		}
	}
}



// Tab Content
function initTabMenu(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 == "")
			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() {
		  	//document.documentElement.scrollTop = 1000 + 'px'; 
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
			}
			this.targetEl.style.display = "";
			this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}


//QuickMenu Layer
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)
}




// Windows open function
function openWin(url,width,height) {
         var srUrl = url;
         window.open(srUrl,"","toolbar=no,width="+width+",height="+height+",scrollbars=yes,resizable=yes,menubar=no,status=no");
}
