// JavaScript Document
    /*Used For Checking And Unchecking All Checkboxes*/
	var checkflag = "false";
	function check(field) 
	{
		if (checkflag == "false"){
			for (i = 0; i < field.length; i++) 			
				field[i].checked = true;			
			checkflag = "true";}
		else{
			for (i = 0; i < field.length; i++) 
				field[i].checked = false; 
			checkflag = "false";}
	}

    /*Used For Opening New Windows*/
	function openWindow(doc,name,features) 
	{
      win = window.open(doc,name,features);
	  win.focus();
    }
	
	/*Used For Changing Element Classes*/
	function changeClass(obj, newClass)
	{
		obj.className = newClass;
	}
	
	/*Confirm Delete Mail*/
	function deleteMail()
	{
		return confirm("Are You Sure You Want To Delete These Messages?");
	}
	
	function deleteSentMail()
	{
		return confirm("Are You Sure You Want To Delete These Messages Permanently From Sent Items?");
	}
	
	function deleteSingleMail()
	{
		return confirm("Are You Sure You Want To Delete This Message?");
	}
	
	function deleteMailPerm()
	{
		return confirm("Are You Sure You Want To Delete These Messages Permanently?");
	}
	
	function deletePosting()
	{
		return confirm("Are You Sure You Want To Delete This Posting?");
	}
	
	function deleteGroup()
	{
		return confirm("Are You Sure You Want To Delete This Group?\nUsers from this group will need to be reassigned!!");
	}
	
	function logOut()
	{
		return confirm("Are You Sure You Want To Log Out?");
	}
	
	function userPending(obj)
	{
		error=false;
		if(obj.user.selectedIndex==-1)
		{
			obj.user.className = "formError";			
			error=true;
		}
		if(obj.group.value==""&&obj.status[1].checked==false)
		{
			obj.group.className = "formError";		
			error=true;
		}
		else
			obj.group.className = "";
		if(obj.status[0].checked==false&&obj.status[1].checked==false)
		{
			obj.status[0].className = "formError";
			obj.status[1].className = "formError";
			error=true;
		}
		else if(obj.status[0].checked==true&&error==false)
		{
			choice = confirm("Are you sure you want to approve this user?");
		}
		else if(obj.status[1].checked==true&&error==false)
		{
			choice = confirm("Are you sure you want to deny this user?");
		}
				
		if(error==true)
		{
			alert("There is an error with your form entry!\nPlease check all fields marked in red and try again.");
			return false;
		}
		else
			return choice;
	}
	
	function approveDeny(obj)
	{
		obj.status[0].className = "";
		obj.status[1].className = "";
	}
	
	function userCurrent(obj)
	{		
		numElements = obj.length;
		error = false;

		for(i=0;i<numElements;i++)
		{
		    if(obj[i].className=="formError"&&obj.status.checked==false)
		    {	
			    error=true;
		    }
		    else if(obj[i].className=="formRequired"&&obj[i].value==""&&obj.status.checked==false)
		    {
				obj[i].className="formError";	
		     	error=true;			  	
		    }
		}
		
		if(obj.user.selectedIndex==-1)
		{
			obj.user.className = "formError";			
			error=true;
		}
		if(obj.group.value==""&&obj.status.checked==false)
		{
			obj.group.className = "formError";		
			error=true;
		}
		else
			obj.group.className = "";
		
		if(obj.status.checked==true&&error==false)
		{
			choice = confirm("Are you sure you want to delete this user?");
		}
					
				
		if(error==true)
		{
			alert("There is an error with your form entry!\nPlease check all fields marked in red and try again.");
			return false;
		}
		else if(obj.status.checked==true)
			return choice;			
		else
			return true;
	}

	function callme(field){

		var single ="'";
		var double ="\"";

		if(document.getElementById(field).value.indexOf(single)!=-1){
			document.getElementById(field).value = '';
		}

		if(document.getElementById(field).value.indexOf(double)!=-1){
			document.getElementById(field).value = '';
		}

	}