<!--

// Get today's date ________________________________________________________________________________
var allmonths=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var tdate=new Date();
var wholedate;
wholedate=allmonths[tdate.getMonth()] + " " + tdate.getDate() + ", " + tdate.getYear();
// _________________________________________________________________________________________________

if (document.images) {
  image1on = new Image();
  image1on.src = "images/btn1b.gif";

  image2on = new Image();
  image2on.src = "images/btn2b.gif";

  image3on = new Image();
  image3on.src = "images/btn3b.gif";

  image4on = new Image();
  image4on.src = "images/btn4b.gif";

  image5on = new Image();
  image5on.src = "images/btn5b.gif";

  image6on = new Image();
  image6on.src = "images/btn6b.gif";

  image1off = new Image();
  image1off.src = "images/btn1a.gif";

  image2off = new Image();
  image2off.src = "images/btn2a.gif";

  image3off = new Image();
  image3off.src = "images/btn3a.gif";

  image4off = new Image();
  image4off.src = "images/btn4a.gif";

  image5off = new Image();
  image5off.src = "images/btn5a.gif";

  image6off = new Image();
  image6off.src = "images/btn6a.gif";
  
  otherImageDefault = new Image();
  otherImageDefault.src = "images/a.gif";

  otherImage1 = new Image();
  otherImage1.src = "images/a1.gif";

  otherImage2 = new Image();
  otherImage2.src = "images/a2.gif";

  otherImage3 = new Image();
  otherImage3.src = "images/a3.gif";
  
  otherImage4 = new Image();
  otherImage4.src = "images/a4.gif";

  otherImage5 = new Image();
  otherImage5.src = "images/a5.gif";

  otherImage6 = new Image();
  otherImage6.src = "images/a6.gif";

}

function changeImages() {
  if (document.images) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
    }
  }
}
function check_contact_form() {
	if (document.contact_form.contact.value=='') {
		alert("Please provide the name of the person for us to contact regarding your question or comment.");
		document.contact_form.contact.focus();
	}
	else if (document.contact_form.phone.value=='') {
		alert("Please provide a phone number we can reach the contact person at.");
		document.contact_form.phone.focus();
	}
	else if (document.contact_form.phone.length<10) {
		alert("Please include the area code in the phone number.");
		document.contact_form.phone.focus();
	}
	else if (document.contact_form.topic.value=='') {
		alert("Please select the topic of you question or comment.");
		document.contact_form.topic.focus();
	}
	else if (document.contact_form.question.value=='') {
		alert("Please provide at least a brief question or comment.");
		document.contact_form.question.focus();
	}
	else {
		document.contact_form.submit();
	}
}

function check_login() {
	if (document.loginForm.username.value=='') {
		alert("You must enter your username!");
		document.loginForm.username.focus();		
	}
	else if (document.loginForm.password.value=='') {
		alert("You must enter you password!");
		document.loginForm.password.focus();
	}
	else {
		document.loginForm.submit();
	}
}

function getEmail() {
	email = prompt("Enter your email address:","");
	window.self.location.href = "http://www.youngbuilders.com/admin/Login.cfm?action=sendEmail&email=" + email;
}

function check_project_form() {
	var obj;
	obj = document.project_form;
	if  (obj.project_name.value=='') {
		alert("You must provide the name of the project!");
		obj.project_name.focus();
	}
	else if (obj.contractor.value==''&&obj.owner.value==''&&obj.ownerAgent.value==''&&obj.architect.value=='') {
		alert("You must provide either the contractor or the owner of the project!");
		obj.project_name.focus();
	}
	else if (obj.scope.value=='') {
		alert("You must provide the scope of the project!");
		obj.scope.focus();
	}
	else if (obj.square_footage.value=='') {
		alert("You must provide the square footage of the project!");
		obj.square_footage.focus();
	}
	else if (obj.status.value=='') {
		alert("You must select the status of the project!");
		obj.status.focus();
	}
	else if (obj.status.value=='Current'&&(obj.scheduled_completion.value==''||obj.scheduled_completion.value.length<7)) {
		alert("You must provide the scheduled completion date of the project!");
		obj.scheduled_completion.focus();
	}
	else if (obj.status.value=='Past'&&(obj.actual_completion.value==''||obj.actual_completion.value.length<7)) {
		alert("You must provide the actual completion date of the project!");
		obj.actual_completion.focus();
	}
	else {
		obj.submit();
	}
}

function make_complete(p_id) {
	var date, action;
	date = prompt("Enter the date that this project was actually completed.\n\n i.e.- January 1, 2003","");
	if (date=='') {
		action = confirm("You did not enter a valid date. If you would like to continue, click 'Yes' if not click 'No'");
		if (action==true) {
			makeComplete(p_id);
		}		
	}
	else {
		window.self.location.href = 'adminProjects.cfm?action=makeComplete&date=' + date + '&p_id=' + p_id;
	}
}

// -->
