// Active X 비활성화 대응 : 플래시
function flash(a,b,c,d) {
	var http_on;
	if (location.href.indexOf("https://") != -1) {
		http_on = "https://";
	} else {
		http_on = "http://";
	}

	var flash_tag = "";
	flash_tag = '<OBJECT classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
	flash_tag +='codebase="'+http_on+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" ';
	flash_tag +='WIDTH="'+a+'" HEIGHT="'+b+'"  id="'+d+'">';
	flash_tag +='<param name="movie" value="'+c+'">';
	flash_tag +='<param name="quality" value="high">';
	flash_tag +='<param name="allowFullScreen" value="true">';
	flash_tag +='<param name="wmode" value="transparent">';//플래시 배경 투명 설정
	flash_tag +='<embed src="'+c+'" quality="high" wmode="transparent" pluginspage="'+http_on+'www.adobe.com/go/getflashplayer" ';
	flash_tag +='type="application/x-shockwave-flash"  WIDTH="'+a+'" HEIGHT="'+b+'"/></object>'
	document.write(flash_tag);
}

function writeFlash(a,b,c,d) {
	var http_on;
	if (location.href.indexOf("https://") != -1) {
		http_on = "https://";
	} else {
		http_on = "http://";
	}

	var flash_tag = "";
	flash_tag = '<OBJECT classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
	flash_tag +='codebase="'+http_on+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" ';
	flash_tag +='WIDTH="'+a+'" HEIGHT="'+b+'"  id="'+d+'">';
	flash_tag +='<param name="movie" value="'+c+'">';
	flash_tag +='<param name="quality" value="high">';
	flash_tag +='<param name="allowFullScreen" value="true">';
	flash_tag +='<param name="wmode" value="transparent">';//플래시 배경 투명 설정
	flash_tag +='<embed src="'+c+'" quality="high" wmode="transparent" pluginspage="'+http_on+'www.adobe.com/go/getflashplayer" ';
	flash_tag +='type="application/x-shockwave-flash"  WIDTH="'+a+'" HEIGHT="'+b+'"/></object>'
	return flash_tag;
}

// 모달	윈도우 함수	(IE	전용)
function modalWindow(vWidth, vHeight, vUrl) {
	var	mdWindow=null;
	//var	kiho = (vUrl.indexOf("?")<0)?"?":"&";
	var	x=(screen.width-vWidth)/2;
	var	y=(screen.height - vHeight)/2;
	opt="status:no;	help:no; edge:raised;";
	opt=opt+"dialogWidth:"+vWidth+"px; dialogHeight:"+vHeight+"px; dialogLeft:"+x+";scroll:no; dialogTop:"+y+";";
	var	mdWindow=showModalDialog(vUrl,'',opt);
}

// 팝업윈도우 함수(원하는 크기로 툴바없이	화면 가운데	띄우기)
function openWindow(vWidth,	vHeight, vUrl, vOpt) {
	var	mdWindow = null;
	var	x	=	(screen.width - vWidth)/2;
	var	y	=	(screen.height - vHeight)/2;
	var	opt;
	if (vOpt ==	"" ||	vOpt ==	null)	vOpt = 0;
	opt	=			"width=" + vWidth	+	",height=" + vHeight;
	opt	=	opt	+	",scrollbars=" + vOpt	+	",toolbar=0,menubars=0,locationbar=0,historybar=0,statusbar=0";
	opt	=	opt	+	",outerWidth=" + vWidth	+	",outerHeight="	+	vHeight	+	",resizable=0";
	opt	=	opt	+	",left=" + x + ",top=" + y;
	opt	=	opt	+	",channelmode=no,	titlebar=no";
	var	mdWindow = window.open(vUrl, "openWindow", opt,	false);
}

// 인스턴스이름 있는 창 열기.
function openNameWindow(vWidth,	vHeight, vUrl, vName, vOpt)	{
	var	mdWindow = null;
	var	x	=	(screen.width - vWidth)/2;
	var	y	=	(screen.height - vHeight)/2;
	var	opt;
	if (vOpt ==	"" || vOpt == null)	vOpt = 0;
	opt	=			"width=" + vWidth	+	",height=" + vHeight;
	opt	=	opt	+	",scrollbars=" + vOpt	+	",toolbar=0,menubars=0,locationbar=0,historybar=0,statusbar=0";
	opt	=	opt	+	",outerWidth=" + vWidth	+	",outerHeight="	+	vHeight	+	",resizable=0";
	opt	=	opt	+	",left=" + x + ",top=" + y;
	opt	=	opt	+	",channelmode=no,	titlebar=no";
	var	mdWindow = window.open(vUrl, vName,	opt, false);
	if (!mdWindow) {
		alert("팝업차단을 해제해주세요.");
		return false;
	}
	mdWindow.focus();
}

// 페이징 링크
function goPage(formNm,	PageNo)	{
	f = document.getElementById(formNm);
	f.page.value=PageNo;
	f.submit();
}

// 형식 체크
function checkPattern(sType, str) {
	var	pattern	=	new	String() ;
	switch (sType){
		case "NUM" :	// 숫자만
			pattern	=/^[0-9]+$/;
			break;
		case "PHONE" :
			pattern	=/^[0-9]{2,4}-[0-9]{3,4}-[0-9]{4}$/;						 //전화번호	형식 : 033-1234-5678
			break;
		case "EMAIL" :
			pattern	=/^[_a-zA-Z\d\-\.]+@([_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+)/;	//메일
			break;
		case "DOMAIN"	:
			pattern	=/^[.a-zA-Z0-9-]+.[a-zA-Z]+$/; ///영자 숫자와	.	다음도 영자
			break;
		case "ENG" : //영자만
			pattern	=/^[a-zA-Z]+$/;
			break;
		case "ENGNUM"	:	//영자와 숫자
			pattern	=/^[a-zA-Z0-9]+$/;
			break;
		case "HAN" : //	한글만
			pattern	=/^[가-힣]*$/;
			break;
		case "USERID"	:	//첫글자는 영자	그뒤엔 영어숫자	4이상	15자리 이하
			pattern	=/^[a-zA-Z]{1}[a-zA-Z0-9_-]{4,15}$/;
			break;
		case "DATE"	:	// 날짜	:	2002-08-15
			pattern	=/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
			break;
		case "PASS"	:	// 날짜	:	2010-07-13
			pattern	=/^[_a-z0-9-]{6,16}$/;
			break;
		case "ID"	:
			pattern	=/^[_a-z0-9-]{5,10}$/;
			break;
		default :
		  return false;
		  break;
	}

	//alert(str	+	"|"	+	pattern);

	if(!pattern.test(str)){
			return false;
	}
	return true;
}

// 해당패턴으로 검사후 메세지 출력
function isValidType(field,	type, msg) {
	if(!checkPattern(type, field.value))
	{
		if(msg !=	"")	alert(msg);
		field.focus();
		return false;
	}
	return true;
}

// 숫자만 눌리게	하기 , 방향키	+	Delele + BackSpace 포함
function onlynum() {
	var	iCode = event.keyCode;
	if(!(	((iCode	>= 48) &&	(iCode <=	57)) ||	((iCode	>= 37) &&	(iCode <=	40)) ||	(iCode ==	8	)	|| (iCode	== 46	)||	(iCode ==	9	)	)) event.returnValue = false;
}

// 날짜	유효성체크
function isValidDate(yyyy, mm, dd, limitYearS, limitYearE) {
	var	arrLastDay = [31,	28,	31,	30,	31,	30,	31,	31,	30,	31,	30,	31];
	if (!/^[0-9]{4}$/.test(yyyy))	return false;
	if (!/^[0-9]{1,2}$/.test(mm))	return false;
	if (!/^[0-9]{1,2}$/.test(dd))	return false;

	if(limitYearS	!= null	&& limitYearE	!= null){
		if(yyyy	<	limitYearS &&	yyyy > limitYearE) return	false;
	}
	if(limitYearS	!= null){
		if(yyyy	<	limitYearS)	return false;
	}
	if(limitYearE	!= null){
		if(yyyy	>	limitYearE)	return false;
	}

	if (yyyy%1000	!= 0 &&	yyyy%4 ==	0) arrLastDay[1] = 29; //	윤년
	if (dd > arrLastDay[mm-1]	|| dd	<	1) return	false; //	날짜 체크
	if (mm < 1 ||	mm > 12) return	false; //	월 체크
	if (mm%1 !=	0	|| yyyy%1	!= 0 ||	dd%1 !=	0) return	false; //	정수 체크

	return true;
}

// 주민번호	체크
function checkJumin(formname1, formname2) {
	var	chk=0
	var	yy=formname1.value.substring(0,2)
	var	mm=formname1.value.substring(2,4)
	var	dd=formname1.value.substring(4,6)
	var	sex=formname2.value.substring(0,1)
	if((formname1.value.length!=6)||(yy<25||mm<1||mm>12||dd<1)){
		formname1.select();
		formname1.focus();
		return false;
	}
	if((sex!=1&&sex!=2)||(formname2.value.length!=7)){
		formname2.select();
		formname2.focus();
		return false;
	}
	for(var	i=0;i<=5;i++){
		chk=chk+((i%8+2)*parseInt(formname1.value.substring(i,i+1)))
	}
	for(var	i=6;i<=11;i++){
		chk=chk+((i%8+2)*parseInt(formname2.value.substring(i-6,i-5)))
	}
	chk=11-(chk	%11)
	chk=chk%10
	if(chk!=formname2.value.substring(6,7)){
		formname2.select();
		formname2.focus();
		return false;
	}
	return true;
}

function checkValid(String, space)
{
	var retvalue =	false;

	for (var	i=0; i<String.length;	i++) {
		//String이 0(""	이나 null)이면 무조건	false
		if (space	== true) {
			if	(String.charAt(i)	== ' ')	{
				//String이 0이 아닐때	space가	있어야만 true(valid)
				retvalue = true;
				break;
			}
		}	else {
			if	(String.charAt(i)	!= ' ') {
				//string이 0이 아닐때	space가	아닌 글자가	있어야만 true(valid)
				retvalue = true;
				break;
			}
		}
	}

	return retvalue;
}

// 항목이 비어있는지 체크
function isEmpty(field,	error_msg)
{
	if(error_msg ==	"")	{
		if(!checkValid(field.value,	false))	{
			if (field.type == "text")
			field.focus();
			return true;
		}	else {
			return false;
		}
	}	else {
		if(!checkValid(field.value,	false))	{
			alert(error_msg);
			if (field.type == "text")
			field.focus()	;
			return true;
		}	else {
			return false;
		}
	}
}

// 투명 PNG 사용하기
function setPng24(obj) {
	obj.width=obj.height=1;
	obj.className=obj.className.replace(/\bpng24\b/i,'');
	obj.style.filter =
	"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
	obj.src='about:blank;';
	return '';
}

/*
	.trim()
*/
String.prototype.trim = function() {
    return this.replace(/(^ *)|( *$)/g, "");
}

/*
	.ltrim()
*/
String.prototype.ltrim = function() {
    return this.replace(/(^ *)/g, "");
}

/*
	.rtrim()
*/
String.prototype.rtrim = function() {
	return this.replace(/( *$)/g, "");
}

// Radio Box, Check Box 체크되어있는지 여부
function isCheck(pName, pMsg) {
	if ($("input[name='"+pName+"']:checked").length < 1) {
		if(pMsg != "") {
			alert(pMsg);
		}

		return false;
	}
	else {
		return true;
	}
}

// Check Box 모두 선택/해제
function checkAll(pId, pName) {
	if ($("#"+pId+":checked").length > 0) {
		$("input[name='"+pName+"']:not(checked)").attr("checked", "checked");
	} else {
		$("input[name='"+pName+"']:checked").attr("checked", "");
	}
}

// 입력 Byte 체크
function input_cal_byte(frm, fname, max_byte) {
	var fname_str, byte_count=0, fname_length=0, one_str, ext_byte;

	fname_str = new String(fname.value);
	fname_length = fname_str.length;

	for (i=0;i<fname_length;i++){
	  one_str=fname_str.charAt(i);

	  if (escape(one_str).length > 4){
			byte_count+=2;
	  } else if (one_str != '\r'){
			byte_count++;
	  }
	}
	//frm.iTxtByte.value = byte_count;
	$("#iTxtByte").text(byte_count/2);

	if (byte_count > max_byte){
		ext_byte = byte_count - max_byte;
	  alert((max_byte/2)+'자 이상 입력하실수 없습니다.\n\n입력하신 내용 중 초과 '+(ext_byte/2)+'자는 자동 삭제 됩니다.\n');
	  input_cut_text(fname,max_byte);
	}
}

// 입력창 byte대로 자르기
function input_cut_text(fname, max_byte){
    var fname_str, byte_count=0, fname_length=0, one_str;

    fname_str = new String(fname.value);
    fname_length = fname_str.length;

    for (i=0;i<fname_length;i++){

        if (byte_count < max_byte){
            one_str=fname_str.charAt(i);

            if (escape(one_str).length > 4){
                byte_count+=2;
            }
            else if (one_str != '\r'){
                byte_count++;
            }
        }
        else{
            fname_str = fname_str.substring(0,i);
            break;
        }
    }

    if ((max_byte%2) ==1){
        fname_length = (fname_str.length-1);
        if (escape(fname_str.charAt(fname_length)).length > 4){
            fname_str = fname_str.substring(0,fname_length);
        }
    }

    fname.value = fname_str;
    return fname_str;
}

// 글자수 체크
function checkWordSize(obj, title, max){
	if (obj.value.length > max) {
		obj.blur();
		obj.value = obj.value.substring(0,max-1);
		alert(title+'(은/는) '+max+'자를 초과할 수 없습니다.');
		obj.focus();
	}
}

// 팝업 자동 리사이즈
function popupResize(pID, pWidth, pHeight) {
	if (typeof(pWidth) == "undefined" && typeof(pHeight) == "undefined") {
		var width = 0, height = 0;

		if ($.browser.msie) { // IE
			if ($.browser.version == "6.0") {
				width = 37;
				height = 85;
			}
			else if ($.browser.version == "7.0") {
				width = 21;
				height = 108;
			}
			else {
				width = 21;
				height = 108;
			}
		}
		else if ($.browser.mozilla) {	// FF
			width = 18;
			height = 113;
		}
		else if ($.browser.safari) {	// safari, crome
			width = 20;
			height = 85;
		}

		window.resizeTo($("#" + pID).width() + width, $("#" + pID).height() + height);
	}
	else {
		window.resizeTo(pWidth, pHeight);
	}
}

// 플래시 파라미터값으로 이동
function flashMove(pVal, pTarget){
	if (pVal != "#") {
		if (pTarget == "_blank") {
			window.open(pVal,'','');
		} else {
			location.href = pVal;
		}
	}
}

// 쿠키 가져오기
function getCookie(name) {
	var nameOfCookie=name+"=";
	var a=0;

	while(a<=document.cookie.length) {
		var b=(a+nameOfCookie.length);

		if(document.cookie.substring(a,b)==nameOfCookie) {
			if((endOfCookie=document.cookie.indexOf(";",b))==-1)
				endOfCookie=document.cookie.length;

			return unescape(document.cookie.substring(b,endOfCookie));
		}

		a = document.cookie.indexOf(" ",a) +1;

		if(a==0)
			break;
	}

	return "";
}

// 쿠키 생성하기
function setCookie(name, value, expiredays) {
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}


// -------------------------------------------------------------------
// STR : 파일 업로드
function openFileUpload() {
	var iMaxCount = document.getElementById("iMaxCount").value;
	if (iMaxCount == "") { iMaxCount = 3; }
	if (parseInt(iMaxCount) <= parseInt(document.getElementById("selFileList").length)-1) {
		alert("파일첨부는 "+ iMaxCount +"개까지 가능합니다.");
		return;
	}

	openNameWindow(500, 200, "", "file", "");
	document.getElementById("frmMain").target = "file";
	document.getElementById("frmMain").method = "post";
	document.getElementById("frmMain").action = "/common/etc/file_write.asp";
	document.getElementById("frmMain").submit();
}

function fileAdd(pFileName, pRealFileName, pFileSize) {
	var CurFileListLength = document.getElementById("selFileList").length;

	document.getElementById("selFileList").length = CurFileListLength + 1;
	document.getElementById("selFileList").options[CurFileListLength].text = pRealFileName;
	document.getElementById("selFileList").options[CurFileListLength].value = pFileSize;

	document.getElementById("selHiddenList").length = CurFileListLength + 1;
	document.getElementById("selHiddenList").options[CurFileListLength].text = pRealFileName;
	document.getElementById("selHiddenList").options[CurFileListLength].value = pFileName;

	fileSize();
}

function fileDel() {
	var selIndex = document.getElementById("selFileList").selectedIndex;

	if (selIndex <= 0) {
		alert("삭제할 파일을 선택해주세요.");
	}
	else {
		var strFileName = "";
		var strRealFileName = "";
		strFileName = document.getElementById("selHiddenList").options[selIndex].value;
		strRealFileName = document.getElementById("selHiddenList").options[selIndex].text;

		var CurSelListLenght = document.getElementById("selFileList").length;
		var blnFileSavePath = document.getElementById("blnFileSavePath").value;
		var sFilePath = document.getElementById("sFilePath").value;
		$.ajax({
			url: "/common/etc/file_del.asp",
			type: "post",
			data: {"blnFileSavePath":blnFileSavePath,"sFilePath":sFilePath,"sRealFileName":strRealFileName},
			dataType: "json",
			global: false,
			success: function(data){
				if (data.msg != "") {
					alert(data.msg);
				}
				else {
					for (var intLoop = selIndex; intLoop < CurSelListLenght - 1; intLoop++) {
						document.getElementById("selFileList").options[intLoop].text = document.getElementById("selFileList").options[intLoop + 1].text;
						document.getElementById("selFileList").options[intLoop].value = document.getElementById("selFileList").options[intLoop + 1].value;

						document.getElementById("selHiddenList").options[intLoop].text = document.getElementById("selHiddenList").options[intLoop + 1].text;
						document.getElementById("selHiddenList").options[intLoop].value = document.getElementById("selHiddenList").options[intLoop + 1].value;
					}

					document.getElementById("selFileList").length = document.getElementById("selFileList").length - 1;
					document.getElementById("selHiddenList").length = document.getElementById("selHiddenList").length - 1;
				}
			},
			error: function(xhr, status, error) { alert("#error:"+status); }
		});

		fileSize();
	}
}

function fileSize() {
	var intTotalSum = 0;

	for (intLoop=0; intLoop<document.getElementById("selFileList").length; intLoop++) {
		if (intLoop != 0) {
			intTotalSum = intTotalSum + parseInt(document.getElementById("selFileList").options[intLoop].value);
		}
	}

	//토탈 파일 사이즈를 넣어준다.(소수점 한자리까지 넣어준다.)=====================
	document.getElementById("fileTotalSize").innerHTML = fileNumberFormat(intTotalSum);
}

function fileNumberFormat(num) {
	num = Math.round(num / 1024);

	if (num < 1) { num = 1; }

	return num;
}

function fileCheck(frm) {
	var strFileName = "";
	var strRealFileName = "";
	var strFileSize = "";
	if (frm.selHiddenList.length >= 2) {
		for (i=1; i<frm.selHiddenList.length; i++) {
			strFileName += frm.selHiddenList.options[i].value+"^";
			strRealFileName += frm.selHiddenList.options[i].text+"^";
			strFileSize += frm.selFileList.options[i].value+"^";
		}
	}
	frm.arrFileName.value = strFileName;
	frm.arrRealFileName.value = strRealFileName;
	frm.arrFileSize.value = strFileSize;
}

// END : 파일 업로드
// -------------------------------------------------------------------


// -------------------------------------------------------------------
// By HJu 2011-06-28
function snsTwitter() {
    var popWin = window.open("http://twitter.com/intent/tweet?text="+encodeURIComponent("시즌3! 캘리포니아의 다양한 ROADMAP - http://www.mycalifornia.co.kr/"), "shareTwitter", "toolbar=0,status=0,width=626,height=436,scrollbars=1");
    if (popWin) {
        popWin.focus();
    }
}

function snsFacebook() {
    //var url = "http://www.mycalifornia.co.kr:8066/";
    var url = location.href;
    var msg = document.title;

    var href = "http://www.facebook.com/sharer.php?u="+encodeURIComponent(url)+"&t="+encodeURIComponent(msg);
    var popWin = window.open(href, "shareFacebook","toolbar=0,status=0,width=626,height=436,scrollbars=1");
    if (popWin) {
        popWin.focus();
    }
}

// DialogCommon Layer Popup. By HJu
function fnDialogLayer(pID, pIfrm, pURL, pWidth, pHeight)
{
	if(pWidth == "") { pWidth = 100; }
	if(pHeight == "") { pHeight = 100; }
	if (pIfrm != "") {
    	document.getElementById(pIfrm).src = pURL;
    	document.getElementById(pIfrm).style.width = parseInt(pWidth)+"px";
    	document.getElementById(pIfrm).style.height = parseInt(pHeight-35)+"px";
    	document.getElementById(pID).style.width = parseInt(pWidth)+"px";
    	document.getElementById(pID).style.height = parseInt(pHeight)+"px";
    	//alert(document.getElementById(pIfrm).src+document.getElementById(pIfrm).style.width+document.getElementById(pIfrm).style.height);
    }
    $("body").css("overflow", "hidden");
	$("#"+pID).dialog({
	     closeOnEscape: true
	    , closeText: 'hide'
	    , dialogClass: 'alert'
	    , draggable: true
	    , modal: true
	    , position: 'center'
	    , resizable: false
	    , width:pWidth,height:pHeight
    });
    $(".ui-dialog-titlebar").hide();
}

function fnDialogLayerClose(pID, pIfrm) {
	$("#"+pID).dialog("close");
	$("body").css("overflow", "auto");
	if (pIfrm != "") {
        document.getElementById(pIfrm).src = "about:blank";
	}
}

// search Layer Popup. By cham
function dimBlock() {
	$('body').prepend('<div id="popFade" style="display:none;"></div>');
	$('#popFade').css({'position':'fixed','top':'0','left':'0','width':'100%','height':'3000%','background-color':'#000','opacity':'0.4','filter':'alpha(opacity=40)','z-index':'99'});
	$('#popFade').html('<!--[if (IE 8)|(IE 7)]><style type="text/css">#popFade{height:300% !important;}</style><![endif]--><!--[if lte IE 6]><style type="text/css">#popFade{position:absolute !important;height:'+$(document).height()+'px !important;}.ie6_iframe{position:absolute;width:100%;height:'+$(document).height()+'px;background-color:#000;filter:alpha(opacity=0);overflow:hidden;z-index:100;}</style><iframe frameborder="0" class="ie6_iframe"></iframe><![endif]-->')
	;
}


function dimLayerOp1() {
	//스크롤 숨김 By cham
	if($.browser.msie && $.browser.version == '7.0') {
	$("html").css("overflow", "auto");
	} else {
	$("body").css("overflow", "auto");
	}
	dimBlock();
	$("#layerPop01").show();
	$("#popFade").show();

	var flash_tag = writeFlash('815','620','/swf/playSearch.swf?imgurl=/swf/images/play/','playSearch');
	$(".con_Psearch").html(flash_tag);
}
function dimLayerOp2() {
	//스크롤 숨김 By cham
	if($.browser.msie && $.browser.version == '7.0') {
	$("html").css("overflow", "auto");
	} else {
	$("body").css("overflow", "auto");
	}
	dimBlock();
	$("#layerPop02").show();
	$("#popFade").show();

	var flash_tag = writeFlash('815','718','/swf/multiSearch.swf?xmlurl=/swf/xml/multiList.asp&dataurl=/swf/xml/multiList.xml','multiSearch');
	$(".con_Msearch").html(flash_tag);
}
// RoadMap Detail. By HJu
function dimLayerOp3(pMenuCode) {
	var xmlURL = "/swf/xml/navi_info.xml";
	var xml = parseXML(xmlURL);
	$(xml).find("depth3").each(function(){
		if(pMenuCode == $(this).attr("menucode")) {
			if($(this).attr("gUrl") != "") {
				document.getElementById("ifrmLoadMapContent").src = $(this).attr("gUrl");
			}
			else {
				dimLayerPopCl3();
				alert("정상적인 접근이 아닙니다.");
			}
		}
	});

	dimBlock();
	$("#layerPop03").show();
	$("#popFade").show();
}

function dimLayerOp3Start(pMenuCode) {
	setTimeout("scroller('"+pMenuCode+"')",1000);
}

function scroller(pMenuCode) {
	//get the full url - like mysitecom/index.htm#home
	var full_url = "#"+pMenuCode;	//var full_url = this.href;

	//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
	var parts = full_url.split("#");
	var trgt = parts[1];

	//get the top offset of the target anchor
	var target_offset = $("#"+trgt).offset();
	var target_top = target_offset.top;

	//goto that anchor by setting the body scroll top to anchor top
	$('html, body').animate({scrollTop:target_top}, 500);
}

function dimLayerPopCl1() {
	//스크롤 오토 By cham
	if ($.browser.msie && $.browser.version == '7.0') {
		$("html").css("overflow", "auto");
	} else {
		$("body").css("overflow", "auto");
	}
	$("#layerPop01").hide();
	$("#popFade").hide();
	$(".con_Psearch").html("");
}
function dimLayerPopCl2() {
	//스크롤 오토 By cham
	if ($.browser.msie && $.browser.version == '7.0') {
		$("html").css("overflow", "auto");
	} else {
		$("body").css("overflow", "auto");
	}
	$("#layerPop02").hide();
	$("#popFade").hide();
	$(".con_Msearch").html("");
}
function dimLayerPopCl3() {
	//스크롤 오토 By cham
	if ($.browser.msie && $.browser.version == '7.0') {
		$("html").css("overflow", "auto");
	} else {
		$("body").css("overflow", "auto");
	}

	$("#layerPop03").hide();
	$("#popFade").hide();
	document.getElementById("ifrmLoadMapContent").src = "about:blank";
}

//layer onmouseover onmouseout By cham
$(document).ready(function() {
	//$('.arrButton').mouseover(function(obj) {
	//	alert($(this).index());
	//});
	$('.arrButton').mouseover(function(obj) {
		var imageName = $('.arrButton:eq('+$(this).index()+') img').attr('src').replace('.png','_on.png');
		$('.arrButton:eq('+$(this).index()+') img').attr('src',imageName);
		$('.arrResult').eq($(this).index()).show(); //버튼에 오버시 레이어팝업 보이기
		//var imageName = $(this).attr('src').replace('.png','_on.png'); //버튼on 이미지
		//$(this).attr('src',imageName); //버튼on 이미지
		//$('.arrResult').eq($(this).index()).show(); //버튼에 오버시 레이어팝업 보이기

	});

	$('.arrButton').mouseout(function(index) {
		var imageName = $('.arrButton:eq('+$(this).index()+') img').attr('src').replace('_on.png','.png');
		$('.arrButton:eq('+$(this).index()+') img').attr('src',imageName);
		//var imageName = $(this).attr('src').replace('_on.png','.png');
		//$(this).attr('src',imageName);
		$('.arrResult').hide();
	});
});

// 이미지 크기에 맞게 새창 띄우기. (2012-01-06)
function imgResize(img){
	img1 = new Image();
	img1.src = (img);
	imgControll(img);
}

function imgControll(img){
	if ((img1.width!=0)&&(img1.height!=0)) {
		viewImage(img);
	}
	else {
		controller = "imgControll('"+img+"')";
		intervalID = setTimeout(controller,20);
	}
}

function viewImage(img) {
	W = img1.width;
	H = img1.height;
	O = "width="+W+",height="+H;
	imgWin=window.open("","",O);
	imgWin.document.write("<html><head><title>이미지 미리보기</title></head>");
	imgWin.document.write("<body topmargin=0 leftmargin=0>");
	imgWin.document.write("<img src='"+img+"' onclick='self.close()' style=cursor:hand>");
	imgWin.document.close();
}


// iframe 리사이즈. (2012-01-06)
function resizeFrame(frm) {
	frm.style.height = "auto";
	contentHeight = frm.contentWindow.document.documentElement.scrollHeight;
	frm.style.height = contentHeight + 30 + "px";
}


