// JavaScript Document

//Date Function
function fCurrentDate()
{
    var days = new Array(7);
	var months = new Array(12);
    days[1] = "Sunday";
    days[2] = "Monday";
    days[3] = "Tuesday"; 
    days[4] = "Wednesday";
    days[5] = "Thursday";
    days[6] = "Friday";
    days[7] = "Saturday";
    
    months[1] = "January";
    months[2] = "February";
    months[3] = "March";
    months[4] = "April";
    months[5] = "May";
    months[6] = "June";
    months[7] = "July";
    months[8] = "August";
    months[9] = "September";
    months[10] = "October"; 
    months[11] = "November";
    months[12] = "December";
    
	today = new Date(); day = days[today.getDay() + 1]
	
    month = months[today.getMonth() + 1]
    
	date = today.getDate()
    
	year=today.getYear(); 
	if (year < 2000)
	year = year + 1900;
	return month + " " + date + ", " + year
}




	//validate Administration
	function fncNewUser(frm)
	{
		/*
			Field Names:
				adminFullname -- Required
				email -- Required	
				cemail -- Must Match
				password -- Required
				cpassword -- Must Match
		*/
		//Admin Full name
		var sAdminFullname = frm.adminFullname.value
		if(sAdminFullname.length==0)
		{
			alert("Please enter your full name");
			frm.adminFullname.focus();
			return false;
		}
		//Check e-mail length
		var semail = frm.email.value
		if(semail.length==0)
		{
			alert("Please enter your e-mail address");
			frm.email.focus();
			return false;
		}
		//check cE-mail length
		var scemail = frm.cemail.value
		if(scemail.length==0)
		{
			alert("Please enter the confirmation e-mail address");
			frm.cemail.focus();
			return false;
		}
		//Compare E-mails
		if(semail!=scemail)
		{
			alert("E-mails do not match!");
			return false;
		}
		//Check Password length
		var spassword = frm.password.value;
		if(spassword.length==0)
		{
			alert("Please enter a password");
			frm.password.focus();
			return false
		}
		//check cPassword Length
		var scpassword = frm.cpassword.value;
		if(scpassword.length==0)
		{
			alert("Please enter a confirmation password");
			frm.cpassword.focus();
			return false;
		}
		//compare passwords
		if(spassword!=scpassword)
		{
			alert("Passwords do not match!!");
			return false;
		}
		/*alert("Ready");
		return false;*/
		return true;
	}
	
	function fncValidateLogin(frm)
	{

		var sEmail = frm.email;
		if(sEmail.value.length==0)
		{
			alert("Please enter in an e-mail");
			sEmail.focus();
			return false;
		}
		if(sEmail.value=="User Email")
		{
			alert("Please enter in an e-mail");
			sEmail.focus();
			return false;
		}
		var sPass = frm.password;
		if(sPass.value.length==0)
		{
			alert("Please enter a password");
			sPass.focus();
			return false;
		}
		if(sPass.value=="Password")
		{
			alert("Please enter a password");
			sPass.focus();
			return false;
		}
		return true;
	}
	function fncValidateForgot(frm)
	{
		var sEmail = frm.email.value;
		if(sEmail.length==0)
		{
			alert("Please fill out your e-mail address");
			frm.email.focus();
			return false;
		}
		/*alert("Ready");
		return false;*/
		return true;
	}


	function fTextBox_FadeOut(txtBx,bIsPWD)
	{
		if(bIsPWD)
			{
				try{
					//txtBx.type="password";
					txtBx.style.display="none";
					document.frmLogin.password.style.display="";
				}catch(e)
				{
					
					//alert("error");
				}
			}
		
		txtBx.style.color="black";
		txtBx.value="";
		
		return;
	}
	
	function fTextBox_FadeIn(txtBx,txtEntry)
	{
		if(txtBx.value.length==0 || txtBx.value==txtEntry)
		{
			txtBx.style.color="#CCCCCC";
			txtBx.value=txtEntry;
		}
		return;
	}
	
	function fncCheckSelection(selTest){
// First Check to see if there is more than one selected
//if there there is then to check to see if any of them are ""
//Deselect them if I can

	selItem = document.getElementById(selTest)

	intSelectCount = 0
//How Many are selected
	for(i=0;i<selItem.options.length;i++)
	{
		if(selItem.options[i].selected)
		{
			intSelectCount++
		}
	}

	if(intSelectCount>1)
	{
		//More than one Selected
		//Now iterate through and if it is "", deselect
		for(i=0;i<selItem.options.length;i++)
		{
			if(selItem.options[i].selected){
				if(selItem.options[i].value=="")
				{
					selItem.options[i].selected=false
				}
		   	 }
		}
	}
}//end function

