// JavaScript Document

//사이트맵 창열기
function open_sitemap(){
	window.open('sitemap.html','sitemap','width=420,height=356');
}

//폼리셋
function form_reset(fid){
	var f = document.getElementById(fid);
	f.reset();
}

// 스페이스 검사
function chkSpace( str ){
     if(str.search(/\s/) != -1) return 1;
}

//이메일 검사
function chkEmail( str )
{
     /* check whether input value is included space or not  */
     if(str == "" || str =="@"){
     	alert("Please input Email field");
     	return 0;
     }
     if( chkSpace( str ) ) {
         alert("Error : Email value");
         return 0;
     }
          
     /* checkFormat */
     var isEmail = /[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+(\.[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+)*@[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+(\.[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+)*/;
     if( !isEmail.test(str) ) {
         alert("Error : Email value");
         return 0;
     }
     if( str.length > 60 ) {
         alert("Error : Email value");
         return 0;
     }

     return 1;
}

//문자가 스페이스로만 이뤄졌는지 검사
function onlySpace(str){
	while(str.search(/ /) > -1){
		str = str.replace(/[ ]/,'');
	}
	if(!str) return 1;
}

//텍스트인풋 입력값 검사 (항목,에러메세지,최소문자길이)
function chk_ipt_txt(obj,alt,num){
	if(!num) num = obj.value.length;
	if(obj.value.length < num){
		if(!onlySpace(obj.value)) ;//alt += " " + num + "자이상";
		alert("Please input " + alt );
		obj.focus();
		return false;
	}
	return true;
}

// 삭제 검사 확인
function chk_run(str,href){
	if(!href){
		if(!confirm(str)) 
			return false;
		else
			return true;
	}
	if(confirm(str)) 
		document.location.href = href;
}