          function randomNumber(lowLim, hiLim)
           {
           var normalVal = (hiLim - lowLim) * Math.random();
           //Truncate the fractional portion of the normalized value
           // and using ceil() add result to low limit and return the value.
           return Math.ceil( normalVal ) + lowLim;
           }   // random Number()

              var maxi = 5
              var i = randomNumber(0, maxi);

         adImages1 = new Array();
              adImages1[0]    = "http://www.aiap.org/images/Balboa_International.gif";
              adImages1[1]    = "http://www.aiap.org/images/aiap_mseddigh.jpg";
              adImages1[2]    = "http://www.aiap.org/images/aiap_ostad.jpg";             
              adImages1[3]    = "http://www.aiap.org/images/aiap_jamshide.gif";
              adImages1[4]    = "http://www.aiap.org/images/aiap_alvarado.jpg";
              adImages1[5]    = "http://www.aiap.org/images/haleh1.jpg";
              
         adImages2 = new Array();
              adImages2[1]    = "http://www.aiap.org/images/Balboa_International.gif";
              adImages2[2]    = "http://www.aiap.org/images/aiap_mseddigh.jpg";
              adImages2[3]    = "http://www.aiap.org/images/aiap_ostad.jpg";             
              adImages2[4]    = "http://www.aiap.org/images/aiap_jamshide.gif";
              adImages2[5]    = "http://www.aiap.org/images/aiap_alvarado.jpg";
              adImages2[0]    = "http://www.aiap.org/images/haleh1.jpg";

         adImages3 = new Array();
              adImages3[2]    = "http://www.aiap.org/images/Balboa_International.gif";
              adImages3[3]    = "http://www.aiap.org/images/aiap_mseddigh.jpg";
              adImages3[4]    = "http://www.aiap.org/images/aiap_ostad.jpg";             
              adImages3[5]    = "http://www.aiap.org/images/aiap_jamshide.gif";
              adImages3[0]    = "http://www.aiap.org/images/aiap_alvarado.jpg";
              adImages3[1]    = "http://www.aiap.org/images/haleh1.jpg";
              
         adImages4 = new Array();
              adImages4[3]    = "http://www.aiap.org/images/Balboa_International.gif";
              adImages4[4]    = "http://www.aiap.org/images/aiap_mseddigh.jpg";
              adImages4[5]    = "http://www.aiap.org/images/aiap_ostad.jpg";             
              adImages4[0]    = "http://www.aiap.org/images/aiap_jamshide.gif";
              adImages4[1]    = "http://www.aiap.org/images/aiap_alvarado.jpg";
              adImages4[2]    = "http://www.aiap.org/images/haleh1.jpg";

         adURL1 = new Array();
              adURL1[0]    = "balboamarket.com/";
              adURL1[1]    = "ibuysandiego.com/";
              adURL1[2]    = "ritefamilydental.com/";
              adURL1[3]    = "homesatsandiego.com/";
              adURL1[4]    = "alvaradohospital.com/";
              adURL1[5]    = "halehtravel.com/";

         adURL2 = new Array();
              adURL2[1]    = "balboamarket.com/";
              adURL2[2]    = "ibuysandiego.com/";
              adURL2[3]    = "ritefamilydental.com/";
              adURL2[4]    = "homesatsandiego.com/";
              adURL2[5]    = "alvaradohospital.com/";
              adURL2[0]    = "halehtravel.com/";

         adURL3 = new Array();
              adURL3[2]    = "balboamarket.com/";
              adURL3[3]    = "ibuysandiego.com/";
              adURL3[4]    = "ritefamilydental.com/";
              adURL3[5]    = "homesatsandiego.com/";
              adURL3[0]    = "alvaradohospital.com/";
              adURL3[1]    = "halehtravel.com/";

         adURL4 = new Array();
              adURL4[3]    = "balboamarket.com/";
              adURL4[4]    = "ibuysandiego.com/";
              adURL4[5]    = "ritefamilydental.com/";
              adURL4[0]    = "homesatsandiego.com/";
              adURL4[1]    = "alvaradohospital.com/";
              adURL4[2]    = "halehtravel.com/";

              adURL5 = new Array();
              adURL5[0]    = "aiap.org/aiap_advertising.shtml";

        thisAd1 = i
        thisAd2 = i
        thisAd3 = i
        thisAd4 = i
        imgCt1 = maxi
        imgCt2 = maxi
        imgCt3 = maxi
        imgCt4 = maxi

        function rotate() {
                if (document.images)    {

                        thisAd1++
                        if (thisAd1 > imgCt1) {
                                thisAd1 = 0
                        }
                        document.adBanner1.src=adImages1[thisAd1]

                        thisAd2++
                        if (thisAd2 > imgCt2) {
                                thisAd2 = 0
                        }
                        document.adBanner2.src=adImages2[thisAd2]

                        thisAd3++
                        if (thisAd3 > imgCt3) {
                                thisAd3 = 0
                        }
                        document.adBanner3.src=adImages3[thisAd3]

                        thisAd4++
                        if (thisAd4 > imgCt4) {
                                thisAd4 = 0
                        }
                        document.adBanner4.src=adImages4[thisAd4]

                    setTimeout("rotate()", 6 * 1000)
                }
        }

        function newLocation1() {
                document.location.href = "http://www." + adURL1[thisAd1]
        }
        
        function newLocation2() {
                document.location.href = "http://www." + adURL2[thisAd2]
        }

        function newLocation3() {
                document.location.href = "http://www." + adURL3[thisAd3]
        }

        function newLocation4() {
                document.location.href = "http://www." + adURL4[thisAd4]
        }
        function newLocation5() {
                document.location.href = "http://www." + adURL5[0]
        }
