
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 commercial condo developer Antrim Group and Southfront Investors for Design and Construction of their 31,000 square-foot commercial condo development in Livermore.<span class=\"quote\">&quot;</span><br /><span class=\"by\">East Bay Business Times</span>","<span class=\"quote\">&quot;</span> It is my pleasure to give my highest  recommendation to Jeff Antrim and Proforma Construction. His work speaks for itself. I particularly like his style, efficient yet meticulous and dedication throughout our project.  I trusted his judgment calls and experience and can truly say Jeff and his staff  put us at ease and pulled it all together for us. <span class=\"quote\">&quot;</span><span class=\"by\">Cacie Mularchuk <br/>Ashford Real Estate<br />Agent  for Sports and Pain Management Medial Group<br />Pleasanton,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 on the myriad of details accompanying any build out. 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\">Dr. Liu-Longacre / Dr. Liu<br/>Foothill Optometric<br /> Pleasanton, CA</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 Jeff Antrim was fantastic... Everyone involved on the team was outstanding to work with and I would recommend them to anyone without hesitation. <span class=\"quote\">&quot;</span><span class=\"by\">Dr. Tom Marcel<br/>Marcel Orthodontics Group<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\">Dr. Brian Mayall<br/>Unitarian Universalistic Church<br />Livermore, CA </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;
}