var menuState = null;
function printYear(){
	time = new Date();
	document.write(time.getFullYear());
}
function menuHide(id){
	window.clearTimeout(menuState);
	menuState = window.setTimeout(function(){$("servicemenu").hide();},600);
}
function menuShow(){
	window.clearTimeout(menuState);
	$("servicemenu").show();
}
function hilite(element){
	element.style.background = "#009";
}
function lolite(element){
	element.style.background = "none";
}
function rigMenu(){
	$$('ul#nav li').each(function (element){
	    element.observe("mouseover", function(){
	        hilite(this);	
	    });
	    element.observe("mouseout", function(){
	        lolite(this);		
	    });
	});
	//$("serviceheader").stopObserving("mouseover");
	$("serviceheader").observe("mouseover", function(){
		menuShow("servicemenu");
	});
	$("serviceheader").observe("mouseout", function(){
		menuHide("servicemenu");
	});
}
function printEmail(account){
	address = account + "@" + "thecomputerdomain.com";
	document.write('<a href="mailto:' + address + '">' + address + '</a>')
}
function rigFaq(){
	$$("dl#faq dt").each(function (element) {
	    element.observe("click", function() {
	        toggleFaq(this);return false;
	    });
		element.insert({'top' : '<img src="images/expand.png" />'});
	});
	$$("dl#faq dd").each(function (element) {element.hide();});
}
function toggleFaq(element){
	nextElement = element.nextSiblings()[0];
	if(nextElement.visible()){
		element.childElements()[0].writeAttribute("src", "images/expand.png");
		nextElement.hide();
	}else{
		element.childElements()[0].writeAttribute("src", "images/collapse.png");
		nextElement.show();
	}
}
function rigPortfolio(){
	$$("table#portfolio tr td a").each( function(element){
		url = element.readAttribute("href");
		element.writeAttribute("onclick","window.open('" + url + "');return false;");
	});
}
function embedMap(){
	document.write('<iframe width="650" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;q=240+River+St.+Dedham,+MA+02026&amp;sll=42.702863,-71.458661&amp;sspn=0.009903,0.022745&amp;ie=UTF8&amp;s=AARTsJqwpjcq5rvnkTxzEQ1xBz8ksdB52w&amp;ll=42.249868,-71.150551&amp;spn=0.022237,0.036478&amp;z=14&amp;iwloc=addr&amp;output=embed"></iframe>');
}