// flash
function swfView(src,w,h){
	var html = '';
	html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'" VIEWASTEXT>';
	html +=  '<param name="movie" value="'+src+'" />';
	html +=  '<param name="wmode" value="transparent" />';
	html +=  '<param name="quality" value="high" />';
	html +=  '<embed src="'+src+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" wmode="transparent">';
	html +=  '</embed> ';
	html +=  '</object>';
	document.write(html);
}

// 하단고정
if(typeof document.compatMode!='undefined'&&document.compatMode!='BackCompat'){
    cot_t1_DOCtp="_top:expression(document.documentElement.scrollTop+document.documentElement.clientHeight-this.clientHeight);_left:expression(document.documentElement.scrollLeft + document.documentElement.clientWidth - offsetWidth);}";
}else{
    cot_t1_DOCtp="_top:expression(document.body.scrollTop+document.body.clientHeight-this.clientHeight);_left:expression(document.body.scrollLeft + document.body.clientWidth - offsetWidth);}";
}

var cot_tl_bodyCSS='* html {background:url() fixed;background-repeat: repeat;background-position: right bottom;}';
var footerCSS='#footer{position:fixed;';
var footerCSS=footerCSS+'_position:absolute;';
var footerCSS=footerCSS+'z-index:1500;';
var footerCSS=footerCSS+'width:100%;';
//var footerCSS=footerCSS+'_width:98.4%;';
var footerCSS=footerCSS+'text-align:center;';
var footerCSS=footerCSS+'bottom:0;';
var footerCSS=footerCSS+'left:0;';
var footerCSS=footerCSS+'clip:rect(0 100% 100% 0);';
var footerCSS=footerCSS+cot_t1_DOCtp;

document.write('<style type="text/css">'+cot_tl_bodyCSS+footerCSS+'</style>');

// 커뮤니티서브메뉴
/*if(typeof document.compatMode!='undefined'&&document.compatMode!='BackCompat'){
    cot_t2_DOCtp="_top:expression(document.documentElement.scrollTop+document.documentElement.clientHeight-this.clientHeight);_left:expression(document.documentElement.scrollLeft + document.documentElement.clientWidth - offsetWidth);}";
}else{
    cot_t2_DOCtp="_top:expression(document.body.scrollTop+document.body.clientHeight-this.clientHeight);_left:expression(document.body.scrollLeft + document.body.clientWidth - offsetWidth);}";
}

var cot_tl_bodyCSS='* html {background:url() fixed;background-repeat: repeat;background-position: right bottom;}';
var commBtmCSS='#commBtm{position:fixed;';
var commBtmCSS=commBtmCSS+'_position:absolute;';
var commBtmCSS=commBtmCSS+'z-index:500;';
//var commBtmCSS=commBtmCSS+'width:100%;';
//var commBtmCSS=commBtmCSS+'text-align:center;';
//var commBtmCSS=commBtmCSS+'margin:0 auto;';
var commBtmCSS=commBtmCSS+'bottom:0;';
var commBtmCSS=commBtmCSS+'left:50%;';
//var commBtmCSS=commBtmCSS+'left:0;';
var commBtmCSS=commBtmCSS+'clip:rect(0 100% 100% 0);';
var commBtmCSS=commBtmCSS+cot_t2_DOCtp;

document.write('<style type="text/css">'+cot_tl_bodyCSS+commBtmCSS+'</style>');*/

/* 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);
			}
		}
	}
}

/* 따라다니는 레이어 */
//new Floating(적용할개체 , 스크롤시 Y축여백 , 최상단시 Y축여백 , 미끄러지는속도:작을수록빠름..기본20 , 빠르기:작을수록부드러움..기본10);

function Floating ( FloatingObj , MarginY , TopLimit , Percentage , setTime ) {
	this.FloatingObj = FloatingObj;
	this.MarginY = (MarginY) ? MarginY : 50;
	this.TopLimit = (TopLimit) ? TopLimit : 151;
	this.Percentage = (Percentage) ? Percentage : 30;
	this.setTime = (setTime) ? setTime : 10;
	this.FloatingObj.style.position = "absolute";
	this.Body = null;
	this.setTimeOut = null;
	this.Run();
}
Floating.prototype.Run = function () {
	this.Body = document.documentElement.scrollTop>document.body.scrollTop ? document.documentElement : document.body;
	var This = this;
	var FloatingObjTop = (this.FloatingObj.style.top) ? parseInt(this.FloatingObj.style.top,10) : this.FloatingObj.offsetTop;
	var DocTop = this.Body.scrollTop + this.MarginY;
	var MoveY = Math.abs(FloatingObjTop - DocTop);
	if ( DocTop > this.TopLimit ) {
		if ( FloatingObjTop < DocTop ) {
			this.FloatingObj.style.top = FloatingObjTop + Math.ceil( MoveY/this.Percentage ) + "px" ;
		} else {
			this.FloatingObj.style.top = DocTop + "px" ;
		}
	} else {
			this.FloatingObj.style.top = this.TopLimit + "px" ;
	}
	/* 레이어 위치 표시 (삭제해도 무방) 
	document.getElementById('rTop').innerHTML = 'FloatingObjTop:'+FloatingObjTop+'<br />DocTop:'+DocTop +'<br />MoveY:'+MoveY ;
	*/
	window.clearTimeout(this.setTimeOut);
	this.setTimeOut = window.setTimeout( function () { This.Run(); } , this.setTime );
}

/* 투명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='';  
    return ''; 
} 

/* 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 += "on";
			}
			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();
	}
}




// 브랜드모드
function brandStart() {
	document.getElementById("commWrap").style.display = "none";
	document.getElementById("quickMenuF").style.display = "none";
	location.href = "#";
}
function brandStop() {
	location.href = "/brand/index.asp";
}

// 커뮤니티모드
function tokStart() {
	document.getElementById("brandWrap").style.display = "none";
	document.getElementById("floating").style.display = "none";
}
function tokStop() {
	location.href = "/tok/index.asp";
}

// header
function openTop() {
	document.getElementById("header").style.height = "243" + "px";
}
function closeTop() {
	document.getElementById("header").style.height = "40" + "px";
}

// 푸터
function openFooter() {
	document.getElementById("footSwf").style.height = "610" + "px";
	document.getElementById("swf").style.top = "0";
}
function closeFooter() {
	document.getElementById("footSwf").style.height = "50" + "px";
	document.getElementById("swf").style.top = "-560" + "px";
}

// 배경플래쉬 높이값제어

function getPos() {
var y = document.documentElement.clientHeight;

var rect = document.getElementById('commWrap');
var rectObj = rect.getBoundingClientRect();
var rectCol = rectObj.bottom;

	if(rectCol <= y) {
		document.getElementById('showBox').style.height = "100%";
	} else {
		document.getElementById('showBox').style.height = rectCol + "px";
	}
}

//window.onload = getPos;
//window.onresize = getPos;

function getPos2() {
var y = document.documentElement.clientHeight;

var rect2 = document.getElementById('brandWrap');
var rectObj2 = rect2.getBoundingClientRect();
var rectCol2 = rectObj2.bottom;

	if(rectCol2 <= y) {
		document.getElementById('showBox').style.height = "100%";
	} else {
		document.getElementById('showBox').style.height = rectCol2 + "px";
	}
}

// wallpaper

function viewPop(seq) {
	var temp = document.getElementById("popRes" + seq);
	temp.style.display="block";
}

function closePop(seq){
	var temp = document.getElementById("popRes" + seq);
	temp.style.display="none";
}


//openVIew
function isView(divName,num){
	var ele = document.getElementById(divName);
	var titleEle=ele.getElementsByTagName('span');
	var contEle=ele.getElementsByTagName('dd');

  for(var i=0;i<titleEle.length;i++){
		if(i==num){
			if(contEle[i].className=="onCont"){
				titleEle[i].className="";
				contEle[i].className="";
			}else{
				titleEle[i].className="";
				contEle[i].className="onCont";
			}
		}else{
			titleEle[i].className="";
			contEle[i].className="";
		}
	}
}

// 이벤트 팝업
function open_Pop(seq){
	var temp = document.getElementById("quizEvent_" + seq);
	temp.style.display="block";
	location.href = "#quizEvent";
}
function close_Pop(seq){
	var temp = document.getElementById("quizEvent_" + seq);
	temp.style.display="none";
}