function startHere() {
//INITIALIZE VARIABLES
var numRows=0;
//INITIALIZE TEMP VARIABLES
var resourceContent;
var tempString="";
var tempLink="";
var nameImage = "1geocachingLogo.jpg";
//INITIALIZE ARRAYS
var myArray = new Array();
var myArray2D = new Array()
var tempArray = new Array();
var traditionals2D = new Array();
var mysteries2D = new Array();
var multicaches2D = new Array();
var letterboxes2D = new Array();
var nightcaches2D = new Array();
//INITIALIZE ARRAY LENGTHS
var lenTraditionals=0;
var lenMysteries=0;
var lenMulticaches=0;
var lenLetterboxes =0;
var lenNightcaches = 0;
//INITIALIZE TABLE VARIABLES
var tableWidth=0;
$.get('hagFavorites.txt', function(data) {
//GRAB DATA FROM TEXT FILE
resourceContent = data;
myArray = data.split("\n");
numRows = myArray.length;
for (var i = 0; i < numRows; i++) {
myArray2D[i] = myArray[i].split(/"/g);
if ((myArray2D[i][3]) == "Traditional Cache") { //FILL TRADITIONAL CACHE ARRAY
var tempArray = new Array();
tempArray[0] = myArray2D[i][9];
tempArray[1] = myArray2D[i][31];
tempArray[2] = myArray2D[i][1];
//alert(tempArray[2]);
traditionals2D[lenTraditionals] = tempArray;
lenTraditionals = lenTraditionals+1;
} else if ((myArray2D[i][3]) == "Unknown Cache") { //FILL MYSTERY CACHE ARRAY
if ((((myArray2D[i][9]).indexOf("Pink Panther")) != -1) || (((myArray2D[i][9]).indexOf("Signal von Muggle")) != -1) || (((myArray2D[i][9]).indexOf("Night Games")) != -1)) {
//BUILD NIGHT CACHE ARRAY
var tempArray = new Array();
tempArray[0] = myArray2D[i][9];
tempArray[1] = myArray2D[i][31];
tempArray[2] = myArray2D[i][1];
nightcaches2D[lenNightcaches] = tempArray;
lenNightcaches++;
} else {
var tempArray = new Array();
tempArray[0] = myArray2D[i][9];
tempArray[1] = myArray2D[i][31];
tempArray[2] = myArray2D[i][1];
mysteries2D[lenMysteries] = tempArray;
lenMysteries++;
}
} else if ((myArray2D[i][3]) == "Multicache") { //FILL MULTICACHE ARRAY
var tempArray = new Array();
tempArray[0] = myArray2D[i][9];
tempArray[1] = myArray2D[i][31];
tempArray[2] = myArray2D[i][1];
multicaches2D[lenMulticaches] = tempArray;
lenMulticaches++;
} else if ((myArray2D[i][3]) == "Letterbox Hybrid") { //FILL LETTERBOX ARRAY
var tempArray = new Array();
tempArray[0] = myArray2D[i][9];
tempArray[1] = myArray2D[i][31];
tempArray[2] = myArray2D[i][1];
letterboxes2D[lenLetterboxes] = tempArray;
lenLetterboxes++;
}
}
/************************************************************SET CSS***********************************************************/
//CALCULATE TABLE WIDTH
//http://www.w3schools.com/css/tryit.asp?filename=trycss_table_fancy
tableWidth = Math.floor((window.innerWidth) / 3) - 30;
var secondColWidth = 75;
var firstColWidth = tableWidth - secondColWidth;
//SET CSS FOR TITLE OF PAGE
document.write("");
/***************************************************START PRINTINT OUT HTML***************************************************/
//PRINT OUT PAGE TITLE
document.write("
");
document.write("
HAG X Favorites
");
document.write("");
//PRINT OUT TABLE OF TRADITIONALS
//DRAW SPECIAL 1-CELL TABLE JUST FOR TABLE TITLE
document.write("");
document.write("
");
document.write("");
document.write("TRADITIONAL CACHES | ");
document.write(" |
");
document.write("
");
//DRAW TABLE LABELS
document.write("
");
document.write("");
document.write("" + "Cache Name" + " | ");
document.write("" + "# Favorites" + " | ");
document.write("
");
//DRAW DATA TABLE
var colorRow = false;
for (var i = 0; i < (lenTraditionals); i++) {
if (colorRow == false) {
document.write("");
} else {
document.write("
");
}
//WRITE IMAGE AND LINK
//
tempString = "";
tempString = tempString + "";
tempString = tempString + "";
document.write(tempString);
//alert(tempString);
//WRITE CACHE NAME
tempString = " " + traditionals2D[i][0] + " | " ; //cache name
document.write(tempString);
//alert(tempString);
//WRITE FAVORITE POINTS
tempString = "" + traditionals2D[i][1] + " | " ;
document.write(tempString);
//alert(tempString);
//FINISH OFF
document.write("
");
colorRow = !colorRow;
}
document.write("
");
document.write("
");
//PRINT OUT TABLE OF PUZZLE CACHES
//DRAW SPECIAL 1-CELL TABLE JUST FOR TABLE TITLE
document.write("");
document.write("
");
document.write("");
document.write("PUZZLE CACHES | ");
document.write(" |
");
document.write("
");
//DRAW TABLE LABELS
document.write("
");
document.write("");
document.write("" + "Cache Name" + " | ");
document.write("" + "# Favorites" + " | ");
document.write("
");
//DRAW DATA TABLE
var colorRow = false;
for (var i = 0; i < (lenMysteries); i++) {
if (colorRow == false) {
document.write("");
} else {
document.write("
");
}
//WRITE IMAGE AND LINK
//
tempString = "";
tempString = tempString + "";
tempString = tempString + "";
document.write(tempString);
//WRITE CACHE NAME
tempString = " " + mysteries2D[i][0] + " | " ; //cache name
document.write(tempString);
//WRITE FAVORITE POINTS
tempString = "" + mysteries2D[i][1] + " | " ;
document.write(tempString);
//FINISH OFF
document.write("
");
colorRow = !colorRow;
}
document.write("
");
document.write("
");
//MAKE DIV FOR LEFTOVER TABLES
document.write("");
//PRINT OUT TABLE OF NIGHT CACHES
//DRAW SPECIAL 1-CELL TABLE JUST FOR TABLE TITLE
document.write("
");
document.write("");
document.write("NIGHT CACHES | ");
document.write(" |
");
document.write("
");
//DRAW TABLE LABELS
document.write("
");
document.write("");
document.write("" + "Cache Name" + " | ");
document.write("" + "# Favorites" + " | ");
document.write("
");
//DRAW DATA TABLE
var colorRow = false;
for (var i = 0; i < (lenNightcaches); i++) {
if (colorRow == false) {
document.write("");
} else {
document.write("
");
}
//WRITE IMAGE AND LINK
//
tempString = "";
tempString = tempString + "";
tempString = tempString + "";
document.write(tempString);
//WRITE CACHE NAME
tempString = " " + nightcaches2D[i][0] + " | " ; //cache name
document.write(tempString);
//WRITE FAVORITE POINTS
tempString = "" + nightcaches2D[i][1] + " | " ;
document.write(tempString);
//FINISH OFF
document.write("
");
colorRow = !colorRow;
}
document.write("
");
//PRINT OUT TABLE OF MULTICACHES
//DRAW SPECIAL 1-CELL TABLE JUST FOR TABLE TITLE
document.write("
");
document.write("");
document.write("MULTICACHES | ");
document.write(" |
");
document.write("
");
//DRAW TABLE LABELS
document.write("
");
document.write("");
document.write("" + "Cache Name" + " | ");
document.write("" + "# Favorites" + " | ");
document.write("
");
//DRAW DATA TABLE
var colorRow = false;
for (var i = 0; i < (lenMulticaches); i++) {
if (colorRow == false) {
document.write("");
} else {
document.write("
");
}
//WRITE IMAGE AND LINK
//
tempString = "";
tempString = tempString + "";
tempString = tempString + "";
document.write(tempString);
//WRITE CACHE NAME
tempString = " " + multicaches2D[i][0] + " | " ; //cache name
document.write(tempString);
//WRITE FAVORITE POINTS
tempString = "" + multicaches2D[i][1] + " | " ;
document.write(tempString);
//FINISH OFF
document.write("
");
colorRow = !colorRow;
}
document.write("
");
//PRINT OUT TABLE OF LETTERBOXES
//DRAW SPECIAL 1-CELL TABLE JUST FOR TABLE TITLE
document.write("
");
document.write("");
document.write("LETTERBOXES | ");
document.write(" |
");
document.write("
");
//DRAW TABLE LABELS
document.write("
");
document.write("");
document.write("" + "Cache Name" + " | ");
document.write("" + "# Favorites" + " | ");
document.write("
");
//DRAW DATA TABLE
var colorRow = false;
for (var i = 0; i < (lenLetterboxes); i++) {
if (colorRow == false) {
document.write("");
} else {
document.write("
");
}
//WRITE IMAGE AND LINK
//
tempString = "";
tempString = tempString + "";
tempString = tempString + "";
document.write(tempString);
//WRITE CACHE NAME
tempString = " " + letterboxes2D[i][0] + " | " ; //cache name
document.write(tempString);
//WRITE FAVORITE POINTS
tempString = "" + letterboxes2D[i][1] + " | " ;
document.write(tempString);
//FINISH OFF
document.write("
");
colorRow = !colorRow;
}
document.write("
");
//FINISH OFF
document.write("**Click on the geocaching logos to link to the cache pages");
document.write("
Last updated: March 10, 2014");
//ADD COUNTER
document.write("
");
document.write("");
document.write("");
document.write("
");
});
}