function myFavorite(){
	window.external.AddFavorite('http://www.withgo.or.kr', '::»ç¶û³ª´©±â -ÇÔ²²ÇÏ´Â»ç¶û¹ç-::')
}

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 batang()
{
    window.open("/batang/batang.asp","","scrollbars=no, status=no, resize=no, top=300, left=400, width=300, height=200")
    }
// ·Î±×ÀÎÆû


/////////////////////////////////////// ÅÇ ÀÚµ¿ÀÌµ¿
var isNN = (navigator.appName.indexOf("Netscape")!=-1); 

function autoTab(input,len, e) { 
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46]; 

	if(input.value.length >= len && !containsElement(filter,keyCode)) { 
		input.value = input.value.slice(0, len); 
		input.form[(getIndex(input)+1) % input.form.length].focus(); 
	} 

function containsElement(arr, ele) { 
	var found = false, index = 0; 
	while(!found && index < arr.length) 
		if(arr[index] == ele) 
			found = true; 
		else 
			index++; 
	return found; 
} 

function getIndex(input) { 
	var index = -1, i = 0, found = false; 
	while (i < input.form.length && index == -1) 
		if (input.form[i] == input)index = i; 
		else i++; 
	return index; 
	} 
return true; 
}
/////////////////////////////////////// ÅÇ ÀÚµ¿ÀÌµ¿


/////////////////////////////////////// ·Î±×ÀÎ
function loginform_clearbg(type) {
    if (type == "id") {
     document.login.ID.style.backgroundImage = '';
    } else if (type == "pass") {
     document.login.PWD.style.backgroundImage = '';
    }
}

function login_ok(){
	if(document.login.ID.value == ''){
		alert("ID¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		document.login.ID.focus();
		return false;
	}
	if(document.login.PWD.value == ''){
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		document.login.PWD.focus();
		return false;
	}
	document.login.submit();
}
/////////////////////////////////////// ·Î±×ÀÎ


/////////////////////////////////////// ÀÌ¸ÞÀÏ ÁÖ¼Ò µî·Ï
function mail_in(){
	if(document.mail.NAME.value==''){
		alert('ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä.');
		document.mail.NAME.focus();
		return;
	}
	if(document.mail.EMAIL.value==''){
		alert('ÀÌ¸ÞÀÏ ÁÖ¼Ò¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		document.mail.EMAIL.focus();
		return;
	}
	document.mail.submit();
}
/////////////////////////////////////// ÀÌ¸ÞÀÏ ÁÖ¼Ò µî·Ï


/////////////////////////////////////// Left Log
	$(document).ready(function() {
		
		$('.too-plain').focus(function() {
 
			if($(this).val() == "Enter your email here")
				$(this).val('');
 
		}).blur(function() {
 
			if($(this).val() == "")
				$(this).val('Enter your email here');
 
		});
		
		$('.ID-label, .PWD-label').animate({ opacity: "0.4" })
			.click(function() {
				var thisFor	= $(this).attr('for');
				$('.'+thisFor).focus();
		});
	
		$('.ID').focus(function() {
		
			$('.ID-label').animate({ opacity: "0" }, "fast");
		
				if($(this).val() == "ID")
					$(this).val() == "";
 
			}).blur(function() {
		
				if($(this).val() == "") {
					$(this).val() == "ID";
					$('.ID-label').animate({ opacity: "0.4" }, "fast");
				}
			});
	
		$('.PWD').focus(function() {
		
			$('.PWD-label').animate({ opacity: "0" }, "fast");
		
				if($(this).val() == "PWD") {
					$(this).val() == "";
				}
			}).blur(function() {
		
				if($(this).val() == "") {
					$(this).val() == "PWD";
					$('.PWD-label').animate({ opacity: "0.4" }, "fast");
				}
		});
		
		$('.ID-label-sliding, .PWD-label-sliding').animate({ opacity: "0.4" })
			.click(function() {
				var thisFor	= $(this).attr('for');
				$('.'+thisFor).focus();
		});
	
		$('.ID-sliding').focus(function() {
		
			$('.ID-label-sliding').animate({ marginLeft: "7.4em" }, "slow");
		
				if($(this).val() == "ID")
					$(this).val() == "";
 
			}).blur(function() {
		
				if($(this).val() == "") {
					$(this).val() == "ID";
					$('.ID-label-sliding').animate({ marginLeft: "10px" }, "fast");
				}
			});
	
		$('.PWD-sliding').focus(function() {
		
			$('.PWD-label-sliding').animate({ marginLeft: "7em" }, "slow");
		
				if($(this).val() == "PWD") {
					$(this).val() == "";
				}
			}).blur(function() {
		
				if($(this).val() == "") {
					$(this).val() == "PWD";
					$('.PWD-label-sliding').animate({ marginLeft: "10px" }, "fast");
				}
		});
		
	});
/////////////////////////////////////// Left Log


/////////////////////////////////////// Left OnmouseOver Menu
	function IE_HtmlRewrite(objParent) {
		if (window.ActiveXObject && objParent) {
			objParent.innerHTML = objParent.innerHTML;
		}
	}

	/* www.rrl.go.kr submenu */
	function initSubmenu(depth1, depth2, depth3) {
		selectDepth1 = "menu" + depth1 + "-" + depth2;
		selectDepth2 = "menu" + depth1 + "-" + depth2 + "-" + depth3;

		nav = document.getElementById("leftmenu");
		menuEl = nav.getElementsByTagName("td");


		for(i = 0; i < menuEl.length; i++) {
			if (menuEl.item(i).id == selectDepth1 || menuEl.item(i).id == selectDepth2  ) {
				menuEl.item(i).getElementsByTagName("img").item(0).src = menuEl.item(i).getElementsByTagName("img").item(0).src.replace(".gif", "_on.gif");
			} else {
				menuEl.item(i).getElementsByTagName("img").item(0).onmouseover = menuOver;
				menuEl.item(i).getElementsByTagName("img").item(0).onmouseout = menuOut;
				if (menuEl.item(i).getElementsByTagName("tr").item(0)) {
					menuEl.item(i).getElementsByTagName("tr").item(0).style.display = "none";
				}
			}
		}
	}
/////////////////////////////////////// Left OnmouseOver Menu

///////////////////////////////////////// Ä·ÆäÀÎ ÆäÀÌÁö Á¤±âÀÏ½Ã º¯È¯
function show_Abroad(obj) {
	show_num2 = obj;
  for (j=0;j<=1;j++) {
		Abroad[j].style.display="none";
	}
    Abroad[show_num2].style.display="";
    return;
}
///////////////////////////////////////// Ä·ÆäÀÎ ÆäÀÌÁö Á¤±âÀÏ½Ã º¯È¯

(function($){
   $.fn.dPassword = function(options) {

      var defaults = {
         interval:      200,
         duration:      3000,
         replacement:   '%u25CF',
         prefix:        'password_',
         debug:  			false
      }

      var opts    = $.extend(defaults, options);
      var checker = new Array();
      var timer   = new Array();

      $(this).each(function() {
         if (opts.debug) console.log('init [' + $(this).attr('id') + ']');

         // get original password tag values
         var name        = $(this).attr('name');
         var id          = $(this).attr('id');
         var cssclass    = $(this).attr('class');
         var style       = $(this).attr('style');
         var size        = $(this).attr('size');
         var maxlength   = $(this).attr('maxlength');
         var disabled    = $(this).attr('disabled');
         var tabindex    = $(this).attr('tabindex');
         var accesskey   = $(this).attr('accesskey');
         var value       = $(this).attr('value');

         // set timers
         checker.push(id);
         timer.push(id);

         // hide field
         $(this).hide();
         
         // add debug span
         if (opts.debug) {
				$(this).after('<span id="debug_' + opts.prefix + name + '" style="color: #f00;"></span>');         
         }
         // add new text field
         $(this).after(' <input name="' + (opts.prefix + name) + '" ' +
                                 'id="' +  (opts.prefix + id) + '" ' + 
                               'type="text" ' +
                              'value="' + value + '" ' +
               (cssclass != '' ? 'class="' + cssclass + '"' : '') +
               (style != '' ? 'style="' + style + '"' : '') +
                 (size != '' ? 'size="' + size + '"' : '') +
       (maxlength != -1 ? 'maxlength="' + maxlength + '"' : '') +
         (disabled != '' ? 'disabled="' + disabled + '"' : '') +
         (tabindex != '' ? 'tabindex="' + tabindex + '"' : '') +
 (accesskey != undefined ? 'accesskey="' + accesskey + '"' : '') +
                      'autocomplete="off" />');
         
         // change label
         $('label[for='+id+']').attr('for', opts.prefix + id);
         // disable tabindex
         $(this).attr('tabindex', '');
         // disable accesskey
         $(this).attr('accesskey', '');


         // bind event
         $('#' + opts.prefix + id).bind('focus', function(event) {
            if (opts.debug) console.log('event: focus [' + getId($(this).attr('id')) + ']');
            clearTimeout(checker[getId($(this).attr('id'))]);
            checker[getId($(this).attr('id'))] = setTimeout("check('" + getId($(this).attr('id')) + "', '')", opts.interval);
         });
         $('#' + opts.prefix + id).bind('blur', function(event) {
            if (opts.debug) console.log('event: blur [' + getId($(this).attr('id')) + ']');
            clearTimeout(checker[getId($(this).attr('id'))]);
         });

			setTimeout("check('" + id + "', '', true);", opts.interval);
      });

      getId = function(id) {
         var pattern = opts.prefix+'(.*)';
         var regex = new RegExp(pattern);
         regex.exec(id);
         id = RegExp.$1;
         
         return id;
      }
   
      setPassword = function(id, str) {
         if (opts.debug) console.log('setPassword: [' + id + ']');

         var tmp = '';
         for (i=0; i < str.length; i++) {
            if (str.charAt(i) == unescape(opts.replacement)) {
               tmp = tmp + $('#' + id).val().charAt(i);
            }
            else {
               tmp = tmp + str.charAt(i);
            }
         }
         $('#' + id).val(tmp);
      }
      
      check = function(id, oldValue, initialCall) {
         if (opts.debug) console.log('check: [' + id + ']');
         
         var bullets = $('#' + opts.prefix + id).val();

         if (oldValue != bullets) {
            setPassword(id, bullets);
            if (bullets.length > 1) {
               var tmp = '';
               for (i=0; i < bullets.length-1; i++) {
                  tmp = tmp + unescape(opts.replacement);
               }
               tmp = tmp + bullets.charAt(bullets.length-1);
   
               $('#' + opts.prefix + id).val(tmp);
            }
            else {
            }
            clearTimeout(timer[id]);
            timer[id] = setTimeout("convertLastChar('" + id + "')", opts.duration);
         }
         if (opts.debug) {
         	$('#debug_' + opts.prefix + id).text($('#' + id).val());
         }
         if (!initialCall) {
	         checker[id] = setTimeout("check('" + id + "', '" + $('#' + opts.prefix + id).val() + "', false)", opts.interval);
			}
      }
      
      convertLastChar = function(id) {
         if ($('#' + opts.prefix + id).val() != '') {
            var tmp = '';
            for (i=0; i < $('#' + opts.prefix + id).val().length; i++) {
               tmp = tmp + unescape(opts.replacement);
            }
   
            $('#' + opts.prefix + id).val(tmp);
         }
      }
   };
}) (jQuery);

