
function get_date() {
	var mydate=new Date()
	var year=mydate.getYear()
	if (year < 1000)
		year+=1900
	var day=mydate.getDay()
	var month=mydate.getMonth()
	var daym=mydate.getDate()
	if (daym<10)
	daym="0"+daym
	var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
	var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
	return dayarray[day]+", "+montharray[month]+" "+daym+", "+year;
}

function rotate_testimonial() {
  if(document.getElementById("testimonials")) {
		x = Math.round(Math.random() * testimonials.length) - 1;
		if(x < 0) {
			x = 0;
		}
    document.getElementById("testimonials").innerHTML = testimonials[x];
    setTimeout("rotate_testimonial()", 16000);
  }
}

var testimonials = new Array("<span class=\"quote\">&quot;</span> Small is beautiful for commerical condo developer Antrim Construction's 31,000 square-foot commercial condo development in Livermore. <span class=\"quote\">&quot;</span><span class=\"by\">East Bay Business Times</span>","<span class=\"quote\">&quot;</span> Trust. Probably the most significant aspect of our building project was the mutual trust and respect we developed with Antrim. As they said, their job is to worry the construction details, ours is to make sure we have the money. <span class=\"quote\">&quot;</span><span class=\"by\">B. Unyall<br/>Livermore, Ca</span>","<span class=\"quote\">&quot;</span> We wanted to thank you again for the outstanding work completed for our business . . we were greatly impressed with your attention to detail, and follow-through by very competent staff on the myriad of details accompanying any buildout. Again, thanks for a beautiful space which we are thrilled to share with our staff and patients. <span class=\"quote\">&quot;</span><span class=\"by\">Amy Liu Longacre<br/>Foothill Optometric, Pleasanton</span>","<span class=\"quote\">&quot;</span> Owners with vision are choosing to accomplish an ever increasing percentage of their design and construction requirements using design-build. <span class=\"quote\">&quot;</span><span class=\"by\">Design Build Institute of America</span>","<span class=\"quote\">&quot;</span> Although any construction project can be trying for a small business, I must say my experience with Antrim was fantastic... All were outstanding to work with and I would recommend their team to anyone without hesitation. <span class=\"quote\">&quot;</span><span class=\"by\">Tom Marcel, DDS<br/>Livermore, Ca</span>","<span class=\"quote\">&quot;</span> Trust. Probably the most significant aspect of our building project was the mutual trust and respect we developed with Antrim. As they said, their job is to worry the construction details, ours is to make sure we have the money. <span class=\"quote\">&quot;</span><span class=\"by\">Brian Unyall</span>");


window.onload = function() {
	rotate_testimonial();
	document.getElementById('date').innerHTML = get_date();
	document.getElementById('nav').style.height = '1800px';
	var height = getElementHeight("content") + "px";
	document.getElementById('nav').style.height = height;
}

function checkContact() {
  var email_filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+/;
	var phone_filter  = /^((\+\d{1,3}(-|\.| )?\(?\d\)?(-|\.| )?\d{1,5})|(\(?\d{2,6}\)?))(-|\.| )?(\d{3,4})(-|\.| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/;
  var error = '';

	var name = document.getElementById('name').value;
	var email = document.getElementById('email').value;
	var phone1 = document.getElementById('phone_1').value;
	var phone2 = document.getElementById('phone_2').value;

  //error = 'check_vals: ' + check_vals + '\n';

  if (name == '') {
    error += "A name is required.\n";
	}
	
	if (email == '') {
    error += "An e-mail address is required.\n";
  } else if (email != '' && !email_filter.test(email)) {
    error += "A valid e-mail address is required.\n";
  }
	if (phone1 == '') {
		error += "A phone number 1 is required.\n";
	} else if (phone1 != '' && !phone_filter.test(phone1)) {
		error += "A valid phone number 1 is required.\n";
	}
	
	if (phone2 != '' && !phone_filter.test(phone2)) {
		error += "A valid phone number 2 is required.\n";
	}

  if(error != '') {
    alert(error);
    return false;
  } else {
    return true;
  }
}

function getElementHeight(Elem) {
  if(document.getElementById) {
    var elem = document.getElementById(Elem);
  } else if (document.all){
    var elem = document.all[Elem];
  }
  
  xPos = elem.offsetHeight;

  return xPos;
}