var sponsorImages = new Array
var sponsorCount = 0;

function Sponsor( name, image, link, description, lat, lon )
{
	this.m_name = name;
	this.m_image= new Image(246,50);
	this.m_image.src = image;
	this.m_description	= description;
	this.m_link	= link;
	this.m_lat	= lat;
	this.m_lon	= lon;
	//
	sponsorImages[ sponsorImages.length ] = this;
	//
	if ( lat != null )
	{
		this.GMark		= new PdMarker( new GLatLng( lat, lon ), sponsorIcon2 );
		this.GMark.setTooltip( "Sponsor "+ this.m_name );
	
		var htmlTestLocation = 
		"<table width=200>"+
		"<tr><td><span class='helpertextheader'>Sponsor "+ this.m_name +
		"<BR><a href='"+this.m_link+"' target='sponsor'>"+this.m_link+"</a>"+
		"<BR>"+this.m_description+
		"</span></td></tr>"+
		"</table>";	
	
		var mark = this.GMark;
		
		GEvent.addListener(
				mark, 
				"click", 
				function() {
					mark.openInfoWindowHtml(htmlTestLocation);
				}
			);
			
		map.addOverlay( this.GMark );	
	}
}

function sponsorBannerTimer()
{
	html="";
	oSponsor = sponsorImages[sponsorCount];
	
	if ( sponsorCount > 0 )
	{
		oPrevSponsor = sponsorImages[sponsorCount-1];
		if ( oPrevSponsor.GMark != null )
		{
			oPrevSponsor.GMark.setImage("/socialinteraction/images/icon_sponsor2.png");
		}
	}
	
	if ( oSponsor.GMark != null )
	{
		oSponsor.GMark.setImage("/socialinteraction/images/icon_sponsor.png");
	}
	
	if ( oSponsor.m_link != "" )
		html+="<a href='"+oSponsor.m_link+"' target=sponsor>";
	html+="<img src='"+oSponsor.m_image.src+"' border=0>";
	if ( oSponsor.m_link != "" )
		html+="</a>";
	
	document.getElementById("sponsorsdiv").innerHTML = html;
	
	sponsorCount++;
	if ( sponsorCount >= sponsorImages.length )
		sponsorCount = 0;
}

function startSponsorBanner()
{
	// Preload images
        new Sponsor( "Austin Community Foundation","images/sponsor_ACF.png","http://austincommunityfoundation.org/","",30.30918,-97.733978);
        new Sponsor( "LiveCast","images/sponsor_livecast.png","http://www.livecast.com","",49.276762,-123.128838);
        // new Sponsor( "Verizon","images/sponsor_verizon.png","http://www.verizon.com","",30.268612,-97.74048);
        new Sponsor( "Princess Craft Campers and Trailers","images/sponsor_princesscraft.png","http://www.princesscraft.com","",30.439891,-97.620979);
        new Sponsor( "Living Direct","images/sponsor_livingdirect.png","http://www.livingdirect.com","",30.340554,-97.673071);
        new Sponsor( "Floor and Decor","images/sponsor_flooranddecor.png","http://www.flooranddecoroutlets.com","",30.400215,-97.74298);
        new Sponsor( "Home Depot","images/sponsor_homedepot.png","http://www.homedepot.com","",30.465468,-97.600393);
        new Sponsor( "GivShop","images/sponsor_givshop.png","http://www.givshop.com","",30.259686,-97.747939);
        new Sponsor( "Texadelphia","images/sponsor_texadelphia.png","http://www.texadelphia.com/find-a-location/austin/2","",30.277992,-97.744434);
        new Sponsor( "Tech Ranch","images/sponsor_techranch.png","http://techranchaustin.com/","",30.381445,-97.722445);
        new Sponsor( "Cowork Austin","images/sponsor_coworkaustin.png","http://www.coworkaustin.com","",30.267861,-97.74101);
        new Sponsor( "Lance Armstrong Foundation","images/sponsor_livestrong.png","http://www.livestrong.org","",
30.259702,-97.718513);
        new Sponsor( "Image Auto Body","images/sponsor_imageautobody.png","http://www.tigertrux.com","",30.439851,-97.610959);
        new Sponsor( "ACM Body and Frame","images/sponsor_acm.png","http://www.acmwork.com/","",29.916327,-97.897759);
        new Sponsor( "Sikkens","images/sponsor_sikkens.png","http://www.sikkens.net","");
        new Sponsor( "BatteriesPlus","images/sponsor_batteriesplus.png","http://www.batteriesplus.com","",30.296033,-97.832162);
        new Sponsor( "River Hills Pizza","images/sponsor_riverhillspizza.png","http://www.riverhillspizza.com/","",30.317476,-97.862951);
        new Sponsor( "Imagine Art","images/sponsor_imagineart.png","http://www.imagineart.net/","",
30.28321,-97.710195);
       new Sponsor( "Pepboys","images/sponsor_pepboys_donation.png","http://localstores.pepboys.com/south-lamar/","",30.236329,-97.790354);
        new Sponsor( "Oaktreeidea","images/sponsor_oaktree.png","http://www.oaktreeidea.com/","");
	new Sponsor( "Mobile Loaves & Fishes","images/sponsor_mlf.png","http://www.mlfnow.org","",30.294655,-97.822724);
        //new Sponsor( "AT&T","images/sponsor_att.png","http://www.att.com","",30.310547,-97.941115);
        new Sponsor( "KTBC FOX7","images/sponsor_myfoxAustin.png","http://www.myfoxaustin.com","",30.271716,-97.741188);
	//new Sponsor( "Chick-fil-A","images/sponsor_chick-fil-A.png","http://www.chick-fil-A.com","",30.317535,-97.951576);
        new Sponsor( "KXAN","images/sponsor_kxan.png","http://www.kxan.com","",30.283371,-97.747659);
        //new Sponsor( "Hightech Signs","images/sponsor_hightechsigns.png","http://www.signsaustin.com/","");
        //new Sponsor( "DreamDesignLaunch","images/sponsor_dreamdesignlaunch.png","http://www.dreamdesignlaunch.com/","");
        new Sponsor( "Best Buy","images/sponsor_bestbuy.png","http://wwww.bestbuy.com/","",30.305385,-97.94151);
        //new Sponsor( "Nokia","images/sponsor_nokia.png","http://www.nokia.com/","",30.19585,-97.706726);
	new Sponsor( "Expert Fleet Service, INC.","images/sponsor_fleet.png","http://expertfleet.net/","",30.194976,-97.707527);
	//new Sponsor( "Southwest Cycle Sport","images/sponsor_swcs.png","http://www.southwestcyclesport.com","",30.515323,-97.851187);
	//new Sponsor( "Southwest Cycle Sport","images/sponsor_swcs.png","http://www.southwestcyclesport.com","",30.313205,-97.881319);
	//new Sponsor( "Motorola","images/sponsor_motorola.png","http://www.motorola.com","");
	
	//new Sponsor( "Diesel Green Fuels","images/sponsor_diesel1.png","http://www.dieselgreenfuels.com","",30.250989,-97.696838);
	new Sponsor( "Wilson Electronics","images/sponsor_wilson.png","http://www.wilsonelectronics.com","");
	new Sponsor( "Interstate Connection","images/sponsor_ic.png","http://www.interstate-connections.com/ic/index.asp?id=55","", 30.436276, -97.683808);
	new Sponsor( "FlexSolarCells","images/sponsor_flex.png","http://www.flexsolarcells.com/","");
	new Sponsor( "WAAV","images/sponsor_waav.png","http://www.waav.com/","");
	//new Sponsor( "Executive Intelligence Coaching","images/sponsor_eic.png","http://www.executiveintelligentcoaching.com/");
new Sponsor( "3 Threads","images/sponsor_3threads.png","http://www.outfits.com/","",30.272549,-97.799568);


	//new Sponsor( "Liberty Tax Services","images/sponsor_liberty.png","http://www.libertytax.com/","",30.262442,-97.721715);
	//new Sponsor( "RadioShack","images/sponsor_radioshack.png","http://www.radioshack.com/","",30.330777,-97.93852);

	//new Sponsor( "Nyle MaxWell","images/sponsor_nyle.png","http://www.nylemaxwell.com/","");
	//new Sponsor( "Driscoll Motors","images/sponsor_driscoll.png","http://www.driscollmotors.net/","");
	//new Sponsor( "Roger Beasley Porsche","images/sponsor_roger.png","http://beasleyporsche.cms.dealer.com/","");
	//new Sponsor( "Texas Truck & Toys","images/sponsor_ttt.png","http://www.texastrucksandtoys.com /","");
	//new Sponsor( "Rising Fast Motors","images/sponsor_risingfast.png","http://www.risingfastmotors.com/","");
        

	// new Sponsor( "Brought To You By","images/sponsor_announce2.png","","");
		
	new Sponsor( "Sponsored By","images/sponsor_announce.png","","");
        //
	setInterval ( "sponsorBannerTimer()", 3500 );
}