	//add function which disables the form upon submit press
	allowSubmit = true;	
	function disableForm() 
	{
		for ( var i = 0; i < document.forms.length ; i++) {
			for ( var j = 0; j < document.forms[i].length ; j++) {
				var formElement = document.forms[i].elements[j];	
				formElement.style.color = '#999999';
				formElement.readOnly = true;	
			}
		}
		var allow = allowSubmit;
		allowSubmit = false;
		return allow;
	}
	
	//Does not allow space
	function CheckNotAllowSpace(inputValue)
	{
		var objRegExp  = /^[a-zA-Z0-9!@#$%^&*?_]+$/;
		return objRegExp.test(inputValue);
	}
	
	//Does not allow space
	function CheckPhoneNo(inputValue)
	{
		var objRegExp  = /^[0-9]+$/;
		return objRegExp.test(inputValue);
	}	
	
	function rightTrim( strValue ) 
	{
		var objRegExp = /^([\w\W]*)(\b\s*)$/;
		if(objRegExp.test(strValue)) 
		{
			strValue = strValue.replace(objRegExp, '$1');
		}
		return strValue;
	}
	
	function leftTrim( strValue ) 
	{
		var objRegExp = /^(\s*)(\b[\w\W]*)$/;
		if(objRegExp.test(strValue)) 
		{
			strValue = strValue.replace(objRegExp, '$2');
		}
		return strValue;
	}
	
	function trimAll( strValue ) 
	{
		var objRegExp = /^(\s*)$/;
		if(objRegExp.test(strValue)) 
		{
		   strValue = strValue.replace(objRegExp, '');
		   if( strValue.length == 0)
			  return strValue;
		}
	   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
	   if(objRegExp.test(strValue)) 
	   {
		   strValue = strValue.replace(objRegExp, '$2');
		}
		return strValue;
	}
	
	function ValidateEmail(inputvalue)
	{	
		var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
		return  pattern.test(inputvalue);
	}
	
    function getDayInMonth(year, month)
     {
		if (month == 2)
		{
			  if (year % 4 == 0 && (year <= 1582 || (year % 100 != 0 || year % 400 == 0)))
			  {
					return 29;
			  }
			  return 28;
		}
		if (month > 7) month ++;
		return (month % 2 == 0) ? 30 : 31;
     }
      
	function isValidDate(year, month, date)
	{
		for (i = 0; i < arguments.length; i++)
		{
			  if (isNaN(arguments[i]) || arguments[i] < 1) return false;
		}
		if (month > 12 || date > getDayInMonth(year, month)) return false;
	
		return true;
	}	

	function roll_over(img_name, img_src)
   	{
   		document[img_name].src = img_src;
   	}
	
	/*	Alert password strength	*/
	function passwordStrength(password)
	{
		var desc = new Array();
		desc[0] = "Very Weak";
		desc[1] = "Weak";
		desc[2] = "Better";
		desc[3] = "Medium";
		desc[4] = "Strong";
		desc[5] = "Strongest";
	
		var score   = 0;
	
		//if password bigger than 6 give 1 point
		if (password.length > 6) score++;
	
		//if password has both lower and uppercase characters give 1 point	
		if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++;
	
		//if password has at least one number give 1 point
		if (password.match(/\d+/)) score++;
	
		//if password has at least one special caracther give 1 point
		if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) )	score++;
	
		//if password bigger than 12 give another 1 point
		if (password.length > 12) score++;
	
		 document.getElementById("passwordDescription").innerHTML = desc[score];
		 document.getElementById("passwordStrength").className = "strength" + score;
	}
	
/*	Dynamic Layers		*/
function writeContent(id,text) 
{
	var layer = browser(id);  //get path to layer using global browser function
	var content;
	content = '<table border=0 bgcolor=\'#000000\'>'+
	'<tr><td width=\'100%\'>'+
	'<table border=0 width=\'100%\' bgcolor=\'#ffcc33\'>'+
	'<tr><td width=\'100%\'>' + text + '</td></tr>'+ //arg 'text' used here
	'</table>'+
	'</td></tr></table>';

	if(nn4) 
	{	
		layer.document.open();
		layer.document.write(content); //write content to layer
		layer.document.close();
		layer.visibility="visible";	//change visibility to visible
	}
	else 
	{		     
		layer.innerHTML = content;  //write content to layer
		layer.style.visibility="visible";	//change visibility to visible
	}
}
/*	Dynamic Layers		*/
function hideLayer(id) 
{
	var layer = browser(id)	
	if(!nn4)
	{
		layer.style.visibility="hidden"	;
	}
	else
	{
		layer.visibility="hidden";
	}
}



