//Iris Tsing, Lab 5

/*Use these Hints if you need them...   1. Create a function called randomInt that will generate a random number within a given range.          * The function has 2 parameters; lower (the lowest integer in the range) and higher (the highest integer in the range).          * Declare a variable (size) equal to the number of integers in the given range; the size of the range is one more than the difference between the highest and lowest integer.          * Use Math.floor() and Math.random() as well as the lower parameter and the size variable to generate a random number (see week 4 Random Numbers).   2. Create a new function called tipTitle(). The function will have one parameter, n. This function will return the title of the nth tip title. The nth value is the random number generated above.          * Within the function, declare a new array called title and populate it with the tip titles contained in the data file above. Start the index with 1.          * Have the function return title[n] when called.   3. Create a new function called tipText(). The function will have one parameter, n. This function will return the text of the nth tip text. The nth value is the random number generated above.          * Within the function, declare a new array called text and populate it with the tip text contained in the data file above. Start the index with 1.          * Have the function return text[n] when called.   4. Within the home_ctr.html document, locate the HTML DIV element called "tip". Replace the contents of with an embedded script that declares a new variable (tipNum). Set its value by calling the randInt function using 1 and 10 as the parameters.   5. Write the following to the page (continuing to use JS) where title is the title of the random tip generated by the tipTitle function and tip is the text of the random tip generated by the tipText function: <h1>Random Tip<br /> title</h1> <p>tip</p>
*/

var Title = new Array(10);Title[1] = "Damaged Tiles";Title[2] = "Sanding Wood";Title[3] = "Dealing with Ice";Title[4] = "Weed Killers";Title[5] = "Effective Mowing";Title[6] = "Lighting the Outdoors";Title[7] = "Using a Sump Pump";Title[8] = "Sagging Gutters";Title[9] = "Long-lasting Brushes";Title[10] = "Using Downspouts";

var Text = new Array(10);Text[1] = "To replace a tile, blast a hair dryer at full force onto the ragged edge of the tile that's chipped. Once it heats up, press a large wood chisel into that edge to lift away the tile, then use the chisel or a putty knife to remove any remaining adhesive.";Text[2] = "Before you stain wood, first sand it down to a silky smoothness, using successively finer grades of sandpaper. Once it's smoooth, soak a rag in turpentine and rub it into the wood. As the turpentine dries, the wood's grain will rise. Sand this down with super-fine grit, making sure never to sand against the grain. You're now ready to stain.";Text[3] = "Not sure how to take care of an icy driveway? Rock salt clears the ice, but it can kill nearby vegetation and damage the concrete below. Luckily, there's now a whole handful of environmentally-friendly products that melt the ice without ruining your lawn or sidewalk. You can also go the old-fashioned route and spread ash, sand or gravel on the ice to provide better traction.";Text[4] = "To control your weeds you may need to use chemical weed killers. Don't spread a weed killer on a newly seeded lawn. That may do more harm than good. If you spray weed killer with a garden-hose attachment, wait for a calm day with little or no wind to prevent it from spreading to adjoining flower patches and harming them. Finally, spray between mowings so that the chemical can sink into the weeds.";Text[5] = "Don't mow your grass when it's wet; that damages the blades and your lawn alike. Don't buzz cut an overgrown lawn to get back on schedule. Instead, cut the grass back in increments, never by more than a third of its current length. However, do cut your lawn as high as about three inches. That length helps limit weed growth, reduces the need for watering and promotes a strong root structures. Don't cut your lawn obsessively.";Text[6] = "Use outdoor lights with a photocell unit or a timer so they will turn off during the day. Turn off decorative outdoor gas lamps; eight gas lamps burning year round use as much natural gas as it takes to heat an average-size home during an entire winter. Finally, if you live in a cold climate, be sure to buy a lamp with a cold-weather ballast.";Text[7] = "Dealing with basement flooding? Get a sump pump if you don't already have one. If you do have one, consider a second one for emergency situations. If your sump pump is electric, get a battery-operated version as a backup since power outages often accompany heavy storms. Be sure to check your pump for problems. First, disconnect the pump and clean out any debris; then reconnect it and pour in enough water for a test.";Text[8] = "If your gutters aren't draining quickly and drip long after the rain, water may be collecting in a low spot caused by sagging. If that's the case, grab a friend and snap a chalk line along the gutter using both ends of its top edge as your guiding points. (You should have a slope of 1 inch for every 16 feet of gutter). Look for spots where the gutter's edge falls below the chalk line, then refasten the spikes, straps or brackets that hold it in place.";Text[9] = "Excessive soaking is the number one menace to the lifespan of a paintbrush. Instead of soaking, clean your brush immediately according to the directions. When using oil base paints, clean thoroughly in solvent, kerosene or thinner, then comb and place back in the keeper.";Text[10] = "To effectively get the water away from your house you can let your downspout empty onto a splash block or send the runoff to an extension gutter. Or you can get a retractable downspout extender which unfurls as it fills with water, then contract as the water stops flowing, tucking neatly under the downspout and out of the way of lawn mowers.";


var randomTip = 1;
function randomInt() {

  randomTip = Math.floor(1 + Math.random() * 10);

  document.write(Title[randomTip]);
}function writeText() {

  document.write (Text[randomTip]);
}