/* addLoadEvent */
function addLoadEvent(func) {
 var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
       oldonload();
      func();
    }
   }
}

/* addResizeEvent */
function addResizeEvent(func) {
	var oldonresize = window.onresize;
	if (typeof window.onresize != 'function') {
		window.onresize = func;
	}else {
		window.onresize = function() {
			oldonresize();
			func();
		}
   }
}

/* Flash Depth Change */
function depthChange(zIndexType){
	var headerEl = document.getElementById("header");
	var contentEl = document.getElementById("content");
	switch(zIndexType){
		case "start" : headerEl.style.zIndex = "5"; contentEl.style.zIndex = "1"; 
		break;
		case "end" : headerEl.style.zIndex = "1"; contentEl.style.zIndex = "5";
		break;
		default : headerEl.style.zIndex = "1"; contentEl.style.zIndex = "5";
		break;
	}
}
/* Flash Footer familyDepthChange */
function familyDepthChange(str){
	var footerEl = document.getElementById("footer");
	switch(str){
			case "on" : footerEl.style.zIndex= "4";
			break;
			case "off" : footerEl.style.zIndex= "1";
			break;
			default : footerEl.style.zIndex= "1";
			break;
	}
}

var htmlEl = document.getElementsByTagName("html")[0];
function digitalHistoryOn(){
	var digitalflashEl = document.getElementById("digital-flash");
	var wrapperEl = document.getElementById("wrapper");
	digitalflashEl.style.display = "block";
	htmlEl.style.overflow = "hidden";
	wrapperEl.style.display = "none";
	addResizeEvent(dHResizeEvent);
	//resizeEvent = setInterval(dHResizeEvent,1000);
}
function digitalHistoryOff(){
	var digitalflashEl = document.getElementById("digital-flash");
	var wrapperEl = document.getElementById("wrapper");
	htmlEl.style.overflow = "auto";
	wrapperEl.style.display = "block";
	digitalflashEl.style.display = "none";
	window.onresize = null;
}
function dHResizeEvent(){
	var bodyW = document.body.offsetWidth;
	var bodyH = document.body.offsetHeight;
	var digitalflashEl = document.getElementById("digital-flash");
	var minW = 975;
	var minH = 768;
	
	if(bodyW <= minW){ 
		minWidth(minW);
	}
	else{ 
		notWH('w'); 
	}
	if(bodyH <= minH){ 
		minHeight(minH); 
	}else{ 
		notWH('h'); 
	}
}
function minWidth(minW){
		var digitalflashEl = document.getElementById("digital-flash");
		var htmlElScroll = function(){ 
			htmlEl.style.overflowX = "auto";
			clearTimeout(spaceTime);
		};
		var spaceTime = setTimeout(htmlElScroll,600);
		digitalflashEl.style.width = minW + "px";
}
function minHeight(minH){
		var digitalflashEl = document.getElementById("digital-flash");
		var htmlElScroll = function(){ 
			htmlEl.style.overflowY = "auto";
			clearTimeout(spaceTime);
		};
		var spaceTime = setTimeout(htmlElScroll,100);
		digitalflashEl.style.height = minH + "px";
}
function notWH(minType){
		var digitalflashEl = document.getElementById("digital-flash");
		htmlEl.style.overflow = "hidden";
		if(minType == "w"){
			digitalflashEl.style.width = "100%";
		}else{
			digitalflashEl.style.height = "100%";
		}
}

/* Sontent Scroll-X Hidden 
function contentScroll(){
	var bodyW = document.body.offsetWidth;
	var bodyH = document.body.offsetHeight;
	var bodyParent = document.body.parentNode;
	var contentElW = document.getElementById("wrapper").offsetWidth;
	if(bodyW >= contentElW){ 
		bodyParent.style.overflowX = "hidden";
		document.body.className = "ocivisual";
	}
	else{ 
		bodyParent.style.overflowX = "auto";
		document.body.className = "notvisual";
	}
}
*/

/* flashLoad(ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, ¾ÆÀÌµð, ¹è°æ»ö, º¯¼ö, À©µµ¿ì¸ðµå) */
function flashLoad(url,w,h,id,bg,vars,win) {
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='sameDomain' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<param name='base' value='.'>"+
	"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";	
	// ÇÃ·¡½Ã ÄÚµå Ãâ·Â
	document.write(flashStr);
	
	//FlashÀÇ ExternalInterface°¡ Form Tag³»¿¡¼­ ¿À·ù³ª´Â ¹ö±×¸¦ ÇØ°áÇÏ´Â ÄÚµå     
	//eval("window." + id + " = document.getElementById('" + id + "');");	
}

/* IE Background */
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

/* PNG */
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='about:blank;';
	return '';
}

/* ClassHover */
function hoverOn(obj) { obj.className = obj.className + " hover"; }
function hoverOut(obj) { obj.className = obj.className.replace(" hover",""); }

/* Image On Change   */
/* Image Rollover */
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function mOn(imgEl) { if(imgEl.src.indexOf("_on") < 0) imgEl.src = imgEl.src.replace(".gif", "_on.gif"); }
function mOff(imgEl) { imgEl.src = imgEl.src.replace("_on.gif", ".gif"); }
//function mOn(objImgId) {
//
//}

//function mOff(imgEl) {
//	MM_swapImgRestore();
//}
/* POPUP */
function popType(form_nm, type,src,w,h){
  var newsrc = src.lastIndexOf(".");
  switch(type){
    case 1 :
      var scroll = "yes"
    break;
    case 2 :
      var scroll = "no"
    break;
    case 3 :
      popup = window.open(src,"new"+ h +"",'fullscreen,scrollbars,width="100%",height="100%"');
    break;
    default :
      var scroll = "yes";
    break;
  }
  var space = 20;
  var winleft = (screen.width - w) / 2;
  var wintop = (screen.height - h) / 2 - space;
  var poptype = 'width='+w+',height='+h+',top='+wintop+',left='+winleft+',resizable=no,scrollbars='+scroll+',toolbars=no,status=no,menu=no';
  popup = window.open(src, form_nm, poptype)
  if (parseInt(navigator.appVersion) >= 4) { popup.window.focus(); }
}

/* lbox */
function lbox(idx){
	var getCurrentYPos = function(){ return window.pageYOffset || window.scrollY || document.documentElement.scrollTop || document.body.scrollTop ; };
	var wrapperH = document.getElementById("wrapper").offsetHeight;
	var spaceWrap = document.getElementById("lbox-wrap");
	var bodyH = document.body.offsetHeight;
	var boxOut = document.getElementById(idx);
	var boxOutW = boxOut.offsetWidth;
	var boxOutH = boxOut.offsetHeight;
	boxOut.style.marginLeft = -(boxOutW / 2) + 90 + "px";
	boxOut.style.marginTop = -(boxOutH / 2) + getCurrentYPos() + "px";
	boxOut.style.left = "50%";
	boxOut.style.width = boxOutW + "px";
	boxOut.style.height = boxOutH + "px";	
	if( wrapperH <= bodyH){ spaceWrap.style.height = bodyH + "px";
	}else{ spaceWrap.style.height = wrapperH + "px"; }
	spaceWrap.onclick = function(){  spaceWrap.style.display = "none"; boxOut.style.left = "-99999px"; boxOut.style.top = "0%";	}
	if(spaceWrap.style.display == "none"){ boxOut.style.left = "50%"; boxOut.style.top = "50%"; spaceWrap.style.display = "block"; }
	else{ boxOut.style.left = "-99999px"; boxOut.style.top = "0%"; spaceWrap.style.display = "none"; }
}

/* Request */
function Request(valuename){
	var rtnval = "";
	var nowAddress = unescape(location.href);
	var parameters = (nowAddress.slice(nowAddress.indexOf("?")+1,nowAddress.length)).split("&");
	
	for(var i = 0 ; i < parameters.length ; i++){
	var varName = parameters[i].split("=")[0];
	if(varName.toUpperCase() == valuename.toUpperCase())
	{
		rtnval = parameters[i].split("=")[1];
		break;
	}
	}
	return rtnval;
}
/* Flash Search Call */
function topSearch(str){
	document.location.href = "/product/product_search.asp?srchVal=" + str;
}

/* Location 
function setPathInfo() {
}
*/
/* ONLOAD EVENT */
//addLoadEvent (setPathInfo);
//addLoadEvent(contentScroll);
//addResizeEvent(contentScroll);

/* IE Alt Delete 
var IE='\v'=='v';
var imgAltReset = function(){ imgEl = document.getElementsByTagName("img"); for(var i=0; i<imgEl.length; i++){ imgEl[i].setAttribute("alt",""); } }
if(IE){ addLoadEvent (imgAltReset); }
*/

// ÆÄÀÏ´Ù¿î·Îµå
/*
	»èÁ¦ÇÏÁö ¸¶¼¼¿ä.
*/
function doFileDownload(gbn, cate, seq) {
	var obj 	= new IS_FormHandler();		// Class ¼±¾ð
	obj.IS_setFormID(document.frmFile);			// Form Name ¼¼ÆÃ
	obj.IS_setTarget("frmFrame");				// Target ¼³Á¤
	obj.IS_setMethod("post");				// Method ¼³Á¤
	obj.IS_setAction("/product/product_filedownload.asp");	// Action URL ¼³Á¤
	obj.IS_setInputValue("gubun",gbn);
	obj.IS_setInputValue("category", cate);
	obj.IS_setInputValue("idx", seq);
	obj.IS_doSubmit();
}

