﻿var _setTime, ac, fadeAction
try { document.execCommand("BackgroundImageCache",false,true); } catch (e) { }

/* -- EASY ID pickup --------------------------------------------------------------- by Park  */
function $id(obj) { 
	if(typeof(obj) == 'object') return obj
	else return document.getElementById(obj);
}

function $name(id) {
	return document.getElementsByName(id);
}

	
/* -- flash write script -------------------------------------------------------------- by Park -- 
	[ files : path를 포함한 swf파일 ] [ name : 무비클립에 지정할 이름 ] [ width & height : 무비클립 크기 ]
-------------------------------------------------------------------------------------------- */
function writeSwf(files, name, width, height, val) {
	var sTag = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ width + '" height="'+ height + '" id="'+ name +'" align="middle">'
		+ '<param name="allowScriptAccess" value="always" />'
		+ '<param name="movie" value="' + files + '" />'
		+ '<param name="quality" value="high" />'
		+ '<param name="wmode" value="transparent">'
		+ '<param name="Menu" value="false">'
		+ '<embed wmode="transparent" src="' + files + '" quality="high" bgcolor="#ffffff" width="' + width + '" height="'+ height +'" name="'+ name +'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" swLiveConnect="true" Menu="false" /></object>';
	if(val) 
		$id(val).innerHTML = sTag;
	else
		document.write (sTag);
	eval("window." + name + " = document.getElementById('" + name + "');");

}

/* -- Boxmodel change script ------------------------------------------------------- by Park -- 
	[ obj : boxmodel object의 ID ] [ no : 바꿀 boxmodel의 번호 ]
-------------------------------------------------------------------------------------------- */
function boxChange(obj,no,on,off) {
	for (var i = 1; $id(obj+"Div_"+i); i++) $id(obj+"Div_"+i).style.display = "none"
	for (var i = 1; $id(obj+"Tab_"+i); i++) $id(obj+"Tab_"+i).className = ""
	$id(on).src = $id(on).src.replace("_off", "_on")
	$id(off).src = $id(off).src.replace("_on", "_off")
	$id(obj+"Div_"+no).style.display = "block"
	$id(obj+"Tab_"+no).className = "selected"
}

/* -- Image change script ---------------------------------------------------------- by Park -- 
	[ obj : image object의 ID ] [ type : 작동 타입 // 1(default) - mouseover // 2 - click ]
-------------------------------------------------------------------------------------------- */
function ImgToggle(obj,map) {
	var _img = (obj.nodeName == "IMG" ) ? obj : false;
	if(!_img) return false
	_img.src = _img.src.replace("_off", "_on")
	_img.onmouseout = function() { 
		if(_img.getAttribute('status') != "on") _img.src = _img.src.replace("_on", "_off")
	}
	if(map) {
		_img.onclick = function() { 
			var _tits = $id('mapBox').getElementsByTagName('IMG')
			for (var i=0; _tits[i]; i++) {
				_tits[i].src = _tits[i].src.replace("_on", "_off")
				_tits[i].setAttribute('status','off')
			}
			this.setAttribute('status','on')
			this.src = this.src.replace("_off", "_on") 
			cosView(map)
		}
	}
}

/* -- Image fade script ------------------------------------------------------------ by Park */
function cosView(cos) {
	var _maps = $id('mapBox').getElementsByTagName('DD')
	var _imgs = $id(cos+"Map").getElementsByTagName('IMG')
	for (var i=0; _maps[i]; i++ ) _maps[i].style.display = "none"
	for (var i=0; _imgs[i]; i++ ) {
		_imgs[i].style.display = "none"
		_imgs[i].setAttribute('op',0)
	}
	$id(cos).style.display = "block"
	clearTimeout(fadeAction)
	fade_in(_imgs)
}
function fade_in(obj) {
	Obj = obj
	for (var i=0; Obj[i]; i++ ) Obj[i].style.display = "none"
	if (Obj[0].getAttribute('op') != 100 ) {
		fadeObj = Obj[0]
	} else if ( Obj[1].getAttribute('op') != 100 ) {
		fadeObj = Obj[1]
	} else if ( Obj[2].getAttribute('op') != 100 ) {
		fadeObj = Obj[2]
	} else {
		for (var i=0; obj[i]; i++) obj[i].setAttribute('op',0)
		setTimeout('fade_in(Obj)',10)
		return false;
	}	
	fadeObj.style.display = "block"
	var op = fadeObj.getAttribute('op')
	op = parseInt(op) + 4
	fadeObj.setAttribute('op',op)
	fadeObj.style.filter = "alpha(opacity=" + op + ")";
	fadeObj.style.opacity = op / 100;
	if (op == 100) {
		fadeAction = setTimeout('fade_in(Obj)',2000)
	} else {
		fadeAction = setTimeout('fade_in(Obj)',10)
	}
}

/* -- Location action ------------------------------------------------------------ by Park */
function Go(_url,_target) {
	if(_target)
		window.open(_url,'_blank')
	else
		location.href = _url;
}