function FormCheck()
{
	this.form;
	this.input1;
	this.input2;
	this.item;

	this.chkNeedTxt=Form_chkNeedTxt;
	this.chkNeedSlt=Form_chkNeedSlt;
	this.chkNeedRdi=Form_chkNeedRdi;
	this.chkNeedChk=Form_chkNeedChk;
	this.chkDupliChk=Form_chkDupliChk;
	this.chkNO=Form_chkNO;
	this.chkNO2=Form_chkNO2;
	this.chkAmount=Form_chkAmount;
	this.chkCode=Form_chkCode;
	this.chkKorean=Form_chkKorean;
	this.chkEmail=Form_chkEmail;
	this.chkLength=Form_chkLength;
	this.chkJumin=Form_chkJumin;
	this.chkCheckbox=Form_chkCheckbox;
	this.nextFocus=Form_nextFocus;
	this.nextFocus2=Form_nextFocus2;
	this.getRdiVal=Form_getRdiVal;
	this.viewLength=Form_viewLength;
	this.resizeTextarea=Form_resizeTextarea;
	this.checkAll=Form_checkAll;
	this.checkInv=Form_checkInv;
	this.getChecked=Form_getChecked;
}

// Check Need Text Value //
function Form_chkNeedTxt()
{
	var inputname=this.input1;
	var item=this.item;

	if(inputname)
	{
		if(inputname.value)
		{
			return true;
		}
		else
		{
			if(item) alert(this.printf(LANG[2],item));
			inputname.focus();
			inputname.select();
			return false;
		}
	}

	return true;
}

// Check Need Select Value //
function Form_chkNeedSlt()
{
	var inputname=this.input1;
	var item=this.item;

	if(inputname)
	{
		if(inputname.value)
		{
			return true;
		}
		else
		{
			if(item) alert(this.printf(LANG[1],item));
			inputname.focus();
			return false;
		}
	}

	return true;
}

// Check Need Radio Value //
function Form_chkNeedRdi()
{
	var inputname=this.input1;
	var item=this.item;

	if(inputname)
	{
		if(inputname.length>0)
		{
			for(i=0;i<inputname.length;i++)
			{
				if(inputname[i].checked==true)
				{
					var tmp=1;
				}
			}
		}
		else
		{
			if(inputname.checked==true) return true;
		}

		if(tmp) return true;
		else
		{
			if(item) alert(this.printf(LANG[1],item));
			return false;
		}
	}

	return true;
}

// Check Checkbox Checked //
function Form_chkNeedChk()
{
	var inputname=this.input1;
	var item=this.item;

	if(inputname)
	{
		for(i=0;i<inputname.length;i++)
		{
			if(inputname[i].checked==true)
			{
				var tmp=1;
			}
		}
		if(tmp)
		{
			return true;
		}
		else
		{
			if(item) alert(this.printf(LANG[1],item));
			return false;
		}
	}

	return true;
}

// Check Number //
function Form_chkNO()
{
	var inputname=this.input1;
	var item=this.item;

	if(inputname)
	{
		if(this.isNO(inputname.value))
		{
			return true;
		}
		else
		{
			if(item) alert(this.printf(LANG[3],item));
			inputname.select();
			return false;
		}
	}

	return true;
}

// Check Number include Code //
function Form_chkNO2()
{
	var inputname=this.input1;
	var item=this.item;

	if(inputname)
	{
		if(this.isNO2(inputname.value))
		{
			return true;
		}
		else
		{
			if(item) alert(this.printf(LANG[3],item));
			inputname.select();
			return false;
		}
	}

	return true;
}

// Check Amount //
function Form_chkAmount()
{
	var inputname=this.input1;
	var item=this.item;

	if(inputname)
	{
		if(this.isAmount(inputname.value))
		{
			return true;
		}
		else
		{
			if(item) alert(this.printf(LANG[5],item));
			inputname.select();
			return false;
		}
	}

	return true;
}

// Check Code //
function Form_chkCode()
{
	var inputname=this.input1;
	var item=this.item;

	if(inputname)
	{
		if(this.isCode(inputname.value))
		{
			return true;
		}
		else
		{
			if(item) alert(this.printf(LANG[5],item));
			inputname.select();
			return false;
		}
	}

	return true;
}

// Check Korean //
function Form_chkKorean()
{
	var inputname=this.input1;
	var item=this.item;

	if(inputname)
	{
		if(this.isKorean(inputname.value))
		{
			return true;
		}
		else
		{
			if(item) alert(this.printf(LANG[5],item));
			inputname.select();
			return false;
		}
	}

	return true;
}

// Check Email //
function Form_chkEmail()
{
	var inputname=this.input1;
	var item=this.item;

	if(inputname)
	{
		if(this.isEmail(inputname.value))
		{
			return true;
		}
		else
		{
			if(item) alert(this.printf(LANG[4],item));
			inputname.select();
			return false;
		}
	}

	return true;
}

// Confirm Text Size //
function Form_chkLength(length)
{
	var inputname=this.input1;
	var item=this.item;

	if(inputname)
	{
		var len=this.isLength(inputname.value);
		if(length>len)
		{
			return true;
		}
		else
		{
			if(item) alert(this.printf(LANG[6],item,len,length));
			inputname.select();
			return false;
		}
	}

	return true;
}

// Check Jumin //
function Form_chkJumin()
{
	var inputname1=this.input1;
	var inputname2=this.input2;
	var item=this.item;

	if(inputname1 && inputname2)
	{
		if(this.isJumin(inputname1.value,inputname2.value))
		{
			return true;
		}
		else
		{
			if(item) alert(this.printf(LANG[5],item));
			inputname1.select();
			return false;
		}
	}

	return true;
}

// Check Duplicate checked //
function Form_chkDupliChk()
{
	var inputname=this.input1;
	var item=this.item;

	var tmp=0;

	if(inputname)
	{
		for(i=0;i<inputname.length;i++)
		{
			if(inputname[i].checked==true) tmp++;
		}

		if(tmp>1)
		{
			alert(this.printf(LANG[10],item));
			return false;
		}
		else
		{
			return true;
		}
	}

	return true;
}

// Check Checkbox Checked //
function Form_chkCheckbox(name,msg)
{
	var form=this.form;
	var chk;

	for(i=0;i<form.elements.length;i++)
	{
		if(form.elements[i].name==name)
		{
			if(form.elements[i].checked) chk=true;
		}
	}

	if(chk==true)
	{
		return true;
	}
	else
	{
		if(msg) alert(msg);
		return false;
	}
}

// Move Focus //
function Form_nextFocus(len)
{
	var inputname1=this.input1;
	var inputname2=this.input2;

	if(inputname1 && inputname2)
	{
		if(inputname1.value.length >= len)
		{
			inputname2.focus();
		}
	}
}

// Move Focus //
function Form_nextFocus2(name1,name2,len)
{
	if(name1 && name2)
	{
		if(document.getElementById(name1).value.length >= len)
		{
			document.getElementById(name2).select();
		}
	}
}

// Get Radio Value Checked //
function Form_getRdiVal()
{
	var inputname1=this.input1;

	var tmp;

	if(inputname1)
	{
		if(inputname1.length > 0)
		{
			for(var i=0;i<inputname1.length;i++)
			{
				if(inputname1[i].checked==true)
				{
					tmp=i;
					break;
				}
			}
		}
		else
		{
			return inputname1.value;
		}

		if(tmp=='undefined' || tmp==undefined) return false;
		return inputname1[tmp].value;
	}
	else return false;

	return true;
}

// View Element Value Length //
function Form_viewLength(inputname,bytesname)
{
	bytesname.value=this.getLength(inputname.value); 
}

// Resize Textarea //
function Form_resizeTextarea(size,def)
{
	var inputname1=this.input1;

	if(!def) def=30;

	if(size=='R')
	{
		inputname.rows=def;
	}
	else
	{
		var value=inputname.rows+size;

		if(value>0) inputname.rows=value
		else return;
	}
}

// Check All Checkbox //

function Form_checkAll(form,name)
{
	if(document.getElementById(name).checked==true) var a=false;
	else var a=true;

	for(i=0;i<form.elements.length;i++)
	{
		if(form.elements[i].name==name)
		{
			form.elements[i].checked=a;
		}
	}
}

// Check All Checkbox or Uncheck //
function Form_checkInv(form,name)
{
	for(i=0;i<form.elements.length;i++)
	{
		if(form.elements[i].name==name)
		{
			form.elements[i].checked=!form.elements[i].checked;
		}
	}
}

// Get Checked //
function Form_getChecked(form,name)
{
	var chk;
	var len=form.elements.length;

	for(i=0;i<len;i++)
	{
		if(form.elements[i].name==name)
		{
			if(form.elements[i].checked==true) chk=1;
		}
	}

	if(chk)
	{
		return true;
	}
	else
	{
		alert(LANG[12]);
		return false;
	}
}

