//--------------------------------------------------------------------//
function AjaxDoInsert()
{	if(ValidateSubmit()==true)
	{
		var parent=document.getElementById("txtParent").value;
		var name=document.getElementById("txtName").value;
		var active=document.getElementById("chkActive").value;
		if(active=="on")
			active=true;
		else
			active=false;
		var order=document.getElementById("txtOrder").value;
		SuveyNET.UserControl.ucCategory.AddCat(parent,name,order,active);		
		document.getElementById("CreateCategory").style.visibility="hidden";
		doShowGird();
	
	}
}
//--------------------------------------------------------------------//
function doShowGird()
{
	SuveyNET.UserControl.ucCategory.LoadGrid(doShowGird_CallBack);
	//alert("hello");
}
//--------------------------------------------------------------------//
function doShowGird_CallBack(res)
{
	document.getElementById("CategoryGird").innerHTML=res.value;
}
//--------------------------------------------------------------------//
function doShowAddCategory()
{
	SuveyNET.UserControl.ucCategory.GetParentSelect(doShowAddCategory_CallBack);
	name=document.getElementById("txtName").value="";
	order=document.getElementById("txtOrder").value="";
	document.getElementById("CreateCategory").style.visibility="visible";
}
//--------------------------------------------------------------------//
function doShowAddCategory_CallBack(res)
{
	document.getElementById("divParent").innerHTML=res.value;
}
//--------------------------------------------------------------------//
function ValidateSubmit()
{
	if(trim(document.getElementById("txtName").value)=="")
	{
		alert("Please input Category Name!");
		document.getElementById("txtName").focus();
		return false;
		
	}
	if(checkNumber(document.getElementById("txtOrder").value)==false)
	{
		alert("Please input Order Number!");
		document.getElementById("txtOrder").focus();
		return false;
		
	}
	return true;
	
}
