//###############################################################
// $B6&DL%b%8%e!<%k(B($BF~NO%A%'%C%/(B)
//     2003/05/09 V1.01 $B?75,(B                               $B>.Cf(B
//     2003/01/22 V1.02 $B@)8f5-9fBP:vDI2C(B                   $B>.Cf(B
//     2006/12/05 V1.03 FullPathCheck() Windows Vista$BBP1~(B  $B>.Cf(B
//###############################################################

// InputCheck: $BF~NO%U%#!<%k%I$N%A%'%C%/(B
// $B0z?t$N@bL@(B
//    form ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam  ... $BF~NO%U%#!<%k%IL>Kt$O%U%#!<%k%IHV9f(B($B>JN,IT2D(B)
//    typ  ... $BF~NO%U%#!<%k%I%?%$%W(B($B>JN,2D(B:$BC"$7B8:_3NG'MW$N>l9g$O>JN,IT2D(B)
//             text/file/hidden/password/textarea
//    chk  ... $B%A%'%C%/$N@55,I=8=(B($B>JN,2D(B)
//             ex. [^0-9] <- $B?t;z0J30$N;XDj$r5v2D$7$J$$!#(B
//    min  ... $B:G>.;XDj5v2DJ8;z?t(B($B>JN,2D(B)
//    max  ... $B:GBg;XDj5v2DJ8;z?t(B($B>JN,2D(B)
//    omt  ... $B>JN,2DH];XDj(B($B>JN,IT2D(B)
//             0:$B>JN,2D(B 1:$B>JN,IT2D(B
//    ext  ... $B%U%#!<%k%I$NB8:_3NG'MWH](B($B>JN,2D(B:$B>JN,CM(B0)
//             0:$B3NG'L5(B 1:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pL5(B 2:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pM-(B
//    opt  ... $BF~NO$5$l$?J8;z$rJQ49(B($B>JN,2D(B)
//             upper:$B1QBgJ8;z$XJQ49(B lower:$B1Q>.J8;z$XJQ49(B
//             special:$B@)8f5-9f$rFC<lJ8;z$XJQ49(B
//    msg  ... $B%(%i!<%a%C%;!<%8%-!<%o!<%I(B($B>JN,IT2D(B)
// $BJVCM$N@bL@(B
//    true  ... $BF~NO$5$l$?J8;zNs$O5v2DHO0OFb$G$"$k!#(B
//    false ... $B5v2D$5$l$F$$$J$$J8;zNs$NF~NO$,$"$k!#(B
//
function InputCheck(form,nam,typ,chk,min,max,omt,ext,opt,msg)
{
	if(nam.search("[^0-9]") == -1) {nam = document.forms[form].elements[nam].name;}
	code = ExistCheck(form, nam, typ, ext, msg);
	if(code != "exist") {return code;}

	if(opt == "upper")        {InputUpper(form, nam, typ, 0, msg);}
	else if(opt == "lower")   {InputLower(form, nam, typ, 0, msg);}
	else if(opt == "special") {InputSpecial(form, nam, typ, 0, msg);}
	if(OmitCheck(form, nam, typ, omt, 0, msg) != true) {return false;}
	if(CharCheck(form, nam, typ, chk, 0, msg) != true) {return false;}
	if(LengthCheck(form, nam, typ, min, max, 0, msg) != true) {return false;}
	return true;
}

// ButtonCheck: $B%\%?%s$NA*Br%A%'%C%/(B
// $B0z?t$N@bL@(B
//    form  ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam   ... $B%\%?%sL>Kt$O3+;O%(%l%a%s%HHV9f(B($B>JN,IT2D(B)
//              $B?t;z$N$_$G9=@.$5$l$F$$$k>l9g$O!"3+;O%(%l%a%s%HHV9f$H$_$J$9(B
//    typ   ... $B%\%?%s%?%$%W(B($B>JN,IT2D(B)
//              radio/checkbox
//    ext  ... $B%\%?%s$NB8:_3NG'MWH](B($B>JN,2D(B:$B>JN,CM(B0)
//             0:$B3NG'L5(B 1:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pL5(B 2:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pM-(B
//    msg   ... $B%(%i!<%a%C%;!<%8%-!<%o!<%I(B($B>JN,IT2D(B)
// $BJVCM$N@bL@(B
//    $BA*BrCM(B... $BA*Br$5$l$F$$$k%\%?%s$NCM(B
//    true  ... $B%\%?%sL5(B(ext=1)
//    false ... $BL$A*BrKt$O%\%?%sL5(B(ext=2)
//
function ButtonCheck(form,nam,typ,ext,msg)
{
	if(nam.search("[^0-9]") == -1) {nam = document.forms[form].elements[nam].name;}
	var code = ExistCheck(form, nam, typ, ext, msg);
	if(code != "exist") {return code;}

	var sel = '';
	if(document.forms[form].elements[nam].checked == true){
       		sel = document.forms[form].elements[nam].value;
	}
	else {
      		for(i=0; i<document.forms[form].elements[nam].length; i++) {
         		if(document.forms[form].elements[nam][i].checked == true){
            			sel = document.forms[form].elements[nam][i].value;
            			break;
			}
         	}
	}

	if(sel == '') {
		alert("Select any item in the " + msg + " .");
		sp = SearchObject(form, nam, typ, msg);
		if(sp != -1) {ErrFocus(form, sp);}
		return false;
	}
	else {return sel;}
}

// CharCheck: $BF~NO$5$l$?J8;zNs$N%A%'%C%/(B($B1Q?t;z(B)
// $B0z?t$N@bL@(B
//    form ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam  ... $BF~NO%U%#!<%k%IL>Kt$O%U%#!<%k%IHV9f(B($B>JN,IT2D(B)
//    typ  ... $BF~NO%U%#!<%k%I%?%$%W(B($B>JN,2D(B:$BC"$7B8:_3NG'MW$N>l9g$O>JN,IT2D(B)
//             text/file/hidden/password/textarea
//    chk  ... $B%A%'%C%/$N@55,I=8=(B($B>JN,2D(B)
//             ex. [^0-9] <- $B?t;z0J30$N;XDj$r5v2D$7$J$$!#(B
//    ext  ... $B%U%#!<%k%I$NB8:_3NG'MWH](B($B>JN,2D(B:$B>JN,CM(B0)
//             0:$B3NG'L5(B 1:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pL5(B 2:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pM-(B
//    msg  ... $B%(%i!<%a%C%;!<%8%-!<%o!<%I(B($B>JN,IT2D(B)
// $BJVCM$N@bL@(B
//    true  ... $BF~NO$5$l$?J8;zNs$O5v2DHO0OFb$G$"$k!#(B
//    false ... $B5v2D$5$l$F$$$J$$J8;zNs$NF~NO$,$"$k!#(B
//
function CharCheck(form,nam,typ,chk,ext,msg)
{
	if(nam.search("[^0-9]") == -1) {nam = document.forms[form].elements[nam].name;}
	code = ExistCheck(form, nam, typ, ext, msg);
	if(code != "exist") {return code;}

	chkval = document.forms[form].elements[nam].value;
	if(chkval == "") {return true;}

	if(chk != "" && chkval.search(chk) != -1) {
		if(chk == "[^0-9]") {
			alert("Non-numeric characters are entered in the " + msg + " field.");

		}
		else if(chk == "[^a-z]") {
			alert("Characters other than lower-case letters are entered in the " + msg + " field.");
		}
		else if(chk == "[^A-Z]") {
			alert("Characters other than upper-case letters are entered in the " + msg + " field.");
		}
		else if(chk == "[^a-zA-Z]" || chk == "[^A-Za-z]") {
			alert("Characters other than alphabetical characters are entered in the " + msg + " field.");
		}
		else if(chk == "[^a-zA-Z0-9]" || chk == "[^a-z0-9A-Z]" || chk == "[^A-Za-z0-9]" || chk == "[^A-Z0-9a-z]" || chk == "[^0-9a-zA-Z]" || chk == "[^0-9A-Za-z]") {
			alert("Characters other than alphanumerical characters are entered in the " + msg + " field.");
		}
		else if(chk == "[^a-fA-F0-9]" || chk == "[^a-f0-9A-F]" || chk == "[^A-Fa-f0-9]" || chk == "[^A-F0-9a-f]" || chk == "[^0-9a-fA-F]" || chk == "[^0-9A-Fa-f]" || chk == "[^A-F0-9]" || chk == "[^0-9A-F]") {
			alert("The value other than hexadecimal values is entered in the " + msg + " field.");
		}
		else {
			alert("The characters which are not permitted are entered in the " + msg + " field.");
		}
		ErrFocus(form, nam);
		return false;
	}

	return true;
}

// OmitCheck: $BF~NO$5$l$?J8;zNs$N>JN,2DH]%A%'%C%/(B
// $B0z?t$N@bL@(B
//    form ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam  ... $BF~NO%U%#!<%k%IL>Kt$O%U%#!<%k%IHV9f(B($B>JN,IT2D(B)
//    typ  ... $BF~NO%U%#!<%k%I%?%$%W(B($B>JN,2D(B:$BC"$7B8:_3NG'MW$N>l9g$O>JN,IT2D(B)
//             text/file/hidden/password/textarea
//    omt  ... $B>JN,2DH];XDj(B($B>JN,IT2D(B)
//             0:$B>JN,2D(B 1:$B>JN,IT2D(B
//    ext  ... $B%U%#!<%k%I$NB8:_3NG'MWH](B($B>JN,2D(B:$B>JN,CM(B0)
//             0:$B3NG'L5(B 1:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pL5(B 2:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pM-(B
//    msg  ... $B%(%i!<%a%C%;!<%8%-!<%o!<%I(B($B>JN,IT2D(B)
// $BJVCM$N@bL@(B
//    true  ... $B@5$7$/F~NO$5$l$F$$$k!#(B
//    false ... $B>JN,IT2D$N%U%#!<%k%I$K$b4X$o$i$:F~NO$,L5$$!#(B
//
function OmitCheck(form,nam,typ,omt,ext,msg)
{
	if(nam.search("[^0-9]") == -1) {nam = document.forms[form].elements[nam].name;}
	code = ExistCheck(form, nam, typ, ext, msg);
	if(code != "exist") {return code;}

	chkval = document.forms[form].elements[nam].value;

	if(chkval == "" && omt == 1) {
		alert("Be sure to enter a value in the " + msg + " field.");
		ErrFocus(form, nam);
		return false;
	}

	return true;
}

// LengthCheck: $BF~NO$5$l$?J8;zNs$ND9$5$r%A%'%C%/(B
// $B0z?t$N@bL@(B
//    form ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam  ... $BF~NO%U%#!<%k%IL>Kt$O%U%#!<%k%IHV9f(B($B>JN,IT2D(B)
//    typ  ... $BF~NO%U%#!<%k%I%?%$%W(B($B>JN,2D(B:$BC"$7B8:_3NG'MW$N>l9g$O>JN,IT2D(B)
//             text/file/hidden/password/textarea
//    min  ... $B:G>.;XDj5v2DJ8;z?t(B($B>JN,2D(B)
//    max  ... $B:GBg;XDj5v2DJ8;z?t(B($B>JN,2D(B)
//    ext  ... $B%U%#!<%k%I$NB8:_3NG'MWH](B($B>JN,2D(B:$B>JN,CM(B0)
//             0:$B3NG'L5(B 1:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pL5(B 2:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pM-(B
//    msg  ... $B%(%i!<%a%C%;!<%8%-!<%o!<%I(B($B>JN,IT2D(B)
// $BJVCM$N@bL@(B
//    true  ... $BF~NO$5$l$?J8;zD9$O5v2DHO0OFb$G$"$k!#(B
//    false ... $B5v2D$5$l$F$$$J$$J8;zD9$NF~NO$,$"$k!#(B
//
function LengthCheck(form,nam,typ,min,max,ext,msg) {
	if(nam.search("[^0-9]") == -1) {nam = document.forms[form].elements[nam].name;}
	code = ExistCheck(form, nam, typ, ext, msg);
	if(code != "exist") {return code;}

	chkval = document.forms[form].elements[nam].value;
	chklen = chkval.length;

	if(chkval == "" || (min == "" && max == "")) {return true;}
	if(Math.min(min, chklen) != min && max == "") {
		alert("Fill in the " + msg + " field with " + min + " characters or more.");
		ErrFocus(form, nam);
		return false;
	}
	else if(min == "" && Math.max(max, chklen) != max) {
		alert("Fill in the " + msg + " field with up to " + max + " characters.");
		ErrFocus(form, nam);
		return false;
	}
	else if(Math.min(min, chklen) != min || Math.max(max, chklen) != max) {
		if(min == max) {alert("Fill in the " + msg + " field with " + min + " characters.");}
		else {alert("Fill in the " + msg + " field with " + min + " to " + max + " characters.");}
		ErrFocus(form, nam);
		return false;
	}

	return true;
}

// FileTypeCheck: $BF~NO$5$l$?J8;zNs$N3HD%;R%A%'%C%/(B
// $B0z?t$N@bL@(B
//    form ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam  ... $BF~NO%U%#!<%k%IL>Kt$O%U%#!<%k%IHV9f(B($B>JN,IT2D(B)
//    typ  ... $BF~NO%U%#!<%k%I%?%$%W(B($B>JN,2D(B:$BC"$7B8:_3NG'MW$N>l9g$O>JN,IT2D(B)
//             text/file/hidden/textarea
//    ftyp ... $B5v2D$9$k%U%!%$%k3HD%;R;XDj(B($B>JN,IT2D(B)
//             $BJ#?t$N3HD%;R$r5v2D$9$k>l9g$O(B"/"$B$G6h@Z$k(B
//    ext  ... $B%U%#!<%k%I$NB8:_3NG'MWH](B($B>JN,2D(B:$B>JN,CM(B0)
//             0:$B3NG'L5(B 1:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pL5(B 2:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pM-(B
//    msg  ... $B%(%i!<%a%C%;!<%8%-!<%o!<%I(B($B>JN,IT2D(B)
// $BJVCM$N@bL@(B
//    true  ... $B@5$7$/F~NO$5$l$F$$$k!#(B
//    false ... $B3HD%;R$,L5$$Kt$O!"5v2D$5$l$F$$$J$$3HD%;R$,F~NO$5$l$F$$$k!#(B
//
function FileTypeCheck(form,nam,typ,ftyp,ext,msg)
{
	if(nam.search("[^0-9]") == -1) {nam = document.forms[form].elements[nam].name;}
	code = ExistCheck(form, nam, typ, ext, msg);
	if(code != "exist") {return code;}

	chktyp = document.forms[form].elements[nam].value.substr(document.forms[form].elements[nam].value.lastIndexOf(".")+1);

	if(chktyp == document.forms[form].elements[nam].value) {
		alert("The filename without a file extension is entered in the " + msg + " Filename field." );
		ErrFocus(form, nam);
		return false;
	}

	pmttyp = ftyp.split("/");

	for(i=0; i<=pmttyp.length-1; i++) {
		if(chktyp == pmttyp[i]) {
			return true;
		}
	}
	alert("Enter a " + msg + " filename with a ." + ftyp + " extention.");
	ErrFocus(form, nam);
	return false;
}

// FullPathCheck: $BF~NO$5$l$?J8;zNs$N%U%k%Q%9%A%'%C%/(B
// $B0z?t$N@bL@(B
//    form ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam  ... $BF~NO%U%#!<%k%IL>Kt$O%U%#!<%k%IHV9f(B($B>JN,IT2D(B)
//    typ  ... $BF~NO%U%#!<%k%I%?%$%W(B($B>JN,2D(B:$BC"$7B8:_3NG'MW$N>l9g$O>JN,IT2D(B)
//             text/file/hidden/textarea
//    os   ... $B%/%i%$%"%s%H4D6-$N(BOS($B>JN,2D(B:$B>JN,;~$OA4$F$N(BOS$B$,BP>](B)
//             Win/Mac/Sol/Linux
//    ext  ... $B%U%#!<%k%I$NB8:_3NG'MWH](B($B>JN,2D(B:$B>JN,CM(B0)
//             0:$B3NG'L5(B 1:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pL5(B 2:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pM-(B
//    msg  ... $B%(%i!<%a%C%;!<%8%-!<%o!<%I(B($B>JN,IT2D(B)
// $BJVCM$N@bL@(B
//    true  ... $B@5$7$/F~NO$5$l$F$$$k!#(B
//    false ... $B;XDj$5$l$?J8;zNs$O%U%k%Q%9$G$O$J$$!#(B
//
function FullPathCheck(form,nam,typ,os,ext,msg)
{
	if(nam.search("[^0-9]") == -1) {nam = document.forms[form].elements[nam].name;}
	code = ExistCheck(form, nam, typ, ext, msg);
	if(code != "exist") {return code;}

	filepath = document.forms[form].elements[nam].value;

	// Windows Vista no check
	if(navigator.appVersion.search(/Windows NT 6/) != -1) {return true;}

	if(os == "Win" || os == "Mac" || os == "") {
		if(filepath.search(/\:\\|^\\\\/) != -1) {return true;}
	}

	if(os == "Sol" || os == "Linux" || os == "") {
		if(filepath.search(/^\//) != -1) {return true;}
	}
	alert("Specify a filename in the " + msg + " with a full path.");
	ErrFocus(form, nam);
	return false;
}

// ErrFocus: $BF~NO%(%i!<2U=j$X%+!<%=%k$r0\F0(B
// $B0z?t$N@bL@(B
//    form ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam  ... $BF~NO%U%#!<%k%IL>Kt$O%U%#!<%k%IHV9f(B($B>JN,IT2D(B)
// $BJVCM$N@bL@(B
//    true  ... $B>o;~(B
//
function ErrFocus(form,nam)
{
	if(document.forms[form].elements[nam].type != "hidden") {
		document.forms[form].elements[nam].focus();
	}
	return true;
}

// SearchObject: $B%A%'%C%/BP>]$r8!:w(B
// $B0z?t$N@bL@(B
//    form  ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam   ... $B%\%?%sL>(B($B>JN,IT2D(B)
//    typ   ... $BF~NO%?%$%W$r;XDj(B($B>JN,IT2D(B)
//              text/radio/checkbox/file/hidden/password/textarea
//    msg   ... $B7Y9p%a%C%;!<%8M-L5(B($B>JN,2D(B:$B>JN,CM$O7Y9pL5(B)
//              0:$B7Y9pL5(B 1:$B7Y9pM-(B
// $BJVCM$N@bL@(B
//    $B@5@0?t(B... $B8!:w$5$l$?%U%#!<%k%I$N@hF,%(%l%a%s%HHV9f(B
//    -1    ... $B8!:wBP>]L5$7(B
//
function SearchObject(form,nam,typ,msg)
{
	for(i=0; i<=document.forms[form].length-1; i++) {
		if(document.forms[form].elements[i].type != typ) {continue;}
		if(document.forms[form].elements[i].name == nam) {return i;}
	}

	if(msg == 1) {alert("There is no " + nam + " field.");}
	return -1;
}

// ExistCheck: $B%A%'%C%/BP>]$NB8:_3NG'(B
// $B0z?t$N@bL@(B
//    form  ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam   ... $B%\%?%sL>(B($B>JN,IT2D(B)
//    typ   ... $BF~NO%?%$%W$r;XDj(B($B>JN,IT2D(B)
//              text/radio/checkbox/file/hidden/password/textarea
//    ext  ... $B%U%#!<%k%I$NB8:_3NG'MWH](B($B>JN,2D(B:$B>JN,CM(B0)
//             0:$B3NG'L5(B 1:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pL5(B 2:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pM-(B
//    msg  ... $B%(%i!<%a%C%;!<%8%-!<%o!<%I(B($B>JN,IT2D(B)
// $BJVCM$N@bL@(B
//    exist... $BBP>]M-$j(B
//    true ... $BBP>]L5$7(B/$B7Y9pL5$7(B
//    false... $BBP>]L5$7(B/$B7Y9pM-$j(B
//
function ExistCheck(form,nam,typ,ext,msg)
{
	if(ext == 0) {return "exist";}
	else if(!document.forms[form].elements[nam] || document.forms[form].elements[nam].type == "hidden") {
		if(ext == 1)      {return true;}
		else if(ext == 2) {
			if(typ == 'radio' || typ == 'checkbox') {alert("There is no " + msg + " select button.");}
			else {alert("There is no " + msg + " field.");}
			return false;
		}
	}
	return "exist";
}

// InputUpper: $B1Q>.J8;z$r1QBgJ8;z$XJQ49(B
// $B0z?t$N@bL@(B
//    form ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam  ... $BF~NO%U%#!<%k%IL>Kt$O%U%#!<%k%IHV9f(B($B>JN,IT2D(B)
//    typ  ... $BF~NO%U%#!<%k%I%?%$%W(B($B>JN,2D(B:$BC"$7B8:_3NG'MW$N>l9g$O>JN,IT2D(B)
//             text/file/hidden/password/textarea
//    ext  ... $B%U%#!<%k%I$NB8:_3NG'MWH](B($B>JN,2D(B:$B>JN,CM(B0)
//             0:$B3NG'L5(B 1:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pL5(B 2:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pM-(B
//    msg  ... $B%(%i!<%a%C%;!<%8%-!<%o!<%I(B($B>JN,IT2D(B)
// $BJVCM$N@bL@(B
//    true ... $B>o;~(B
//
function InputUpper(form,nam,typ,ext,msg) {
	if(nam.search("[^0-9]") == -1) {nam = document.forms[form].elements[nam].name;}
	code = ExistCheck(form, nam, typ, ext, msg);
	if(code != "exist") {return code;}
	document.forms[form].elements[nam].value = document.forms[form].elements[nam].value.toUpperCase();
	return true;
}

// InputLower: $B1QBgJ8;z$r1Q>.J8;z$XJQ49(B
// $B0z?t$N@bL@(B
//    form ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam  ... $BF~NO%U%#!<%k%IL>Kt$O%U%#!<%k%IHV9f(B($B>JN,IT2D(B)
//    typ  ... $BF~NO%U%#!<%k%I%?%$%W(B($B>JN,2D(B:$BC"$7B8:_3NG'MW$N>l9g$O>JN,IT2D(B)
//             text/file/hidden/password/textarea
//    ext  ... $B%U%#!<%k%I$NB8:_3NG'MWH](B($B>JN,2D(B:$B>JN,CM(B0)
//             0:$B3NG'L5(B 1:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pL5(B 2:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pM-(B
//    msg  ... $B%(%i!<%a%C%;!<%8%-!<%o!<%I(B($B>JN,IT2D(B)
// $BJVCM$N@bL@(B
//    true ... $B>o;~(B
//
function InputLower(form,nam,typ,ext,msg) {
	if(nam.search("[^0-9]") == -1) {nam = document.forms[form].elements[nam].name;}
	code = ExistCheck(form, nam, typ, ext, msg);
	if(code != "exist") {return code;}
	document.forms[form].elements[nam].value = document.forms[form].elements[nam].value.toLowerCase();
	return true;
}

// InputSpecial: $B@)8f5-9f$rFC<lJ8;z$XJQ49(B
// $B0z?t$N@bL@(B
//    form ... $B%U%)!<%`L>(B($B>JN,IT2D(B)
//    nam  ... $BF~NO%U%#!<%k%IL>Kt$O%U%#!<%k%IHV9f(B($B>JN,IT2D(B)
//    typ  ... $BF~NO%U%#!<%k%I%?%$%W(B($B>JN,2D(B:$BC"$7B8:_3NG'MW$N>l9g$O>JN,IT2D(B)
//             text/file/hidden/password/textarea
//    ext  ... $B%U%#!<%k%I$NB8:_3NG'MWH](B($B>JN,2D(B:$B>JN,CM(B0)
//             0:$B3NG'L5(B 1:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pL5(B 2:$B3NG'M-(B/$BB8:_$7$J$$;~7Y9pM-(B
//    msg  ... $B%(%i!<%a%C%;!<%8%-!<%o!<%I(B($B>JN,IT2D(B)
// $BJVCM$N@bL@(B
//    true ... $B>o;~(B
//
function InputSpecial(form,nam,typ,ext,msg) {
	if(nam.search("[^0-9]") == -1) {nam = document.forms[form].elements[nam].name;}
	code = ExistCheck(form, nam, typ, ext, msg);
	if(code != "exist") {return code;}
	var rep = document.forms[form].elements[nam].value;
	rep = rep.replace(/&amp;|&#38;/g, '&');
	rep = rep.replace(/&gt;|&#62;/g, '>');
	rep = rep.replace(/&lt;|&#60;/g, '<');
	rep = rep.replace(/&minus;|&#8722;/g, '-');
	rep = rep.replace(/&nbsp;/g, ' ');
	rep = rep.replace(/&quot;|&#34;/g, '"');
	rep = rep.replace(/&#39;/g, '\'');
	document.forms[form].elements[nam].value = rep;
	return true;
}
