function validity(){
var str=document.form1.searching.value;
if (str=="")
alert("Please input a valid search keyword!")
document.form1.searching.focus;
}


function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function addcategory(){
var str=document.UploadForm1.categorytotal.value;
if (str=="")
alert("Please input number of category to create !")
else if (IsNumeric(document.UploadForm1.categorytotal.value) == false) 
alert("Please input a valid number !")
}

function addimage(){
var str=document.UploadForm1.imagetotal.value;
if (str=="")
alert("Please input number of images to upload !")
else if (IsNumeric(document.UploadForm1.imagetotal.value) == false) 
alert("Please input a valid number !")
}

function addnews(){
var str=document.UploadForm1.newstotal.value;
if (str=="")
alert("Please input number of news file to upload !")
else if (IsNumeric(document.UploadForm1.newstotal.value) == false) 
alert("Please input a valid number !")
}

function addsubcategory(){
if (document.UploadForm1.maincategoryname.checked)
return true
else
alert("Please choose a main category first !") 
}

function addsubcategory2(){
var str=document.UploadForm1.subcategorytotal.value;
if (str=="")
alert("Please input number of subcategory file to upload !")
else if (IsNumeric(document.UploadForm1.subcategorytotal.value) == false) 
alert("Please input a valid number !")
}

function IDeleteEXP(){
if (document.UploadForm1.checkbox.checked)
return true
else
alert("Please check at least 1 box!") 
}

function checkForm(isForm){ 

nradio = 0; 
ok = false; 
for (n=0; n<isForm.length; n++) 
{ 
if (isForm[n].type == 'radio'){nradio++} 
} 
for (i=0; i<nradio; i++) 
{ 
if(isForm.maincategoryname[i].checked == true){ok = true} 
} 
if (ok == false){alert('Please choose a main category first !')}; 
else {return true} 

}

function IDelete(isForm)
{
ncheckbox = 0; 
ok = false; 
for (n=0; n<isForm.length; n++) 
	{ 
		if (isForm[n].type == 'checkbox')
			{
			ncheckbox++
			} 
	} 
for (i=0; i<ncheckbox; i++) 
{ 
	if(isForm.checkbox[i].checked == true)
		{
		ok = true
		} 
} 
	
if (ok == false){
alert('Please check at least 1 box !')
}; 
else {return true} 

}

