function dealer_name(index)
{
  var dealers=new Array()
  dealers[1]="WOODLAND HILLS<BR>CAMERA"
  dealers[2]="ANACORTES<BR>TELESCOPES"
  dealers[3]="TELESCOPES.COM"
  dealers[4]="ASTRONOMICS"
  dealers[5]="SHUTAN CAMERA"
  dealers[6]="OPT TELESCOPES"
  dealers[7]="HIGH POINT<BR>SCIENTIFIC"
  dealers[8]="OPTICS PLANET"
  dealers[9]="SCIENCE & HOBBY"
  dealers[10]="B & H PHOTO"
  dealers[11]="FOCUS CAMERA"
  dealers[12]="CAMERA CONCEPTS"
  dealers[13]="20/20 TELESCOPES<BR>& BINOCULARS"
  dealers[14]="CAMERA BUG"
  dealers[15]="THE OBSERVATORY"
  dealers[16]="LAND, SEA & SKY<BR>UNLIMITED"
  dealers[17]="ADORAMA"
  dealers[18]="SKIES UNLIMITED"
  dealers[19]="DURANGO SKIES<BR>TELESCOPES"
  dealers[20]="HANDS ON OPTICS"
  dealers[21]="BIG BANG<BR>ASTRONOMY"
  dealers[22]="SCOPE CITY"
  dealers[23]="BERGER BROTHERS"
  dealers[24]="SCIENCE KIT"

  var name = dealers[index]

  return name;
}

function dealer_location(index)
{
  var location=new Array()
  location[1]="Woodland&nbsp;Hills,&nbsp;CA<BR>877-626-3233"
  location[2]="Anacortes,&nbsp;WA<BR>888-996-3233"
  location[3]="Omaha,&nbsp;NE<BR>800-303-5873"
  location[4]="Norman,&nbsp;OK<BR>800-356-6603"
  location[5]="Vernon Hills,&nbsp;IL<BR>866-621-6363"
  location[6]="Oceanside,&nbsp;CA<BR>800-338-9638"
  location[7]="Montague,&nbsp;NJ<BR>800-266-9590"
  location[8]="Northbrook,&nbsp;IL<BR>800-504-5897"
  location[9]="Watervliet,&nbsp;NY<BR>518-272-9040"
  location[10]="New York,&nbsp;NY<BR>800-329-0315"
  location[11]="Brooklyn,&nbsp;NY<BR>800-221-0828"
  location[12]="Patchogue,&nbsp;NY<BR>631-475-1118"
  location[13]="Lansing,&nbsp;IL<BR>877-883-8883"
  location[14]="Atlanta,&nbsp;GA<BR>877-422-6284"
  location[15]="Dallas,&nbsp;TX<BR>972-248-1450"
  location[16]="Houston,&nbsp;TX<BR>713-529-3551"
  location[17]="New York,&nbsp;NY<BR>800-223-2500"
  location[18]="Pottstown,&nbsp;PA<BR>888-947-2673"
  location[19]="Durango,&nbsp;CO<BR>970-259-5400"
  location[20]="Damascus,&nbsp;MD<BR>866-726-7371"
  location[21]="Raleigh,&nbsp;NC<BR>919-329-2800"
  location[22]="Various Locations,&nbsp;CA,NV<BR>800-235-3344"
  location[23]="Syosset, NY<BR>800-542-8811"
  location[24]="Tonawanda, NY<BR>800-828-7777"

  var dealerlocation = location[index]

  return dealerlocation;
}

function dealer_address(index)
{
  var address=new Array()
  address[1]="http://www.meade.com/authdlrshowroom/sca/2270.html"
  address[2]="http://www.meade.com/authdlrshowroom/wa/9000.html"
  address[3]=""
  address[4]=""
  address[5]="http://www.meade.com/authdlrshowroom/il/2000.html"
  address[6]="http://www.meade.com/authdlrshowroom/sca/3348.html"
  address[7]="http://www.meade.com/authdlrshowroom/nj/7200.html"
  address[8]=""
  address[9]="http://www.meade.com/authdlrshowroom/ny/3744.html"
  address[10]="http://www.meade.com/authdlrshowroom/ny/7500.html"
  address[11]="http://www.meade.com/authdlrshowroom/ny/8841.html"
  address[12]="http://www.meade.com/authdlrshowroom/ny/1118.html"
  address[13]="http://www.meade.com/authdlrshowroom/il/0078.html"
  address[14]="http://www.meade.com/authdlrshowroom/ga/4513.html"
  address[15]="http://www.meade.com/authdlrshowroom/tx/1450.html"
  address[16]="http://www.meade.com/authdlrshowroom/tx/3551.html"
  address[17]="http://www.meade.com/authdlrshowroom/ny/0401.html"
  address[18]="http://www.meade.com/authdlrshowroom/pa/9881.html"
  address[19]="http://www.meade.com/authdlrshowroom/co/9215.html"
  address[20]="http://www.meade.com/authdlrshowroom/md/7371.html"
  address[21]="http://www.meade.com/authdlrshowroom/nc/2800.html"
  address[22]="http://www.meade.com/authdlrshowroom/scopecity/index.html"
  address[23]="http://www.meade.com/authdlrshowroom/ny/4160.html"
  address[24]="http://www.meade.com/authdlrshowroom/ny/6020.html"

  var dealeraddress = address[index]

  return dealeraddress;
}

function dealer_links(index)
{
  var links=new Array()
  links[1]="http://www.telescopes.net/meade/meade.html"
  links[2]="http://www.buytelescopes.com/meade"
  links[3]="http://meade.telescopes.com"
  links[4]="http://www.astronomics.com/main/Meade-Telescopes.asp"
  links[5]="http://www.shutan.com/meade"
  links[6]="http://www.optcorp.com/meade"
  links[7]="http://www.highpointscientific.com/store/meade_store.asp"
  links[8]="http://www.opticsplanet.net/meade-brand.html"
  links[9]="http://www.scienceandhobby.com/meade.htm"
  links[10]="http://www.bhphotovideo.com/c/category/7970/Meade.html"
  links[11]="http://www.focuscamera.com"
  links[12]="http://www.cameraconcepts.com"
  links[13]="http://www.2020telescopes.com/meade.html"
  links[14]="http://www.camerabug.com"
  links[15]="http://www.theobservatoryinc.com"
  links[16]="http://www.takahashiamerica.com"
  links[17]="http://www.adorama.com/catalog.tpl?op=brands&brand=Meade"
  links[18]="http://www.skiesunlimited.net/index.php?CategoryID=159"
  links[19]="http://www.durangoskies.com/mfg_meade.php"
  links[20]="http://www.handsonoptics.com/tel_meade.html"
  links[21]="http://www.bigbangastro.com//meadetelescopes-c-31.html?infoBox=0"
  links[22]="http://www.scopecity.com/brands.cfm?SearchBrandID=167"
  links[23]="http://www.berger-bros.com/page/BBCVD/CTGY/MEADE"
  links[24]="http://sciencekit.com/Default.asp?bhcd2=1196192105"

  var link = links[index]

  return link;
}

function dealer_info(index)
{
  var info=new Array()
  info[1]="Info"
  info[2]="Info"
  info[3]=""
  info[4]=""
  info[5]="Info"
  info[6]="Info"
  info[7]="Info"
  info[8]=""
  info[9]="Info"
  info[10]="Info"
  info[11]="Info"
  info[12]="Info"
  info[13]="Info"
  info[14]="Info"
  info[15]="Info"
  info[16]="Info"
  info[17]="Info"
  info[18]="Info"
  info[19]="Info"
  info[20]="Info"
  info[21]="Info"
  info[22]="Info"
  info[23]="Info"
  info[24]="Info"

  var button = info[index]

  return button;
}

function teir1_rotator(){
  
  var ry=0
  var max=24
  var row=Math.ceil(max/4)
  var printNum=max
  var position=1
  var new_window="target='_blank'"

  while(ry==0)
  {
  	ry=Math.floor(Math.random()*max)
  }

  document.write('<table border="0" cellspacing="20" cellpadding="0" align="center">')
  
  for(var i=1; i <= row; i++)
  {
	document.write('<tr>')
	for(var j=1; j <= 4; j++)
	{
		if(printNum <= 0)
		{
			document.write('<td>&nbsp;</td>')			
		}
		else
		{
			if(j < 4)
			{
				document.write('<td valign="bottom"><div class="dealerName">'+dealer_name(ry)+'</div>')
				document.write(dealer_location(ry)+'<BR>')
				if(dealer_info(ry) == "Info")
				{
					document.write('<a href="'+dealer_address(ry)+'" class="button">Info</a>&nbsp;')
					document.write('<a href="'+dealer_links(ry)+'" class="button" '+new_window+'>Web</a></td><td width="20">&nbsp;</td>')
				}
				else
				{
					document.write('<a href="'+dealer_links(ry)+'" class="button" '+new_window+'>Web</a>&nbsp;</td><td width="20">&nbsp;</td>')				
				}
				position++
				if(ry!=max)
					ry++
				else
				{
					max=ry
					ry=1
				}
			}
			else
			{
				document.write('<td valign="bottom"><div class="dealerName">'+dealer_name(ry)+'</div>')
				document.write(dealer_location(ry)+'<BR>')
				if(dealer_info(ry) == "Info")
				{
					document.write('<a href="'+dealer_address(ry)+'" class="button">Info</a>&nbsp;')
					document.write('<a href="'+dealer_links(ry)+'" class="button" '+new_window+'>Web</a></td>')
				}
				else
				{
					document.write('<a href="'+dealer_links(ry)+'" class="button" '+new_window+'>Web</a>&nbsp;</td>')				
				}
				position++
				if(ry!=max)
					ry++
				else
				{
					max=ry
					ry=1
				}	
			}
		}
		printNum--
	}
	document.write('</tr>')
  }
  document.write('<tr><td valign="bottom" colspan="7" bgcolor="#00457C"><span class="headline">Canada</span></td></tr>')
  document.write('<tr><td valign="bottom"><div class="dealerName">KHAN SCOPE<BR>CENTER</div>')
  document.write('Toronto,&nbsp;CA<BR>800-580-7160<BR>')
  document.write('<a href="http://www.meade.com/authdlrsintrnl/Canada/4140.html" class="button">Info</a>&nbsp;')
  document.write('<a href="http://www.khanscope.com/newEquipList.cfm?catID=1&subCatID=1&manID=1" class="button">Web</a></td>')
  document.write('<td>&nbsp;</td>')
  document.write('<td valign="bottom"><div class="dealerName">EFSTONSCIENCE</div>')
  document.write('Toronto,&nbsp;CA<BR>888-777-5255<BR>')
  document.write('<a href="http://www.meade.com/authdlrsintrnl/Canada/5255.html" class="button">Info</a>&nbsp;')
  document.write('<a href="http://www.telescopes.ca/meade/" class="button">Web</a></td>')
  document.write('<td>&nbsp;</td>')
  document.write('<td valign="bottom"><div class="dealerName">ASTRONOMIE PLUS</div>')
  document.write('Longueuil,&nbsp;CA<BR>888-540-0444<BR>')
  document.write('<a href="http://www.meade.com/authdlrsintrnl/Canada/5072.html" class="button">Info</a>&nbsp;')
  document.write('<a href="http://www.astronomieplus.com/modules.php?name=ProductList&op=BrowseCat&catid=6#Meade" class="button">Web</a></td>')
  document.write('<td>&nbsp;</td>')
  document.write('<td valign="bottom"><div class="dealerName">THE SCIENCE SHOP</div>')
  document.write('Edmonton,&nbsp;CA<BR>888-434-0519<BR>')
  document.write('<a href="http://www.meade.com/authdlrsintrnl/Canada/0519.html" class="button">Info</a>&nbsp;')
  document.write('<a href="http://www.thescienceshop.ca/meade_telescopes/Meadescopes_1.htm" class="button">Web</a></td></tr>')
  document.write('<tr><td valign="bottom"><div class="dealerName">SANEAL CAMERA</div>')
  document.write('Calgary,&nbsp;CA<BR>866-231-8614<BR>')
  document.write('<a href="http://www.meade.com/authdlrsintrnl/Canada/1836.html" class="button">Info</a>&nbsp;')
  document.write('<a href="http://www.sanealcamera.com/" class="button">Web</a></td>')
  document.write('<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>')
  document.write('</table>')

}