﻿// JavaScript Document

/******************************************************************************
	파일명 : common.js - 공통 Javascript
	작성자 : PortfolioAD
	작성일 : 
******************************************************************************/

var sendit;
var win;

//dynamic viewBusinessLayer viewer (chang-soo,CHOI,2010.02.19)<!--
var _currIdx = 0;
function viewBusinessLayer(idx)
{
	if (isNaN(idx)){_currIdx = 0; return;}
		
	if (_currIdx){
		var lyerPrev = document.getElementById('business_layer'+_currIdx);
		if (!lyerPrev){_currIdx = 0; return;}
		//lyerPrev.style.display = 'none';
		popdiv('pop_op',lyerPrev.id, 2);
	}
	
	var ele = GetFlashElement('/flash/com_test.swf?pageN='+idx,'100%','100%');
	var lyer = document.getElementById('business_layer'+idx);
	if (!lyer){_currIdx = 0; return;}
	lyer.innerHTML = ele;
	//lyer.style.display = 'block';
	popdiv('pop_op',lyer.id, 1);
	_currIdx = idx;
}
//dynamic viewBusinessLayer viewer-->

//dynamic viewEarthLayer viewer , close : -1 (chang-soo,CHOI,2010.03.19)<!--
function viewEarthLayer(idx)
{
	if (isNaN(idx)){_currIdx = 0; return;}
		
	var lyer = document.getElementById('earth_layer');
	if (!lyer){return;}
	if (idx != -1)
	{
		lyer.style.display = 'block';	
		var ele = GetFlashElement('/flash/popupMain.swf?selNum='+idx,'100%','100%');
		lyer.innerHTML = ele;
		//lyer.style.display = 'block';
		popdiv('pop_op',lyer.id, 1);
	}
	else
	{
		//lyer.style.display = 'none';
		popdiv('pop_op',lyer.id, 2);
	}
}
//dynamic viewEarthLayer viewer-->
//dynamic copy to clipBoard by widget code (chang-soo,CHOI,2010.03.19)<!--
function copyWidgetCode(idx) { 

    var therange = '<embed src="http://www.woongjin.com/flash/widget/widget.swf" width="160" height="275" type="application/x-shockwave-flash"></embed>';
    window.clipboardData.setData('Text', therange);
    //therange.execCommand("Copy") 
	alert ('클립보드에 복사되었습니다. Ctrl+V로 붙히기 하세요');
}
//dynamic copy to clipBoard by widget code-->

function layer_view (layer_name, layer_display){
	if (layer_display == "view"){
		document.getElementById(layer_name).style.display = "block" ;
	} else {
		document.getElementById(layer_name).style.display = "none" ;
	}
}



// Flash

// flashWrite(url, width, height, ID, bgcolor, wmode)
function flashWrite(url,w,h,id,bg,win){

    var flashStr=
    "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
    "<param name='movie' value='"+url+"' />"+
    "<param name='wmode' value='"+win+"' />"+
    "<param name='menu' value='false' />"+
    "<param name='quality' value='high' />"+
    "<param name='bgcolor' value='"+bg+"' />"+
    "<param name='allowScriptAccess' value='always' /> "+
    "<embed allowScriptAccess='always' src='"+url+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
    "</object>";

    document.write(flashStr);
}

var EmbedStr = "";
function GetFlash(swf, width, height, bgcolor, id, flashvars) { 
	
	document.write(GetFlashElement(swf, width, height, bgcolor, id, flashvars));
	return;
}

function GetFlashElement(swf, width, height, bgcolor, id, flashvars) { 
	var strFlashTag = new String();
	var bgColor = bgcolor;
	if (bgColor == null || bgColor == "")
		bgColor = "#ffffff";
		
	if (id == null || id == '')
		id = swf + '_flash';

	if (navigator.appName.indexOf("Microsoft") != -1)
	{
		strFlashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
		strFlashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version=8,0,0,0" ';
		strFlashTag += 'id="' + id + '" width="' + width + '" height="' + height + '">';
		strFlashTag += '<param name="movie" value="' + swf + '"/>';

		if(flashvars != null) {strFlashTag += '<param name="flashvars" value="' + flashvars + '"/>'};
		strFlashTag += '<param name="quality" value="best"/>';
		strFlashTag += '<param name="bgcolor" value="' + bgColor + '"/>';
		strFlashTag += '<param name="menu" value="false"/>';
		strFlashTag += '<param name="salign" value="LT"/>';
		strFlashTag += '<param name="scale" value="noscale"/>';
		strFlashTag += '<param name="wmode" value="transparent"/>';
		strFlashTag += '<param name="allowScriptAccess" value="sameDomain"/>';
		strFlashTag += '</object>';

	}
	else
	{
		strFlashTag += '<embed src="' + swf + '" ';
		strFlashTag += 'quality="best" ';
		strFlashTag += 'bgcolor="' + bgColor + '" ';
		strFlashTag += 'width="' + width + '" ';
		strFlashTag += 'height="' + height + '" ';
		strFlashTag += 'menu="false" ';
		strFlashTag += 'scale="noscale" ';
		strFlashTag += 'id="' + id + '" ';
		strFlashTag += 'salign="LT" ';
		strFlashTag += 'wmode="transparent" ';
		strFlashTag += 'allowScriptAccess="sameDomain" ';
		if(flashvars != null) {strFlashTag += 'flashvars="' + flashvars + '" '};
		strFlashTag += 'type="application/x-shockwave-flash" ';
		strFlashTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
		strFlashTag += '</embed>';
	}
	return strFlashTag;
}

// IE6 PNG 투명
function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
	var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
   var imgTitle = (myImage.title) ? 
             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
   var imgStyle = "display:inline-block;" + myImage.style.cssText
   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
   myImage.outerHTML = strNewHTML   
    }
}




// RollOver
function imageOver(imgs) {
	imgs.src = imgs.src.replace("off.gif", "on.gif");
}
function imageOut(imgs) {
	imgs.src = imgs.src.replace("on.gif", "off.gif");
//  onmouseover="imageOver(this);" onmouseout="imageOut(this);"
} 



// faq 답변 ---------
	function act(x) {
		if (document.all[x].style.display == "none") {
				document.all[x].style.display = "block";
		} else {
			document.all[x].style.display = "none";
		}	
	 }


// 직무소개, 직무선택시 내용 변화 ---------
function sel_tab(obj) {
    var menuCont2 = document.getElementsByName('call');
    var objIdnum = obj.id;
    for (j=0;j<menuCont2.length;j++) {
        document.getElementById('tab'+(j+1)).style.display = 'none';
    }
    document.getElementById('tab'+objIdnum).style.display = 'block';
}



/////////////////////////////// 레이어


function popdiv(divname1,divname2,a){ 
	ch = document.body.scrollHeight;
	cw = window.screen.width - 22;
	//cw = document.documentElement.scrollWidth;
	switch(a){
	case 1: 
		document.getElementById(divname1).style.height = ch+"px" ;
		document.getElementById(divname1).style.width = cw+"px" ;
		document.getElementById(divname1).style.display = 'block';
		document.getElementById(divname2).style.display = 'block';  
		break;
	case 2: 
		document.getElementById(divname1).style.display = 'none';
		document.getElementById(divname2).style.display = 'none';
		break;
	}
	 
}


//따라다니는 탑버튼 START

var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS = navigator.appName == "Netscape";

function getRef(id) {
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
}

var scrollerHeight = 88;
var puaseBetweenImages = 3000;
var imageIdx = 0;

function moveRightEdge() {
	var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;

	if (isDOM) {
			yMenuFrom   = parseInt (divMenu.style.top, 10);
			yMenuTo     = (isNS ? window.pageYOffset : document.body.scrollTop) + 50; // 위쪽 위치
	}
	timeoutNextCheck = 500;

	if (yMenuFrom != yMenuTo) {
			yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
			if (yMenuTo < yMenuFrom)
					yOffset = -yOffset;
			if (isNS4)
					divMenu.top += yOffset;
			else if (isDOM)
					divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
					timeoutNextCheck = 10;
	}
	setTimeout ('moveRightEdge()', timeoutNextCheck);
}


function goURL(url)
{
	location.href=url;
}


// 팝업 레이어 리사이즈

var pop_op_height; // 페이지 전체 크기 변수

function resizeIF(Id)
{
	var obj = document.getElementById(Id);
	var Body;
	var H, Min;
	Min = 503;// 최소 높이 설정 (너무 작아지는 것을 방지)
	try
	{
		if (!document.all && obj.contentWindow.document.location.href == 'about:blank')
		{
			setTimeout("resizeIF('"+Id+"')", 10);
			return;
		}

		Body = obj.contentWindow.document.getElementsByTagName('BODY');
		Body = Body[0];

		if (this.Location != obj.contentWindow.document.location.href)
		{
			H = Body.scrollHeight ;
			obj.style.height =  (H<Min?Min:H) + 'px';
			if(H > pop_op_height)
			{
				document.getElementById("pop_op").style.height = H + 200;
			}
			else
			{
				parent.document.body.scrollTop = 0;
				if(H > 1000)
					document.getElementById("pop_op").style.height = pop_op_height + 120;
				else
					document.getElementById("pop_op").style.height = pop_op_height + 50;
			}

			this.Location = obj.contentWindow.document.location.href;
		}
	}
	catch(e)
	{
		setTimeout("resizeIF('"+Id+"')", 10);
		return;
	}
	setTimeout("resizeIF('"+Id+"')", 2000);
}

function smogLayerHeight(){
	pop_op_height = document.body.scrollHeight ;
}

//프린트하기
function printShow(url){
	var newwindow = window.open(url, "printsrc", "status=no,toolbar=no,scrollbars=yes,resizable=no,menubar=no,width=692,height=600");
	newwindow.print();
}
// -->
//연락처 지도보기
function mapOpen(url){
	window.open(url, "map", "");
}

function naverMapOpen(url){
	window.open(url, "map", "width=830,height=540");
}



/****************************************
//주민등록번호 체크 
****************************************/
function IsJuminNumChk(sCode){

	if(sCode.length != 13){
	    return false;
	}

	var s1	= sCode.substr(0,6);
	var s2	= sCode.substr(6,7);
	var n	= 2;
	var sum = 0;
	
	for (i=0; i< s1.length; i++){
		sum += parseInt(s1.substr(i, 1)) * n++;
	}
	
	for (i=0; i< s2.length-1; i++) {
		sum += parseInt(s2.substr(i, 1)) * n++;
		if (n == 10) n = 2;
	}
	
	var c = 11- sum % 11;
	if (c == 11) c = 1;
	if (c == 10) c = 0;
	if (c != parseInt(s2.substr(6, 1))) return false;
	else return true;
      
}


/****************************************
//구글 웹로그 분석 서비스 
****************************************/

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-15924977-4']);
_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);
})();
  
// -->








 
