function checkEmail(email) {
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.toLowerCase())) {
  return true;
 } else {
  return false;
 }
}

var show = new Array();
show['about']=0;
show['why']=0;
show['services']=0;
show['approach']=0;
show['support']=0;
show['materials']=0;
show['design']=0;
show['workmanship']=0;

function showMenu(object,level) {
	hideAll(level);
	show[object]=1;
 document.getElementById("dd_"+object).style.visibility="visible";
	document.getElementById(object).style.backgroundColor="#b6cd18";
	document.getElementById(object).style.color="#ffffff";
}
function hideMenu(object) {
	if (show[object]==0) {
  document.getElementById("dd_"+object).style.visibility="hidden";
 	document.getElementById(object).style.backgroundColor="";
 	document.getElementById(object).style.color="";
	}
}
function preHide(object) {
 show[object]=0;
 setTimeout("hideMenu('"+object+"')",500);
}
function hideAll(level) {
	if (level<2) {
		show['about']=0;
		show['why']=0;
		show['services']=0;
		show['approach']=0;
		show['support']=0;
		hideMenu('about');
		hideMenu('why');
		hideMenu('services');
		hideMenu('approach');
		hideMenu('support');
	}
	show['materials']=0;
	show['design']=0;
	show['workmanship']=0;
	hideMenu('materials');
	hideMenu('design');
	hideMenu('workmanship');
}

var largerDivOn=0;
var posy=0;
var posx=0;
var screenRight=0;
var screenBot=0;
function showLarger(pic) {
 largerDivOn=1;
 document.getElementById('largerPic').src=pic;
 document.getElementById('largerDiv').style.visibility='visible';
 document.getElementById('largerPic').style.width="auto";
 document.getElementById('largerPic').style.height="auto";
}
 
function hideLarger() {
 largerDivOn=0;
 setTimeout("if (largerDivOn==0) document.getElementById('largerDiv').style.visibility='hidden';",100);
 document.getElementById('largerPic').style.width="400px";
 document.getElementById('largerPic').style.height="300px";
 document.getElementById('largerPic').src="img/blank.gif";
}
 
function slideLarger(e) {
 if (largerDivOn) {
  getMousePos(e);
  positionDiv();
 }
}
 
function positionDiv() {
	var width=document.getElementById('largerDiv').offsetWidth+20;
	var height=document.getElementById('largerDiv').offsetHeight+20;
 if (screenRight>width) //place on the left;
	 document.getElementById('largerDiv').style.left=posx+20+"px";
	else //place on the right
	 document.getElementById('largerDiv').style.left=posx-width+"px";
	if (screenBot>height) //place on the bottom;
	 document.getElementById('largerDiv').style.top=posy+20+"px";
	else //place on the top
	 document.getElementById('largerDiv').style.top=posy-height+"px";
}
 
function getMousePos(e) {
 //get mouse x and y coordinates
 if (!e) var e = window.event;
 if (e.pageX || e.pageY) {
  posx = e.pageX;
  posy = e.pageY;
  window.innerWidth, window.innerHeight
  screenRight=window.innerWidth-posx+window.pageXOffset;
  screenBot=window.innerHeight-posy+window.pageYOffset;
 } else if (e.clientX || e.clientY) {
  posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
  posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
  if (document.documentElement.clientHeight) {
   screenRight=document.documentElement.clientWidth-posx+document.documentElement.scrollLeft;
   screenBot=document.documentElement.clientHeight-posy+document.documentElement.scrollTop;
		} else {
			screenRight=document.body.clientWidth-posx;
   screenBot=document.body.clientHeight-posy;
		}
 }
}