

window.onload = function() 
{
	if (document.all) // IE only
	{ 
		attachClass(); 
	}
	
	attachClassToParent();
	
	if ($('homeP'))
	{
		rotateevent();
		rotatelogo();
		rotateBanner();
		boldDates();
	}
}	


function attachClass() {
 var sfEls = $("leftnav").getElementsByTagName("LI");
 for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
 this.className+=" hover";
}
sfEls[i].onmouseout=function() {
 this.className=this.className.replace(new RegExp(" hover\\b"), "");
}
 }
}
if (window.attachEvent) window.attachEvent("onload", attachClass);


function attachClassToParent() {

	if (document.getElementsByClassName('on'))
	{

		var a_on = document.getElementsByClassName('on');
	
		if (!a_on[0] == "")
		{
			a_on[0].parentNode.className = "on";
		}			
	}

 }
 

// bold dates in Press release items -- user must add "date - " for this to work
function boldDates()
{
	
	if (document.getElementsByClassName('NLtoc')) {
		var nl2 = document.getElementsByClassName('NLtoc')
		
	}
					
	for (var i=0; i<nl2.length; i++)
	{
		
		 if(nl2[i].innerHTML.indexOf(' - ')>=0)
		 {
		 	
			var x = nl2[i].innerHTML.split(" - ");
			
			nl2[i].innerHTML = '<b class="date">' + x[0] + ' - </b>' + x[1];

		}
		
					
	}
}


// event banner rotation script

var logotimerid;
var logocount=8;

var eventtimerid;
var eventcount=1;

var eventimg = new Array();
eventimg[0] = '/atf/cf/%7BDD5F079D-CF0C-42E2-BBE1-A18FFF87D200%7D/LA-HOME-06.GIF';
eventimg[1] = '/atf/cf/%7BDD5F079D-CF0C-42E2-BBE1-A18FFF87D200%7D/PS-HOME-06.GIF';

function rotateevent()
{
if (document.images)
	{
	 document.images['event'].src = eventimg[eventcount];
	 eventtimerid = window.setTimeout('rotateevent()', 3000);
	 if(eventcount < (eventimg.length - 1))
	 	{eventcount++;}
	 else
	 	{eventcount = 0;}
	}
}

function locateeventurl()
{
 eventnum=eventcount;
 if(eventcount == 0)
 {var eventnum = 1;}
 else
 {var eventnum = (eventcount - 1);}
 switch(eventnum)
 {
  case 0:
   document.location='http://www.thetaskforce.org/events/awards.cfm';    
   break;
  case 1:
   document.location='http://www.thetaskforce.org/events/event.cfm?eventID=453054486';    
   break;
 }
}

function goeventurl(whichevent)
{
 switch(whichevent)
 {
  case 0:
   document.location='http://www.thetaskforce.org/events/awards.cfm';    
   break;
  case 1:
   document.location='http://www.thetaskforce.org/events/event.cfm?eventID=453054486';    
   break;
 }
}

function stopeventrotation()
{
	window.clearTimeout(eventtimerid);
}

function starteventrotation()
{
	eventtimerid = window.setTimeout('rotateevent()', 3000);
} 

// logo banner rotation script



var logoimg = new Array();
var path = '/atf/cf/%7BDD5F079D-CF0C-42E2-BBE1-A18FFF87D200%7D/';
logoimg[0] = path + 'advocateC.gif';
logoimg[1] = path + 'bacardilimon.gif';
logoimg[2] = path + 'here.gif';
logoimg[3] = path + 'oliviaC.gif';
logoimg[4] = path + 'PlanetOut.gif';
logoimg[5] = path + 'wellsfargoC.gif';
logoimg[6] = path + 'wyndhamC.gif';
logoimg[7] = path + 'WashingtonPlaza.gif';
logoimg[8] = path + 'aavacations.gif';


function rotatelogo()
{
 document.images['logo'].src = logoimg[logocount];
 logotimerid = window.setTimeout('rotatelogo()', 3000);
 if(logocount < (logoimg.length - 1))
 {logocount++;}
 else
 {logocount = 0;}
}

function locatelogourl()
{
 logonum=logocount;
 if(logocount == 0)
 {var logonum = 8;}
 else
 {var logonum = (logocount - 1);}
 switch(logonum)
 {
  case 0:
   document.location='http://www.advocate.com';    
   break;
  case 1:
   document.location='http://www.bacardilimon.com';    
   break;
      case 2:
   document.location='http://www.heretv.com';    
   break;
  case 3:
   document.location='http://www.olivia.com';    
   break;
  case 4:
   document.location='http://www.planetout.com';    
   break;
 case 5:
   document.location='http://www.wellsfargo.com';    
   break;
  case 6:
   document.location='http://www.wyndhamevents.com/bel_age/rainbow1.htm';    
   break;
     case 7:
   document.location='http://www.washingtonplazahotel.com/';    
   break;
     case 8:
   document.location='http://www.aavacations.com/rainbow';    
   break;
 }
}

function gologourl(whichlogo)
{
 switch(whichlogo)
 {
  case 0:
   document.location='http://www.advocate.com';    
   break;
  case 1:
   document.location='http://www.bacardilimon.com';    
   break;
  case 2:
   document.location='http://www.heretv.com';  
   break;
case 3:
   document.location='http://www.olivia.com';    
   break;
  case 4:
   document.location='http://www.planetout.com';  
   break;
case 5:
   document.location='http://www.wellsfargo.com';    
   break;
  case 6:
   document.location='http://www.wyndhamevents.com/bel_age/rainbow1.htm';    
   break;
  case 7:
   document.location='http://www.washingtonplazahotel.com/';    
  break;
  case 8:
   document.location='http://www.aavacations.com/rainbow';    
  break;
 }
}

function stoplogorotation()
{
 window.clearTimeout(logotimerid);
}

function startlogorotation()
{
logotimerid = window.setTimeout('rotatelogo()', 3000);
} 



// rotate slogan-image banner on home page

function rotateBanner()
{
	if ($('banner')) {
		var imgAry = new Array();
		var path = '/atf/cf/%7BDD5F079D-CF0C-42E2-BBE1-A18FFF87D200%7D/';
		imgAry[0] = path + 'MOBILIZE.JPG'; 
		imgAry[1] = path + 'ORGANIZE.JPG';
		imgAry[2] = path + 'LEADERSHIP.JPG';
		imgAry[3] = path + 'JUSTICE.JPG';
		imgAry[4] = path + 'CHANGE.JPG';
		imgAry[5] = path + 'UNWAVERING.JPG';
		imgAry[6] = path + 'UNCOMPROMISING.JPG';
		imgAry[7] = path + 'VICTORY.JPG';				
			
		var r =  Math.floor(Math.random()*imgAry.length);	
		$('banner').src = imgAry[r];
	}
}


