function buildDropDownMenu(t,w){
	var w = (w) ? w : false;
	var d = document.getElementById(t);
	if(!ie){
	d.addEventListener('mouseover', function(e){ showDropDown(this, e, w);  }, false);
	d.addEventListener('mouseout', function(e){ TabHideDropDown(e,this) },false);
	}else{

	d.onmouseover = function(e){  showDropDown(this, e, w); }
	d.onmouseout = function(e){ TabHideDropDown(e, this) }
	}
}

function getCoords(e){
	if(ie){
	   tempX = event.clientX + document.body.scrollLeft;
	   tempY = event.clientY + document.body.scrollTop;
	}else{
	   tempX = e.pageX;
	   tempY = e.pageY;
	}
}
function TabHideDropDown(e, t){ if(ie){ var menu = document.getElementById('thisDivMenu'); hideDropDown(t, menu,e); }else{ var menu = document.getElementById(menuId); hideDropDown(t, menu, e); } }
function showDropDown(t, e, w){

      var v = null;
      if(old_v = document.getElementById(menuId)){ hideDropDown(t, old_v,e ); } 
      v = document.createElement('div');
      v.innerHTML = '';
      for(var mn = 0; mn < menus[t.id].length; mn++){
        v.innerHTML += '<a href="'+items[menus[t.id][mn]]+'">'+names[menus[t.id][mn]]+'</a>';
      }
      v.id = menuId;
      v.className = tabClass;

      if(ie){
      v.style.top = (t.parentNode.parentNode.offsetTop + t.parentNode.offsetTop + t.offsetHeight + 97) + 'px';
      v.style.left = (t.parentNode.offsetLeft + document.getElementById('page-container').offsetLeft)+'px';
      }else{
      v.style.top = (t.offsetTop + t.offsetHeight) + 'px';
      v.style.left = t.offsetLeft + 'px';
      }
      if(w){ v.style.width = w+'px'; }
      document.body.appendChild(v);

      t.className = 'selectedDynTab';
      if(!ie){
      v.addEventListener('mouseout', function(e){ hideDropDown(t,v, e) },false);
      }else{
      
       v.onmouseout = function(e){ hideDropDown(t,v,e);  } 
}
      return v; 
}
function is_child_of(parent, child){ if( child != null ){ while(child.parentNode){ if( (child = child.parentNode) == parent ) { return true; } } } return false; }
function hideDropDown(tab,menu, e){  var target = (!ie) ? e.relatedTarget : event.toElement; if(!is_child_of(menu, target) && menu != target){  
 tab.className = nonselectedtabclass; 
document.body.removeChild(menu); 

} } 

/*  Photo Gallery */

showGalleryPic = function(src, id, caption){ 
	var objDiv = document.getElementById('gallery');
	var t = document.getElementsByTagName('div');
	for(n = 0; n < t.length; n++){
	  if(t[n].className == 'galleryThumbImgwrapper'){
	      if(t[n].id == 'picWrapperSel_'+id){
		 t[n].style.background = '#c0c0c0';
		 objDiv.scrollTop = t[n].parentNode.offsetTop - 290; 
	      }else{ 
		 t[n].style.background = '#fff';
	      }
	  }
	}

	prev = $('galleryNavPrev');
	next = $('galleryNavNext');

	if(src[(id - 1)]){
	prev.onclick = function(){ showGalleryPic(src, (id - 1), caption); } 
	prev.className = 'active';
	}else{
	prev.onclick = function(){  }
	prev.className = 'fade';
	}

	if(src[(id+1)]){
	next.onclick = function(){ showGalleryPic(src, (id + 1), caption); }
	next.className = 'active';
	}else{
	next.onclick= function(){}
	next.className = 'fade';
	}
	var bps =  document.getElementById('bigPicSrc'); 
	var bpid = document.getElementById('bigPicId'); 
	bps.src = '/images/'+src[id]; bpid.innerHTML = caption[id]; 
}

	setShowEmail = function(t){
	   s = $('showEmail');  
	   val = t.options[t.selectedIndex].value;
	   s.innerHTML = '<a href="mailto:'+val+'">'+val+'</a>';
	}
  


