
function loadHeaderBanner()
{
  var curHeaderLeft = new Array();
  var curHeaderRight= new Array();
  var curHeader = document.createElement('div');

  curHeaderLeft["URL"]="http://www.blacknj.org/";
  curHeaderLeft["ALT"]="BLACKNJ (Your Connection)";

  //Order of values: URL, ALT, IMG
curHeaderRight[0]= ["http://blacknj.org/page/dawn-fitch","Dawn Fitch (Member Since: 2001)","http://blacknj.com/images/hdr_dawnfitch.jpg"];
curHeaderRight[1]= ["http://www.trtc.org/plays_events/current_season.php?categoryID=134","Two Rivers Theater Company","http://blacknj.com/images/hdr_tworiverstheater.jpg"];
curHeaderRight[2]= ["http://blacknj.org/profile/TammeishaSmith?xg_source=profiles_memberList","Tammeisha Smith (BLACKNJ Partner)","http://blacknj.com/images/hdr_tammeishasmith.jpg"];
curHeaderRight[3]= ["http://www.newarkmuseum.org/","Newark Museum (BLACKNJ Partner)","http://blacknj.com/images/hdr_newarkmuseum.jpg"];
curHeaderRight[4]= ["http://www.makingboldmovesnow.com/","Making Bold Moves","http://blacknj.com/images/hdr_billparrish.jpg"];

  var curRandIndex = Math.floor(Math.random() * curHeaderRight.length);

  var curContents = '<img src ="';
  curContents += curHeaderRight[curRandIndex][2];
  curContents += '" usemap ="#headermap" />';
  curContents += '<map name="headermap">';
  curContents += '<area shape="rect" coords="0,0,477,156" href="';
  curContents += curHeaderLeft["URL"];
  curContents += '" alt="';
  curContents += curHeaderLeft["ALT"];
  curContents += '" title="';
  curContents += curHeaderLeft["ALT"];
  curContents += '" />';
  curContents += '<area shape="rect" coords="478,0,955,156" href="';
  curContents += curHeaderRight[curRandIndex][0];
  curContents += '" alt="';
  curContents += curHeaderRight[curRandIndex][1];
  curContents += '" title="';
  curContents += curHeaderRight[curRandIndex][1];
  curContents += '" />';
  curContents += '</map>';

  curHeader.id="curHead";
  curHeader.innerHTML= curContents;

  document.getElementById("xg_masthead").appendChild(curHeader);
}

var addedMenu= false;

if(document.getElementById("xg_masthead"))
  {
    loadHeaderBanner();
  }

//Add main site banner and menu if we are on the slide show page
if(getCurMozzle() == "photo" && document.location.href.indexOf("slideshow") != -1)
  {
    loadHeaderBanner();
    addedMenu=true;
  }

if(document.location.href.indexOf("authorization/newProfile") != -1)
  {
    document.getElementById("topAd").style.display="none";
    document.getElementById("bottomAd").style.display="none";
  }
 else
   {
     //This adds the position holder for the top add to the header. We use this to get the top and left height for the actual ad slot.
     x$('#xg_masthead').prepend('<div id="adheader_spacer" style="padding:0;min-height:95px;height:95px;width:955px;background-color:#FFFFFF;margin:0"></div>');
     
     ///This adds the position holder for the bottom add to the footer. We use this to get the top and left height for the actual ad slot.
     //x$('#xg_foot').prepend('<div id="adfooter_spacer" style="padding:0;min-height:95px;height:95px;width:955px;background-color:#FFFFFF;margin:0"></div>');
     
     //This function moves the header ad slot from the bottom of the page to the top of the page by positioning it on top of the spacer.
     x$('#topAd').ready(function() {
	 var r = x$('#topAd');
	 var s = x$('#adheader_spacer');
	 
	 s.width(r.width()); s.height(r.height());
	 r.css({ position: 'absolute', left: s.position().left +0.5+ 'px', top: s.position().top + 'px', zindex: 99999 }).show();
	
        //old code======= 
	 //if(document.getElementById("xg_masthead"))
	   //{
	     //document.getElementById("xg_masthead").style.height="155px";
	     //document.getElementById("xg_masthead").style.minHeight="155px";
	  //t.css({height: '160px',min-height: '160px'});
	   //}
         //end old code=========
       });
     
     //This function moves the footer ad slot from the bottom of the page to the footer of the page by positioning it on top of the spacer.
     //x$('#bottomAd').ready(function() {
	 //var r = x$('#bottomAd');
	 //var s = x$('#adfooter_spacer');
	 
	 //s.width(r.width()); s.height(r.height());
	 
	 //var tempSpace = (addedMenu== true)?0:0.5;
	 //r.css({ position: 'absolute', left: s.position().left +0.5+ 'px', top: s.position().top+ tempSpace + 'px', zindex: 99999 }).show();
       //});
     
     //This function determines when the window is resized and updates the left position of the header and footer so that they move with resized page
     x$(window).resize(function(){
	 x$("#topAd").css({"left": x$("#adheader_spacer").position().left + 0.5+"px"});
	 //x$("#bottomAd").css({"left": x$("#adfooter_spacer").position().left + 0.5+"px"});
       });
   }

function fixBottomAdPos()
{
  var r = x$('#bottomAd');
  var s = x$('#adfooter_spacer');
  
  var tempSpace = (addedMenu== true)?0:0.5;
  
  r.css({ position: 'absolute', left: s.position().left +0.5+ 'px', top: s.position().top+ tempSpace + 'px', zindex: 99999 });
}

if(document.getElementById("comment_form"))
  {
    x$("#comment_form").submit(function(){
	//setTimeout("fixBottomAdPos()", 900);
      });
  }

//link window
var myLinks = document.getElementsByTagName('a');
for (x in myLinks) {
if(myLinks[x].href != null) {
if(!(myLinks[x].href.match(/blacknj.org/))) {
//set external links to open in new window
myLinks[x].target = '_blank'; }
}
}

