/* ·Î±×ÀÎ */
var isCtrl = false;
var flag = false;
function LogonSubmitCheck(sf)
{
	if(!fnChkVal(sf.UserID, "Email items did not enter."))	return;
	//if(!chkEmail(sf.UserID))	return;
	if(!fnChkVal(sf.Passwd, "Did not enter a password entry."))	return;
	
	if(flag == true){
		alert("Is connected. Please wait");
	}else{
		flag = true;
		
		var SaveID = ($("#SaveID").attr("checked")) ? "Y" : "N";
		var returl = $("#returl").val();
		var Data = {
			xMode : "logon",
			UserID : $("#UserID").val(),
			Passwd : $("#Passwd").val(),
			SaveID : SaveID
		}
		
		$.post("/process/member_process.php", Data, function(data) {
			if(data == 119){
				alert("Connection ID is blocked.");
				$("#Passwd").val("")
				$("#UserID").val("").focus();
			}else if(data == 1){
				/* layer popup close */
				parent.$.fn.colorbox.close();
				if(!IsEmpty(returl)){
					parent.window.location.href = returl;
				}else{
					//parent.window.location.href = '/main/main.php';
					parent.window.location.reload();
				}
			}else if(data == 2){
				flag = false;
				alert("E-mail address is not registered.");	
				$("#Passwd").val("")
				$("#UserID").val("").focus();
			}else if(data == 3){
				flag = false;
				alert("Password do not match.\nPlease enter your password exactly");
				$("#Passwd").val("").focus();
			}else if(data == 4){
				flag = false;
				alert("You currently are pending approval.");
			}else{
				alert(data);	
			}
		});
	
	}
}
/* ·Î±×ÀÎ input ¹Ú½º¿¡¼­ ¿£ÅÍÅ° ÃºÀ»¶§*/
function onLogonKey(e){
	var evtK = (e) ? e.which : window.event.keyCode;  
	var isCtrl = ((typeof isCtrl != 'undefined' && isCtrl) || ((e && evtK == 17) || (!e && event.ctrlKey))) ? true : false;  
	if(evtK == 13){
		LogonSubmitCheck(document.sForm);
	}else{
		return false;
	}
}


/* ºñ¹Ð¹øÈ£ Ã£±â */
function SearchPassword(sf){
	var Message = "";
	if(!fnChkVal(sf.UserID, "Email items did not enter."))	return;
	if(!chkEmail(sf.UserID))	return;
	
	
	if(flag == true){
		alert("Is connected. Please wait");
	}else{
		
		var Data = {
			xMode : "search",
			xType : "passwd",
			UserID : $("#UserID").val()
		}
		
		$.post("/process/member_process.php", Data, function(data) {
			if(data == 1){
				/* layer popup close */
				/*
				Message = "Check your email\n";
				Message += "A verification email was sent to your mailbox.\n";
				Message += "Please follow the instruction to reset your password.";
				alert(Message);
				parent.$.fn.colorbox.close();
				parent.window.location.reload();
				*/
				window.location.replace("/member/pw_reset_check.php");
				
			}else if(data == 2){
				$("#errormsg").show();
				$("#UserID").val("").focus();
			}else{
				alert(data);	
			}
		});
	}
}

/* ºñ¹Ð¹øÈ£Ã£±â input ¹Ú½º¿¡¼­ ¿£ÅÍÅ° ÃºÀ»¶§*/
function onPwSearchKey(e){

	var evtK = (e) ? e.which : window.event.keyCode;  
	var isCtrl = ((typeof isCtrl != 'undefined' && isCtrl) || ((e && evtK == 17) || (!e && event.ctrlKey))) ? true : false;  
	if(evtK == 13){
		SearchPassword(document.sForm);
	}else{
		return false;
	}

}

/* */
function NewPasswordCheck(sf){
	
	if(!fnChkVal(sf.passwd, "Please input the new password."))	return;
	if(!chkVarLen(sf.passwd, 5, "Must be at least 5 characters")) return;
	if(!fnChkVal(sf.re_passwd, "Please input the confirm new password."))	return;
	if(!chkVarLen(sf.re_passwd, 5, "Must be at least 5 characters")) return;
	if(!fnChkCmp(sf.passwd, sf.re_passwd,  "Password is not correct. Please double check it"))		return;	
	
	if(flag == true){
		alert("Is connected. Please wait");
	}else{
		
		sf.submit();
	}
}


/* ºñ¹Ð¹øÈ£ º¯°æ */
function ChangePassword(sf){
		
	//var sf 	= document.cForm;
	if(!fnChkVal(sf.UserID, "Please input the email."))	return;
	if(!chkEmail(sf.UserID))	return;
	if(!fnChkVal(sf.Passwd, "Please input the password."))	return;
	if(!fnChkVal(sf.Password, "Please input the new password."))	return;
	if(!chkVarLen(sf.Password, 5, "Must be at least 5 characters"))	return;
	if(!fnChkVal(sf.rePasswd, "Please input the confirm new password."))	return;
	if(!chkVarLen(sf.rePasswd, 5, "Must be at least 5 characters"))	return;
	if(!fnChkCmp(sf.Password,sf.rePasswd,  "Password is not correct. Please double check it"))		return;
		
	if(flag == true){
		alert("Is connected. Please wait");
	}else{
		
		var Data = {
			xMode : "retype",
			UserID : $("#cUserID").val(),
			Passwd : $("#cPasswd").val(),
			Password : $("#cPassword").val(),
			Repasswd : $("#rePasswd").val()
		}
		
		$.post("/process/member_process.php", Data, function(data) {
			if(data == 1){
				/* layer popup close */
				alert("Your password has been changed");
				parent.$.fn.colorbox.close();
				parent.location.replace("/main/main.php");
			}else if(data == 2){
				alert("E-mail address is not registered.");	
				$("#cPasswd").val("");
				$("#cRePasswd").val("");
				$("#cPassword").val("");
				$("#cUserID").val("").focus();
			}else if(data == 3){
				alert("The username or password you entered is inconrrect.");
				$("#cRePasswd").val("");
				$("#cPassword").val("");
				$("#cPasswd").val("").focus();
			}else if(data == 4){
				alert("Password is not correct. Please double check it");
				$("#cRePasswd").val("");
				$("#cPassword").val("");
				$("#cPasswd").val("").focus();
			}else{
				alert(data);	
			}
		});		
	}
}

/* ºñ¹Ð¹øÈ£Ã£±â input ¹Ú½º¿¡¼­ ¿£ÅÍÅ° ÃºÀ»¶§*/
function onPasswordKey(e){
	var evtK = (e) ? e.which : window.event.keyCode;  
	var isCtrl = ((typeof isCtrl != 'undefined' && isCtrl) || ((e && evtK == 17) || (!e && event.ctrlKey))) ? true : false;  
	if(evtK == 13){
		ChangePassword(document.cForm);
	}else{
		return false;
	}
}



/* È¸¿ø°¡ÀÔ */
function SignUpCheck(sf){
	
	if(!fnChkVal(sf.UserID, "Email items did not enter."))	return;
	if(!fnChkEmail(sf.UserID))	return;
	if(!fnChkVal(sf.Passwd, "Please enter your password."))	return;
	if(!chkVarLen(sf.Passwd, 5, "Must be at least 5 characters"))	return;
	if(!fnChkVal(sf.Password, "Please input the re-type password."))	return;
	if(!chkVarLen(sf.Password, 5, "Must be at least 5 characters"))	return;
	if(!fnChkCmp(sf.Passwd, sf.Password, "Password is not correct. Please double check it"))	return;
	
	if( !$("#jUse").attr("checked") ){
		alert("Accepting terms of use/privacy statement required.");
		return;
	}
	
	if(flag == true){
		alert("Is connected. Please wait");
	}else{
		
		var Data = {
			xMode : "join",
			UserID : $("#jUserID").val(),
			Passwd : $("#jPasswd").val(),
			Password : $("#jPassword").val()
		}
		
		UserID = $("#jUserID").val();
		$.post("/process/member_process.php", Data, function(data) {
			if(data == 1){
				parent.location.href = "./join_message.php";
				parent.$.fn.colorbox.close();
				//alert("["+UserID+"] You have successfully registered.");
				//parent.$.fn.colorbox.close();
				//parent.window.location.reload();
			}else if(data == 2){
				alert("This email address already exists");	
				location.replace('./logon.php');
				//$("#jUserID").val("").focus();
			}else if(data == 3){
				alert("Password do not match.\nPlease enter your password exactly");
				$("#cPassword").val("");
				$("#cPasswd").val("").focus();
			}else{
				alert(data);	
			}
		});
	}
}

/* È¸¿ø°¡ÀÔ input ¹Ú½º¿¡¼­ ¿£ÅÍÅ° ÃºÀ»¶§*/
function onSignUpKey(e){

	var evtK = (e) ? e.which : window.event.keyCode;  
	var isCtrl = ((typeof isCtrl != 'undefined' && isCtrl) || ((e && evtK == 17) || (!e && event.ctrlKey))) ? true : false;  
	if(evtK == 13){
		SignUpCheck(document.jForm);
	}else{
		return false;
	}

}


function logout(){
	
	$.post("/process/member_process.php", {xMode:"logout"}, function(data) {
		window.location.href = "/";
	});
	
}

/* ÇÁ·ÎÇÊ µî·Ï */
function SubmitProfile(sf){

	var LocationType = $("input[name='in_out']").eq(0).attr("checked");

	
	if(flag == true){
		alert("Registration is being processed. Please wait.");
	}else{
		if(!fnChkVal(sf.fName, "Please input the first name."))	return false;;
		if(!fnChkVal(sf.lName, "Please input the last name."))	return false;
		if(!fnSelVal(sf.nationalityNum, "Please select the Nationality."))	return false;
		if(!fnChkVal(sf.email, "This information is required."))	return false;
		if(!fnChkEmail(sf.email))	return;
		
		if(!fnChkVal(sf.birth1, "Please select the birthday."))	return false;
		if(!fnChkVal(sf.birth2, "Please select the birthday."))	return false;
		if(!fnChkVal(sf.birth3, "Please select the birthday."))	return false;
		if(!fnChkVal(sf.gender, "Please select then gender."))	return false;
		if(!fnChkVal(sf.tel, "Please select then primary Phone."))	return false;
		if(!fnChkVal(sf.eduLevel, "Please select the Education Level."))	return false;
		
		
		if(LocationType){
			
			if(!fnSelVal(sf.loca_id1, "Please select the Current Location Country."))	return false;
			if(!fnSelVal(sf.loca_id2, "Please select the Current Location City / Do."))	return false;
			
		}else{
				
			if(!fnSelVal(sf.out_code, "Please select the Current Location Nationality."))	return false;
			if(!fnChkVal(sf.out_addr, "Please select the Current Location."))	return false;
		}
		
		
		if(!fnSelVal(sf.engProficiency, "Please select the english proficiency."))	return false;
		
		//if(!fnSelVal(sf.otherLanguage, "Please select the otherLanguage."))	return false;
		if(sf.otherLanguage.value != ""){
			if(!fnSelVal(sf.langLevel, "Please select the otherLanguage proficiency."))	return false;
		}
		
		flag = true;
	}
	sf.submit();
}

/* ·¹ÁÖ¸Þ µî·Ï */
function SubmitResume(fname){
	var LocationType = $("input[name='in_out']").eq(0).attr("checked");
	var sf = fname;
	if(flag == true){
		alert("Registration is being processed. Please wait.");
	}else{
	
		if(!fnChkVal(sf.b_title, "Please input the Resume Title."))	return false;;
		if(!fnChkVal(sf.jobCategory, "Please input the Job Category."))	return false;
		
		
		if(LocationType){
			if(!fnSelVal(sf.loca_id1, "Please input the Desired Location is required."))	return false;
			if(!fnChkVal(sf.loca_id2, "Please input the Desired Location is required."))	return false;
		}else{
			if(!fnSelVal(sf.out_code, "please select the Current Location Nationality."))	return false;
			if(!fnChkVal(sf.out_addr, "please input the Current Location."))	return false;		
		}
		
		if(!fnChkVal(sf.typeOfPosition, "Please input the Type of Position."))	return false;
		if(!fnSelVal(sf.Experience, "Please input the Year of Professional Experience."))	return false;
		
		flag = true;
	}
	sf.submit();
}

/* ¿ÓÃ÷¿Â µî·Ï */
function SubmitEntertainment(sf){

	var LocationType = $("input[name='in_out']").eq(0).attr("checked");
	
	if(flag == true){
		alert("Registration is being processed. Please wait.");
	}else{

		if(!fnChkVal(sf.CategoryCode, "Select Event Category."))	return false;;
		if(!fnChkVal(sf.sYear, "Please input the year."))	return false;;
		if(!fnChkVal(sf.sMonth, "Please input the month."))	return false;;
		if(!fnChkVal(sf.sDay, "Please input the day."))	return false;;
		if(!fnChkVal(sf.eYear, "Please input the year."))	return false;;
		if(!fnChkVal(sf.eMonth, "Please input the month."))	return false;;
		if(!fnChkVal(sf.eDay, "Please input the day."))	return false;;
		if(!fnChkVal(sf.b_title, "Please input the title."))	return false;;
		
		if(LocationType){
			if(!fnChkVal(sf.loca_id2, "Select Location."))	return false;;
		}else{
			if(!fnSelVal(sf.out_code, "please select the Current Location Nationality."))	return false;
			if(!fnChkVal(sf.out_addr, "please input the Current Location."))	return false;		
		}
		
		if(!GetContents("b_comment")) { 	
			alert("Please input the Description."); 
			return false;
		}
		
		flag = true;
	}
	sf.submit();
}

/* °¶·¯¸® µî·Ï */
function SubmitPhoto(sf){

	if(flag == true){
		alert("Registration is being processed. Please wait.");
	}else{
		if(!fnChkVal(sf.CategoryCode, "Select Gallery Category."))	return false;;
		if(!fnChkVal(sf.b_title, "Please input the title."))	return false;;
		flag = true;
	}
	sf.submit();
}

/* °¶·¯¸® µî·Ï */
function SubmitVideos(sf){

	if(flag == true){
		alert("Registration is being processed. Please wait.");
	}else{
		if(!fnChkVal(sf.CategoryCode, "Select Video Category."))	return false;;
		if(!fnChkVal(sf.b_title, "Please input the title."))	return false;;
		flag = true;
	}
	sf.submit();
}

/* °¶·¯¸® µî·Ï */
function SubmitBlogs(sf){

	if(flag == true){
		alert("Registration is being processed. Please wait.");
	}else{
		if(!fnChkVal(sf.CategoryCode, "Select Category."))	return false;;
		if(!fnChkVal(sf.b_title, "Please input the title."))	return false;;
		flag = true;
	}
	sf.submit();
}




function PrivacyPolicy(){
	parent.$.fn.colorbox.close();
	parent.window.location.href = "/member/privacy.php";
}

function TermsofUse(){
	parent.$.fn.colorbox.close();
	parent.window.location.href = "/member/terms.php";
}





function chgMessenger() {
	var mess =  document.getElementById("mess");
	var messID = document.getElementById("messID");

	if(IsEmpty(mess.value)) {
		messID.style.backgroundColor = "#EFEFEF";
		messID.disabled = true;
	} else {
		messID.style.backgroundColor = "#FFFFFF";
		messID.disabled = false;
		messID.focus();
	}
}


function loadData(sel,target){ 
	
	var loca1 = sel.options[sel.selectedIndex].value;  // Ã¹¹øÂ° selectboxÀÇ ¼±ÅÃµÈ °ª      
	var form = sel.form.name;  
	
	locaframe.location.href = "/CurrentLocation.php?loca1="+loca1 + "&form=" + form + "&target=" + target;
	/*
	if(loca1 == 2232) { 
		locaframe.location.href = "/CurrentLocation.php?loca1="+loca1 + "&form=" + form + "&target=" + target;
	}else{
		
		for (K = document.getElementById("loca_id2").options.length; K >= 1; K--) {
			document.getElementById("loca_id2").options[K] = null;
		}
	}
	*/
} 
	 
function loadData2(sel,target){ 
	var loca2 = sel.options[sel.selectedIndex].value;  // Ã¹¹øÂ° selectboxÀÇ ¼±ÅÃµÈ °ª      
	var form = sel.form.name;  
	locaframe.location.href = "/CurrentLocation.php?loca2="+loca2 + "&form=" + form + "&target=" + target;
}  

function myphoto_add() {
	openWin("./myprofile_photo.php", "ADDPHOTO", 400, 100, false, false);	
}

function myphoto_del(param){
	
	if(confirm("Do you want to delete pictures?")){
		var Data = {
			xMode : "delete",
			sType : "M",
			param : param
		}
		
		$.post("/process/myprofile_process.php", Data, function(data) {
			if(data == 1){
				$("#btn_photo").show();
				$("#btn_delete").hide();
				$("#picture").attr("src", "/images/sample/my_photo.jpg");
			}else{
				alert("delete error");
			}
		});
	}
}

function companyphoto_add() {
	openWin("./company_profile_photo.php", "ADDPHOTO", 400, 100, false, false);	
}

function companyphoto_del(param){
	
	if(confirm("Do you want to delete pictures???")){
		var Data = {
			xMode : "delete",
			sType : "M",
			param : param
		}
		
		$.post("/process/comprofile_process.php", Data, function(data) {
			if(data == 1){
				$("#btn_photo").show();
				$("#btn_delete").hide();
				$("#picture").attr("src", "/images/sample/my_photo.jpg");
			}else{
				alert("delete error");
			}
		});
	}
}


function SearchControl(obj, depth, check){
	return false;
	//alert(obj.name + " // " + obj.form.name);
	
	if(obj.name == "loc1" || obj.name == "loc2" || obj.name == "loc3"){
		//alert(obj.name + " // " + depth + " // " + check);
		$("#line_jobs").hide();
		LocationLoding(obj,depth, check);
	}else if(obj.name == "jcategory" || obj.name == "jtype" || obj.name == "nationsel"){
		$("#line_jobs").hide();
		Jobs_Loding();	
	}
}


function LocationLoding(obj, depth , check){
	
	var sf = document.jobsform;
	var Data = {
		xMode : "select",
		xType : "lication",
		xDepth : depth,
		location1 : sf.loc1.value,
		location2 : sf.loc2.value
	}
	
	if(check){
		$.ajax({
			type: "GET",
			dataType: "xml",  //xml,html,jeon,jsonp,script,text
			url: "../process/location_process.php",
			data: Data,
			cache: false,
			contentType : 'application/xml', 
			success: function (xml){
				
				if ($(xml).find("list").find("item").length > 0) {
					// totalitem Ã£±â
					var totitem = $(xml).find("totalitem").text();
					
					sf.loc2.length = parseInt($(xml).find("list").find("item").length) + 1;
					sf.loc2.options[0].text = '2nd Location';
					sf.loc2.options[0].value = '';
					
					// item ³ëµå loop
					$(xml).find("list").find("item").each(function(idx) {				
						K = idx + 1;
						var no = $(this).find("no").text();
						var value = $(this).find("value").text();
						var text = $(this).find("text").text();
						
						sf.loc2.options[K].text = text;
						sf.loc2.options[K].value = value;
					});	
				}
				
				if ($(xml).find("list").find("item2").length > 0) {
					// totalitem Ã£±â
					var totitem = $(xml).find("totalitem").text();
					
					sf.loc3.length = parseInt($(xml).find("list").find("item2").length) + 1;
					sf.loc3.options[0].text = '3nd Location';
					sf.loc3.options[0].value = '';
					
					// item ³ëµå loop
					$(xml).find("list").find("item2").each(function(idx) {				
						K = idx + 1;
						var no = $(this).find("no").text();
						var value = $(this).find("value").text();
						var text = $(this).find("text").text();
						sf.loc3.options[K].text = text;
						sf.loc3.options[K].value = value;
					});	
				}
			
			},
			beforeSend: function(x){ $("#loding_img").show(); },
			complete: function(xhr, exception){
				if (xhr.status == 200) { // success
				} else if (xhr.status == 500) { // Internal Server Error
				} else if (xhr.status == 404) { // File Not found
				}
				//alert('Exception : ' + exception + ' \n'+'status : ' + xhr.status ); 
			},
			error: function(xhr, exception){
				alert('Exception : ' + exception + ' \n'+'Error message :\n' + xhr.responseText ); 
				return false;
			}
		});
		
		Jobs_Loding();
	}else{
		$("#line_jobs").hide();
		Jobs_Loding();
	}
}
	
	
function ShareControl(e){
	
	if($("#"+e).css("display") == "none"){
		$("#"+e).show();
	}else{
		$("#"+e).hide();
	}
}


function SetLanguage(obj){
	var Key = obj.value;
	if(Key != ""){
		document.getElementById("SetLanguageOther").style.display = "block";
		document.getElementById("SetLanguageOther").style.marginTop = "2px";
	}else{
		document.getElementById("langLevel").length = 1;
		document.getElementById("langLevel").options[0].text = 'Select';
		document.getElementById("langLevel").options[0].value = '';
		document.getElementById("SetLanguageOther").style.display = "none";
		document.getElementById("SetLanguageOther").style.marginTop = "0px";
	}
}

function SetInOut(kind){
	if(kind != 'not' && kind != ''){
		if(kind == "in") {
			document.getElementById("in_korea").style.display = "block";
			document.getElementById("out_korea").style.display = "none";
		}else{
			document.getElementById("in_korea").style.display = "none";
			document.getElementById("out_korea").style.display = "block";
		}
	}
}


/* Resume Location Loading */
function SearchLocationControl(obj, depth, check){
	if(obj.name == "loc1" || obj.name == "loc2"){
		
		if(!obj.value){
			if(depth == 1){
				var Clean_Select = document.getElementById("loc2");
				for (j = Clean_Select.options.length ; j >= 0 ; j--) Clean_Select.options[j] = null; 
				Clean_Select.length = 1;
				Clean_Select.options[0].text = '2nd Location';
				Clean_Select.options[0].value = '';
				
				var Clean_Select = document.getElementById("loc3");
				for (j = Clean_Select.options.length ; j >= 0 ; j--) Clean_Select.options[j] = null; 
				Clean_Select.length = 1;
				Clean_Select.options[0].text = '3rd Location';
				Clean_Select.options[0].value = '';
			}else if(depth == 2){
				var Clean_Select = document.getElementById("loc3");
				for (j = Clean_Select.options.length ; j >= 0 ; j--) Clean_Select.options[j] = null; 
				Clean_Select.length = 1;
				Clean_Select.options[0].text = '3rd Location';
				Clean_Select.options[0].value = '';	
			}else{
				return false;	
			}
		}else{
			if(depth == 1){
				var Clean_Select = document.getElementById("loc2");
				for (j = Clean_Select.options.length ; j >= 0 ; j--) Clean_Select.options[j] = null; 
				Clean_Select.length = 1;
				Clean_Select.options[0].text = '2nd Location';
				Clean_Select.options[0].value = '';
				
				var Clean_Select = document.getElementById("loc3");
				for (j = Clean_Select.options.length ; j >= 0 ; j--) Clean_Select.options[j] = null; 
				Clean_Select.length = 1;
				Clean_Select.options[0].text = '3rd Location';
				Clean_Select.options[0].value = '';
			}else if(depth == 2){
				var Clean_Select = document.getElementById("loc3");
				for (j = Clean_Select.options.length ; j >= 0 ; j--) Clean_Select.options[j] = null; 
				Clean_Select.length = 1;
				Clean_Select.options[0].text = '3rd Location';
				Clean_Select.options[0].value = '';	
			}else{
				return false;	
			}	
		}
		
		
		SearchLocationLoading(obj,depth, check);
	}
}

/* My Profile ÇöÀç À§Ä¡ ·Îµù */
function SearchLocationLoading(obj, depth , check){
	
	var sf = eval("document." + obj.form.name);
	var parameter = {
		xMode : "Select",
		xType : "Location",
		xDepth : depth,
		location1 : sf.loc1.value,
		location2 : sf.loc2.value
	}
	
	if(check){
		$.ajax({
			type: "GET",
			dataType: "xml",  //xml,html,jeon,jsonp,script,text
			url: "../process/clocation_process.php",
			data: parameter,
			cache: false,
			contentType : 'application/xml', 
			success: function (xml){
				
				/*
				var Query = $(xml).find("query").text();
				var Query2 = $(xml).find("query2").text();
				if($("#Query")){
					Query += "<BR />" + Query2;
					$("#Query").html(Query);
				}
				*/
				
				
				if ($(xml).find("list").find("item").length > 0) {
					// totalitem Ã£±â
					var totitem = $(xml).find("totalitem").text();
				
					sf.loc2.length = parseInt($(xml).find("list").find("item").length) + 1;
					sf.loc2.options[0].text = '2nd Location';
					sf.loc2.options[0].value = '';
					
					// item ³ëµå loop
					$(xml).find("list").find("item").each(function(idx) {				
						K = idx + 1;
						var no = $(this).find("no").text();
						var value = $(this).find("value").text();
						var text = $(this).find("text").text();
						
						sf.loc2.options[K].text = text;
						sf.loc2.options[K].value = value;
					});	
				}
				
				if ($(xml).find("list").find("item2").length > 0) {
					// totalitem Ã£±â
					var totitem = $(xml).find("totalitem").text();
					
					sf.loc3.length = parseInt($(xml).find("list").find("item2").length) + 1;
					sf.loc3.options[0].text = '3rd Location';
					sf.loc3.options[0].value = '';
					
					// item ³ëµå loop
					$(xml).find("list").find("item2").each(function(idx) {				
						K = idx + 1;
						var no = $(this).find("no").text();
						var value = $(this).find("value").text();
						var text = $(this).find("text").text();
						sf.loc3.options[K].text = text;
						sf.loc3.options[K].value = value;
					});	
				}
			
			},
			beforeSend: function(x){  },
			complete: function(xhr, exception){
				if (xhr.status == 200) { // success
				} else if (xhr.status == 500) { // Internal Server Error
				} else if (xhr.status == 404) { // File Not found
				}
				//alert('Exception : ' + exception + ' \n'+'status : ' + xhr.status ); 
			},
			error: function(xhr, exception){
				alert('Exception : ' + exception + ' \n'+'Error message :\n' + xhr.responseText ); 
				return false;
			}
		});
		
	}else{

	}
}






/* My Profile ÇöÀç À§Ä¡ ·Îµù */
function CurrentLocation(obj, depth, check){
	if(obj.name == "loca_id1" || obj.name == "loca_id2"){

		if(!obj.value){
			if(depth == 1){
				var Clean_Select = document.getElementById("loca_id2");
				for (j = Clean_Select.options.length ; j >= 0 ; j--) Clean_Select.options[j] = null; 
				Clean_Select.length = 1;
				Clean_Select.options[0].text = 'City / Do';
				Clean_Select.options[0].value = '';
				
				var Clean_Select = document.getElementById("loca_id3");
				for (j = Clean_Select.options.length ; j >= 0 ; j--) Clean_Select.options[j] = null; 
				Clean_Select.length = 1;
				Clean_Select.options[0].text = 'City / Gu';
				Clean_Select.options[0].value = '';
			}else if(depth == 2){
				var Clean_Select = document.getElementById("loca_id3");
				for (j = Clean_Select.options.length ; j >= 0 ; j--) Clean_Select.options[j] = null; 
				Clean_Select.length = 1;
				Clean_Select.options[0].text = 'City / Gu';
				Clean_Select.options[0].value = '';	
			}
			return false;
		}else{
			$("#loca_id3").show();	
		}
		
		
		if(obj.value.substr(0,2) == "32" || obj.value.substr(0,2) == "33" || obj.value.substr(0,2) == "34"){
			$("#loca_id3").hide();
		}else if(obj.value == "2232"){
			$("#loca_id3").show();
		}else{
			
		}
		
		CurrentLocationLoding(obj,depth, check);
	}
}


/* My Profile ÇöÀç À§Ä¡ ·Îµù */
function CurrentLocationLoding(obj, depth , check){
	
	var sf = eval("document." + obj.form.name);
	var parameter = {
		xMode : "Select",
		xType : "Location",
		xDepth : depth,
		location1 : sf.loca_id1.value,
		location2 : sf.loca_id2.value
	}
	
	
	if(check){
		$.ajax({
			type: "GET",
			dataType: "xml",  //xml,html,jeon,jsonp,script,text
			url: "/process/clocation_process.php",
			data: parameter,
			cache: false,
			contentType : 'application/xml', 
			success: function (xml){
				
				if ($(xml).find("list").find("item").length > 0) {
					// totalitem Ã£±â
					var totitem = $(xml).find("totalitem").text();
					
					sf.loca_id2.length = parseInt($(xml).find("list").find("item").length) + 1;
					sf.loca_id2.options[0].text = 'City / Do';
					sf.loca_id2.options[0].value = '';
					
					// item ³ëµå loop
					$(xml).find("list").find("item").each(function(idx) {				
						K = idx + 1;
						var no = $(this).find("no").text();
						var value = $(this).find("value").text();
						var text = $(this).find("text").text();
						
						sf.loca_id2.options[K].text = text;
						sf.loca_id2.options[K].value = value;
					});	
				}
				
				if ($(xml).find("list").find("item2").length > 0) {
					// totalitem Ã£±â
					var totitem = $(xml).find("totalitem").text();
					
					sf.loca_id3.length = parseInt($(xml).find("list").find("item2").length) + 1;
					sf.loca_id3.options[0].text = 'City / Gu';
					sf.loca_id3.options[0].value = '';
					
					// item ³ëµå loop
					$(xml).find("list").find("item2").each(function(idx) {				
						K = idx + 1;
						var no = $(this).find("no").text();
						var value = $(this).find("value").text();
						var text = $(this).find("text").text();
						sf.loca_id3.options[K].text = text;
						sf.loca_id3.options[K].value = value;
					});	
				}
			
			},
			beforeSend: function(x){ $("#loding_img").show(); },
			complete: function(xhr, exception){
				if (xhr.status == 200) { // success
				} else if (xhr.status == 500) { // Internal Server Error
				} else if (xhr.status == 404) { // File Not found
				}
				//alert('Exception : ' + exception + ' \n'+'status : ' + xhr.status ); 
			},
			error: function(xhr, exception){
				alert('Exception : ' + exception + ' \n'+'Error message :\n' + xhr.responseText ); 
				return false;
			}
		});
		
	}else{

	}
}

function colorbox_close(opt, url){
	if (typeof(arguments[0]) == 'undefined') opt = "";
	if (typeof(arguments[1]) == 'undefined') url = "";
	if(opt == "reload"){
		parent.location.reload();
		parent.$.fn.colorbox.close();	
	}else if(opt == "href"){
		parent.location.href = url;
		parent.$.fn.colorbox.close();
	}else{
		parent.$.fn.colorbox.close();		
	}
}

function colorbox_resize(width, height){
	
	parent.$.fn.colorbox.resize({width:width,height:height});
	
}

function colorbox_msg(elnum){
	if (typeof(arguments[0]) == 'undefined') return false;
	
	$.fn.colorbox({
		href:"/message/messagebox.php?elnum="+ elnum, 
		open:true,
		width:"630", 
		height:"378", 
		iframe:true, 
		transition:"none",
		opacity:"0.8", 
		overlayClose:false,
		escKey:false
	});
	
}

$(".example5").colorbox();


function MemberLogin(returl){
	if (typeof(arguments[0]) == 'undefined') returl = "";
	
	$.fn.colorbox({
		href:"/member/logon.php?returl="+ escape(returl), 
		open:true,
		width:"630", 
		height:"378", 
		iframe:true, 
		transition:"none",
		opacity:"0.8", 
		overlayClose:false,
		escKey:false 
	});
}

function MemberSignUp(){

	$.fn.colorbox({
		href:"/member/sign_up.php", 
		open:true,
		width:"630", 
		height:"378", 
		iframe:true, 
		transition:"none",
		opacity:"0.8", 
		overlayClose:false,
		escKey:false
	});
}

function MessageForm(user_id){

	$.fn.colorbox({
		href:"/message/message_layer.php?mail=" + user_id, 
		open:true,
		width:"630", 
		height:"378", 
		iframe:true, 
		transition:"none",
		opacity:"0.8", 
		overlayClose:false,
		escKey:false
	});
}



function ColorBoxImg(target){
	$.fn.colorbox({
		href:target, 
		slideshow:true
	});
}

function mSearchSubmits(sf){
	if(!fnChkVal(sf.keyword, "Please input the Search."))	return;
	document.mSearch.submit();
}

function mSearchSubmit(sf){
	if(!fnChkVal(sf.jkeyword, "Please input the Search."))	return;
	document.mSearch.submit();
}

/* ÄÁÅÙÃ÷ ¼­Ä¡ input ¹Ú½º¿¡¼­ ¿£ÅÍÅ° ÃºÀ»¶§*/
function onmSearchKey(e){
	var evtK = (e) ? e.which : window.event.keyCode;  
	var isCtrl = ((typeof isCtrl != 'undefined' && isCtrl) || ((e && evtK == 17) || (!e && event.ctrlKey))) ? true : false;  
	if(evtK == 13){
		mSearchSubmit(document.mSearch);
	}else{
		return false;
	}
}

function goResume(param){
	if (typeof(arguments[0]) == 'undefined') return false;
	window.location.href = "/resume/resume_view.php?no="+param;
}


$(function(){
	
	$("#MemberLogin").attr("href","/").click(function(){
		MemberLogin();
		return false;
	});
	
	$("#MemberSignUp").attr("href","/").click(function(){
		MemberSignUp();	
		return false;
	})
		   
});



function GetContents(field)
{
	var rc = /\s+/g;	
	var oEditor = FCKeditorAPI.GetInstance(field) ;
	var Contents = oEditor.GetXHTML( true );
	Contents = Contents.replace("<br />","");
	if (Contents.replace(rc,'').length == 0) {
		return false;
	}else{
		return true;
	}
}


function ContentsPrint(BBS, idx){
	if(BBS == "job"){
		openWin("/korea-jobs-print/"+idx, "contents_print", 870,700,false,true);
	}else{
		openWin("/korea-resume-print/"+idx, "contents_print", 870,700,false,true);
	}
}

function ContentsPrints(BBS, idx, key){
	openWin("/korea-resume-print/"+idx+"/"+key, "contents_print", 870,700,false,true);
}
