
function CheckArray(rgUsedAds, intRand, numads)
{
  
  var blnFound = "False";
  for (i=0;i<numads;i++)
  {
    if (rgUsedAds[i] == intRand)
    {
      blnFound = "True";
    }
  }
  return blnFound;
}

function openWindow_180(adid)
{
  winURL = "/shared-content/topads/showad.php?adid=" + adid;
  winName = "win" + adid;
  newwindow = window.open(winURL,winName,'width=400,height=450,location=no,toolbar=0,menubar=no,scrollbars=0,resizable=yes');
} 

function GenerateRandom(maxnum)
{
  var randnum = Math.round(maxnum * Math.random());
  return randnum
}


var blnInArray;
var numads = 5;
var intRand;
var i;
var rgUsed=new Array();
var rgAds=new Array();
rgAds[0] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587980&typeid=3" target = "_blank">COLDWELL BANKER WESTMINSTER</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[1] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587991&typeid=3" target = "_blank">DEER PARK LIONS CLUB SMALLWOOD FESTIVAL</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[2] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587990&typeid=3" target = "_blank">DARLENES PET SITTING SERV</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[3] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587982&typeid=3" target = "_blank">CHESAPEAKE UROLOGY</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[4] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587992&typeid=3" target = "_blank">ARCADIA FIRE DEPT DEMO DERBY</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[5] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587983&typeid=3" target = "_blank">SHAMROCK RESTAURANT</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[6] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587988&typeid=3" target = "_blank">WAGNER MEATS</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[7] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587987&typeid=3" target = "_blank">NEVIN TASTO DOUBLE A AUCTION</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[8] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587984&typeid=3" target = "_blank">SHAMROCK RESTAURANT</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[9] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587957&typeid=3" target = "_blank">ARCH MURRAY INC</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[10] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587989&typeid=3" target = "_blank">HANK WILLIAMS JR AT YORK FAIR</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[11] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587948&typeid=3" target = "_blank">FIREWORKS INC</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[12] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587949&typeid=3" target = "_blank">RITE AID</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[13] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587950&typeid=3" target = "_blank">MYERS DURBORAW FUNERAL HOME</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[14] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587951&typeid=3" target = "_blank">LUCKY STARS COUNTY KENNELS</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[15] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587952&typeid=3" target = "_blank">CASH N GO</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[16] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587953&typeid=3" target = "_blank">SPLISH SPLASH PETS</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[17] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587954&typeid=3" target = "_blank">HANOVER ORTHOPAEDIC</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[18] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587964&typeid=3" target = "_blank">REFLECTIONS OF LIGHT</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[19] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587955&typeid=3" target = "_blank">MYERS 140 PHOTO</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[20] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587956&typeid=3" target = "_blank">LINEBORO FIRE DEPT BASKET BINGO</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[21] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587959&typeid=3" target = "_blank">PET DIRECTORY</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[22] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587960&typeid=3" target = "_blank">PROFESSIONAL DIRECTORY</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[23] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587961&typeid=3" target = "_blank">JAZZBOS DOG GROOMING</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[24] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587962&typeid=3" target = "_blank">TR O FARRELL INC</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[25] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587963&typeid=3" target = "_blank">BULLETIN BOARD</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[26] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587958&typeid=3" target = "_blank">CRAFTERS ALLEY</a><br> <span class = "topads_company"></span><hr class="topads-rule">';
rgAds[27] = '<center><a class = "topads_heading" href = "/shared-content/topads/showad.php?adid=587947&typeid=3" target = "_blank">HANKS LOCK AND KEY</a><br> <span class = "topads_company"></span><hr class="topads-rule">';

i=0;
while (i < numads)
{
  
  intRand = GenerateRandom(rgAds.length - 1);
  blnInArray = CheckArray(rgUsed, intRand, i);
  if (blnInArray == "False")
  {
    rgUsed[i] = intRand;
    i++;
  }
}
for (i=0;i<numads;i++)
{
  var adNum = rgUsed[i];
  document.write('' + rgAds[adNum] + '');
}


