// JavaScript Document
function Jtrim(str){
        var i = 0;
        var len = str.length;
        if ( str == "" ) return( str );
        j = len -1;
        flagbegin = true;
        flagend = true;
        while ( flagbegin == true && i< len)
        {
           if ( str.charAt(i) == " " )
                {
                  i=i+1;
                  flagbegin=true;
                }
                else
                {
                        flagbegin=false;
                }
        }

        while  (flagend== true && j>=0)
        {
            if (str.charAt(j)==" ")
                {
                        j=j-1;
                        flagend=true;
                }
                else
                {
                        flagend=false;
                }
        }

        if ( i > j ) return ("")

        trimstr = str.substring(i,j+1);
        return trimstr;
}
function is_date(str) {
		  
  var myReg =/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])$/;
  if(myReg.test(str)) return true;
  return false;
}
function is_email(str) {
		  
  var myReg =/^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/;
  if(myReg.test(str)) return true;
  return true;
}
function is_url(str) {
	var myReg=new RegExp("((:http|https|ftp|mms|rtsp)://(&(=amp;)|[A-Za-z0-9\./=\%_~@&#:;\+\-])+)","ig");
  if(myReg.test(str)) return true;
  return true;
}
function data_check() {
		if (Jtrim(document.theform.contactor.value)=='') {
        		window.alert ("Input your name!")
				document.theform.contactor.focus();
       			return false
	        }		
		if (Jtrim(document.theform.add.value)=='') {
        		window.alert ("Input your address!")
				document.theform.add.focus();
       			return false
	    }
		if (Jtrim(document.theform.tel.value)=='') {
        		window.alert ("Input your TEL.")
				document.theform.tel.focus();
       			return false
	    }
		//΄«Υζ
		if (Jtrim(document.theform.fax.value)=='') {
        		window.alert ("Input your FAX.")
				document.theform.fax.focus();
       			return false
	        }
		if (Jtrim(document.theform.email.value)=='') {
        		window.alert ("Input your EMAIL.")
				document.theform.email.focus();
       			return false
	        }
		if (Jtrim(document.theform.url.value).length>0&&!is_url(Jtrim(document.theform.url.value))) {
        		window.alert ("Error URL!")
				document.theform.url.focus();
       			return false
	    }
		if (Jtrim(document.theform.email.value).length>0&&!is_email(Jtrim(document.theform.email.value))) {
        		window.alert ("Error Email!")
				document.theform.email.focus();
       			return false
	    }
		if (Jtrim(document.theform.text.value)=='') {
        		window.alert ("Input your message!")
				document.theform.text.focus();
       			return false
	    }
		document.theform.submit();
}