
function extractPageName(hrefString)
{
	var arr = hrefString.split('.');
	arr = arr[arr.length-2].split('/');
	return arr[arr.length-1].toLowerCase();		
}

function setActiveMenu(arr, crtPage)
{
	for(var i=0; i < arr.length; i++)
		if(extractPageName(arr[i].href) == crtPage)
		{
			arr[i].className = "current";

		}
}

function setPage()
{
	if(document.location.href) 
		hrefString = document.location.href;
	else
		hrefString = document.location;

	if (document.getElementById("sidebar1")!=null) 
		setActiveMenu(document.getElementById("sidebar1").getElementsByTagName("a"), extractPageName(hrefString));
}

function isBlank(strValue){
                     strValue = strValue.replace(/\s+/g,"");

                     if (strValue.length <= 0) {
                         return true;
                     } else {
                         return false;
                     }
}

function validate(){

	var error = "Please correct the following:\n\n";
	var errorCount = 0;

                    if (isBlank(document.searchForm.firstname.value)) {
                         error = error + "Please provide a value for First Name." + "\n";
                         errorCount++;
                     }
					 
                    if (isBlank(document.searchForm.lastname.value)) {
                         error = error + "Please provide a value for Last Name." + "\n";
                         errorCount++;
                     }
					 
					if (isBlank(document.searchForm.title.value)) {
                         error = error + "Please provide a value for Title." + "\n";
                         errorCount++;
                     }
					 
                    if (isBlank(document.searchForm.company.value)) {
                         error = error + "Please provide a value for Company Name." + "\n";
                         errorCount++;
                     }
					 
					if (isBlank(document.searchForm.address1.value)) {
                         error = error + "Please provide a value for Address." + "\n";
                         errorCount++;
                     }
					
					if (isBlank(document.searchForm.city.value)) {
                         error = error + "Please provide a value for City." + "\n";
                         errorCount++;
                     }
					
					if (isBlank(document.searchForm.state.value)) {
                         error = error + "Please provide a value for State." + "\n";
                         errorCount++;
                     }
					 
                    if (isBlank(document.searchForm.email.value)) {
                         error = error + "Please provide a value for Email." + "\n";
                         errorCount++;
                     }

	if (errorCount > 0){
		alert(error);
		return false;
	}else{
		return true;
	}//##End Error Check If

}//##End Function Validate