// 폰트 크기관련
/*
function setCookie(name,value,expires) { 
	document.cookie=name + "=" + escape(value) + ((expires == null)? "" : (" ; expires=" + expires.toGMTString()));
}

function getCookie(name) { 
	var arg = name + "="; 
	var alen = arg.length; 
	var clen = document.cookie.length; 
	var i = 0; while(i< clen) {
		 var j = i + alen; 
		 if(document.cookie.substring(i,j)==arg){ 
		 	var end = document.cookie.indexOf(";",j); 
		 	if(end == -1) end = document.cookie.length; 
		 	return unescape(document.cookie.substring(j,end));
		 	} 
		 	i=document.cookie.indexOf(" ",i)+1;
		 	if (i==0) break; 
		 	} 
		return null;
}

function getFontCookie() { 
	var cookie = getCookie("news_font_size"); 
	if ( cookie == null ) return 16; 
	if ( cookie.length ) return cookie; 
	else return 16; 
}

function scaleFont(val) {
var content, lineHeight;
content = document.getElementById("content"); 
if (val > 0) { 
	if (fontSize <= 18) { 
		fontSize = fontSize + val;
		lineHeight = fontSize+Math.round(1.1*fontSize);
		content.style.fontSize = fontSize + "px"; 
		} 
		} else { 
	if (fontSize > 12) { 
		fontSize = fontSize + val; 
		lineHeight = fontSize+Math.round(1.1*fontSize); 
		content.style.fontSize = fontSize + "px"; 
		} 
		} 
	var mydate = new Date;
	mydate.setDate(mydate.getDate()+1000);
	setCookie("news_font_size", fontSize, mydate);
}
*/
//폰트 크기 관련 끝!!!!

function isBlank(str) {
	flag = 0;
	for (i=0; i<str.length; i++) {
		if (str.substr(i,1) != " ") {
			flag = 1
		}
	}
	return flag;
}

function del(Url) {
	var str = "정말 삭제하시겠습니까?";
	if (confirm(str) == true) { this.location.replace(Url); return; }
	else return;
}

//source에서 target으로 셀렉트 넘기는거.
function selectAllSelect(pSource, pTarget){
var optionEl = document.createElement("OPTION");
targetEl = eval("document.all." + pTarget );
sourceEl = eval("document.all." + pSource);
clearOption(pTarget);
for (i=0; i< sourceEl.length; i++) {
  addOption(pTarget, sourceEl.options[i].value, sourceEl.options[i].text)
  }
}

function select2Select(pSource, pTarget){
  var optionEl = document.createElement("OPTION");
  optionsEl = null;
  targetEl = eval("document.all." + pTarget );
  sourceEl = eval("document.all." + pSource);
  var tLength = targetEl.length
  var sLength = sourceEl.length
  for(i=0; i< tLength; i++) {
    if((targetEl.options[i].value == sourceEl.value) || (sourceEl.selectedIndex == -1)) {
      return;
    }
  }
  
  if(sourceEl.selectedIndex == -1){ 
    return 
  }

  
  for (i=0; i< sLength; i++) {
    if(sourceEl.options[i].selected){
  	  optionEl.text = sourceEl.options[i].text;
      optionEl.value = sourceEl.options[i].value;
  	}
  }


    sourceEl.options[sourceEl.selectedIndex] = null;
    targetEl.options.add(optionEl);
    
  }

//특정리스트 박스에대한 ?뭐지
function selectAllOption(pSource){
  var el = eval("document.all." + pSource);
  for(i=0; i < el.length; i++) el.options[i].selected = true;
}

//특정 리스트 박스내용 전체 삭제
function clearOption(pSource){
var el = eval("document.all." + pSource);
var elLength = el.length;
	for(i=elLength; i > 0 ; i--) {
		el.options[i-1] = null;
	}  
}

function deleteOption(pSource){
var el = eval("document.all." + pSource);
	for(i=0; i < el.length; i++) {
	if(el.options[i].selected == true) {
		el.options[i] = null;
		}
	}
}

function upSelected(pSource){
var el = eval("document.all." + pSource);
var tmpText, tmpValue, tmpI
	for(i=0; i < el.length; i++){
		if(el.options[i].selected == true && i != 0) {
		tmpText = el.options[i].text
		tmpValue = el.options[i].value
		el.options[i].text = el.options[i-1].text
		el.options[i].value = el.options[i-1].value
		el.options[i-1].text = tmpText
		el.options[i-1].value = tmpValue
		tmpI = i
		i=el.length;
		}
	}
	for(i=0; i < el.length; i++) {
		if(tmpI-1 == i)	el.options[i].selected = true;
		else el.options[i].selected = false;
	}
}

function downSelected(pSource){
var el = eval("document.all." + pSource);
var tmpText, tmpValue, tmpI
	for(i=0; i < el.length; i++){
		if(el.options[i].selected == true && i != el.length-1) {
		tmpText = el.options[i].text
		tmpValue = el.options[i].value
		el.options[i].text = el.options[i+1].text
		el.options[i].value = el.options[i+1].value
		el.options[i+1].text = tmpText
		el.options[i+1].value = tmpValue
		tmpI=i
		i = el.length;
		}
	}
	for(i=0; i < el.length; i++) {
		if(tmpI+1 == i)	el.options[i].selected = true;
		else el.options[i].selected = false;
	}
}

function Tourist_Select(idx,key) {
	window.open('/program/tourism_link/lst_tlink.php?pP_idx='+idx+'&pP_key='+key,'Tourist_Select','left=20,top=20,width=600,height=400,scrollbars=no,resizable=no');
}


n = document.layers 
ie = document.all 
function hide() { 
if (ie || n) { 
if (n) document.Load.visibility = "hidden" 
else Load.style.visibility = "hidden" 
} 
}

function showPicture(src,title) {
  var imgObj = new Image();
  imgObj.src = src;
  var wopt = "scrollbars=no,status=no,resizable=no";
  wopt += ",width=" + imgObj.width;
  wopt += ",height=" + imgObj.height;
  var wbody = "<head><title>"+title+"</title>";
  wbody += "<script type='text/javascript'>";
  wbody += "function finalResize(){";
  wbody += "  var oBody=document.body;";
  wbody += "  var oImg=document.images[0];";
  wbody += "  var xdiff=oImg.width-oBody.clientWidth;";
  wbody += "  var ydiff=oImg.height-oBody.clientHeight;";
  wbody += "  window.resizeBy(xdiff,ydiff);";
  wbody += "}";
  wbody += "</"+"script>";
  wbody += "</head>";
  wbody += "<body onLoad='finalResize()' style='margin:0'>";
  wbody += "<a href='javascript:window.close()'><img src='" + src + "' border=0></a>";
  wbody += "</body>";
  winResult = window.open("about:blank","",wopt);
  winResult.document.open("text/html", "replace");
  winResult.document.write(wbody);
  winResult.document.close();
  return;
}

function showSwf(src,title,width,height) {
  var imgObj = new Image();
  imgObj.src = src;
  var wopt = "scrollbars=no,status=no,resizable=no";
  wopt += ",width=" + width;
  wopt += ",height=" + height;
  var wbody = "<head><title>"+title+"</title>";
  wbody += "</head>";
  wbody += "<body style='margin:0'>";
  wbody += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+width+"' height='"+height+"'><param name='movie' value='" + src + "'><param name='quality' value='high'><embed src='" + src + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+width+"'  height='"+height+"'></embed></object>";
  wbody += "</body>";
  winResult = window.open("about:blank","",wopt);
  winResult.document.open("text/html", "replace");
  winResult.document.write(wbody);
  winResult.document.close();
  return;
}


function StatusOff(){ return onText(""); }
function onText(str){ window.status = str; return true }


// 회원정보관련 

function showUserRegistForm() { //v2.0
  var secure_link = "http://mail.gimhae.go.kr/nara/index_secure.jsp";
  var url = "http://mail.gimhae.go.kr/nara/servlet/gimhae.UserSecureServ?cmd=showProvision";
  secure_link = secure_link+"?url="+url;
  window.open( secure_link,"userregistform","status=no,toolbar=no,scrollbars=no,width=700,height=700");
}

function showUserInfo(uid) { //v2.0
  var secure_link = "http://mail.gimhae.go.kr/nara/index_secure.jsp";
  var url = "http://mail.gimhae.go.kr/nara/servlet/gimhae.UserEnvSecureServ?cmd="+uid;
  secure_link = secure_link+"?url="+url;
  window.open( secure_link,"userinfo","status=no,toolbar=no,scrollbars=no,width=700,height=600");
}

function showUserPasswdHint() { //v2.0
  var secure_link = "http://mail.gimhae.go.kr/nara/index_secure.jsp";
  var url = "http://mail.gimhae.go.kr/nara/servlet/gimhae.UserSecureServ?cmd=showPasswdHint";
  secure_link = secure_link+"?url="+url;
  window.open( secure_link,"userPasswdHint","status=no,toolbar=no,scrollbars=no,width=700,height=300");
}

function showUserfindID() { //v2.0
  var secure_link = "http://mail.gimhae.go.kr/nara/index_secure.jsp";
  var url = "http://mail.gimhae.go.kr/nara/servlet/gimhae.UserSecureServ?cmd=showFindIDForm";
  secure_link = secure_link+"?url="+url;
  window.open( secure_link,"findID","status=no,toolbar=no,scrollbars=no,width=800,height=300");
}

// 회원정보관련 끝

function SMS(idx,tb) { // SMS 보내기
	
	window.open('/program/sendsms/sms.php?idx='+idx+'&tb='+tb,'sendsms','left=30,top=30,width=297,height=474,scrollbars=no,resizable=no');
	
}
// 2008.05.28 tkpark SMS발송하기 추가.
function tk_SMS(href) { // SMS 보내기
	
	window.open(href,'sendsms','left=30,top=30,width=297,height=474,scrollbars=no,resizable=no');
	
}

function hidestatus()
{
window.status='';
return true
}
if (document.layers) document.captureEvents(Event.mouseover | Event.mouseout)
document.onmouseover=hidestatus
document.onmouseout=hidestatus

var CBA_window; 

function openName(pay){ 
    CBA_window = window.open('/program/realnamecheck/real_check.php?rUrl='+pay, 'CbaWindow', 'width=410, height=250, resizable=0, scrollbars=0, status=0, titlebar=0, toolbar=0, left=300, top=200' );

    if(CBA_window == null){ 
        var ua = window.navigator.userAgent;
        var msie = ua.indexOf ( "MSIE" );
        var msxp = ua.indexOf ( "Windows NT 5.1" );
        var msxpsp2 = ua.indexOf ( " SV1" );

        if(msie >0 && msxp >0 && msxpsp2 >0){
            alert("※ MSN,야후,구글 팝업 차단 툴바가 설치된 경우 팝업허용을 해주셔야만 가상식별 실명확인서비스 이용이 가능합니다. \n\n※ 윈도우 XP SP2 사용자일 경우에는 화면 상단에 있는 팝업 차단 알림줄을 클릭하여 팝업을 \n    허용해 주시기 바랍니다.");
        }else{
            alert("※ MSN,야후,구글 팝업 차단 툴바가 설치된 경우 팝업허용을 해주셔야만 가상식별 실명확인서비스 이용이 가능합니다."); 
        } 
    }
}

//if (document.layers) document.captureEvents(Event.mouseover | Event.mouseout)
//document.onmouseover=hidestatus
//document.onmouseout=hidestatus

//============================================================================ 
// 이미지 자동 리사이즈 
//============================================================================ 
function image_auto_resize(this_s,width,height){ 
 var ta_image = new Image(); 
 ta_image.src = this_s.src; 
  if(!width){this_s.removeAttribute('width'); 
  this_s.style.width='auto';} 
  else if(width < ta_image.width){ 
  this_s.width = width; 
  }else{ 
  this_s.width = ta_image.width; 
  } 
  if(!height){this_s.removeAttribute('height'); 
  this_s.style.height='auto';} 
  else if(height < ta_image.height){ 
  this_s.height = height; 
  }else{ 
  this_s.height = ta_image.height; 
  } 
} 

function image_auto_resize_inarea(this_s,width,height,view){ 
//this_s안의 모든 이미지는 자동 리사이즈 된다. 
 //alert(this_s.childNodes.length); 
 if(!view){view=true;} 
 if(!this_s){return;} 
 if(this_s.nodeType!=1){return;} 
 for(var i=0,m=this_s.childNodes.length;i<m;i++){ 
  var ta = this_s.childNodes[i]; 
  
  if(ta.nodeName=='IMG'){ 
  //ta.style.border='1px solid #333333';  
  image_auto_resize(ta,width,height); 

  if(view){ 
    if(!ta.title){ta.title=ta.src;} 
    if(!ta.onclick){ 
    ta.style.cursor='pointer'; 
    ta.onclick=function(){js_image_view(this,1);} 
    } 
    if(!ta.onload) 
    ta.onload=function(){image_auto_resize(this,width,height);} 
    if(!ta.onmouseover)  
    ta.onmouseover=function(){image_auto_resize(this,width,height);} 
  } 
  } 
  if(ta.childNodes.length>0){ 
  image_auto_resize_inarea(ta,width,height); 
  } 
 } 
 return; 

} 

//image_auto_resize_inarea(document.getElementById('content_view'),100,'',true); 

function isDate(select_year, select_month, select_day) {	

	var err = 0;
	var int_february_day;

	if(select_year != "" && select_month != "" && select_day != "") {

		if (select_year < 1980 || select_year > 2037 || isNaN(select_year)) err = 1;
	  	if (select_month < 1 || select_month > 12 || isNaN(select_month))  err = 1;
		if (select_day < 1 || select_day > 31 || isNaN(select_day)) err = 1;
		if (select_month == 4 || select_month == 6 || select_month == 9 || select_month == 11) {
			if (select_day==31) err=1;
		}
		if (select_month == 2) {
			if (( (select_year % 4 == 0) && (select_year % 100 != 0) ) || (select_year % 400 == 0) ) {
				int_february_day = 29; 
			}
			else {
				int_february_day = 28;
			}
		
			if (select_day > int_february_day) err=1;
		}

		if (err == 1 ) {	
			return false;
		}
		else {
			return true;
		}
	}
	else {
		return false;
	}		
}


// E-mail 입력 확인 	
function isEmail(form1)
	{  
		var email = form1;
		var email_1 = "";
		var email_2 = "";
		var check_point = 0;

		if (email.indexOf("@") < 0 ) {
			alert("e-mail에 @ 가 빠져있습니다.");
			return false;
		}
		if (email.indexOf(".") < 0 ) {
			alert("e-mail에 . 가 빠져있습니다.");
			
			return false;
		}

		if (email.indexOf("|") >= 0 ) {
			alert("e-mail에 | 는 포함할수 없습니다..");
			
			return false;
		}
		if (email.indexOf(">") >= 0 ) {
			alert("e-mail에 > 는 포함할수 없습니다..");
			
			return false;
		}
		if (email.indexOf("<") >= 0 ) {
			alert("e-mail에 < 는 포함할수 없습니다..");
			
			return false;
		}
		if (email.indexOf(" ") >= 0 ) {
			alert("e-mail에 스페이스는 포함할수 없습니다..");
			
			return false;
		}

	          for (var j = 0 ; j < email.length; j++)
	          {
	               if ( email.substring(j, j + 1) != "@"  && check_point == 0 ) {
				email_1 = email_1 + email.substring(j, j + 1)
	               } else if ( email.substring(j, j + 1) == "@" )  {
				check_point = check_point + 1;
	               } else {
	               		email_2 = email_2 + email.substring(j, j + 1);	
	               }
	          }

		if (email_1.length < 3 ) {
			alert("e-mail에 @ 앞자리는 3자리이상 입력하셔야합니다.");
			
			return false;
		}
		if (email_2.length < 2 ) {
			alert("e-mail에 @ 뒷자리는 2자리이상 입력하셔야합니다.");
			
			return false;
		}

		if (check_point > 1 ) {
			alert("e-mail에 @ 는 1번이상 들어갈수 없습니다.");
			
			return false;
		}

		if (email_2.indexOf("(") >= 0 ) {
			alert("e-mail에 ( 는 포함할수 없습니다..");
			
			return false;
		}
		if (email_2.indexOf("(") >= 0 ) {
			alert("e-mail에 ( 는 포함할수 없습니다..");
			
			return false;
		}
		if (email_2.indexOf(")") >= 0 ) {
			alert("e-mail에 ) 는 포함할수 없습니다..");
			
			return false;
		}
		if (email_2.indexOf(",") >= 0 ) {
			alert("e-mail에 , 는 포함할수 없습니다..");
			
			return false;
		}
		if (email_2.indexOf(";") >= 0 ) {
			alert("e-mail에 ; 는 포함할수 없습니다..");
			
			return false;
		}
		if (email_2.indexOf(":") >= 0 ) {
			alert("e-mail에 : 는 포함할수 없습니다..");
			
			return false;
		}
		if (email_2.indexOf("/") >= 0 ) {
			alert("e-mail에 / 는 포함할수 없습니다..");
			
			return false;
		}
		if (email_2.indexOf("[") >= 0 ) {
			alert("e-mail에 [ 는 포함할수 없습니다..");
			
			return false;
		}
		if (email_2.indexOf("]") >= 0 ) {
			alert("e-mail에 ] 는 포함할수 없습니다..");
			
			return false;
		}
		if (email_2.indexOf("{") >= 0 ) {
			alert("e-mail에 { 는 포함할수 없습니다..");
			
			return false;
		}
		if (email_2.indexOf("}") >= 0 ) {
			alert("e-mail에 } 는 포함할수 없습니다..");
			
			return false;
		}
		if (email_2.indexOf(" ") >= 0 ) {
			alert("e-mail에 스페이스는 포함할수 없습니다..");
			
			return false;
		}
		return true;
	}	
