/**
 *  µðÀÚÀÎ ½ºÅ©¸³Æ®
 */

/**
 * °øÅë ½ºÅ©¸³Æ® (»çÀÌÆ® Àü¹ÝÀûÀ¸·Î »ç¿ëµÇ´Â ½ºÅ©¸³Æ®)
 */


/**
 * µå¸²À§¹ö ½ºÅ©¸³Æ®
 */
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 MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

// ¹Ù·Î°¡±â
 
function viewExtLink() {
	target = this.href;
	linkEl = document.getElementById(target.split("#")[1]);
	if (linkEl.style.display == "block") {
		linkEl.style.display = "none";
	} else {
		linkEl.style.display = "block";
	}
	return false;
}
function initExtLink(int_value) {
	extLinkEl = document.getElementById(int_value);
	extLinkElH2 = extLinkEl.getElementsByTagName("h2");
	for(i=0; i<extLinkElH2.length; i++) {
		extLinkElH2[i].getElementsByTagName("a")[0].onclick = viewExtLink;
	}
}

//alertÃ¢
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

//ÀÌ¸ÞÀÏ ÃßÃâ ¹æÁö ½ºÅ©¸³Æ¼
function email_link(mailname, maildomain) {
  document.write("<A HREF='mailto:"+mailname+"@"+maildomain+"'>"+mailname+"@"+maildomain+"</A>");
}

/* ¿ÀÇÂÃ¢ */
function OpenWindowWithoutReturn(p_sURL, p_sName, p_iTopMargin, p_iLefMargin, p_bScrollBars, p_bResizable, p_iWidth, p_iHeight) {
	l_sSpecialty = 'topmargin=' + p_iTopMargin;
	l_sSpecialty = l_sSpecialty + ', leftmargin=' + p_iLefMargin;
	l_sSpecialty = l_sSpecialty + ', scrollbars=' + p_bScrollBars;
	l_sSpecialty = l_sSpecialty + ', resizable=' + p_bResizable;
	l_sSpecialty = l_sSpecialty + ', width=' + p_iWidth;
	l_sSpecialty = l_sSpecialty + ', height=' + p_iHeight;

	window.open(p_sURL, p_sName, l_sSpecialty);
}

// image roll
function menuOver() {
	this.src = this.src.replace(".gif", "_on.gif");
}
function menuOut() {
	this.src = this.src.replace("_on.gif", ".gif");
}

function imageOver(imgEl) {
	imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}
function imageOut(imgEl) {
	imgEl.src = imgEl.src.replace("_on.gif", ".gif");
}

// element toggle
//function blockToggle(href) {
//	targetElement = document.getElementById(href.split("#")[1]);
//
//	if (targetElement && targetElement.style.display == "block") {
//		targetElement.style.display = "none";
//	} else {
//		targetElement.style.display = "block";
//	}
//	return false;
//}

// tabbed menu
function initTabMenu(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 = menuOver;
		thismenu.getElementsByTagName("img").item(0).onmouseout = menuOut;
		thismenu.onmouseover = tabMenuOver;
//		thismenu.onclick = tabMenuClick;
	}

	initmenu = tabMenu.item(0);
	initmenu.targetEl.style.display = "block";
	initmenu.getElementsByTagName("img").item(0).onmouseover();
	initmenu.getElementsByTagName("img").item(0).onmouseover = null;
	initmenu.getElementsByTagName("img").item(0).onmouseout = null;
	initmenu.menuContainer.current = initmenu;
}
function tabMenuOver() {
	currentmenu = this.menuContainer.current;
	if (currentmenu != this) {
		currentmenu.targetEl.style.display = "none";
		currentmenu.getElementsByTagName("img").item(0).onmouseover = menuOver;
		currentmenu.getElementsByTagName("img").item(0).onmouseout = menuOut;
		currentmenu.getElementsByTagName("img").item(0).onmouseout();
	
		this.targetEl.style.display = "block";
		this.getElementsByTagName("img").item(0).onmouseover = null;
		this.getElementsByTagName("img").item(0).onmouseout = null;
		this.menuContainer.current = this;
	}
	return false;
}
function go_url(sel, targetstr) {
	var index = sel.selectedIndex;
	if (sel.options[index].value != '') {
		if (targetstr == 'blank') {
			window.open(sel.options[index].value, 'site_link');
		}
		else {
			var frameobj;
			if ((frameobj = eval(targetstr)) != null)
			frameobj.location = sel.options[index].value;
		}
	}
}


// ÆË¾÷Ã¢ Áß¾ÓÀ¸·Î À§Ä¡ : ÆË¾÷À¸·Î ¶ß´Â ÆÄÀÏÀÇ ¸¶Áö¸· ºÎºÐ¿¡ ¿¡¼­ È£Ãâ

// ÃâÃ³ : http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=45793
// <script type="text/javascript" language="JavaScript"> 
//<!-- 
//popup_center(); 
//--> 
//</script> 
// ÆË¾÷Ã¢ Áß¾ÓÀ¸·Î À§Ä¡ 

function popup_center(){
	var x,y; 
	if (self.innerHeight) { // IE ¿Ü ¸ðµç ºê¶ó¿ìÀú 
		x = (screen.availWidth - self.innerWidth) / 2; 
		y = (screen.availHeight - self.innerHeight) / 2; 
	}else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict ¸ðµå 
		x = (screen.availWidth - document.documentElement.clientWidth) / 2; 
		y = (screen.availHeight - document.documentElement.clientHeight) / 2; 
	}else if (document.body) { // ´Ù¸¥ IE ºê¶ó¿ìÀú( IE < 6) 
		x = (screen.availWidth - document.body.clientWidth) / 2; 
		y = (screen.availHeight - document.body.clientHeight) / 2; 
	}
	window.moveTo(x,y); 
}


/**
 * ticker effect
 *
 * ex) initTicker(document.getElementById("banner-scroll"), document.getElementById("banner-content"), 3000);
 */
var tickerEl = new Array();

function initTicker(tickerContainer, tickerContent, delay) {
	tickerEl[tickerEl.length] = tickerContainer;
	tickerContainer.moveOffset = tickerContainer.offsetHeight;
	tickerContainer.count = 0;
	tickerContainer.delay = delay / 20;

	tickerContainer.cont = tickerContent;
	tickerContainer.cont.currentHeight = 0;
	tickerContainer.cont.innerHTML += tickerContainer.cont.innerHTML;

	tickerContainer.move = setInterval("tickerRoll()", 80);
}

function tickerRoll() {
	for (i=0; i<tickerEl.length; i++) {
		if (tickerEl[i].cont.currentHeight < tickerEl[i].cont.offsetHeight * -1) {
			tickerEl[i].cont.currentHeight = 0;
		}
		if (tickerEl[i].cont.currentHeight % tickerEl[i].moveOffset == 0 && tickerEl[i].count < tickerEl[i].delay) {
			tickerEl[i].count++;
		} else {
			tickerEl[i].count = 0;
			tickerEl[i].cont.currentHeight--;
			tickerEl[i].cont.style.top = tickerEl[i].cont.currentHeight + "px";
			if (tickerEl[i].cont.currentHeight % (tickerEl[i].cont.offsetHeight / 2) == 0) {
				tickerEl[i].cont.currentHeight = 0;
			}
		}
	}
}

function win_open(url, name, option)
{
	var popup = window.open(url, name, option);
	popup.focus();
}


/* quick */
function actFloatLayer(Margin, slideTime, layerName, Type, browser)
{  
   //===== initial the properties ===== begin =====
   
   switch(browser)
   {
      case (1):
                  find = (Type < 3) ? document.body.clientHeight : document.body.clientWidth;
                  current = (Type < 3) ? eval(layerName + ".style.pixelTop") : eval(layerName + ".style.pixelLeft");
                  scrollAt = (Type < 3) ? document.body.scrollTop : document.body.scrollLeft;
                  break;

      case (2): 
                  find = (Type < 3) ? window.innerHeight : window.innerWidth;
                  current = (Type < 3) ? eval("document." + layerName + ".top") : eval("document." + layerName + ".left");
                  scrollAt = (Type < 3) ? window.pageYOffset : window.pageXOffset;
                  break;

      case (3): 
                  find = (Type < 3) ? window.innerHeight : window.innerWidth;
                  current = (Type < 3) ? parseInt(eval("document.getElementById('" + layerName + "').style.top")) : parseInt(eval("document.getElementById('" + layerName + "').style.left")); 
                  scrollAt = (Type < 3) ? window.scrollY : window.scrollX;
                  break;
   }

   //===== initial the properties ===== end =====
 

   //========== Main Trigger ========== begin =====
   
   switch(Type)
   {
      case (1): case (3): //Type : top and left
         newTarget = scrollAt + Margin;
         break;
      case (2): case (4): //Type : bottom and right
         newTarget = scrollAt + find - Margin;
         break;
   }
   
   if ( current != newTarget ) 
   {        
      if (newTarget !=  this.target ) 
      { 
         //========== Start Float ========== begin =====

         target = newTarget;

         now = new Date();
         Mul = target - current;
         Wave = Math.PI / ( 2 * slideTime );
         Pass = now.getTime();

         if (Math.abs(Mul) > find) 
         { 
            
            Dis = (Mul > 0) ? target - find : target + find ;
            Mul = (Mul > 0) ? find : -find ;
         }
   
         else 	 
            Dis = current 

         //========== Start Float ========== end =====
      } 
      
      //========== Animator ========== begin =====

      now = new Date();
      newPosition = Mul * Math.sin( Wave * ( now.getTime() - Pass ) ) + Dis;

      newPosition = Math.round(newPosition);

      if (( Mul > 0 && newPosition > current ) || ( Mul < 0 && newPosition < current )) 
      { 
         switch(browser)
         {
            case (1):
                        (Type < 3) ? eval(layerName + ".style.pixelTop = newPosition;") : eval(layerName + ".style.pixelLeft = newPosition;");
                        break;
            case (2):
                        (Type < 3) ? eval("document." + layerName + ".top = newPosition;") : eval("document." + layerName + ".left = newPosition;");
                        break;
            case (3):
                        (Type < 3) ? eval("document.getElementById('" + layerName + "').style.top = newPosition + 'px';") : eval("document.getElementById('" + layerName + "').style.left = newPosition + 'px';");
                        break;
         }         
      }       

      //========== Animator ========== end =====
   } 

   //========== Main Trigger ========== end =====
}

function startFloatLayer(layerName, x, Margin, slideTime, Type) 
{
   //===== verify the Type ===== begin =====
   var browser;

   if (document.all)
      browser = 1;  //ie4

   if (document.layers)
      browser = 2;  //ns4

   if (!document.all && document.getElementById)
      browser = 3 ; //ns6
   
   setInterval("actFloatLayer(" + Margin + ", " + slideTime + ", '" + layerName + "', " + Type + ", " + browser + ")", 10);
}