function CheckFormC()
{
	var strError = "";
	
	if(document.Form1.Full_name.value == "" || trim(document.Form1.Full_name.value) == true)
		strError += "-  Full Name is a mandatory field. \n";
		
	if(document.Form1.Email.value == "" || trim(document.Form1.Email.value) == true)
		strError += "-  Email is a mandatory field. \n";
	else if (CheckEmail(document.Form1.Email.value) != true)
		strError += "-  Invalid Email address. \n";
		
	if(document.Form1.Phone.value == "" || trim(document.Form1.Phone.value) == true)
		strError += "-  Tel No. is a mandatory field. \n";
		
	if(document.Form1.Enquiry.value == "" || trim(document.Form1.Enquiry.value) == true)
		strError += "-  Enquiry is a mandatory field. \n";
	
	if(strError != "")
	{
		alert(strError);
		return false;
	}
	
	return true;
}


function CheckFormA()
{
	var strError = "";
	var bool = false;
	
	if(document.Form1.Full_name.value == "" || trim(document.Form1.Full_name.value) == true)
		strError += "-  Full Name is a mandatory field. \n";
		
	if(document.Form1.Email.value == "" || trim(document.Form1.Email.value) == true)
		strError += "-  Email is a mandatory field. \n";
	else if (CheckEmail(document.Form1.Email.value) != true)
		strError += "-  Invalid Email address. \n";
		
	if(document.Form1.Day.value == "" || trim(document.Form1.Day.value) == true)
	{
		strError += "-  Date of Requested Service is a mandatory field. \n";
		bool = true;
	}
	
	if(!bool)
	{
		if(document.Form1.Month.value == "" || trim(document.Form1.Month.value) == true)
			strError += "-  Date of Requested Service is a mandatory field. \n";
	}
		
	if(!bool)
	{
		if(document.Form1.Year.value == "" || trim(document.Form1.Year.value) == true)
			strError += "-  Date of Requested Service is a mandatory field. \n";
	}
	
	if(strError != "")
	{
		alert(strError);
		return false;
	}
	
	return true;
}

function CheckFormB()
{
	var strError = "";
	var bool = false;
	
	if(document.Form1.Full_name.value == "" || trim(document.Form1.Full_name.value) == true)
		strError += "-  Full Name is a mandatory field. \n";
		
	if(document.Form1.Phone.value == "" || trim(document.Form1.Phone.value) == true)
		strError += "-  Phone Number is a mandatory field. \n";
		
	if(document.Form1.Email.value == "" || trim(document.Form1.Email.value) == true)
		strError += "-  Email is a mandatory field. \n";
	else if (CheckEmail(document.Form1.Email.value) != true)
		strError += "-  Invalid Email address. \n";
		
	if(document.Form1.Day.value == "" || trim(document.Form1.Day.value) == true)
	{
		strError += "-  Date of Requested Service is a mandatory field. \n";
		bool = true;
	}
	
	if(!bool)
	{
		if(document.Form1.Month.value == "" || trim(document.Form1.Month.value) == true)
			strError += "-  Date of Requested Service is a mandatory field. \n";
	}
		
	if(!bool)
	{
		if(document.Form1.Year.value == "" || trim(document.Form1.Year.value) == true)
			strError += "-  Date of Requested Service is a mandatory field. \n";
	}

	if(document.Form1.Name_or_Address.value == "" || trim(document.Form1.Name_or_Address.value) == true)
		strError += "-  Name or Addres is a mandatory field? \n";
	
	if(strError != "")
	{
		alert(strError);
		return false;
	}
	
	return true;
}

//--------------------------------- ADDITIONAL FORM VALIDATION -------------------------------//

function CheckEmail(email) 
{
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email))
		return false;
		
	return true;
}

function trim(str) 
{
	if(str.replace(/^\s+|\s+$/g,"") == "")
		return true;
		
	return false
}

function GetFileExtension(Filename)
{
  var I = Filename.lastIndexOf(".");
  return (I > -1) ? Filename.substring(I + 1, Filename.length).toLowerCase() : "";
}

function ToTrim(str) {
	return str.replace(/^\s+|\s+$/g,"");
}

function IsCorrectUploadFile(Extensions, FormObj)
{
	var UploadFile = FormObj.value;
	var Extensions = Extensions.split(",");
	var Ext = "";
	var CompareTo = "";
	var By = "";

	if (UploadFile != "")
	{
		Ext = GetFileExtension(UploadFile);
		for(var i = 0; i < Extensions.length; i++)
		{
			CompareTo = ToTrim(Ext.toUpperCase());
			By = ToTrim(Extensions[i].toUpperCase());
			if(CompareTo == By)
				return true; 
		}
		return false;
	}
}

function SpecialSecurityFormula(input)
{
	var re1 = /[0-9]/;
	var re2 = /[a-z]/;
	
	if(!re1.test(input))
        return false;
	else if(!re2.test(input))
        return false;
		
	return true;
}

function isSpecial(input)
{
	var iChars = "*|,\":<>[]{}`\';()@&$#%";
	for (var i = 0; i < input.length; i++)
	{
		if (iChars.indexOf(input.charAt(i)) != -1)
		{
			return true;
		}
	}
	return false;
}

function checkArchiveForm(mode)
{
	var deleted = document.frmArchives.chkArchives;
	var hidd = document.frmArchives.HiddArchives;
	var cancel = false;
	
	if (deleted.length != null)
	{
		var i
		for(i = 0; i < deleted.length; i++)
		{
			if(deleted[i].checked == true)
			{
				if(confirm("Are you sure you want to Archive this File?"))
				{
					hidd.value = mode;
					return true;
				}
				else
				{
					cancel = true;
					break;
				}
			}
		}
	}
	else
	{
		if(deleted.checked == true)
		{
			if(confirm("Are you sure you want to Archive this File?"))
			{
				hidd.value = mode;
				return true;
			}
			else
				cancel = true;
		}
	}

	if(!cancel)
	{
		alert(" - Please check at lease one File to Archive!");
		return false;
	}
	return false;
}

function selectOne(id)
{
	var control = document.getElementById(id);
	if(control.value == "[1]")
		control.selectedIndex = 0;
}
