﻿//<![CDATA[

/*PC, 모바일 접속환경 체크*/
var agent = window.navigator.userAgent.toLowerCase();
var mobile_url = 'http://m.mobis.co.kr';
if (/iphone/.test(agent) || /android/.test(agent) || /opera/.test(agent) || /bada/.test(agent) || /mobile/.test(agent)) {
  top.document.location.replace(mobile_url);
}

/*
공통 팝업 함수
*/
function popWin(url,wname,w,h,ptype,t,l) {
	var pWin, tVal, lVal;
	if (t == "c") {
		lVal = (screen.Width - w) / 2;
		tVal = (screen.Height - h) / 2;
	}
	else {
		tVal = (t!=null)?t:0;
		lVal = (l!=null)?l:0;
	}

	var popOpt = "width="+w+"px,height="+h+"px, top="+tVal+", left="+lVal;
	if(ptype == 0)
		popOpt += ",scrollbars=no";

	if(ptype == 1)
		popOpt += ",scrollbars=yes";

	if(ptype == 2)
		popOpt += ",scrollbars=yes,resizable=yes";

	pWin = window.open(url,wname,popOpt);
	return pWin;
}

/** 게시판 글쓰기 길이값 제어 **/
var oldStr, oldCnt;
function checkByte(element,lens,Yn) {
    var onechar;
    var tcount = 0;

    for (k=0;k<element.value.length;k++) {
        onechar = element.value.charAt(k);

        if (escape(onechar).length > 4)
            tcount += 2;
        else if (onechar!='\r')
            tcount++;
    }

    if(tcount>lens) {
      if(Yn == "Y")
      {
        document.form1.cbyte.value = tcount;//수정할 부분
      }
        alert(lens+" byte가 초과되었습니다.\r\n초과된 부분은 자동으로 삭제됩니다.");
        element.value = oldStr;
        tcount = oldCnt;
    }
    oldStr = element.value;
    oldCnt = tcount;
    if(Yn == "Y")
    {
      document.form1.cbyte.value = tcount;//수정할 부분
    }
}

function ChkLen() {
  var msgtext, msglen;

    msgtext = document.form1.txtHeadline.value;
    //msglen = document.MsgForm.MSG_TXT_CNT.value;

    var i=0,l=0;
    var temp,lastl;

    //길이를 구한다.
    while(i < msgtext.length)
    {
        temp = msgtext.charAt(i);

        if (escape(temp).length > 4)
            l+=2;
        else if (temp!='\r')
            l++;
        // OverFlow
        //if(l>80)
        //{
            //alert(l);
        //    alert("메시지란에는 한글 40자, 영문80자까지만 쓰실 수 있습니다.");
        //    temp = document.form1.txtHeadline.value.substr(0,i);
        //    document.form1.txtHeadline.value = temp;
        //    l = lastl;
        //    break;
        //}
        lastl = l;
        i++;
    }
    document.form1.cbyte.value=l;
}

/* call swf*/
function swfView(id, swfPath, width, height, wmode, accessMode, subConId) {
  if (!wmode) wmode = 'transparent';
  if (!accessMode) accessMode = 'always';
  var swfStr = "";
  swfStr = "<object id=\"" + id + "\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"" + location.protocol + "//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10.0.42.34\" width=\"" + width + "\" height=\"" + height + "\">";
  swfStr += "<param name=\"movie\" value=\"" + swfPath + "\" />";
  swfStr += "<param name=\"wmode\" value=\"" + wmode + "\" />";
  swfStr += "<param name=\"allowscriptAccess\" value=\"" + accessMode + "\" />";
  swfStr += "<!--[if !IE]> <-->";
  swfStr += "<object type=\"application/x-shockwave-flash\" id=\"" + id + "NIE\" data=\"" + swfPath + "\" width=\"" + width + "\" height=\"" + height + "\">";
  swfStr += "<param name=\"wmode\" value=\"" + wmode + "\" />";
  swfStr += "<param name=\"allowscriptAccess\" value=\"" + accessMode + "\" />";
  if (subConId != "" && document.getElementById(subConId) != null) {
    swfStr += document.getElementById(subConId).innerHTML;
    document.getElementById(subConId).innerHTML = "";
  }
  swfStr += "</object>";
  swfStr += "<!--> <![endif]-->";
  swfStr += "</object>";
  document.write(swfStr);
}


/* GNB Link */
function pageURL(a,b){
  var z_1_0 = "/Introduction/company.aspx"; 						// 모비스 소개
		var z_1_1 = "/Introduction/Information/Summary/AboutUs.aspx";							// 기업정보
		var z_1_2 = "/Introduction/Business/Domestic/HeadOffice.aspx";					// 사업장안내
		var z_1_3 = "/Introduction/ServiceIntroduce/Module/Chassis.aspx";				// 사업소개
		var z_1_4 = "/Introduction/Investment/Company/AboutUs.aspx"; 			// 투자정보
		var z_1_5 = "/Introduction/Development/vision/Vision.aspx"; 			// 연구개발
		var z_1_6 = "/Introduction/Recruit/Recruit.aspx"; 			// 인재채용
		var z_2_0 = "/Active/Active.aspx"; 					// 모비스활동
		var z_2_1 = "/Active/Pr/News/list.aspx";						// 모비스 PR
		var z_2_2 = "/Active/Sport/Basketball/Phoebus.aspx";					// 모비스 스포츠
		var z_2_3 = "/Active/Social/Summary/Outline.aspx";								// 사회책임
		var z_2_4 = "/Active/Social/Continuous/report.aspx";								// 지속가능성 보고서
		var z_3_0 = "/Culture/Culture.aspx"; 						// 모비스문화
		var z_3_1 = "/culture/People/Together/List.aspx";						// 모비스 피플
		var z_3_2 = "/culture/world/GoTo.aspx";			// 모비스 세상
		var z_3_3 = "/culture/HappyFind/CheerUp/List.aspx"; 		// 행복찾기
		var z_3_4 = "/culture/mcarfe.aspx";   			// MCarfe
		var z_4_0 = "/Support/Support.aspx"; 						// 고객지원
		var z_4_1 = "/Support/PartInfomation/Wpc.aspx";							// 부품정보검색
		var z_4_2 = "/Support/ServiceSchool/Chapter01.aspx";							// 정비스쿨
		var z_4_3 = "/Support/QNA/Email/Write.aspx";							// 문의하기
		var z_4_4 = "/Support/FAQ/List.aspx";							// 자주하는질문
		//var z_ _  = "javascript:alert('준비중입니다.');";

		var goUrl = eval("z_" + a + "_" + b);
		//if (a == "3" && b == "4") { window.open(goUrl); return; }
 	  if(goUrl != "#") {location.href = goUrl;return;}
}

function go_home(){
	location.href="/Main.aspx";
}
function m1_Go(){ // 사이버 역사관
	window.open("http://history.mobis.co.kr/");
}
function Fb_01(){													//사이트맵
	location.href="/Member/Sitemap.aspx";
}
function Fb_02(){													//이용약관
	location.href="/Member/Contract.aspx";
}
function Fb_03(){													//개인정보취급방침
	location.href="/Member/Policy.aspx";
}
function Fb_04(){													//이메일주소 무단수집거부
	location.href="/Member/Emailnotice.aspx";
}
function Fb_05(){													//CyberAuidt
	window.open("/CyberAudit/CyberAudit.aspx", "_blank", "width=917,height=600,scrollbars=yes");
}
/* family site */
function F_01(){													//현대자동차그룹
	window.open("http://www.hyundai.co.kr");
}
function F_02(){													//현대자동차
	window.open("http://pr.hyundai.com/");
}
function F_03(){													//기아자동차
	window.open("http://www.kia.co.kr/");
}
function F_04(){													//현대제철
	window.open("http://www.hyundai-steel.com/");
}
function F_05(){													//현대하이스코
	window.open("http://www.hysco.com/");
}
function F_06(){													//현대BNG스틸
	window.open("http://www.hyundai-bngsteel.com/");
}
function F_07(){													//현대건설
	window.open("http://www.hdec.kr/");
}
function F_08(){													//현대엠코
	window.open("http://www.hyundai-amco.co.kr/intro.aspx");
}
function F_09(){													//현대엔지니어링
	window.open("http://www.hec.co.kr/");
}
function F_10(){													//현대스틸산업
	window.open("http://www.hdesi.co.kr/");
}
function F_11(){													//현대종합설계
	window.open("http://www.hda.co.kr/");
}
function F_12(){													//현대도시개발
	window.open("http://www.latierra.kr/");
}
function F_13(){													//현대위아
	window.open("http://www.hyundai-wia.com/");
}
function F_14(){													//현대파워텍
	window.open("http://www.powertech.co.kr/");
}
function F_15(){													//현대다이모스
	window.open("http://www.dymos.co.kr/");
}
function F_16(){													//케피코
	window.open("http://www.kefico.co.kr/");
}
function F_17(){													//현대위스코
	window.open("http://www.wisco.co.kr/");
}
function F_18(){													//현대메티아
	window.open("http://www.hyundai-metia.com/");
}
function F_19(){													//현대엠시트
	window.open("http://www.hyundai-mseat.com/");
}
function F_20(){													//현대아이에이치엘
	window.open("http://www.ihl.co.kr/");
}
function F_21(){													//현대파텍스
	window.open("http://www.partecs.co.kr/");
}
function F_22(){													//현대캐피탈
	window.open("http://www.hyundaicapital.com/");
}
function F_23(){													//현대카드
	window.open("http://www.hyundaicard.com/");
}
function F_24(){													//이노션
	window.open("http://www.innocean.com/");
}
function F_25(){													//HMC투자증권
	window.open("http://www.hmcib.com/");
}
function F_26(){													//현대커머셜
	window.open("http://www.hyundaicommercial.com/");
}
function F_27(){													//제주해비치호텔&리조트
	window.open("http://www.haevichi.com/");
}
function F_28(){													//현대엔지비
	window.open("http://www.hyundai-ngv.com/");
}
function F_29(){													//현대서산농장
	window.open("http://www.hdfnd.co.kr/");
}
function F_30(){													//현대글로비스
	window.open("http://www.glovis.net/");
}
function F_31(){													//현대로템
	window.open("http://www.hyundai-rotem.co.kr/");
}
function F_32(){													//현대오토에버
	window.open("http://www.hyundai-autoever.com/");
}
function F_33(){													//현대엠엔소프트
	window.open("http://www.hyundai-mnsoft.com/");
}
function F_34(){													//현대씨엔아이
	window.open("http://www.hyundaicni.com/");
}
function F_35(){													//현대카네스
	window.open("http://www.carnes.co.kr/");
}

/* GNB ON/Off */
function naviOn(){
	var IEflash = document.getElementById("tNavi");
	var noIEflash = document.getElementById("tNaviNIE");
	if(IEflash){IEflash.height = "220px";}
	if(noIEflash){noIEflash.height = "220px";}
	document.getElementById("GNBinContents").style.height = "220px";
}
function naviOff(){
	var IEflash = document.getElementById("tNavi");
	var noIEflash = document.getElementById("tNaviNIE");
	if(IEflash){IEflash.height = "74px";}
	if(noIEflash){noIEflash.height = "74px";}
	document.getElementById("GNBinContents").style.height = "74px";
}

/* footer ON/Off */
function F_naviOn(){
	var IEflash = document.getElementById("Footer");
	var noIEflash = document.getElementById("FooterNIE");
	if(IEflash){IEflash.height = "250px";}
	if(noIEflash){noIEflash.height = "250px";}
	document.getElementById("finCopyright2").style.height = "250px";
}
function F_naviOff(){
	var IEflash = document.getElementById("Footer");
	var noIEflash = document.getElementById("FooterNIE");
	if(IEflash){IEflash.height = "250px";}
	if(noIEflash){noIEflash.height = "250px";}
	document.getElementById("finCopyright2").style.height = "250px";
}

//프린트 관련 스크립트 div 영역'#printarea'만 프린트함
var win = null;
function print(printThis) {
  win = window.open("", "PrintWindow", "width=480,height=241,left=10,top=10,scrollbars=no,resizable=no");
  self.focus();
  win.document.open();
  win.document.write("<html><head>");
  win.document.write("<link href='/css/common.css'  rel='stylesheet' type='text/css'>");
  win.document.write("</head><body style='margin:0;padding:0;'>");
  win.document.write(printThis);
  win.document.write("</body></html>");
  win.document.close(); win.print(); win.close();
}

/* image over out */
function imgOverOut(obj) {
 if ( obj != null && obj.getAttribute('nover') != 'set' )
 {
  obj.src = (obj.src.indexOf("on.gif") > -1) ? obj.src.replace("on.gif", ".gif") : obj.src.replace(".gif", "on.gif");
 }
}

function disCurMenu(id) {
	imgOverOut(document.getElementById(id));
	document.getElementById(id).setAttribute('nover', 'set');
}


/**본인인증시 팝업 호출**/
function openWin(url, nm, w, h) {
  var PopWin = openWinW(url, nm, w, h, '', '', 0, 0);
  return PopWin;
}
function openWinW(strUrl, strWName, nW, nH, nT, nL, bScroll, bResize) {
  var sOption = "";
  var strScroll;
  var nSW = screen.width;
  var nSH = screen.height;
  var nPointW = 0, nPointH = 0;
  var strResize = (bResize == null || bResize == true) ? "resizable=yes" : "resizable=no"
  if (nT == '' || nL == '') {
    if (nW < nSW) {
      nPointW = (nSW - nW) / 2;
    }
    if (nH < nSH) {
      nPointH = (nSH - nH) / 2 - 40;
    }
  } else {
    nPointW = nL;
    nPointH = nT;
  }
  if (bScroll == 0) {
    strScroll = " scrollbars=no";
  } else {
    strScroll = " scrollbars=yes";
  }
  sOption = sOption + "toolbar=no, channelmode=no, location=no, directories=no, menubar=no," + strScroll + "," + strResize;
  sOption = sOption + ", width=" + nW + ", height=" + nH + ", top=" + nPointH + ", left=" + nPointW;
  var PopWin = window.open(strUrl, strWName, sOption);
  PopWin.focus();
  return PopWin;
}
//]]>
