


	/*-------------------
	Validates email input
	-------------------*/
	function validatemail(inputname, DivName, ErrorMessage)
	{
	
		var submit = true
		//var formname = "SignIn"
		var email = ""
		
		//	Browser type
		bname = navigator.appName

		NNemail = MM_findObj(inputname);
		email = NNemail.value;
							
		//		email address regular expression
		var re = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
		
						
		// Check an input has been passed for the email address
		if(email == "")
		{
			submit = false;
			showerror(DivName, true);
		}
		//	Test email aginst regular expression
		else if(re.test(email) != true)
		{
			submit = false;	
			showerror(DivName, true, ErrorMessage);
		}
		else
		{
			showerror(DivName, false, ErrorMessage);
		}	
		
		return submit;		
	}

	/*-------------------
	Validates password input
	-------------------*/
	function validateInput(inputname, DivName, ErrorMessage)
	{
		var submit = true;
		
		NNInput = MM_findObj(inputname);
		InputString = NNInput.value;

		//	Check Password Length
		if(InputString.length < 1)
		{
			showerror(DivName, true, ErrorMessage);	
		}
		else
		{
			showerror(DivName, false, ErrorMessage);
		}
		return submit;
	}

	/*-------------------
	Validates password input
	-------------------*/
	function validatepassword(inputname, DivName, ErrorMessage)
	{
		var submit = true;
		var password = "";
		
		NNpassword = MM_findObj(inputname);
		password = NNpassword.value;

		//	Check Password Length
		if(password.length < 6)
		{
			showerror(DivName, true, ErrorMessage);	
		}
		else
		{
			showerror(DivName, false, ErrorMessage);
		}
		return submit;
	}
	
	/*-------------------
	Validates a radio button group
	
	pass in the name of the group, and the error control that you want to show
	-------------------*/
	function validateRadioButtonGroup(inputname, ErrorDiv)	
	{
		//alert("entering validateRadioButtonGroup");
		var bIsGroupChecked = false;
		
        for(var j = 0 ; j < xbGetElementById(inputname).length ; ++j) 
        {
			if(xbGetElementById(inputname)[j].checked)
			{
                bIsGroupChecked = true; 
                //alert("checked button found");   
                break;                     
            }
        }
        
        if(!bIsGroupChecked)
        {
			//alert("checking not found "+ ErrorDiv);
			changeObjectVisibility(ErrorDiv, 'visible');
			return false;
        }
        
        return true;

	}
	
	function getStyleObject(objectId) 
{
	// cross-browser function to get an object's style object given its id
	if(document.getElementById && document.getElementById(objectId)) 
	{
		// W3C DOM
		return document.getElementById(objectId).style;
	} 
	else if (document.all && document.all(objectId)) 
	{
		// MSIE 4 DOM
		return document.all(objectId).style;
	} 
	else if (document.layers && document.layers[objectId]) 
	{
		// NN 4 DOM.. note: this won't find nested layers
		return document.layers[objectId];
	} 
	else
	{
		return false;
	}
} 

function changeObjectVisibility(objectId, newVisibility) 
{
	// get a reference to the cross-browser style object and make sure the object exists
	var styleObject = getStyleObject(objectId);
	if(styleObject) 
	{
		styleObject.visibility = newVisibility;
		return true;
	} 
	else 
	{
		// we couldn't find the object, so we can't change its visibility
		return false;
	}
}




/*********************************  STANDARD FUNCTIONS   ***************************/








/*-------------------
	make div visable?
	-------------------*/
	function showerror(strDivName, visable)
	{
		
		getStyleObject(strDivName);
		
		
		
		if(visable == false)
		{
			
			changeObjectVisibility(strDivName, "hidden");	
							
		}
		else
		{
			changeObjectVisibility(strDivName, "visible");
		}
	}

	function SetBar(ImageName)
	{
	document.all.bar.src = ImageName
	}

	function NoBar ()
	{
	document.all.bar.src = "../images/site/1.gif"
	}

	/*-------------------
	cross browser compatability of div visability
	-------------------*/
	function getStyleObject(objectId) 
	{
		// cross-browser function to get an object's style object given its id
		if(document.getElementById && document.getElementById(objectId)) 
		{
			// W3C DOM
			return document.getElementById(objectId).style;
		} 
		else if (document.all && document.all(objectId)) 
		{
			// MSIE 4 DOM
			return document.all(objectId).style;
		} 
		else if (document.layers && document.layers[objectId]) 
		{
			// NN 4 DOM.. note: this won't find nested layers
			return document.layers[objectId];
		} 
		else
		{
			return false;
		}
	} 

	function changeObjectVisibility(objectId, newVisibility) 
	{
		// get a reference to the cross-browser style object and make sure the object exists
		var styleObject = getStyleObject(objectId);
		if(styleObject) 
		{
			styleObject.visibility = newVisibility;
			return true;
		} 
		else 
		{
			// we couldn't find the object, so we can't change its visibility
			return false;
		}
	}
	
	function moveObject(objectId, newXCoordinate, newYCoordinate) 
	{
		// get a reference to the cross-browser style object and make sure the object exists
		var styleObject = getStyleObject(objectId);
		if(styleObject) 
		{
			styleObject.left = newXCoordinate;
			styleObject.top = newYCoordinate;
			return true;
		} 
		else 
		{
			// we couldn't find the object, so we can't very well move it
			return false;
		}
	} 
	
	
	/*----------------
	  Detect if the user has hit the enter button
	  and raise click event on button.
	-------------------*/
	function Button_OnClick(Button_Name)
	{
		//	if the event is equal to the return key then fire button				
		if(event.keyCode == '13')
		{
			Button = MM_findObj(Button_Name);
			Button.click();
		}
		return false;
	}	
	

	/*----------------
	  For the search box.  Only clear the box if the default value is in it.
	-------------------*/
	function searchTextboxClick(tbID)
	{
		if(xbGetElementById(tbID).value == 'enter keywords')
		{
			xbGetElementById(tbID).value = '';
		}
	
		
	}