// Function to remove last border from Top Menus
function removeBorder()
{
	var arrUl = document.getElementsByTagName("ul");
	parentUl = arrUl[0];
	
	//thisChild = parentUl.lastChild;
	//var liElement = thisChild.firstChild;
	//alert("Len: "+parentUl.childNodes.length)
	Arlen = parentUl.childNodes.length;
	demo = "";
	
	if (navigator.appName.indexOf('Microsoft') != -1)
		pos = Arlen - 1;
	else{ 
		pos = Arlen - 1;
	}	
	var liObj = parentUl.childNodes[pos];
	liObj.style.background = "none";
	//thisChild.style.border = "none";
}

/**
 * Verifies if the string is in a valid email format
 * @param	string
 * @return	boolean
 */
function isEmail( text )
{
	var pattern = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
	var regex = new RegExp( pattern );
	return regex.test( text );
}

// LTrim(string) : Returns a copy of a string without leading spaces.
function ltrim(str)
{
   var whitespace = new String(" \t\n\r");
   var s = new String(str);
   if (whitespace.indexOf(s.charAt(0)) != -1) {
      var j=0, i = s.length;
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;
      s = s.substring(j, i);
   }
   return s;
}

//RTrim(string) : Returns a copy of a string without trailing spaces.
function rtrim(str)
{
   var whitespace = new String(" \t\n\r");
   var s = new String(str);
   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      var i = s.length - 1;       // Get length of string
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;
      s = s.substring(0, i+1);
   }
   return s;
}

// Trim(string) : Returns a copy of a string without leading or trailing spaces
function trim(str) {
   return rtrim(ltrim(str));
}




//validate comment entry form data.
function checkCommentFrm(objFrm){
	if(objFrm.author.value == ""){
		alert("Please enter your name!");
		objFrm.author.focus();
		return false;		
	}
	if(objFrm.email.value == ""){
		alert("Please enter your Email address!");
		objFrm.email.focus();
		return false;		
	}else if (!isEmail( objFrm.email.value )) {
		alert ('Please enter valid Email address.');
		objFrm.email.focus();
		return false;			
	}
	if(objFrm.comment.value == ""){
		alert("Please enter your comment!");
		objFrm.comment.focus();
		return false;		
	}
	
	
	
}

function AdmincheckCommentFrm(objFrm){
	if(objFrm.comment.value == ""){
		alert("Please enter your comment!");
		objFrm.comment.focus();
		return false;		
	}
}
