/* Tip of the Day Object definition
*/
function objTotd(html, url, linktitle) {
	this.html = html
	this.url = url
	this.linktitle = linktitle
}

/* Tip of the Day Array setup - collection of TOTD Objects
*/
arrTotd = new Array()
arrTotd[0] = new objTotd("Baby Safety - Have you considered removeable fencing? ","docs/baby-loc.htm","Baby-Loc Removable Fencing")
arrTotd[1] = new objTotd("Balancing Packages - Have the chemicals on hand for problems with your water","docs/balancing-packages.htm","Balancing Packages")
arrTotd[2] = new objTotd("Bold Mold - A troublesome mold from under your pool - and what to do about it.","docs/bold-mold.htm","The Bold Mold")
arrTotd[3] = new objTotd("Green Hair? Here's what to do about it.","docs/green-hair.htm","Green hair")
arrTotd[4] = new objTotd("CAUTION - Unbalanced pool water can cause corrosion to pool equipment","docs/heater-corrosion.htm","Heater Corrosion")
arrTotd[5] = new objTotd("CAUTION - Unbalanced pool water can cause heater corrosion.","docs/heater-corrosion.htm","Heater Corrosion")
arrTotd[6] = new objTotd("CAUTION - Unbalanced pool water can cause uncomfortable swimming conditions such as eyeburn and skin irritation.","docs/heater-corrosion.htm","Heater Corrosion")
arrTotd[7] = new objTotd("CAUTION - Unbalanced pool water can completely ruin a new gas heater or heat pump in two short month.","docs/heater-corrosion.htm","Heater Corrosion")
arrTotd[8] = new objTotd("Do NOT start up the Filter with your Multiport in the Closed position","docs/multiport-functions.htm","Multiport Functions")
arrTotd[9] = new objTotd("The 'pink algae' or 'pink slime' that appears in some pools is really a form of bacteria.  We have some recommedations on what you can do.","docs/pink-stuff.htm","Oh No - The 'Pink Stuff'")
arrTotd[10] = new objTotd("When shocking . . . don't be afraid! You will not overshock the pool.","docs/service-tips.htm","Service Tips")
arrTotd[11] = new objTotd("Free Water Analysis - Let Family Pools help you with your pool.","free-water-testing.htm","Free Water Analysis")

/* TOTD - display a random TOTD object from the TOTD array
*/
function totd() {
	index = Math.floor(Math.random() * arrTotd .length);
	
	str = document.URL;	//current URL, includes full path (http://host/subweb/filename.htm)
	//alert("document.URL: " + str);
	currURLcount = 0;
	pos = 0;
	pos = str.indexOf("/");
	while ( pos != -1 ) {
	   	currURLcount++;
	   	pos = str.indexOf("/",pos+1);
	}
	//alert("currURLcount: " + currURLcount)

/*	str = location.pathname;	//path below host (/subweb/filename.htm)
	//alert("document.URL: " + str);
	currURLcount = 0;
	pos = 0;
	pos = str.indexOf("/");
	while ( pos != -1 ) {
	   	currURLcount++;
	   	pos = str.indexOf("/",pos+1);
	}
	//alert("currURLcount: " + currURLcount)
*/

	str = arrTotd[index].url;
	//alert("arrTotd[index].url: " + str);
	totdURLcount = 0;
	pos = 0;
	pos = str.indexOf("/");
	while ( pos != -1 ) {
	   	totdURLcount++;
	   	pos = str.indexOf("/",pos+1);
	}
	//alert("totdURLcount: " + totdURLcount)

	testFloat = "a" + totdURLcount/2;
	//alert("testFloat: " & testFloat)
	document.write(arrTotd[index].html);
	document.write("<br><a href='http://www.familypoolsonline.com/" + arrTotd[index].url + "'>Read more - " + arrTotd[index].linktitle + "</a>");
}
/*
hash: 
host: localhost 
hostname: localhost 
href: http://localhost/familypoolsonline-new/auto-totd.htm 
pathname: /familypoolsonline-new/auto-totd.htm 
target: undefined 

5 http://localhost/familypoolsonline-new/docs/baby-loc.htm
1 docs/baby-loc.htm
../

5 http://localhost/familypoolsonline-new/docs/baby-loc.htm
0 free-water-testing.htm
../
5-0=5

4 http://localhost/familypoolsonline-new/free-water-testing.htm
1 docs/baby-loc.htm
.

4 http://localhost/familypoolsonline-new/free-water-testing.htm
0 free-water-testing.htm
.
4-0=4

4 http://localhost/docs/baby-loc.htm
1 docs/baby-loc.htm
../

4 http://localhost/docs/baby-loc.htm
0 free-water-testing.htm
../

3 http://localhost/free-water-testing.htm
1 docs/baby-loc.htm
.

3 http://localhost/free-water-testing.htm
0 free-water-testing.htm
.

*/



