//====================================
//Enhancements/Fixes:
//====================================
// 5.1.4- 7/05:
//- added special handling for Safari
//- added corporate logo tracking
//- fixed preferences bug
//====================================
// 5.1.5- 11/05
//- added Safari fix to search.htm
//====================================
// 5.1.6- 01/06
//- expiry date function fix
//====================================

//ActivDirectory Version
var version = "5.1.6";

//-Geographic name of directory, publisher, and product to appear on titlebar and results page
var title = "Vacationland"; 	// -- Enter title
var trakVal = "USNVAC10";			//-- enter book code
var traip = "usanorthland.innovectra.net";
var bookLoc = trakVal;
var spinecode = trakVal;
var issuedate = "08";
var year = "2010";
var corp = "USA Northland Directories Inc.";
var publisher = "USA Northland Directories Inc.";
var brandname = "Online Directory";
var product = "Online Directory";
var corplink = "http://www.usanorthland.com/";
var orderNumber = ""
var atkOff = 0;
var uniqueID = null;

//--- ADD SECTIONS IN THE DROP-DOWN HERE (IF YOU NEED TO ADD A SECTION THAT IS NOT HERE, ---
//--- ADD IT HERE, IN TREE.HTM AND IN TREE.JS. ALSO IN THE SEARCH.JS FILES IF IT IS      ---
//--- A WHITE OR YELLOW SECTION)						         ---

//- 20 Popular Headings & Front Cover
	var coverSection = new Array();
	coverSection[0] = new Array("20 Popular Headings / Front Cover", "cover", 1, 1);

//- Front Cover only -- Needed if 20 Headings is switched off
	var frontSection = new Array();
	frontSection[0] = new Array("Front Cover", "cover", 1, 0);



//- Emergency Numbers
	var emerSection = new Array();
	emerSection[0] = new Array("Emergency Numbers", "emerg", 1, 0);

//- Community Section
	var commSection = new Array();
	commSection[0] = new Array("Customer Guide", "comm", 1, 1);	//- Main link
	commSection[1] = new Array("Community Guide", "comm", 1, 1);	//- Main link
	commSection[2] = new Array("911 Numbers", "cust", 2, 1);	//- Main link
	commSection[3] = new Array("Table of Contents", "cust", 1, 1);	//- Main link
	commSection[4] = new Array("Coupons", "cust", 1, 0);	//- Main link
	commSection[5] = new Array("Zip Codes", "cust", 4, 1);	//- Main link
	commSection[6] = new Array("Area Maps", "comm", 38, 0);	//- Main link
	commSection[7] = new Array("Community Corner", "cust02", 1, 1);	//- Main link

//- Customer Guide - in some books instead of Cust & Comm Information 
	var custSection = new Array();
	custSection[0] = new Array("Community Section", "comm", 1, 0);				//- Main link

//- Internet Guide 
	var custgdeSection = new Array();
	custgdeSection[0] = new Array("Internet Guide", "yp01", 242, 0);				//- Main link

//- Blue Pages
	var govSection = new Array();
	govSection[0] = new Array("Blue Pages", "gov", 83 , 0);					//- Main link

//- Golf Guide
	var golfSection = new Array();
	golfSection[0] = new Array("Golf Guide", "yp01", 44, 1);

//- Resort Guide
	var resortSection = new Array();
	resortSection[0] = new Array("Resort Guide", "yp01", 74, 1);

//- Restaurant Menus 
	var restaurantSection = new Array();
	restaurantSection[0] = new Array("Restaurant Guide", "yp01", 79, 1);			//- Main link


//- White Pages - Switch on and name the white pages sections.
//- If you need more than 20 sections, they must be added here, in tree.htm, tree.js, tab.htm, and search.js files
	var whiteSection = new Array();
	whiteSection[0] = new Array("Vacationland", "w01", 1, 1);
	whiteSection[1] = new Array("Vacationland", "w01", 1, 0);
	whiteSection[2] = new Array("Additional Vacationland", "w02", 1, 1);
	whiteSection[3] = new Array("White Pages", "w03", 1, 0);
	whiteSection[4] = new Array("White Pages", "w04", 1, 0);
	whiteSection[5] = new Array("White Pages", "w05", 1, 0);
	whiteSection[6] = new Array("White Pages", "w06", 1, 0);
	whiteSection[7] = new Array("White Pages", "w07", 1, 0);
	whiteSection[8] = new Array("White Pages", "w08", 1, 0);
	whiteSection[9] = new Array("White Pages", "w09", 1, 0);
	whiteSection[10] = new Array("White Pages", "w10", 1, 0);
	whiteSection[11] = new Array("White Pages", "w11", 1, 0);
	whiteSection[12] = new Array("White Pages", "w12", 1, 0);
	whiteSection[13] = new Array("White Pages", "w13", 1, 0);
	whiteSection[14] = new Array("White Pages", "w14", 1, 0);
	whiteSection[15] = new Array("White Pages", "w15", 1, 0);
	whiteSection[16] = new Array("White Pages", "w16", 1, 0);
	whiteSection[17] = new Array("White Pages", "w17", 1, 0);
	whiteSection[18] = new Array("White Pages", "w18", 1, 0);
	whiteSection[19] = new Array("White Pages", "w19", 1, 0);
	whiteSection[20] = new Array("White Pages", "w20", 1, 0);

//- Yellow Page Index sections -- usually just one. Switch on others, if nec.
	var indexSection = new Array();
	indexSection[0] = new Array("Yellow Pages Headings Index", "index", 1, 1);		//- Generally needed
	indexSection[1] = new Array("Yellow Pages Headings Index", "index02", 1, 1);	//- Switch on if nec.
	indexSection[2] = new Array("Third Headings Index", "index03", 1, 1);	//- Switch on if nec.

//- Coupons -- in most books
	var couponSection = new Array();
	couponSection[0] = new Array("Coupons", "yp01", 887, 0);		//- Switch on if there are coupons

//- Featured
	var featuredSection = new Array();
	featuredSection[0] = new Array("Featured Advertisers", "featured", 1, 0);	//- Main link
	featuredSection[1] = new Array("Jeffrey H. Dover Attorney at Law", "featured", 1, 0);
	featuredSection[2] = new Array("Thomas J. Ford Attorney at Law", "featured", 1, 0);
	featuredSection[3] = new Array("Kaplan & Seifter Attorneys at Law", "featured", 1, 0);
	featuredSection[4] = new Array("Mr. Electric", "featured", 1, 0);
	featuredSection[5] = new Array("Mr. Rooter", "featured", 1, 0);
	featuredSection[6] = new Array("Mr. Rooter", "featured", 1, 0);
	featuredSection[7] = new Array("Plichta & Associates", "featured", 1, 0);

	
//- Yellow Sections (Although generally not in the drop-down, these are used by other areas of the GUI
	var ypSection = new Array();
	ypSection[0] = new Array("Yellow Pages", "yp01", 1, 1);
	ypSection[1] = new Array("Yellow Pages", "yp02", 1, 0);
	ypSection[2] = new Array("Yellow Pages", "yp03", 1, 0);
	
//-Featured Advertisers
// Enter number of banner ads (not including Superpages) or maxFeaturedAdvertisers
var bannernumber = 7;

//- add banners here
var advertisers = new Array();
advertisers[0] = new Array("", 1);
advertisers[1] = new Array("", 2);
advertisers[2] = new Array("", 3);
advertisers[3] = new Array("", 4);
advertisers[4] = new Array("", 5);
advertisers[5] = new Array("", 6);
advertisers[6] = new Array("", 7);


// --- SET THESE ONCE PER PUBLISHER ---
//-Rotating logos & associated links
var link = new Array();
link[0] = new Array("www.usanorthland.com", 1);



//-Background GUI color; tab colors
var color = "0066b8";
var tabbkg = "C2D3FC";
var tabtext = "9EBCFA";

var noTabSections = new Array();
				 

//-Default GUI text color
var guiTextColor = "FFFFFF";

//GUI and results links text sizes (in pts) and colors
var links800 = 7;
var links = 7;
var categoryColor= "CCFFFF"; //Match text color in keyword searches
var activeLinksColor = "FFFF00";  //Color of active sub-sections in section list
var linksColor = "FFFFFF";  //Color of sub-sections in section list
var resultColor = "FFFFCE"; //Color of matches in searches
var headingColor= "FFFFFF"; // Color of heading below results
var nomatchColor= "FFFF00"; //Color of text if no matches found
var searchItemColor = "CCFFCC"; //Search item in keyword searches
var doubleTruckResultColor = "FFCEFF"; //Search item in keyword searches for DT ads
var secColor0 = "FFFFCE";
var secColor1 = "FFFFFF";
var secColor2 = "000000";
var secColor3 = "99FFFF";
var secColor4 = "FFCCCC";
var secColor5 = "99FF99";
var secColor6 = "FFCCFF";
var secColor7 = "FFFF66";
var secColor8 = "FFCC99";
var secColor9 = "CCFFCC";
var secColor10 = "CCCC33";
var secColor11 = "FF99FF";
var secColor12 = "FF9999";
var secColor13 = "996600";
var secColor14 = "00FF00";
var secColor15 = "CC0033";
var secColor16 = "FFFF00";

// - Add even page numbers of double truck pairs here --
//Double truck ads
var doubleTrucks = new Array();

//- Enter which section the 911 pages appear in; Enter number of coupon index pages;
//- If coupon page numbers are the same on the front and back of pages, change 'doubleCoupon' to true --
var emergSection = 'cust';
var numCouponIndex = 2;
var doubleCoupon = false;

//-Featured Advertisers links color
var featuredColor = "ffcc33";
var pageWidth = 693;

//USERHELP PAGE CONFIGURATION
var textcolor = "003399"

//NUMBER OF BACK/FORWARD STEPS
var maxNumSpots = 10;

// Enter first page and number before first page of Yellow Page section here
var section="cover";
var number = 0;
var page = 0;

var browser = new Browser();
var href = new Href();
var pathPrefix = solvePathPrefix();

function solvePathPrefix(){
    pathPrefix = "";
    if (browser.app == "Firefox" && browser.version > 2 && href.protocol == "file:"){
        pathPrefix = "data/";
    }
    
    return pathPrefix;
}

function Href(){
    this.protocol = window.location.protocol
    this.host = window.location.host
    this.pathname = window.location.pathname
    this.search = window.location.search
}

function Browser() {
    var name = navigator.appName;
    if (name == "Netscape"){
        this.name = "ns";
    }else if (name == "Microsoft Internet Explorer"){
        this.name = "ie";
    }else{
        this.name = "other";
    }
    var agent = navigator.userAgent;
    if (/Firefox[\/\s](\d+\.\d+)/.test(agent)){
        this.version = new Number(RegExp.$1);
        this.app = "Firefox";
    }else if (/MSIE (\d+\.\d+);/.test(agent)){
        this.version = new Number(RegExp.$1);
        this.app = "IE";
    }else if (/Opera[\/\s](\d+\.\d+)/.test(agent)){
        this.version = new Number(RegExp.$1);
        this.app = "Opera";
    }else if (/Version[\/\s](\d+\.\d+)(\.\d+)?\sSafari/.test(agent)) {
        this.version = new Number(RegExp.$1);
        this.app = "Safari";
    }else{
        this.version = 0;
        this.app = "other";
    }
      
    this.isDOM   = (document.createElement
                    && document.appendChild
                    && document.getElementsByTagName) ? true : false;

    var ua = navigator.userAgent.toLowerCase();
    if (ua.indexOf ("win") > - 1){
        this.platform = "win";
    }else if (ua.indexOf("mac") > -1){
        this.platform = "mac";
    }else{
        this.platform="other";
    }
}

//- Yellow Pages end page number, default section selection
// PAGE RANGES START HERE
var maxComm = 8;
var minComm = 1;

var maxIndex = 8;
var minIndex = 1;
// Enter first page and number before first page of Yellow Page section here
var twobeforefirst = 0;
var beforefirst = 0;
var firstpage = 1;

var maxYP01 = 104;
var minYP01 = 1;

var maxIndex02 = -1;
var minIndex02 = -1;

var maxEmerg = -1;
var minEmerg = -1;

var maxW01 = 88;
var minW01 = 1;

var maxCover = -1;
var minCover = -1;

var maxCust = 8;
var minCust = 1;

var maxCust02 = 6;
var minCust02 = 1;

var maxW02 = 90;
var minW02 = 1;

