var sponsors= new Array();
var sponsor_links=new Array();
	var preloaded= new Array();

	sponsors.push("images/sponsors2010/downtownvision.jpg");
	sponsor_links.push("http://www.rochestereyedoc.com");
	
	sponsors.push("images/sponsors2010/monroeambulance_logo.jpg");
	sponsor_links.push("http://www.monroeambulance.com");
	
	sponsors.push("images/sponsors2010/nationalsecurity_logo.jpg");
	sponsor_links.push("http://www.rochesterraiders.com");
	
	sponsors.push("images/sponsors2010/84_lumber_logo.jpg");
	sponsor_links.push("http://www.rochesterraiders.com");
	
	sponsors.push("images/sponsors2010/d_and_c_logo.jpg");
	sponsor_links.push("http://www.rochesterraiders.com");
	
	sponsors.push("images/sponsors2010/vp_supply_logo.jpg");
	sponsor_links.push("http://www.rochesterraiders.com");
	
	sponsors.push("images/sponsors2010/long_pond_auto_body.jpg");
	sponsor_links.push("http://www.longpondautobody.com");
	
	sponsors.push("images/sponsors2010/fair_and_expo_logo.jpg");
	sponsor_links.push("http://www.fairandexpocenter.org");
	
	sponsors.push("images/sponsors2010/wegmans_ticket.jpg");
	sponsor_links.push("http://www.wegmans.com");
	
	sponsors.push("images/sponsors2010/timewarner_sports.jpg");
	sponsor_links.push("http://web.twcny.com/twsports/");
	
	sponsors.push("images/sponsors2010/john_betlem_heating.jpg");
	sponsor_links.push("http://www.rochesterraiders.com");
	
	sponsors.push("images/sponsors2010/pods_logo.jpg");
	sponsor_links.push("http://www.pods.com");
	
	sponsors.push("images/sponsors2010/cortese_logo.jpg");
	sponsor_links.push("http://www.corteseauto.com/");
	
	sponsors.push("images/sponsors2010/worldgym_logo.jpg");
	sponsor_links.push("http://www.worldgymrochester.com");
	
	sponsors.push("images/sponsors2010/rochester_radiology.jpg");
	sponsor_links.push("http://www.rochrad.com");
	
	sponsors.push("images/sponsors2010/vasilelaw_logo.jpg");
	sponsor_links.push("http://www.vasilelaw.com");
	
	sponsors.push("images/sponsors2010/5linx.gif");
	sponsor_links.push("http://www.5linx.biz");
	
	sponsors.push("images/sponsors2010/mgm.gif");
	sponsor_links.push("http://maps.google.com/maps?hl=en&um=1&ie=UTF-8&q=mgm+insulation,+Rochester,+NY&fb=1&split=1&gl=us&view=text&latlng=3537732707639805754");
	
	sponsors.push("images/sponsors2010/channel13.jpg");
	sponsor_links.push("http://www.13wham.com");
	
	sponsors.push("images/sponsors2010/baden.jpg");
	sponsor_links.push("http://www.badensports.com");
	
	sponsors.push("images/sponsors2010/bigdog_country.gif");
	sponsor_links.push("http://www.bigdog1035.com");
	
	sponsors.push("images/sponsors2010/budweiser.jpg");
	sponsor_links.push("http://www.budweiser.com");
	
	sponsors.push("images/sponsors2010/lake_beverage.gif");
	sponsor_links.push("http://www.abwholesaler.com/lakebeverage/home");
	
	sponsors.push("images/sponsors2010/cgi.gif");
	sponsor_links.push("http://www.elocallink.tv");
	
	sponsors.push("images/sponsors2010/isaac_heating.gif");
	sponsor_links.push("http://www.isaacheating.com");
	
	sponsors.push("images/sponsors2010/athleticoutlet_logo.jpg");
	sponsor_links.push("http://www.southtownplaza.com/storeLocator.htm");
	
	sponsors.push("images/sponsors2010/doubletree.gif");
	sponsor_links.push("http://doubletree1.hilton.com/en_US/dt/hotel/ROCDTDT-Doubletree-Hotel-Rochester-New-York/index.do");
	
	sponsors.push("images/sponsors2010/rit_inn.gif");
	sponsor_links.push("http://www.ritinn.com");
	
	sponsors.push("images/sponsors2010/dpi.gif");
	sponsor_links.push("http://www.dpirochester.com");
	
	sponsors.push("images/sponsors2010/prc.gif");
	sponsor_links.push("http://maps.google.com/maps?hl=en&um=1&ie=UTF-8&q=PRC+and+Assoc,+rochester&fb=1&split=1&gl=us&view=text&latlng=10613421793325557133");
	
	sponsors.push("images/sponsors2010/deweyavesmokeshop.gif");
	sponsor_links.push("http://www.deweyavesmokeshop.com");
	
	sponsors.push("images/sponsors2010/vision.gif");
	sponsor_links.push("http://www.thatsmyvision.com");
	
	sponsors.push("images/sponsors2010/leosbakery.gif");
	sponsor_links.push("http://maps.google.com/maps?f=q&source=s_q&sll=43.101653,-77.630283&view=text&hl=en&gl=us&q=leo%27s+bakery,+rochester&ie=UTF8&sspn=0.006295,0.115625&latlng=43156241,-77566725,17929296716048622843&ei=ZArdSZmAFIrWNvT9yNQK&sig2=vN5gCMChzGNAXmf3pyXxqw&cd=1");
	
	sponsors.push("images/sponsors2010/army_logo.jpg");
	sponsor_links.push("http://www.army.mil");
	
	
	
	sponsors.push("images/sponsors2010/nyspainting.gif");
	sponsor_links.push("http://www.rochesterraiders.com");
	
	sponsors.push("images/sponsors2010/dryclean_express.gif");
	sponsor_links.push("http://www.rochesterraiders.com");	
	
	sponsors.push("images/sponsors2010/gehringpumps.gif");
	sponsor_links.push("http://www.gehringpumps.com");
	
	sponsors.push("images/sponsors2010/covered_wagon_tours.gif");
	sponsor_links.push("http://www.coveredwagontours.net");
	
	sponsors.push("images/sponsors2010/invisible_fence.jpg");
	sponsor_links.push("http://www.invisiblefence.com");
	
	sponsors.push("images/sponsors2010/underberg_kessler.gif");
	sponsor_links.push("http://www.underberg-kessler.com");
	
	sponsors.push("images/sponsors2010/sundaysiders_logo.jpg");
	sponsor_links.push("http://www.rochesterraiders.com");
	
	sponsors.push("images/sponsors2010/consolidated_agency.gif");
	sponsor_links.push("http://www.consolidatedagencyinc.com");
	
	sponsors.push("images/sponsors2010/riccis_towing.gif");
	sponsor_links.push("http://www.rochesterraiders.com");
	
	sponsors.push("images/sponsors2010/deweyauto.gif");
	sponsor_links.push("http://www.rochesterraiders.com");
	
	sponsors.push("images/sponsors2010/cristo.gif");
	sponsor_links.push("http://www.cristowest.com");
	
	sponsors.push("images/sponsors2010/go_media.gif");
	sponsor_links.push("http://www.gomediaproductions.com");
	
	sponsors.push("images/sponsors2010/usapayroll.gif");
	sponsor_links.push("http://www.usapayroll.com");
	
	sponsors.push("images/sponsors2010/zweigles.gif");
	sponsor_links.push("http://www.zweigles.com");
	
	sponsors.push("images/sponsors2010/decarolis.gif");
	sponsor_links.push("http://www.decarolis.com");
	
	sponsors.push("images/sponsors2010/gregmalley.gif");
	sponsor_links.push("http://www.rochesterraiders.com");
	
	sponsors.push("images/sponsors2010/ralphpontiac.gif");
	sponsor_links.push("http://www.ralphpontiac.com");
	
	sponsors.push("images/sponsors2010/mvp.jpg");
	sponsor_links.push("http://www.mvphealthcare.com");
	
	sponsors.push("images/sponsors2010/billscarpet.jpg");
	sponsor_links.push("http://www.billscarpetcenter.com");
	
	sponsors.push("images/sponsors2010/6pockets.gif");
	sponsor_links.push("http://rocwiki.org/Six_Pockets_Billiard_Cafe");
	
	sponsors.push("images/sponsors2010/sleepcity.gif");
	sponsor_links.push("http://www.sleepcitynewyork.com");
	
	sponsors.push("images/sponsors2010/bryant_and_stratton.gif");
	sponsor_links.push("http://www.bryantstratton.edu");
	
	sponsors.push("images/sponsors2010/brandanis_pizza.gif");
	sponsor_links.push("http://brandanispizza.com");
	
	sponsors.push("images/sponsors2010/mechettis.gif");
	sponsor_links.push("http://maps.google.com/maps/place?hl=en&safe=strict&oq=&gs_rfai=&um=1&ie=UTF-8&q=Mechetti%27s+Auto,+Rochester,+nY&fb=1&gl=us&hq=Mechetti%27s+Auto,&hnear=Rochester,+nY&cid=3187728764531134189");
	
	sponsors.push("images/sponsors2010/dick_ide_honda.gif");
	sponsor_links.push("http://www.dickide.com");
	
	sponsors.push("images/sponsors2010/east_coast_limousine.gif");
	sponsor_links.push("http://www.ecolimo.com");
	
	sponsors.push("images/sponsors2010/bbq_and_pizza.gif");
	sponsor_links.push("http://rocwiki.org/Barbeque_and_Pizza_Too");
	
	sponsors.push("images/sponsors2010/ocallaghans.gif");
	sponsor_links.push("http://www.ocalls-pub.com");
	
	sponsors.push("images/sponsors2010/doug_miller_soccer.gif");
	sponsor_links.push("http://www.dougmillersoccer.com/dome.cfm");
	
	sponsors.push("images/sponsors2010/twc_business.gif");
	sponsor_links.push("http://www.twcbc.com");
	
	sponsors.push("images/sponsors2010/airport_transmission.gif");
	sponsor_links.push("http://www.airporttransmission.com");
	
	sponsors.push("images/sponsors2010/applegrove_storage.gif");
	sponsor_links.push("http://www.applegroveministorage.com");
	
	sponsors.push("images/sponsors2010/marina_dodge.gif");
	sponsor_links.push("http://www.marinadodgeny.com");
	
	sponsors.push("images/sponsors2010/wayside.jpg");
	sponsor_links.push("http://www.waysidegardencenter.com");
	
	sponsors.push("images/sponsors2010/stereo_shop.jpg");
	sponsor_links.push("http://www.stereoshoponline.com");
	
	sponsors.push("images/sponsors2010/frontier.jpg");
	sponsor_links.push("http://corporate.frontier.com");
	
	sponsors.push("images/sponsors2010/woodys.jpg");
	sponsor_links.push("http://www.woodysonmonroe.com");
	
	sponsors.push("images/sponsors2010/clock_doc.jpg");
	sponsor_links.push("http://www.clockdocny.com");
	
	sponsors.push("images/sponsors2010/viola.jpg");
	sponsor_links.push("http://www.jvioladental.com");
	
	sponsors.push("images/sponsors2010/joebenson_towing.gif");
	sponsor_links.push("http://joebensontowing.com");
	
	sponsors.push("images/sponsors2010/hank_parker.jpg");
	sponsor_links.push("http://www.hankparkersrental.com");
	
	sponsors.push("images/sponsors2010/ucva.jpg");
	sponsor_links.push("http://www.ucva.com");
	
	
	
	
	for(i=0;i<sponsors.length;i++){
		preloaded[i] = new Image(25,25); 
    	preloaded[i].src=sponsors[i]; 
	}
	


var divs=new Array();
var ims= new Array();



currentInTop=0;
cImage=15;

function setImage(locnum, sponsnum){
	document.getElementById("i"+locnum).src=sponsors[sponsnum];
	if(sponsor_links[sponsnum]!=null){
		document.getElementById("a"+locnum+"link").href=sponsor_links[sponsnum];
		document.getElementById("a"+locnum+"link").target="_blank";
	}
	else document.getElementById("a"+locnum+"link").href="#";
	
	var newImg = new Image();
	newImg.src = sponsors[sponsnum];
	var width = newImg.width+"px";
	var height = newImg.height+"px";
	
	document.getElementById("s"+locnum).style.width=width;
	document.getElementById("s"+locnum).style.height=height;
	
}

function startScroll(){

	divs.push(document.getElementById("s0"));
	divs.push(document.getElementById("s1"));
	divs.push(document.getElementById("s2"));
	divs.push(document.getElementById("s3"));
	divs.push(document.getElementById("s4"));
	divs.push(document.getElementById("s5"));
	divs.push(document.getElementById("s6"));
	divs.push(document.getElementById("s7"));
	divs.push(document.getElementById("s8"));
	divs.push(document.getElementById("s9"));
	divs.push(document.getElementById("s10"));
	divs.push(document.getElementById("s11"));
	divs.push(document.getElementById("s12"));
	divs.push(document.getElementById("s13"));
	divs.push(document.getElementById("s14"));
	divs.push(document.getElementById("s15"));
	
	
	ims.push(document.getElementById("i0"));
	ims.push(document.getElementById("i1"));
	ims.push(document.getElementById("i2"));
	ims.push(document.getElementById("i3"));
	ims.push(document.getElementById("i4"));
	ims.push(document.getElementById("i5"));
	ims.push(document.getElementById("i6"));
	ims.push(document.getElementById("i7"));
	ims.push(document.getElementById("i8"));
	ims.push(document.getElementById("i9"));
	ims.push(document.getElementById("i10"));
	ims.push(document.getElementById("i11"));
	ims.push(document.getElementById("i12"));
	ims.push(document.getElementById("i13"));
	ims.push(document.getElementById("i14"));
	ims.push(document.getElementById("i15"));
	

	setImage(0, 0);
	setImage(1, 1);
	setImage(2, 2);
	setImage(3, 3);
	setImage(4, 4);
	setImage(5, 5);
	setImage(6, 6);
	setImage(7, 7);
	setImage(8, 8);
	setImage(9, 9);
	setImage(10, 10);
	setImage(11, 11);
	setImage(12, 12);
	setImage(13, 13);
	setImage(14, 14);
	setImage(15, 15);
	

	setInterval(scrolling, 50);
}
function scrolling(){
	
	currentTop=divs[currentInTop];
	
	currentTop.style.marginTop=(currentTop.offsetTop-1)+"px";
	
	if(Math.abs(currentTop.offsetTop)>(ims[currentInTop].height+15)){
		
		removeElement(currentTop);
		
		var newdiv = document.createElement('div');
  		newdiv.setAttribute('id','s'+currentInTop);
		
  		newdiv.innerHTML = '<a href="#" id="a'+currentInTop+'link"><img id="i'+currentInTop+'" style="border-width:0px" /></a>';
 		document.getElementById("scroll_container").appendChild(newdiv);

		cImage=getNextElement(sponsors, cImage);
		setImage(currentInTop, cImage);
		document.getElementById("s"+currentInTop).style.marginTop="0px";
		document.getElementById("s"+currentInTop).style.marginLeft="auto";
		document.getElementById("s"+currentInTop).style.marginRight="auto";
		document.getElementById("s"+currentInTop).style.marginBottom="15px";
		
		

		divs[currentInTop]=document.getElementById("s"+currentInTop);
		ims[currentInTop]=document.getElementById("i"+currentInTop);
		
		currentInTop=getNextElement( divs, currentInTop);
	
	}	
}

function getNextElement(arr, ind){
	toreturn=ind+1;
	if(toreturn>=arr.length) toreturn= 0;
	return toreturn;
}

function removeElement(elementToRemove)   {
   var Node = elementToRemove;
   Node.parentNode.removeChild(Node);
}