/*----------------------------------------------------------------------------------------------------------
'ÀÛ¼ºÀÚ : ¹ÚÇüÁØ
'ÀÛ¼ºÀÏ : 2008/05/29
'¿ë  µµ : °øÅëÀ¸·Î »ç¿ëµÇ´Â ÇÔ¼ö¸ðÀ½.!
----------------------------------------------------------------------------------------------------------*/

/*
   -- ¸¶¿ì½º¿À¹ö ½ºÅ©¸³Æ® --- 
*/
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_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_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 CreateEMail(id,mail)
{
    $(id).length = 0;
    $(id).options[0] = new Option("chollian.net","chollian.net");
    $(id).options[1] = new Option("dreamwiz.com","dreamwiz.com");
    $(id).options[2] = new Option("freechal.com","freechal.com");
    $(id).options[3] = new Option("hananet.net","hananet.net");
    $(id).options[4] = new Option("hanmail.net","hanmail.net");
    $(id).options[5] = new Option("hanmir.net","hanmir.net");
    $(id).options[6] = new Option("paran.com","paran.com");
    $(id).options[7] = new Option("hitel.net","hitel.net");
    $(id).options[8] = new Option("hotmail.com","hotmail.com");
    $(id).options[9] = new Option("lycos.co.kr","lycos.co.kr");
    $(id).options[10] = new Option("nate.com","nate.com");
    $(id).options[11] = new Option("naver.com","naver.com");
    $(id).options[12] = new Option("netian.com","netian.com");
    $(id).options[13] = new Option("shinbiro.co.kr","shinbiro.co.kr");
    $(id).options[14] = new Option("unitel.co.kr","unitel.co.kr");
    $(id).options[15] = new Option("yahoo.co.kr","yahoo.co.kr");
    $(id).options[16] = new Option("gmail.com","gmail.com");
    $(id).options[17] = new Option("Á÷Á¢ÀÔ·Â","");
    if (mail != null)
    {
        $(id).value = mail;
    }
}
//ÀüÈ­¹øÈ£ ±¹¹ø »ý¼º ÇÔ¼ö ÀÔ´Ï´Ù.
function CreatePhone(id,tell)
{
    $(id).length = 0;
    $(id).options[0] = new Option("02","02");
    $(id).options[1] = new Option("031","031");
    $(id).options[2] = new Option("032","032");
    $(id).options[3] = new Option("033","033");
    $(id).options[4] = new Option("041","041");
    $(id).options[5] = new Option("042","042");
    $(id).options[6] = new Option("043","043");
    $(id).options[7] = new Option("051","051");
    $(id).options[8] = new Option("052","052");
    $(id).options[9] = new Option("053","053");
    $(id).options[10] = new Option("054","054");
    $(id).options[11] = new Option("055","055");
    $(id).options[12] = new Option("061","061");
    $(id).options[13] = new Option("062","062");
    $(id).options[14] = new Option("063","063");
    $(id).options[15] = new Option("064","064");
    $(id).options[16] = new Option("070","070");
    $(id).options[17] = new Option("0502","0502");
    $(id).options[18] = new Option("0504","0504");
    $(id).options[19] = new Option("0505","0505");
    $(id).options[20] = new Option("0506","0506");
    if (tell != null)
    {
        $(id).value = tell;
    }
}

//ÇÚµåÆù Åë½Å»ç ÄÚµå »ý¼º ÇÔ¼ö ÀÔ´Ï´Ù.
function CreatePcs(id,Pcs)
{
    $(id).length = 0;
    $(id).options[0] = new Option("010","010");
    $(id).options[1] = new Option("011","011");
    $(id).options[2] = new Option("016","016");
    $(id).options[3] = new Option("017","017");
    $(id).options[4] = new Option("018","018");
    $(id).options[5] = new Option("019","019");

    if (Pcs != null)
    {
        $(id).value = Pcs;
    }
}

//Email À¯È¿¼º Ã¼Å© ------  
function checkEmail(val) {	
		var re = new RegExp("(^[_0-9a-zA-Z-]+(\.[_0-9a-zA-Z-]+)*@[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*$)", "g");
		var r = val.match(re);
		if(r != null) { 
			return true;	//À¯È¿ÇÑ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÎ °æ¿ì	
		} else { 
			return false; 
		}
	}



function checkEmail2(s) { //@,.°Ë»ç±îÁö
	var a = false;
	var res = false;

		if(typeof(RegExp) == 'function') {
			var b = new RegExp('abc');
			if(b.test('abc') == true){a = true;}
		}

		if(a == true){
			reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
							 '(\\@)([a-zA-Z0-9\\-\\.]+)'+
							 '(\\.)([a-zA-Z]{2,4})$');
			res = (reg.test(s));
		}
		else {
			res = (s.search('@') >= 1 &&
				   s.lastIndexOf('.') > s.search('@') &&
				   s.lastIndexOf('.') >= s.length-5)
		}
	return(res);
}

//³âµµÄÞº¸¹Ú½º °ª  »ý¼º
function Create_Year(id,year)
{
    var dt = new Date();
    var Y = dt.getYear();
    
    for(var i=0; i <2; i++)
    {
        $(id).options[i] = new Option(Y-i,Y-i)
    } 
    if (year != null)
    {
        $(id).value = year;
    }
}

//¿ù »ý¼º..!
function Create_Month(id,m,n)
{
	var max  = (n == null) ? 12:n;
    var mm=1;
    for(var i=0; i<max; i++)
    {
        if (mm < 10)
        {
           $(id).options[i] = new Option("0"+mm,"0"+mm)        
        }
        else
        {
           $(id).options[i] = new Option(mm,mm)        
        }
        mm++        
    } 
    if (m != null)
    {
        $(id).value = m;
    }
}

//ÀÏ »ý¼º~~!!
function Create_Day(id,d,n)
{
	var max  = (n == null) ? 31:n;
    var mm = 1;
    for(var i=0; i<max; i++)
    {
        if (mm < 10)
        {
           $(id).options[i] = new Option("0"+mm,"0"+mm)        
        }
        else
        {
           $(id).options[i] = new Option(mm,mm)        
        }
        mm++        
    } 
    if (d != null)
    {
        $(id).value = d;
    }
}

/*==================================================
¿ëµµ : innerHTML ¼Óµµ Çâ»óÀ» À§ÇÑ ½ºÅ©¸³Æ® ÀÔ´Ï´Ù.
»ç¿ë¹ý :  var div = replaceHtml(emement,Html)
           div.innerHTML = Html;        
==================================================*/
function replaceHtml(el, html) {
	var oldEl = (typeof el === "string" ? document.getElementById(el) : el);
	/*@cc_on // Pure innerHTML is slightly faster in IE
		oldEl.innerHTML = html;
		return oldEl;
	@*/
	var newEl = oldEl.cloneNode(false);
	newEl.innerHTML = html;
	oldEl.parentNode.replaceChild(newEl, oldEl);
	/* Since we just removed the old element from the DOM, return a reference
	to the new element, which can be used to restore variable references. */
	return newEl;
};

//===================================================================
 // ÇÑ±ÛÃ¼Å© ÇÔ¼ö
 //===================================================================
//ÇÑ±Û Ã¼Å© ÇÔ¼ö ----------
function hangul_check(word) 
{
var str="@-._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
	for (var i=0;i<word.length;i++)
	{
	    idcheck=word.substring(i,i+1); 
	
		for(var j=0; j<str.length;j++)
			{  
				if(idcheck==str.substring(j,j+1))
				{break;
				}

				if((j+1)==str.length)
				{return false;
				}
			}
	}   
	return true;
}

//±ÛÀÚ ÀÚ¸£±â
  /** 
  * string String::cut(int len)
  * ±ÛÀÚ¸¦ ¾Õ¿¡¼­ºÎÅÍ ¿øÇÏ´Â ¹ÙÀÌÆ®¸¸Å­ Àß¶ó ¸®ÅÏÇÕ´Ï´Ù.
  * ÇÑ±ÛÀÇ °æ¿ì 2¹ÙÀÌÆ®·Î °è»êÇÏ¸ç, ±ÛÀÚ Áß°£¿¡¼­ Àß¸®Áö ¾Ê½À´Ï´Ù.
  */
  String.prototype.cut = function(len) {
         var str = this;
         var l = 0;
         for (var i=0; i<str.length; i++) {
                 l += (str.charCodeAt(i) > 128) ? 2 : 1;
                 if (l > len) return str.substring(0,i) + "..";
         }
         return str;
  }

  /** 
  * bool String::bytes(void)
  * ÇØ´ç½ºÆ®¸µÀÇ ¹ÙÀÌÆ®´ÜÀ§ ±æÀÌ¸¦ ¸®ÅÏÇÕ´Ï´Ù. (±âÁ¸ÀÇ length ¼Ó¼ºÀº 2¹ÙÀÌÆ® ¹®ÀÚ¸¦ ÇÑ±ÛÀÚ·Î °£ÁÖÇÕ´Ï´Ù)
  */
  String.prototype.bytes = function() {
         var str = this;
         var l = 0;
         for (var i=0; i<str.length; i++) l += (str.charCodeAt(i) > 128) ? 2 : 1;
         return l;
  }

	//aaa = "±ÛÀÚ¸¦ ¾Õ¿¡¼­ºÎÅÍ ¿øÇÏ´Â ¹ÙÀÌÆ®¸¸Å­ Àß¶ó ¸®ÅÏÇÕ´Ï´Ù.";
	//alert(aaa.cut(20));


function flashAction(param)
{		
	switch(param) 
	{
		//home
		case "english"				:location.href = "/ENG/";
			break;
		case "U1_1"				:location.href = "/";
			break;
		//sitemap
		case "U2_1"				:location.href = "/sitemap/default.asp?depth=0";
			break;
		case "U3_1"				:location.href = "/company/contactus.asp?Depth=1_5";
			break;
		case "tims"				:window.open('http://tims.tuksu.co.kr/Default.aspx?TIMS=TIMS','');
			break;
		case "news"				:location.href = "/cyber/news.asp?Depth=4_3";
			break;
		
		//È¸»ç¼Ò°³
		case "1_1"				:location.href = "/company/intro1.asp?Depth="+param;
			break;
		case "1_1_1"			:location.href = "/company/intro1.asp?Depth="+param;
			break;
		case "1_1_2"			:location.href = "/company/intro2.asp?Depth="+param;
			break;
		case "1_2"				:location.href = "/company/history.asp?Depth="+param;
			break;
		case "1_3"				:location.href = "/company/management.asp?Depth="+param;
			break;
		case "1_4"				:location.href = "/company/organization.asp?Depth="+param;
			break;
		case "1_5"				:location.href = "/company/contactus.asp?Depth="+param;
			break;

		
		//»ç¾÷¿µ¿ª
		//Ã¶µµ/µµ·ÎÀÔÃ¼È­
		case "2_1"				:location.href = "/business/internal_pront.asp?Depth="+param;break;
		case "2_1_1"			:location.href = "/business/internal_pront.asp?Depth="+param;break;
		case "2_1_2"			:location.href = "/business/internal_esa.asp?Depth="+param;break;
		case "2_1_3"			:location.href = "/business/internal_rnc.asp?Depth="+param;break;
		case "2_1_4"			:location.href = "/business/internal_sft.asp?Depth="+param;break;
		case "2_1_5"			:location.href = "/business/internal_pipe.asp?Depth="+param;break;
		
		//±³·®/°Ç¹°±âÃÊ
		case "2_2"				:location.href = "/business/internal_bg.asp?Depth="+param;break;
		case "2_2_1"			:location.href = "/business/internal_bg.asp?Depth="+param;break;
		case "2_2_2"			:location.href = "/business/internal_rcd.asp?Depth="+param;break;
		case "2_2_3"			:location.href = "/business/internal_lw.asp?Depth="+param;break;
		case "2_2_4"			:location.href = "/business/internal_jsp.asp?Depth="+param;break;

		//½¯µåÅÍ³Î
		case "2_3"				:location.href = "/business/internal_sheld.asp?Depth="+param;break;
		case "2_3_1"			:location.href = "/business/internal_sheld.asp?Depth="+param;break;
		case "2_3_2"			:location.href = "/business/internal_semi.asp?Depth="+param;break;

		//Áö¹Ýº¸°­
		case "2_4"				:location.href = "/business/internal_wall.asp?Depth="+param;break;
		case "2_4_1"			:location.href = "/business/internal_wall.asp?Depth="+param;break;
		case "2_4_2"			:location.href = "/business/internal_jsp.asp?Depth="+param;break;
		
		//ÇØ¿Ü°Ç¼³,Áß°ø¾÷
		case "2_5"				:location.href = "/business/foreign.asp?Depth="+param;break;
		case "2_6"				:location.href = "/business/heavy_industry.asp?Depth="+param;break;

		//±â¼ú°³¹ß
		case "3_1"				:location.href = "/technical/rnd.asp?Depth="+param;break;
		case "3_2"				:location.href = "/technical/quality.asp?Depth="+param;break;
		case "3_3"				:location.href = "/technical/license.asp?Depth="+param;break;
		case "3_4"				:location.href = "/technical/tech_data.asp?Depth="+param;break;
		//»çÀÌ¹ö È«º¸½Ç
		case "4_1"				:location.href = "/cyber/online.asp?Depth="+param;break;
		case "4_2"				:location.href = "/cyber/video.asp?Depth="+param;break;
		case "4_3"				:location.href = "/cyber/news.asp?Depth="+param;break;
		case "4_4"				:location.href = "/cyber/qna.asp?Depth="+param;break;
		case "4_5"				:location.href = "/cyber/tech_qna.asp?Depth="+param;break;
		//IRÁ¤º¸
		case "5_1"				:location.href = "/IR_info/financial.asp?Depth="+param;break;
		
		//¸ÞÀÎ¿¡ ¸µÅ©µé
		case "method1"			:location.href = "/business/internal_pront.asp?Depth=2_1";break;
		case "method2"			:location.href = "/business/internal_bg.asp?Depth=2_2";break;
		case "method3"			:location.href = "/business/internal_sheld.asp?Depth=2_3";break;
		case "method4"			:location.href = "/business/internal_wall.asp?Depth=2_4";break;
		case "history"			:location.href = "/company/history.asp?Depth=1_2";break;
		case "brochure"			:location.href = "/cyber/online.asp?Depth=4_1";break;

		case "HOME"				:location.href = '/';break;

		default : alert(param);
		//default : alert('ÁØºñÁßÀÔ´Ï´Ù.');
	}
}

