// ±¸±Û Åë°è ÇÁ·Î±×·¥ ÄÚµå
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-12805932-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


// ¸ÞÀÎ ÆäÀÌÁö ÅëÇÕ°Ë»ö Å°¿öµå ÃÊ±â°ª
function check_w(vv){if (vv.value == ""){vv.value = vv.defaultValue;}}
function clear_w(vv){if (vv.value == vv.defaultValue){vv.value = "";}}


// ÅëÇÕ°Ë»ö ÀÔ·Â°ª °ËÁõ
function search(form) {
  if (form.q.value == "" || form.q.value == "°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä") {
    alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
    form.q.focus();
    return
  }
  form.submit();
}


// ¸µÅ©Á¡¼±Á¦°Å
function bluring(){ 
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
	} 
document.onfocusin=bluring;


// Áö½Ä°Ë»ö Áú¹®ÇÏ±â
function kb_check_focus() 
{
	if (document.question_form.title.value == 'Áú¹®ÇÏ½Ç ³»¿ëÀÇ ÇÙ½É Å°¿öµå¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.')
		document.question_form.title.value='';
}
function kb_form_submit () 
{
    qform = document.question_form;
    qform.query.value = qform.title.value;
    s = qform.title.value;

    if (qform.title.value == '')
		alert ('Áú¹® Á¦¸ñÀ» Àû¾îÁÖ¼¼¿ä.');
	else if (s.length > 50)
		alert ('Áú¹® Á¦¸ñÀº 2ÀÚ ÀÌ³»·Î Àû¾îÁÖ¼¼¿ä.');
	else if (qform.title.value == 'Áú¹®ÇÏ½Ç ³»¿ëÀÇ ÇÙ½É Å°¿öµå¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.')
		window.location = '/app/index.php?id=Knowledge';
	else 
	{
        qform.action = '/app/index.php?id=Knowledge&keyword='+qform.title.value;
		qform.submit();
	}
}


// ÆË¾÷Ã¢ Áß¾ÓÀ¸·Î ÀÌµ¿ 
function center() {
	var x,y;
	if (self.innerHeight) {
        x = (screen.availWidth - self.innerWidth) / 2;
        y = (screen.availHeight - self.innerHeight) / 2;
    }else if (document.documentElement && document.documentElement.clientHeight) {
        x = (screen.availWidth - document.documentElement.clientWidth) / 2; 
        y = (screen.availHeight - document.documentElement.clientHeight) / 2; 
    }else if (document.body) {
        x = (screen.availWidth - document.body.clientWidth) / 2; 
        y = (screen.availHeight - document.body.clientHeight) / 2; 
    } 
    window.moveTo(x,y); 
}

// ¸ÞÀÎ - ÆÐ¹Ð¸® »çÀÌÆ® ·¹ÀÌ¾î º¸ÀÌ±â/°¨Ãß±â

function show_layer(name,status) { 
		var select_obj;
		var obj=document.all[name];
		var _tmpx,_tmpy, marginx, marginy;
		_tmpx = event.clientX + parseInt(obj.offsetWidth);
		_tmpy = event.clientY + parseInt(obj.offsetHeight);
		_marginx = document.body.clientWidth - _tmpx;
		_marginy = document.body.clientHeight - _tmpy ;
		if(_marginx < 0)
			_tmpx = event.clientX + document.body.scrollLeft + _marginx ;
		else
			_tmpx = event.clientX + document.body.scrollLeft ;
		if(_marginy < 0)
			_tmpy = event.clientY + document.body.scrollTop + _marginy +10;
		else
			_tmpy = event.clientY + document.body.scrollTop -200;
		obj.style.posLeft=_tmpx-15;
		obj.style.posTop=_tmpy-15;
		if(status=='visible') {
			if(select_obj) {
				select_obj.style.visibility='hidden';
				select_obj=null;
			}
			select_obj=obj;
		}else{
			select_obj=null;
		}
		obj.style.visibility=status; 
	}



// Àç¸²¸¶À» ¸ÞÀÎ¿¡¼­ ¼³±³¹æ¼Û ·ÎÅ×ÀÌ¼Ç

function drScroll() {

	this.version = "0.1";
	this.name = "drScroll";
	this.item = new Array();
	this.itemcount = 0;
	this.itemoffset = 0;
	this.item_i = new Array();
	this.item_icount = 0;
	this.item_ioffset = 0;
	this.currentspeed = 0;
	this.scrollspeed = 50;
	this.pausedelay = 1000;
	this.pausemouseover = false;
	this.stop = 0;
	this.height = 100;
	this.heightGap = 0;
	this.width = 100;
	this.height_i = 100;
	this.width_i = 100;
	this.stopHeight=0;
	this.count=0;
	this.flag=true;
	this.position="absolute";
	this.item_position="absolute";

	this.add = function () {
		var text = arguments[0];
		this.item[this.itemcount] = text;
		this.itemcount = this.itemcount + 1;
	};

	this.addImage = function () {
		var text = arguments[0];
		this.item_i[this.item_icount] = text;
		this.item_icount = this.item_icount + 1;
	};

	this.start = function () {
		this.display();
		this.currentspeed = this.scrollspeed;
		obj = document.getElementById(this.name+'item0').style;
		obj.display='block';
		this.count++;
		setTimeout(this.name+'.scroll()',this.currentspeed);
	};

	this.ready = function () {
		now = new Date(); ran = now % this.item_icount;
		temp = this.item_i[ran]; this.item_i[ran] = this.item_i[0]; this.item_i[0] = temp;
		this.displayImage();
		obj_i = document.getElementById(this.name+'item_i0').style;
		obj_i.display='block';
	};

	this.display = function () {
		document.write('<div id="'+this.name+'" style="height:'+this.height+';width:'+this.width+';position:'+this.position+';overflow:hidden;" OnMouseOver="'+this.name+'.onmouseover();" OnMouseOut="'+this.name+'.onmouseout();">');
		for(var i = 0; i < this.itemcount; i++) {
				document.write('<div id="'+this.name+'item'+i+'"style="left:0px; width:'+this.width+';position:'+this.item_position+'; display:none; ">');
				document.write(this.item[i]);
				document.write('</div>');
		}
		document.write('</div>');
	};

	this.displayImage = function () {
		document.write('<div id="'+this.name+'_i" style="left:0; height:'+this.height_i+';width:'+this.width_i+';position:relative;overflow:hidden;" OnMouseOver="'+this.name+'.onmouseover();" OnMouseOut="'+this.name+'.onmouseout();">');
		for(var i = 0; i < this.item_icount; i++) {
			document.write('<div id="'+this.name+'item_i'+i+'"style="left:0px; width:'+this.width_i+'; display:none; ">');
			document.write(this.item_i[i]);
			document.write('</div>');
		}
		document.write('</div>');
	};

	this.scroll = function () {
		this.currentspeed = this.scrollspeed;
		if ( !this.stop ) {
			this.imageChange();
		}
		window.setTimeout(this.name+".scroll()",this.currentspeed);
	};


	this.imageChange = function ()
	{
		for (k = 0; k < this.item_icount; k++) {
			obj_i = document.getElementById(this.name+'item_i'+k).style;
			if (this.count % this.item_icount == k) {
				obj_i.display = 'block';
			} else {
				obj_i.display = 'none';
			}
		}
		for (k = 0; k < this.itemcount; k++) {
			obj = document.getElementById(this.name+'item'+k).style;
			if (this.count % this.itemcount == k) {
				obj.display = 'block';
			} else {
				obj.display = 'none';
			}
		}
		this.count++;
	}

	this.onmouseover = function ()
	{
		if ( this.pausemouseover ) {
			this.stop = 1;
		}
	};
  for (k = 0; k < this.item_icount; k++) {
    obj_i = document.getElementById(this.name+'item_i'+k).style;
    if (this.count % this.item_icount == k) {
      obj_i.display = 'block';
    } else {
      obj_i.display = 'none';
    }
  }

	this.onmouseout = function ()
	{
		if ( this.pausemouseover ) {
			this.stop = 0;
		}
	};

	this.up = function ()
	{
		var i;
		this.stop++;

		if ( this.itemcount <= this.itemoffset )
			this.itemoffset = this.itemoffset % this.itemcount;

		for (i = 0; i < this.item_icount; i++) {
			obj_i = document.getElementById(this.name+'item_i'+i).style;
			if ( obj_i.display == "block" ) {this.item_ioffset = i+1;obj_i.display="none";}
		}

		if (this.item_icount > 0) {
			if (this.item_ioffset < this.item_icount) {
				obj_i = document.getElementById(this.name+'item_i'+this.item_ioffset).style;
				obj_i.display = "block";
			} else {
				obj_i = document.getElementById(this.name+'item_i0').style;
				obj_i.display = "block";
			}
		}
		for (i = 0; i < this.itemcount; i++) {
			obj = document.getElementById(this.name+'item'+i).style;
			if ( obj.display == "block" ) {this.itemoffset = i+1;obj.display="none";}
		}
		if (this.itemoffset < this.itemcount) {
			obj = document.getElementById(this.name+'item'+this.itemoffset).style;
			obj.display = "block";
		} else {
			obj = document.getElementById(this.name+'item0').style;
			obj.display = "block";
		}
		window.setTimeout(this.name + ".stop--;",this.pausedelay);
		//this.stop--;
	}
}

// ½ºÅ©·Ñ Á¤ÀÇ
scr = new drScroll();
scr.name = "scr";
scr.height = 0;
scr.width = 0;
scr.height_i = 173;
scr.width_i = 190;
scr.scrollspeed = 5000;
scr.pausedelay = 2000;
scr.pausemouseover = true;

scr.add("");
scr.add("");
scr.add("");


function hopeplayer() {
	var hp = window.open("/hopeplayer/bro.html","hopeplayer","left=0,top=0,width=670,height=422,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no");
	hp.focus();
}



function ScrollLine() {
this.objname = "Scroll";
this.divname = "divname";
this.item = new Array();
this.itemcount = 0;
this.currentspeed = 0;
this.scrollspeed = 50;
this.pausetime = 1000;
this.pausemouseover = false;
this.stop = false;
this.height = 100;
this.width = 100;
this.i=0;
this.cindex=0;
this.refreash = 0;
this.add = function () {
var text = arguments[0];
this.item[this.itemcount] = text;
this.itemcount++;
};
this.linehtml = function(i) {
var divHTML;
divHTML = '';
divHTML += '<div id="'+this.objname+'item'+i+'"style="left:0px; width:'+this.width+'; position:absolute; top:'+(this.height*i)+'px; ">';
divHTML += this.item[i];
divHTML += '</div>';
return divHTML;
}
this.start = function () {
if ( this.itemcount == 1 ) {
this.add(this.item[0]);
}
this.display();
this.currentspeed = this.scrollspeed;
this.stop = true;
setTimeout(this.objname+'.scroll()',this.currentspeed);
window.setTimeout(this.objname+".stop = false", this.pausetime);
};
this.display = function () {
var divHTML;
divHTML = '<div id="'+this.objname+'" style="height:'+this.height+'; width:'+this.width+'; position:relative; overflow:hidden; " OnMouseOver="'+this.objname+'.onmouseover(); " OnMouseOut="'+this.objname+'.onmouseout(); ">';
for(var i = 0; i < this.itemcount; i++) {
divHTML += this.linehtml(i);
}
divHTML += '</div>';
document.getElementById(this.divname).innerHTML=divHTML;
};
this.scroll = function () {
if ( this.pause == true ) {
window.setTimeout(this.objname+".scroll()",this.pausetime);
this.pause = false;
} else {
this.currentspeed = this.scrollspeed;
if ( !this.stop ) {
for (var i = 0; i < this.itemcount; i++) {
obj = document.getElementById(this.objname+'item'+i).style;
obj.top = parseInt(obj.top) - 1;
if ( parseInt(obj.top) <= this.height * (-1) ) obj.top = this.height * (this.itemcount-1);
if ( parseInt(obj.top) == 0 ) {
this.currentspeed = this.pausetime;
this.i = i;
}
}
}
if( !this.stop && i == this.itemcount && parseInt(obj.top) == 0 && this.refreash == 1 ) {
this.refreash = 0;
}
else {
window.setTimeout(this.objname+".scroll()",this.currentspeed);
}
}
};
this.onmouseover = function () {
if ( this.pausemouseover ) {
this.stop = true;
}
};
this.onmouseout = function () {
if ( this.pausemouseover ) {
this.stop = false;
}
};
this.next = function() {
height = this.height;
for (i = 0; i < this.itemcount; i++) {
obj = document.getElementById(this.objname+'item'+i).style;
if ( parseInt(obj.top) < 1 ) {
height = this.height + parseInt(obj.top);
break;
}
}
for (i = 0; i < this.itemcount; i++) {
this.stop = true;
obj = document.getElementById(this.objname+'item'+i).style;
if ( parseInt(obj.top) < 1 ) {
obj.top = this.height * (this.itemcount-1);
} else {
obj.top = parseInt(obj.top) - height;
}
}
}
}

var _ua = window.navigator.userAgent.toLowerCase();

var browser = {
    model: _ua.match(/(sonyericssonx1i|ipod|iphone)/) ? _ua.match(/(sonyericssonx1i|ipod|iphone)/)[0] : "",
	skt : /msie/.test( _ua ) && /nate/.test( _ua ),
	lgt : /msie/.test( _ua ) && /([010|011|016|017|018|019]{3}\d{3,4}\d{4}$)/.test( _ua ),
	opera : /opera/.test( _ua ) || /opera mobi/.test( _ua ),
	ipod : /webkit/.test( _ua ) && /\(ipod/.test( _ua ) ,
	iphone : /webkit/.test( _ua ) && /\(iphone/.test( _ua )
};



// ¸ÞÀÎ ÀÌ¹ÌÁö ·ÎÅ×ÀÌ¼Ç
// window.onload Event
function addLoadEvent(func){
	var oldonload = window.onload;
	
	if(typeof window.onload != 'function'){
		window.onload = func;
		
	}else{
		window.onload = function(){
			oldonload();
			func();
		}
	}
}

//var source_li = document.getElementById("promotion_rollingImg").getElementsByTagName("iframe")[0].contentWindow.document.getElementsByTagName('li');
var promv_count = 701;
var func_promv_rolling = null;
var rolling_time = 5000; // ·Ñ¸µ½Ã°£

function promv_imgRolling(){
	var source_li = document.getElementById("promotion_rollingImg").getElementsByTagName("div");
	var source_btn = document.getElementById("promotion_btn").getElementsByTagName("img");
	//var source_btn = document.getElementById("promotion_btn").getElementsByTagName("iframe");
	
	for(i=0; i<source_li.length; i++){
		source_li[i].style.display = "none";
	}
	for(i=0; i<source_btn.length; i++){
		source_btn[i].src = source_btn[i].src.replace("o.gif", "n.gif");
	}
	
	var chg_imgNum = promv_count % source_li.length;
	source_li[chg_imgNum].style.display = "block";
	source_btn[chg_imgNum].src = source_btn[chg_imgNum].src.replace("n.gif", "o.gif");

	promv_count++;
}

function promv_rolling_start(){
	if(!document.getElementById("promotion_rollingImg")) return false;
	if(!document.getElementById("promotion_btn")) return false;

	var source_img = document.getElementById("promotion_rollingImg").getElementsByTagName("div");
	var source_btn = document.getElementById("promotion_btn").getElementsByTagName("img");

	for(i=0; i<source_img.length; i++){
		source_btn[i].count = i;
		source_btn[i].onclick = function(){
			window.clearInterval(func_promv_rolling);
			func_promv_rolling = null;
			promv_count = this.count;
			promv_imgRolling();
			func_promv_rolling = setInterval(promv_imgRolling, rolling_time);
		} // end of out
	}
	
	func_promv_rolling = setInterval(promv_imgRolling, rolling_time);
}
addLoadEvent(promv_rolling_start);
// ¸ÞÀÎ ÀÌ¹ÌÁö ·ÎÅ×ÀÌ¼Ç


// Àç¸²¸¶À» ¼Ò¼È ÆÐ¹Ð¸® ÆË¾÷
function ShowSocial()
{
 document.getElementById("social").style.display = "block"; 
}
function CloseSocial()
{
 document.getElementById("social").style.display = "none"; 
}

// Àç¸²¸¶À» ¼Ò¼È ÆÐ¹Ð¸® ÆË¾÷
