// JavaScript Document

d=document;

function showHide(elementid){ 
  if (document.getElementById(elementid).style.display == 'none'){ 
    document.getElementById(elementid).style.display = '';
  } else { 
    document.getElementById(elementid).style.display = 'none'; 
  } 
}

function hideAnnouncement(){
	document.getElementById("announcement").style.display = 'none';
	document.getElementById("screen").style.display = 'none';
	document.getElementById("fullscreen").style.display = 'none';
}

function launchPlayer(messageID){
  if(playerWin){
	playerWin.close();
  }
  var playerWin=window.open('/media_player.asp?messageID=' + messageID,playerWin,'width=550,height=450,toolbar=false,resizable=false,menubar=false,scrollbars=false,status=false');
}	

function popNewWindow(eventID, type) {
	window.open('/event_detail.asp?id=' + eventID + '&type=' + type, '_blank', 'width=450, height=450, scrollbars=yes, menubar=no');
}

function showStaff(total, obj, source){  
  for(var i=1; i<=total; i++){
	if(i==obj){
	  d.getElementById('staff' + obj).style.display='';
	  var image="<img src='" + source + "'>";
	  d.getElementById('staff_image' + obj).innerHTML=image;
	}else{
	  d.getElementById('staff' + i).style.display='none';
	}
  }
}

//sfHover couresty of http://www.htmldog.com (http://www.htmldog.com/articles/suckerfish/dropdowns/)
sfHover = function() {
  if(d.getElementById("nav")){
    var sfEls = d.getElementById("nav").getElementsByTagName("li");
    for (var i=0; i<sfEls.length; i++) {
	  sfEls[i].onmouseover=function() {
	    this.className+=" sfhover";
	  }
	  sfEls[i].onmouseout=function() {
	    this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
	  }
    }
  }
}


if(window.attachEvent){
  window.attachEvent("onload", startUp);
}


function startUp(){
  //
  // FORCE THE DOMAIN TO ALWAYS DISPLAY 'WWW' - requested 9/22/09
  //
  
  /*if(window.location.hostname=="baseline-consulting.com"){
	  window.location="http://www.baseline-consulting.com" + window.location.pathname + window.location.search;
  }
  
  */
  replaceActiveX();
  sfHover();
  if(d.getElementById("standard_login")){
	bodyOnLoad();
  }
}


function updateName(myName){
  if(myName){
    d.getElementById('staff_name').innerHTML=myName;
  }else{
	d.getElementById('staff_name').innerHTML="Click a photo below to view details";
  }
}

function URLencode(sStr) {
  return escape(sStr).replace(/\+/g, '%2C').replace(/\"/g,'%22').replace(/\'/g, '%27');
}

function fileDownload(filePath){
  filePath = URLencode(filePath);
  var fileDownloader=window.open('/file_download_launch.asp?filePath=' + filePath,'fileDialog','width=400,height=300,toolbar=false,resizable=false,menubar=false,scrollbars=false,status=false');
}	