/********************************* IMAGE_ROLLOVER ½ºÅ©¸³Æ® ***************************/
function menuOn(imgEl)
{
	imgEl.src = imgEl.src.replace(".gif", "_ov.gif");
}

function menuOut(imgEl)
{
	imgEl.src = imgEl.src.replace("_ov.gif", ".gif");
}
/********************************* IMAGE_ROLLOVER ½ºÅ©¸³Æ® ***************************/

/********************************* ÆË¾÷ Áß¾Ó¿¡ ¶ç¿ì±â ***************************/
var win= null;
function NewWindow(mypage,myname,w,h,scroll){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
/********************************* ÆË¾÷ Áß¾Ó¿¡ ¶ç¿ì±â ***************************/

function charge() {
window.open('window.open','charge','toolbar=no,location=no,directory=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=758,height=500,left=0,top=0');
}

/********************************* faq ***************************/
var dhtmlgoodies_slideSpeed = 1000;    // Higher value = faster
var dhtmlgoodies_timer = 10;    // Lower value = faster

var objectIdToSlideDown = false;
var dhtmlgoodies_activeId = false;
var dhtmlgoodies_slideInProgress = false;
function showHideContent(e,inputId)
{
    if(dhtmlgoodies_slideInProgress)return;
    dhtmlgoodies_slideInProgress = true;
    if(!inputId)inputId = this.id;
    inputId = inputId + '';
    var numericId = inputId.replace(/[^0-9]/g,'');
    var answerDiv = document.getElementById('dhtmlgoodies_a' + numericId);

    objectIdToSlideDown = false;
    
    if(!answerDiv.style.display || answerDiv.style.display=='none'){        
        if(dhtmlgoodies_activeId &&  dhtmlgoodies_activeId!=numericId){            
            objectIdToSlideDown = numericId;
            slideContent(dhtmlgoodies_activeId,(dhtmlgoodies_slideSpeed*-1));
        }else{
            
            answerDiv.style.display='block';
            answerDiv.style.visibility = 'visible';
            
            slideContent(numericId,dhtmlgoodies_slideSpeed);
        }
    }else{
        slideContent(numericId,(dhtmlgoodies_slideSpeed*-1));
        dhtmlgoodies_activeId = false;
    }    
}

function slideContent(inputId,direction)
{
    
    var obj =document.getElementById('dhtmlgoodies_a' + inputId);
    var contentObj = document.getElementById('dhtmlgoodies_ac' + inputId);
    height = obj.clientHeight;
    if(height==0)height = obj.offsetHeight;
    height = height + direction;
    rerunFunction = true;
    if(height>contentObj.offsetHeight){
        height = contentObj.offsetHeight;
        rerunFunction = false;
    }
    if(height<=1){
        height = 1;
        rerunFunction = false;
    }

    obj.style.height = height + 'px';
    var topPos = height - contentObj.offsetHeight;
    if(topPos>0)topPos=0;
    contentObj.style.top = topPos + 'px';
    if(rerunFunction){
        setTimeout('slideContent(' + inputId + ',' + direction + ')',dhtmlgoodies_timer);
    }else{
        if(height<=1){
            obj.style.display='none'; 
            if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
                document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.display='block';
                document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.visibility='visible';
                slideContent(objectIdToSlideDown,dhtmlgoodies_slideSpeed);                
            }else{
                dhtmlgoodies_slideInProgress = false;
            }
        }else{
            dhtmlgoodies_activeId = inputId;
            dhtmlgoodies_slideInProgress = false;
        }
    }
}

function getCookie(name)
{
	var blank='';
	var cname = name + '=';
	var dc = (document.cookie+';');
	if(dc.length > 0) {
		begin = dc.lastIndexOf(cname);
		if(begin==-1)
			begin=dc.lastIndexOf(name);
		if(dc.charAt(begin+name.length)==';')
			return '';
	
		if(begin != -1) {
			begin += cname.length;
			end = dc.indexOf(';', begin);
			if(end == -1) 
				end = dc.length;
			if(begin==end)
				return blank;
			return unescape(dc.substring(begin, end));
		}
	}
	return null;
}

function initShowHideDivs()
{
    var divs = document.getElementsByTagName('DIV');
    var divCounter = 1;
    for(var no=0;no<divs.length;no++){
        if(divs[no].className=='question'){
            divs[no].onclick = showHideContent;
            divs[no].id = 'dhtmlgoodies_q'+divCounter;
            var answer = divs[no].nextSibling;
            while(answer && answer.tagName!='DIV'){
                answer = answer.nextSibling;
            }
            answer.id = 'dhtmlgoodies_a'+divCounter;    
            contentDiv = answer.getElementsByTagName('DIV')[0];
            contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px';     
            contentDiv.className='answer_content';
            contentDiv.id = 'dhtmlgoodies_ac' + divCounter;
            answer.style.display='none';
            answer.style.height='1px';
            divCounter++;
        }        
    }    
}
/********************************* faq ***************************/
function floatedLayer(eleName, initialTop, bottomLimit) {

	if (!document.getElementById(eleName)) { return; }
	
	this.ele = document.getElementById(eleName);
	this.initialTop = initialTop;
	this.bottomLimit = (!bottomLimit)? 0 : bottomLimit;
	this.timer = null;
	this.moveLayer();
}

/* class property */
floatedLayer.INTERVAL = 10; /* µ¿ÀÛ °£°Ý: (´ÜÀ§: ¹Ð¸®ÃÊ(ms)) */
floatedLayer.DEGREE = 5; /* ¿òÁ÷ÀÓ Á¤µµ: (´ÜÀ§: ÆÛ¼¾Æ®, 0 < ¹üÀ§ <= 100) */

/* instance method */
floatedLayer.prototype.moveLayer = function () {

	var scrollHeight = 0;

	// ½ºÅ©·ÑµÈ ³ôÀÌ °è»ê (Âü°í: http://www.howtocreate.co.uk/tutorials/javascript/browserwindow)
	if (document.body && document.body.scrollTop) {
		scrollHeight = document.body.scrollTop;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		scrollHeight = document.documentElement.scrollTop;
	}

	var top = (isNaN(parseInt(this.ele.style.top)))? this.initialTop : parseInt(this.ele.style.top);
	var exactHeight = scrollHeight + this.initialTop;

	var moveHeight = Math.ceil(Math.abs(top - exactHeight) * floatedLayer.DEGREE / 100);
	
	top = (top > exactHeight)? top - moveHeight : top + moveHeight;

	var documentHeight = document.body.offsetHeight;
	var eleHeight = this.ele.offsetHeight;

	if ((top + eleHeight) >= documentHeight - this.bottomLimit) {
		top = documentHeight - eleHeight - this.bottomLimit;
	}

	this.ele.style.top = top + "px";

	// setTimeout¿¡¼­ ÀÎ½ºÅÏ½º ¸Þ¼Òµå »ç¿ë (Âü°í: http://www.faqts.com/knowledge_base/view.phtml/aid/2311)
	var self = this;
	if (this.timer) {
		window.clearTimeout(this.timer);
	}
	this.timer = window.setTimeout(function () { self.moveLayer(); }, floatedLayer.INTERVAL);
}

window.onload  = function() {
	quickMenu();
}

function quickMenu(){
	var ele1Top = 0;
	if (document.getElementById("divStayTopLeft")) {
		new floatedLayer("divStayTopLeft", ele1Top, 80);
	}
}




/********************************* flash ***************************/
function embedFlash1(id, url, width, height, altText, flashVars, wmode) {
	if (!flashVars) flashVars = '';
	if (!wmode) wmode = 'window';
	if (!altText) altText = '<p style="padding-right: 8px;">ÇÃ·¡½Ã ÇÃ·¯±×ÀÎÀÌ ¼³Ä¡µÇ¾î ÀÖÁö ¾Ê½À´Ï´Ù.<br />¾Æ·¡ ¸µÅ©¸¦ Å¬¸¯ÇÏ½Ã¸é ÇÃ·¯±×ÀÎ ´Ù¿î·Îµå ÆäÀÌÁö·Î ÀÌµ¿ÇÕ´Ï´Ù.<br /><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=shockwaveFlash">ÇÃ·¡½Ã ÇÃ·¯±×ÀÎ ´Ù¿î·Îµå ÆäÀÌÁö</a></p>';

	var str = '' +
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="' + width + '" height="' + height + '" id="' + id + '">' +
		'<param name="movie" value="' + url + '" />' +
		'<param name="wmode" value="' + wmode + '" />' +
		'<param name="FlashVars" value="' + flashVars + '" />' +
		'<!--[if !IE]>-->' +
		'<object type="application/x-shockwave-flash" data="' + url + '" width="' + width + '" height="' + height + '">' +
			'<param name="wmode" value="' + wmode + '" />' +
			'<param name="FlashVars" value="' + flashVars + '" />' +
		'<!--<![endif]-->' +
			'<div class="alt-content">' + altText + '</div>' +
		'<!--[if !IE]>-->' +
		'</object>' +
		'<!--<![endif]-->' +
	'</object>';
	document.write(str);
}

/* ÀÌ¹ÌÁö ·Ñ¿À¹ö */
function imgover(imgEl) {
	var imgEl = document.getElementById(imgEl);
	imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}
function imgout(imgEl) {
	var imgEl = document.getElementById(imgEl);
	imgEl.src = imgEl.src.replace("_on.gif", ".gif");
}

function imgon() {
	this.src = this.src.replace("_off.gif", "_on.gif");
}
function imgoff() {
	this.src = this.src.replace("_on.gif", "_off.gif");
}
/* ÅÇ¸Þ´º */
function initTab(menuElId) {
	var tabMenu = document.getElementById(menuElId).getElementsByTagName("a");
	for(i=0; i<tabMenu.length; i++) {
		thismenu = tabMenu.item(i);
		thismenu.menuContainer = document.getElementById(menuElId);
		thismenu.targetEl = document.getElementById(tabMenu.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.getElementsByTagName("img").item(0).onmouseover = imgoff;
		thismenu.getElementsByTagName("img").item(0).onmouseout = imgoff;
		thismenu.onclick = tabClick;
	}
	initmenu = tabMenu.item(0);
	initmenu.targetEl.style.display = "block";
	initmenu.getElementsByTagName("img").item(0).onmouseover = imgon;
	initmenu.getElementsByTagName("img").item(0).onmouseout = imgon;
	initmenu.getElementsByTagName("img").item(0).onmouseover();
	initmenu.menuContainer.current = initmenu;
}

function initTabIdx(menuElId, index) {
	var tabMenu = document.getElementById(menuElId).getElementsByTagName("a");
	for(i=0; i<tabMenu.length; i++) {
		thismenu = tabMenu.item(i);
		thismenu.menuContainer = document.getElementById(menuElId);
		thismenu.targetEl = document.getElementById(tabMenu.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.getElementsByTagName("img").item(0).onmouseover = imgoff;
		thismenu.getElementsByTagName("img").item(0).onmouseout = imgoff;
		thismenu.onclick = tabClick;
	}
	initmenu = tabMenu.item(index);
	initmenu.targetEl.style.display = "block";
	initmenu.getElementsByTagName("img").item(0).onmouseover = imgon;
	initmenu.getElementsByTagName("img").item(0).onmouseout = imgon;
	initmenu.getElementsByTagName("img").item(0).onmouseover();
	initmenu.menuContainer.current = initmenu;
	thismenu = tabMenu.item(0);
	thismenu.getElementsByTagName("img").item(0).onmouseout();
}

function tabClick() {
	currentmenu = this.menuContainer.current;
	if (currentmenu != this) {
		currentmenu.targetEl.style.display = "none";
		currentmenu.getElementsByTagName("img").item(0).onmouseover = imgoff;
		currentmenu.getElementsByTagName("img").item(0).onmouseout = imgoff;
		currentmenu.getElementsByTagName("img").item(0).onmouseout();
	
		this.targetEl.style.display = "block";
		this.getElementsByTagName("img").item(0).onmouseover = imgon;
		this.getElementsByTagName("img").item(0).onmouseout = imgon;
		this.getElementsByTagName("img").item(0).onmouseover();
		this.menuContainer.current = this;
	}
	return false;
}