/*셀렉트링크 스크립트
<form action="javascript:selectlink(this);">
<select onchange='select_change(this);'>
*/
function selectlink(){
	if(hiddenvalue){
	location.href=hiddenvalue;
	}else{
	window.alert('선택하세요');
	}
}
function selectlink2(){
	if(hiddenvalue){
	window.open(hiddenvalue);
	}else{
	window.alert('선택하세요');
	}
}
function select_change(obj) {
	var myindex=obj.selectedIndex;
	hiddenvalue = obj.options[myindex].value;
}
//팝업
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//팝업
function iam_popup(theURL,winName,wWidth,wHeight) { //v2.0
	wX = (window.screen.width - wWidth) / 2-100;
	wY = (window.screen.height - wHeight) / 2-100;
  window.open(theURL,winName,"directories=no,toolbar=no,left="+wX+",top="+wY+",width="+wWidth+",height="+wHeight);
}
//팝업
function iam_popup_move(theURL,winName,wWidth,wHeight) { //v2.0
	wX = (window.screen.width - wWidth) / 2;
	wY = (window.screen.height - wHeight) / 2;
	window.moveBy(0,-20);
  window.open(theURL,winName,"directories=no,toolbar=no,left="+wX+",top="+wY+",width="+wWidth+",height="+wHeight);
}



//온로드
function onloadfunction(){
MM_showHideLayers('top_menu_item1','','hide','top_menu_item2','','hide','top_menu_item3','','hide','top_menu_item5','','hide','top_menu_item6','','hide')
}

//SHOW/HIDE레이어
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_showHideLayers2() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers2.arguments;
  for (i=0; i<(args.length-2); i+=3)
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'inline':(v=='hide')?'none':v; }
    obj.display=v; }
}
//조직도 SHOW/HIDE
var ltLayer = "";
function showLayer(name){
	if(document.all[name].style.display != "none"){
		document.all[name].style.display = "none"
	}
	else{
		document.all[name].style.display = "inline"
		if(ltLayer != "" && name != ltLayer){
			document.all[ltLayer].style.display = "none";
		}
		ltLayer = name;
	}
}

//롤오버
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_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_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 initMoving(target, position, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = position;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;

	if (typeof(window.pageYOffset) == "number") {
		obj.getTop = function() {
			return window.pageYOffset;
		}
	} else if (typeof(document.documentElement.scrollTop) == "number") {
		obj.getTop = function() {
			return document.documentElement.scrollTop;
		}
	} else {
		obj.getTop = function() {
			return 0;
		}
	}

	if (self.innerHeight) {
		obj.getHeight = function() {
			return self.innerHeight;
		}
	} else if(document.documentElement.clientHeight) {
		obj.getHeight = function() {
			return document.documentElement.clientHeight;
		}
	} else {
		obj.getHeight = function() {
			return 500;
		}
	}

	obj.move = setInterval(function() {
		if (obj.initTop > 0) {
			pos = obj.getTop() + obj.initTop;
		} else {
			pos = obj.getTop() + obj.getHeight() + obj.initTop;
			//pos = obj.getTop() + obj.getHeight() / 2 - 15;
		}

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit;
		if (pos < obj.topLimit)
			pos = obj.topLimit;

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 30)
}

//simple_flash
function swf(src,width,height){
    object = '';
    object += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="param" width="'+width+'" height="'+height+'">';
    object += '<param name="movie" value="'+src+'">';
    object += '<param name="wmode" value="transparent">';
    object += '<embed src="'+src+'" quality="high" wmode="transparent" menu="false" width="'+width+'" height="'+height+'" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';
    object += '<\/object>';
    document.write(object);
}

/*
function post_check(){
			
	window.open('/login/member_addr_check2.jsp',"","width=390,height=250,scrollbars=yes");
		
	return;

}

function post_check_tour(){
		
	window.open('/login/member_addr_check2_1.jsp',"","width=390,height=250,scrollbars=yes");
		
	return;

}

function post_check2(key){
		window.open('/g_board/map/map.jsp?key='+key,"","width=390,height=250,scrollbars=yes");
		return;
}
*/




function viewOrg(mVal){
	htmlCont="<html><head><meta http-equiv=Content-Type content=text/html; charset=euc-kr /><style>body{margin:0px;}</style></head><body><img name='nowImg' src='"+mVal+"' border='0' style='cursor:pointer;' onClick='self.close();' onload='if(parseInt(this.width)>800){this.width=800;this.height=600;self.resizeTo(800,630);}else{self.resizeTo(parseInt(nowImg.width),parseInt(nowImg.height+30))}'></body></html>";
	childWin=window.open("about:blank","mainImg","width=0,height=0,scrollbars=no,top=0,left=0");
	if(childWin){
		childWin.close();
		childWin=window.open("javascript:document.write('"+htmlCont+"')","mainImg","width=0,height=0,scrollbars=no,top=0,left=0");
	}
}



 function encodeURL(str){
     var s0, i, s, u;
     s0 = "";                // encoded str
     for (i = 0; i < str.length; i++){   // scan the source
         s = str.charAt(i);
         u = str.charCodeAt(i);          // get unicode of the char
         if (s == " "){s0 += "+";}       // SP should be converted to "+"
         else {
             if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){       // check for escape
                 s0 = s0 + s;            // don't escape
             }
             else {                  // escape
                 if ((u >= 0x0) && (u <= 0x7f)){     // single byte format
                     s = "0"+u.toString(16);
                     s0 += "%"+ s.substr(s.length-2);
                 }
                 else if (u > 0x1fffff){     // quaternary byte format (extended)
                     s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);
                     s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
                     s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                     s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                 }
                 else if (u > 0x7ff){        // triple byte format
                     s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
                     s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                     s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                 }
                 else {                      // double byte format
                     s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
                     s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                 }
             }
         }
     }
     return s0;
 }


function NONONO_set_star2(get_it1, get_it2) {
 var fm = document.eval_;
 var pt = fm.reple.value;

 var url =get_it1;
 var page=get_it2;
  for(i=0;i<5;i++){
   if(fm.helpcheck[i].checked==true){
   var s_val = fm.helpcheck[i].value;
   location.href='/eval_point/set_eval_point.jsp?url='+url+'&amp;mark='+s_val+'&amp;reple='+pt+'&amp;pagename='+page+''
    return true
   }
  }
  alert('선택하세요');

}


function aa(mVal){
	MM_openBrWindow('/si_include/popImg.html?img='+mVal,'image','width=100,height=100,top=0,left=0');
}
function showImage(mVal){
	f_name =document.showimg;
	f_name.img.value=mVal;
	f_name.action='/si_include/popImg.html';
	f_name.target='image';
	MM_openBrWindow('','image','width=100,height=100,top=0,left=0,scrollbars=yes, ');
	f_name.submit();
}




//	+, - 키를 입력하면 화면 확대, 축소를 한다.

var tgs = new Array( 'div','td','tr','a','h1','h2','h3','li','span','p','blockquote','legend','fieldset');
var tgs2 = new Array( 'div','td','tr','a');

var szs = new Array( '9','11','12','14','18','24','30');
var szs2 = new Array( '0.55','1','1.05','1.1','1.15','1.2');
var startSz = 2;

var useragent = navigator.userAgent;
var is_fox = 0;
if ((useragent.indexOf('MSIE 6')==-1) && (useragent.indexOf('MSIE 7')==-1))
{
	is_fox = 1;
}

function ts( trgt,inc ) {

    if (!document.getElementById) return
    var d = document,cEl = null,sz = startSz,i,j,cTags;

    sz = parseInt(sz) + parseInt(inc);

    if ( sz <= 1 ) sz = 1;
    if ( sz >= 5 ) sz = 5;
	startSz = sz;

    if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

    cEl.style.fontSize = szs[sz];

    for ( i = 0 ; i < tgs.length ; i++ ) {
        cTags = cEl.getElementsByTagName( tgs[ i ] );
        for ( j = 0 ; j < cTags.length ; j++ ){
			if(is_fox==1){
				cTags[ j ].style.fontSize = szs2[ sz ]+"em";
			}else{
				cTags[ j ].style.fontSize = szs[ sz ];
			}
//			cTags[ j ].style.fontSize = cTags[ j ].style.fontSize+ "1";
//			cTags[ j ].style.fontSize = szs[ sz ]+"em";
		}
    }

}

function setFontSize(area,a) {
	var defaultFontSize = 1;//em
	var minFontSize = 1;//em
	var maxFontSize = 2;//em
	obj = document.getElementById(area);//확대축소영역
	var objFontSize = obj.style.fontSize;
	if (!objFontSize) { objFontSize = parseFloat(defaultFontSize)+"em"; }
	var checkFontSize = (Math.round(12*parseFloat(objFontSize))+(a*2))/12;
	if (checkFontSize >= maxFontSize) { checkFontSize = maxFontSize; obj.style.fontSize = checkFontSize+"em"; alert("더이상 늘릴 수 없습니다."); }
	else if (checkFontSize <= minFontSize) { checkFontSize = minFontSize; obj.style.fontSize = checkFontSize+"em"; alert("더이상 줄일 수 없습니다."); }
	else { obj.style.fontSize = checkFontSize+"em"; }
//	alert(checkFontSize);
}

function ts2( trgt2,inc ) {
    if (!document.getElementById) return
    var d = document,cEl = null,sz = startSz,i,j,cTags;

    sz = parseInt(sz) + parseInt(inc);

    if ( sz < 0 ) sz = 0;
    if ( sz > 6 ) sz = 6;
    startSz = sz;

    if ( !( cEl = d.getElementById( trgt2 ) ) ) cEl = d.getElementsByTagName( trgt2 )[ 0 ];

    cEl.style.fontSize = szs[sz];

    for ( i = 0 ; i < tgs.length ; i++ ) {
        cTags = cEl.getElementsByTagName( tgs[ i ] );
//        for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
        for ( j = 0 ; j < cTags.length ; j++ ){
			//k= cTags[ j ].style.fontSize;
			//cTags[ j ].style.fontSize = k + inc;
			cTags[ j ].style.fontSize = szs[ sz ]
		}
    }
}

function print_it(page,css){
	var oWin = window.open("/si_include/print.jsp?page="+page+"&css="+css,"printWin","width=780,height=550, menubar=no, scrollbars=yes, resizable=no");
}
function print_it_map(page,css){
	var oWin = window.open("/si_include/print_map.jsp?page="+page+"&css="+css,"printWin","width=780,height=550, menubar=no, scrollbars=yes, resizable=no");
}

function print_council(page){
	var oWin = window.open("/si_include/print_council.jsp?page="+page,"printWin","width=800,height=550, menubar=no, scrollbars=yes, resizable=no");
}

function print_gasa(page){
	var oWin = window.open("/si_include/print_gasa.jsp?page="+page,"printWin","width=750,height=550, menubar=no, scrollbars=yes, resizable=no");
}

function print(page){
	var oWin = window.open("/si_include/print.jsp?page="+page,"width=800,height=550, menubar=no, scrollbars=yes, resizable=no");
}

function print_it2(page){
	var oWin = window.open("/si_include/print.jsp?page="+page,"printWin","width=800,height=550, menubar=no, scrollbars=yes, resizable=no");
}
function print_it3(page){
	var oWin = window.open("/si_include/print.jsp?page="+page,"printWin","width=800,height=550, menubar=no, scrollbars=yes, resizable=no");
}
function print_etc(){
	window.print();
}


function set_star2(get_it1, get_it2) { 
 var fm = document.eval_; 
 var pt = fm.reple.value; 
 
 var url =get_it1; 
 var page=get_it2; 
  for(i=0;i<5;i++){ 
   if(fm.helpcheck[i].checked==true){ 
   var s_val = fm.helpcheck[i].value; 
   location.href='/si_include/eval_set_point.jsp?url='+url+'&amp;mark='+s_val+'&amp;reple='+pt+'&amp;pagename='+page+'' 
    return true 
   } 
  } 
  alert('만족도를 선택해주세요'); 
 
}


function do_down(id,file_name1){
	f_name =document.down;
	f_name.id.value=id;
	f_name.file_name1.value=file_name1;
	f_name.submit();
}


function error_report(url) {
	var oWin = window.open("/bbs/error_report.jsp?url="+url,"printWin","width=740,height=550, menubar=no, scrollbars=yes, resizable=no");
}


function search_form(mForm){
	if(mForm.QUERY.value==""){
		alert('검색어를 입력해 주세요.');
		mForm.QUERY.focus();
		return false;
	}else{
		var pop = window.open('','search','left=0,top=0,width=1000,height='+window.screen.availHeight+',resizable=no,scrollbars=yes');
		return true;
	}
}
var noticeTbl = 0;	//소식 관련
var stopIt1 = 0;
function scrolling_notice(list_num){ 
	if(stopIt1==0){
		list_num = list_num-0;

		for(i=1;i<=list_num;i++){
			eval("news_item"+i).style.display = 'none';
		}//for...
		
		if(noticeTbl == list_num){
			noticeTbl = 1;
		}else{
			noticeTbl = (noticeTbl+1);
		}//if...

		eval("news_item"+noticeTbl).style.display = 'inline';
	}
	window.setTimeout("scrolling_notice("+list_num+")",6000);
}
function stopScroll1(){
	stopIt1 = 1;
}
function stopScroll2(){
	stopIt2 = 1;
}
function startScroll1(){
	stopIt1 = 0;
}
function startScroll2(){
	stopIt2 = 0;
}
var noticeTbl2 = 0;	//소식 관련 tourinfo_item1
var stopIt2 = 0;
function scrolling_notice2(list_num){ 
	if(stopIt2==0){
		list_num = list_num-0;

		for(i=1;i<=list_num;i++){
			eval("tourinfo_item"+i).style.display = 'none';
		}//for...
		
		if(noticeTbl2 == list_num){
			noticeTbl2 = 1;
		}else{
			noticeTbl2 = (noticeTbl2+1);
		}//if...

		eval("tourinfo_item"+noticeTbl2).style.display = 'inline';
	}
	window.setTimeout("scrolling_notice2("+list_num+")",6000);
}


function post_check(){
		window.open('/si_include/post.jsp',"","width=430,height=380,scrollbars=yes");
		return;
}

function checkid(p_id) {	
	if(document.p_id.id.value.length < 0 || document.p_id.id.value == "" ){
		alert("ID를 입력해 주세요!");
		document.p_id.id.focus();
		return;
	}
	else {
		document.p_id.submit();
	}
}
function SendId(c_id,cc_id,a_id,d_id){ 				 		
	var id = c_id;
		opener.document.ff.zip_no1.value = c_id;
		opener.document.ff.zip_no2.value = cc_id;
		opener.document.ff.addr.value = a_id;
       // opener.document.ff.zipnum.value= d_id;
		//document.write("c_id = " + id);
		window.close(); 
	
}

function AdminSendId(c_id,cc_id,a_id,d_id){ 				 		
	var id = c_id;
		opener.document.myform.u_zip1.value = c_id;
		opener.document.myform.u_zip2.value = cc_id;
		opener.document.myform.u_addr1.value = a_id;
		window.close(); 
}

function notice_getCookie( name ) 
{ 
       var nameOfCookie = name + "="; 
       var x = 0; 
       while ( x <= document.cookie.length ) 
       { 
                var y = (x+nameOfCookie.length); 
               if ( document.cookie.substring( x, y ) == nameOfCookie ) { 
                       if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) 
                              endOfCookie = document.cookie.length; 
                       return unescape( document.cookie.substring( y, endOfCookie ) ); 
                } 
                x = document.cookie.indexOf( " ", x ) + 1; 
               if ( x == 0 ) 
                        break; 
       } 
      return ""; 
} 


// iframe resize Function
function iframe_autoresize(arg) {
   arg.height = eval(arg.name+".document.body.scrollHeight");
}
function reSize_bbs()
{

	if (document['ifrm'] != null)
	{

	    window.scrollTo(0,250);
	    var objFrame	=	document.getElementById("ifrm");
	    var objBody	=	ifrm.document.body;
       
	   if(objBody.readyState != "complete")
        {
            setTimeout( "reSize()", 200 );
            return; // 모든 객체가 완전히 로드된 후 한번만 조정하기 위해
        }    
		var nMin = 200;
//		var mMin = 100;
		objFrame.style.height = nMin;
		
	    nHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);

		if(nHeight < nMin) nHeight = nMin;    
		objFrame.style.height = nHeight;

	}

	//}
	//An error is raised if the IFrame domain != its container's domain
	/*catch(e)
	{
	    err_handle(e);
	}*/
}


function check_post_name(mForm){
	if(mForm.dongid.value==""){
		alert('읍,면이름을 입력해주세요');
		mForm.dongid.focus();
		return false;
	}else{
		return true;
	}
}


function check_reply(){
	if(document.ffss.phone.value==""){
		alert('연락처를 입력해주세요');
		document.ffss.phone.focus();
		return false;
	}else if(document.ffss.passwd.value==""){
		alert('비밀번호를 입력해주세요');
		document.ffss.passwd.focus();
		return false;
	}else if(document.ffss.sub.value==""){
		alert('내용을 입력해주세요');
		document.ffss.sub.focus();
		return false;
	}else{
		document.ffss.submit();
	}
}




// 메인탭 메뉴
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab") {
			var thismenu = tabAnchor.item(i);
		} else {
			continue;
		}

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		if (thismenu.imgEl) {
			thismenu.onmouseover = function () {
				//this.onclick();
			}
		}
		thismenu.onclick = tabMenuClick;

		if (!thismenu.container.first) {
			thismenu.container.first = thismenu;
		}
	}
	tabContainer.first.onclick();
}
// 메인탭 메뉴
function tabMenuClick() {
	var currentmenu = this.container.current;
	if (currentmenu != this) {
		if (currentmenu) {
			currentmenu.targetEl.style.display = "none";
			if (currentmenu.imgEl) {
				currentmenu.imgEl.src = currentmenu.imgEl.src.replace("o.gif", "_.gif");
			}
		}

		this.targetEl.style.display = "block";
		if (this.imgEl) {
			this.imgEl.src = this.imgEl.src.replace("_.gif", "o.gif");
		}
		this.container.current = this;
	}
	return false;
}


