/****** Menu Rollover ******/
function menuRoll(name,roll) {
	if (document.getElementById(name).className=='current') return;
	if (document.getElementById(name)) {
		if (roll) document.getElementById(name).style.background='#EAEEF2 url(/images/bulletMenuRoll.gif) no-repeat 178px center';
		else document.getElementById(name).style.background='#FFFFFF url(/images/bulletMenu.gif) no-repeat 178px center';
	}
}

/****** You Are Here ******/
function onbodyload() {
	if (!window.youarehere || !window.initscroll) {
		setTimeout("onbodyload",100);
	} else {
		youarehere();
		initscroll();
	}
	
	if (navigator.userAgent.match(/Safari/i) && document.getElementById("x"))	 {
		document.getElementById("x").src=document.getElementById("x").src.replace("x.gif","xRoll.gif");
		document.getElementById("xRoll").src=document.getElementById("xRoll").src.replace("xRoll.gif","x.gif");
	}
}

function youarehere() {
	var path = window.location.pathname;
	
			/****** Header ******/
		if (path.slice(0,10) == '/portfolio')
			document.getElementById('portfolio').style.color='#FFFFFF';
		if (path.slice(0,9) == '/services')
			document.getElementById('services').style.color='#FFFFFF';
		if (path.slice(0,5) == '/news')
			document.getElementById('news').style.color='#FFFFFF';
		if (path.slice(0,6) == '/about')
			document.getElementById('about').style.color='#FFFFFF';
		if (path.slice(0,11) == '/employment')
			document.getElementById('employment').style.color='#FFFFFF';
		if (path.slice(0,13) == '/affiliations')
			document.getElementById('affiliations').style.color='#FFFFFF';
		if (path.slice(0,8) == '/contact')
			document.getElementById('contact').style.color='#FFFFFF';
			
			/****** Portfolio ******/
		if (path.slice(10,17) == '/retail')
			document.getElementById('retail').className='current';
		if (path.slice(10,19) == '/shopping')
			document.getElementById('shopping').className='current';
		if (path.slice(10,22) == '/restaurants')
			document.getElementById('restaurants').className='current';
		if (path.slice(10,21) == '/commercial')
			document.getElementById('commercial').className='current';
		if (path.slice(10,20) == '/interiors')
			document.getElementById('interiors').className='current';
		if (path.slice(10,22) == '/residential')
			document.getElementById('residential').className='current';
			
			/****** Services ******/
		if (path.slice(9,23) == '/architectural')
			document.getElementById('architectural').className='current';
		if (path.slice(9,19) == '/interiorss')
			document.getElementById('interiorss').className='current';
		if (path.slice(9,21) == '/engineering')
			document.getElementById('engineering').className='current';
		if (path.slice(9,21) == '/specialties')
			document.getElementById('specialties').className='current';
			
			/****** News ******/
		if (path.slice(5,14) == '/articles')
			document.getElementById('articles').className='current';
		if (path.slice(5,12) == '/awards')
			document.getElementById('awards').className='current';
		if (path.slice(5,12) == '/events')
			document.getElementById('events').className='current';
			
			/****** About Us ******/
		if (path.slice(6,14) == '/history')
			document.getElementById('history').className='current';
		if (path.slice(6,16) == '/licensing')
			document.getElementById('licensing').className='current';
			
			/****** Employment ******/
		if (path.slice(11,19) == '/culture')
			document.getElementById('culture').className='current';
		if (path.slice(11,19) == '/careers')
			document.getElementById('careers').className='current';
		if (path.slice(11,17) == '/apply')
			document.getElementById('apply').className='current';
}

/****** Portfolio Photo Swap ******/
function photoSwap(name) {
	document.getElementById('current').src='images/' + name + '.jpg';
}

/****** Staff Photo Popup ******/
function hideWhiteout() {
	document.getElementById("whiteoutDiv").style.visibility="hidden";
}

function showWhiteout() {
	if (!navigator.userAgent.match(/Safari/i))	document.getElementById("whiteoutDiv").style.visibility="visible";
}

function closeStaffPopup() {
	document.getElementById('staffPhotoWrap').style.visibility = 'hidden';
	document.getElementById('staffImage').src = "";
	document.getElementById('staffImage').alt = "";
	document.getElementById('staffLabel').innerHTML = "";
	document.getElementById('xRoll').style.visibility='';
	hideWhiteout();
}

function openStaffPopup(image, name) {
	
	document.getElementById('staffImage').src = "/about/staff/images/" + image + ".jpg";
	document.getElementById('staffImage').alt = name;
	document.getElementById('staffLabel').innerHTML = name;
	
	document.getElementById('staffPhotoWrap').style.visibility = 'visible';
	
	showWhiteout();	
}

function writeWhiteout() {
	document.write('<div class="whiteout" id="whiteoutDiv">');
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="whiteoutObject">');
	document.write('<PARAM NAME="movie" VALUE="/images/whiteout.swf">');
	document.write('<PARAM NAME="quality" VALUE="high">');
	document.write('<PARAM NAME="scale" VALUE="exactfit">');
	document.write('<PARAM NAME="wmode" VALUE="transparent">');
	document.write('<PARAM NAME="bgcolor" VALUE="#ffff">');
	document.write('<EMBED src="/images/whiteout.swf" quality="high" scale="exactfit" wmode="transparent" bgcolor="#ffffff" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" id="whiteoutEmbed"></EMBED>');
	document.write('</OBJECT>');
	document.write('</div>');
}

/****** Browser Detection ******/
// CSS Browser Selector   v0.2.5
// Documentation:         http://rafael.adm.br/css_browser_selector
// License:               http://creativecommons.org/licenses/by/2.5/
// Author:                Rafael Lima (http://rafael.adm.br)
// Contributors:          http://rafael.adm.br/css_browser_selector#contributors
var css_browser_selector = function() {
	var 
		ua=navigator.userAgent.toLowerCase(),
		is=function(t){ return ua.indexOf(t) != -1; },
		h=document.getElementsByTagName('html')[0],
		b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('gecko/')? 'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',
		os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';
	var c=b+os+' js';
	h.className += h.className?' '+c:c;
}();

/****** MailMe ******/
/*** Usage: <a href="javascript:void(0);" onClick="MailMe('contact','subject','body');">Contact Us</a> ***/
function MailMe(name,subj,body)
{
  var domain = 'herschmanarchitects.com';
  var q = ((subj||body)?'?':'');
  if (subj) q=q+'subject='+subj;
  if (subj&&body) q=q+'&';
  if (body) q=q+'body='+body;
  window.location = 'mai' + 'lto:' + name + '@' + domain + q;
}
function MailMeBSS(name,subj,body)
{
  var domain = 'bluestreakservices.com';
  var q = ((subj||body)?'?':'');
  if (subj) q=q+'subject='+subj;
  if (subj&&body) q=q+'&';
  if (body) q=q+'body='+body;
  window.location = 'mai' + 'lto:' + name + '@' + domain + q;
}