function Check(keyword) {
   var st_num, key_len;
   st_num = keyword.indexOf(" ");
   while (st_num != -1) {
      keyword = keyword.replace(" ", "");
      st_num  = keyword.indexOf(" ");
   }
   key_len=keyword.length;
   return key_len;
}

function validateForm(){
	var chkObj = arguments[0];
	chkObj.value=chkObj.value.replace("'","''");
}

function CheckInputField(keyword){
	var validatespace = (keyword.replace(/\s/g,"") == '')?true:false;
	if(validatespace)
		keyword = keyword.replace(/\s/g,"");
	else
		keyword = keyword.replace(/\'/g,"\'\'");
	return keyword;
}

function check_sword_val(fm) {
	if (fm.s_word.value == '') {
		alert("검색어를 입력하세요.");
		fm.s_word.focus();
		return false;
	}
		return true;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  var thisFrm = document.forms[0];
  var searchCompWin = window.open(theURL,winName,features);
  thisFrm.method = "post";
  thisFrm.target = winName;
  thisFrm.action = theURL;
  thisFrm.submit();
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_parentGo(bp){
	top.opener.location.href=bp;
	window.close();
}

function MM_goToURL() {
 // alert("aaa");	
  var obj = arguments[0];
	if(obj.checked){
		document.forms[0].target="_self";
		document.forms[0].action= arguments[1];
		document.forms[0].method='post';
		document.forms[0].submit();
	}
}

function MM_goToURL_Sms(theURL) {
	window.location.href = theURL ;
}

function MM_goToSubmit(){
	document.forms[0].target="_self";
	document.forms[0].action=arguments[0];
	document.forms[0].method="post";
	document.forms[0].menuflag.value=arguments[1];
	document.forms[0].menuid.value=arguments[2];
	document.forms[0].submit();
}

function MM_returnURL(txt, retURL) {
	alert(txt);
	window.location.replace(retURL);
}

function MM_delCheckConfirm(txt,theURL){
	if(confirm(txt)){
		window.location.href = theURL ;
	}
}

function select_toggle(){
	if(form1.select_check.value == 'y'){
		discheck();
		form1.select_check.value = 'n';
	}
	else{
		allcheck();
		form1.select_check.value = 'y';
	}
}

function allcheck()
{
	for( var i=0; i<document.forms[0].elements.length; i++) {
		var ele = document.forms[0].elements[i];
		if(ele.name == 'idx')
			ele.checked = true;
	}
	return;
}
function discheck()
{
	for( var i=0; i<document.forms[0].elements.length; i++) {
		var ele = document.forms[0].elements[i];
		if(ele.name == 'idx')
			ele.checked = false;
	}
	return;
}


function MM_DeleteCheck(theURL){
	if(confirm("정말 삭제할까요?. 삭제한 정보는 복구할 수 없습니다.")){
		window.location.href=theURL ;
	}
}

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 Alim(txt) {
	alert(txt);
	return;
}

function loadImages() {
	if (document.getElementById) {
		document.getElementById('hidepage').style.visibility = 'hidden';
	}
	else {
		if (document.layers) {
			document.hidepage.visibility = 'hidden';
		}
		else {
			document.all.hidepage.style.visibility = 'hidden';
		}
	}
}

function MM_LayerShowHide(ck){

	if (ck == "1"){
		document.all.recinfo.style.display = 'block';
		document.all.albainfo.style.display = 'none';

		MM_swapImage('Image26','','image/recruit_btn_02.gif',1) ;
	}
	else if(ck == "2"){
		document.all.recinfo.style.display = 'none';
		document.all.albainfo.style.display = 'block';

		MM_swapImage('Image27','','image/recruit_btn_03_01.gif',1) ;
	}
	else{
		document.all.recinfo.style.display = 'block';
		document.all.albainfo.style.display = 'none';
	}
}

function 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 "";
}

function MM_Showcarendar(posX, posY){

	var xx = event.clientX;
	var calendar = document.getElementById("calendar");
	var deadlinecheckedVal = false;
	for(var i=0;i < document.forms[0].deadline_method.length;i++){
		if(document.forms[0].deadline_method[i].checked){
			if(document.forms[0].deadline_method[i].value == '060')
				deadlinecheckedVal = true;
		}
	}	
	if(deadlinecheckedVal){
		if (calendar.style.visibility != 'visible'){
			calendar.style.visibility = 'visible';
			calendar.style.left = "600";
			calendar.style.top = posY;
		}
		else{
			MM_showHideLayers('calendar','','hide');
		}
	}else{
		alert("날짜입력이 체크되있어야 사용할 수 있습니다.");
		return;
	}
}

function MM_preloadImages() { 
  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_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_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 MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(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 loginPlease() {
	alert('먼저 로그인 하십시요');
	return;
}

function goUrl(){
	location.href=arguments[0];
}

function logOut(){
	document.forms[0].action='./main.spr';
	document.forms[0].logout.value='logout';
	document.forms[0].method='post';
	document.forms[0].submit();
}

function alterMaxDays(){
	setNameValue(arguments[0],arguments[1]);
	var tagNameIdentityParam = arguments[0].name.substring(0,arguments[0].name.length-2);
	var HiddenFrameName = tagNameIdentityParam +"HIframe";
	if(arguments[1] == "yyyyMMdd"){
		if(document.getElementById(tagNameIdentityParam+"Yr").value != "" && document.getElementById(tagNameIdentityParam+"MM").value != ""){
			var selectedDD = document.getElementById(tagNameIdentityParam+"DD").value;
			if(document.forms[0].tagNameIdentity.length == undefined){
				document.forms[0].tagNameIdentity.value=tagNameIdentityParam;
			}else if(document.forms[0].enctype == 'multipart/form-data'){				
				document.forms[0].tagNameIdentity[document.forms[0].tagNameIdentity.length-1].value=tagNameIdentityParam;
			}else{
				document.forms[0].tagNameIdentity[0].value=tagNameIdentityParam;
			}
			
			document.forms[0].target=HiddenFrameName;
			document.forms[0].action="./commonPage/addSelectOption.spr?selectedDay="+selectedDD;
			document.forms[0].submit();
		}
	}			
}

function setNameValue(){
	var tagNameIdentityParam = arguments[0].name.substring(0,arguments[0].name.length-2);
	var oObject = document.getElementById(tagNameIdentityParam);
	if(arguments[1] == 'yyyy'){
		if(document.getElementById(tagNameIdentityParam+"Yr").value != ""){
			oObject.value=document.getElementById(tagNameIdentityParam+"Yr").value;
		}else{
			oObject.value="";
		}
	}
	if(arguments[1] == 'yyyyMM'){
		if(document.getElementById(tagNameIdentityParam+"Yr").value != "" && document.getElementById(tagNameIdentityParam+"MM").value != ""){
			var mm = "";
			var MMlength = document.getElementById(tagNameIdentityParam+"MM").value.length;
			if(MMlength < 2){
				mm = "0"+ document.getElementById(tagNameIdentityParam+"MM").value;
			}else{
				mm = mm = document.getElementById(tagNameIdentityParam+"MM").value;
			}
			oObject.value=document.getElementById(tagNameIdentityParam+"Yr").value+mm;
		}else{
			oObject.value="";
		}
	}
	
	if(arguments[1] == 'yyyyMMdd'){
		if(document.getElementById(tagNameIdentityParam+"Yr").value != "" && document.getElementById(tagNameIdentityParam+"MM").value != "" && document.getElementById(tagNameIdentityParam+"DD").value != ""){
		 	var mm = "";
		 	var MMlength = document.getElementById(tagNameIdentityParam+"MM").value.length;
			if(MMlength < 2){
				mm = "0"+ document.getElementById(tagNameIdentityParam+"MM").value;
			}else{
				mm = document.getElementById(tagNameIdentityParam+"MM").value;
			} 
			var dd = "";	
			var DDlength = document.getElementById(tagNameIdentityParam+"DD").value.length;
			if(DDlength < 2){
				dd = "0"+ document.getElementById(tagNameIdentityParam+"DD").value;
			}else{
				dd = document.getElementById(tagNameIdentityParam+"DD").value;
			} 
			oObject.value = document.getElementById(tagNameIdentityParam+"Yr").value+mm+dd;		
		}else{
			oObject.value="";
		}
	}
}

function pagingUrl(){
	document.forms[0].action=arguments[0];
	document.forms[0].method='post';
	document.forms[0].pageNum.value=arguments[1];
	document.forms[0].target="_self";
	document.forms[0].submit();
}

function paramsToCommaParam(){
	var Obj = arguments[0];
	var targetObj = arguments[1];
	if( Obj.length != undefined){
		for(var i=0;i < Obj.length; i++){
			if(arguments[2] == 'check'){
				if(Obj[i].checked){
					if(targetObj.value != ''){
						targetObj.value += (", " + Obj[i].value);
					}else{
						targetObj.value += Obj[i].value;
					}
				}
			}else if(arguments[2] == 'select'){
				if(Obj[i].selected){
					if(targetObj.value != ''){
						targetObj.value += (", " + Obj[i].value);
					}else{
						targetObj.value += Obj[i].value;
					}
				}
			}	
		}			
	}	
}

function removeElements(){
	for(var i = 0; i < arguments.length; i++){
		removeElement(arguments[i],i);
	}			
}

function removeElement(){
	var checkedFormidx = arguments[0];	
	if(checkedFormidx != undefined){
		if(checkedFormidx.length != undefined){
			for(var i=0,j=0; i < checkedFormidx.length;i++){
				var ele = checkedFormidx[i];
				if(ele.checked){
					var checkedIdx = document.getElementById("checkedIdx"+arguments[1]);
					document.forms[0].removeChild(checkedIdx);		
				}
			}
		}else{
			if(checkedFormidx.checked){
				var checkedIdx = document.getElementById("checkedIdx"+arguments[1]);
				document.forms[0].removeChild(checkedIdx);											
			}
		}
	}			
}

function addElement(){
	var checkedFormidx = arguments[0];
	var returnValue = false;
	if(checkedFormidx != undefined){
		if(checkedFormidx.length != undefined){
			for(var i=0; i < checkedFormidx.length;i++){
				var ele = checkedFormidx[i];
				if(ele.checked){
					var checkedIdx = document.createElement("input");
					checkedIdx.id = "checkedIdx"+arguments[1];
					checkedIdx.type = "hidden";
					checkedIdx.name = "checkedIdx"+arguments[1];
					checkedIdx.value = ele.value;
					document.forms[0].appendChild(checkedIdx);		
					returnValue = true;	
				}
			}
		}else{
			if(checkedFormidx.checked){
				var checkedIdx = document.createElement("input");
				checkedIdx.id = "checkedIdx"+arguments[1];
				checkedIdx.type = "hidden";
				checkedIdx.name = "checkedIdx"+arguments[1];
				checkedIdx.value = checkedFormidx.value;		
				document.forms[0].appendChild(checkedIdx);		
				returnValue = true;											
			}
		}
	}
	return returnValue;
}

function downloadFile(){
	var thisFrm = document.forms[0];
	thisFrm.target = 'downloadfile';
	thisFrm.action = './download.spr';
	if(thisFrm.num != undefined){
		thisFrm.num.value = arguments[0];
	}
	if(thisFrm.vnum != undefined){
		thisFrm.vnum.value=arguments[0];
	}
	thisFrm.method = 'post';
	thisFrm.submit();
	thisFrm.target = '_self';
}	

function companyInfoView(){
	var thisFrm = document.forms[0];
	var win = window.open('','compInfoView','scrollbars=yes,width=610,height=650,top=5,left=5');
	thisFrm.vcomp_reg.value=arguments[0];
	thisFrm.target='compInfoView';
	thisFrm.action="./compInfoView.spr";
	thisFrm.method='post';
	thisFrm.submit();
}


function openWin()
{
	jsPosition(822, 618);

	var goURL = "http://ucjob.recruit.co.kr:8080/reqInfo/client/loginProcess.jsp?clientDB=db_kunsan";
	
	window.open(goURL,"HelpDesk", "width=822, height=618, resizable=yes, scrollbars=YES, top="+gTop+", left="+gLeft);
}

var gTop = 0;
var gLeft = 0;

function jsPosition(argWidth, argHeight)
{
	var w = screen.width;
	var h = screen.height;

    gLeft = (w - argWidth) / 2 ;
    gTop = (h - argHeight) / 2 ;
} 
  
  
function fla(url,width,height,transparent){
	document.write('<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+'">');
	document.write('<param name="movie" value="'+url+'"');
	document.write('<param name="BGCOLOR" value="#000000">');
	document.write('<param name="quality" value="high">');
	if (transparent == "Y" ){
		document.write('<param name=wmode value=transparent>');
	}
	document.write('<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed></object>');
}
		