﻿var isDHTML = 0;

var isLayers = 0;

var isAll = 0;

var isID = 0;

currDisplay = "none"

if (document.getElementById) {isID = 1; isDHTML = 1;}

else {

browserVersion = parseInt(navigator.appVersion);

if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}

else {

if (document.all) {isAll = 1; isDHTML = 1;}

}}



function findDOM(objectID,withStyle) {

  var menuArea = "menuArea";

  if (withStyle == 1) {

    if (isID) { return (document.getElementById(objectID).style) ; }

    else { 

      if (isAll) { return (document.all[objectID].style); }

      else {

        if (isLayers) { return (document.layers[menuArea].layers[objectID]); }

      };

    }

   }

   else {

     if (isID) { return (document.getElementById(objectID)) ; }

     else { 

       if (isAll) { return (document.all[objectID]); }

       else {

         if (isLayers) { return (document.layers[menuArea].layers[objectID]); }

       };

     }

   }

}



function toggleDisplay(objectID) {

  if (isAll || isID) {

    if (currDisplay != "none") {

        domStyle = findDOM(currDisplay,1);

        domStyle.display='none';

    }

    if (currDisplay != objectID) {

       domStyle = findDOM(objectID,1);

       domStyle.display='block';

       currDisplay=objectID;

    } else {

       domStyle = findDOM(objectID,1);

       domStyle.display='none';

       currDisplay="none";

    }

  }

  return;

}



function initAll() {

    $(document).ready(function() {
        $(document).mousemove(function(e) {
            //$('#pos').html('x: ' + e.pageX + ' y:' + e.pageY + '<br/>doc w: ' + $(document).width());
            if (e.pageX <= $(document).width()) {
                if (e.pageX - 250 <= 0) {
                    $('#locationHover').css('left', e.pageX + 15);
                } else {
                    $('#locationHover').css('left', e.pageX - 250);
                }
                $('#locationHover').css('top', e.pageY - 25);
            }
        })
    });

}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function showLocation(locIndex) {

    obj = document.getElementById('locationHover');
//    objHover = document.getElementById('Area' + locIndex);
//    var coords = findPos(objHover);

    obj.innerHTML = locations[locIndex];

    obj.style.width = 240;
    
//    obj.style.left = coords[0];
//    obj.style.top = coords[1];

    //obj.style.height = centerHeights[centerNo];

    obj.style.visibility = 'visible';


}



function hideLocation() {

    document.getElementById('locationHover').innerHTML = "";

    document.getElementById('locationHover').style.visibility = 'hidden';

}



function openWindowScroll (url, winName, popWidth, popHeight) {

		var horizPos = (screen.availWidth - popWidth)/ 2;

		var vertPos = ((screen.availHeight - popHeight)/ 2) + 30;

		window.open(url, winName, "width=" + popWidth + ", height=" + popHeight + ", resizable=no, top=" + vertPos + ", left=" + horizPos + ", scrollbars=yes, status=no");

}



locations = new Array();

locations[1] = "<p class='locationHover'><strong>Seattle, WA</strong>Servicing Seattle and surrounding area.<br />888-605-5550";
locations[2] = "<p class='locationHover'><strong>Portland, OR</strong>Servicing Portland and surrounding area";
locations[3] = "<p class='locationHover'><strong>Los Angeles North, CA</strong>Servicing northern Los Angeles and Ventura counties";
locations[4] = "<p class='locationHover'><strong>Los Angeles, CA</strong>Servicing Los Angeles, Ventura, Orange, San Bernadino and Riverside counties";
locations[5] = "<p class='locationHover'><strong>San Diego, CA</strong>Servicing San Diego county";
locations[6] = "<p class='locationHover'><strong>San Francisco, CA</strong>Coming Soon";
locations[7] = "<p class='locationHover'><strong>Phoenix, AZ</strong>Servicing Phoenix and surrounding area";
locations[8] = "<p class='locationHover'><strong>Tucson, AZ</strong>Servicing Tucson and surrounding area";
locations[9] = "<p class='locationHover'><strong>Denver, CO</strong>Servicing Denver and surrounding area";
locations[10] = "<p class='locationHover'><strong>Dallas / Fort Worth, TX</strong>Servicing Dallas, Fort Worth, Waco and surrounding areas";
locations[11] = "<p class='locationHover'><strong>Houston, TX</strong>Servicing Houston and surrounding area";
locations[12] = "<p class='locationHover'><strong>Austin, TX</strong>Servicing Austin and surrounding area";
locations[13] = "<p class='locationHover'><strong>San Antonio, TX</strong>Servicing San Antonio and surrounding area";
locations[14] = "<p class='locationHover'><strong>Las Vegas, NV</strong>Servicing Las Vegas and surrounding area";
locations[15] = "<p class='locationHover'><strong>Kansas City, KS</strong>Servicing Kansas City, KS and Kansas City, MO and surrounding areas";
locations[16] = "<p class='locationHover'><strong>Cedar Rapids, IA</strong>Servicing Cedar Rapids, Iowa City, Des Moines, Quad Cities and surrounding areas";
locations[17] = "<p class='locationHover'><strong>Minneapolis / St. Paul, MN</strong>Servicing Minneapolis / St. Paul and surrounding areas";
locations[18] = "<p class='locationHover'><strong>Chicago North, IL</strong>Servicing northern Chicago , southern Wisconsin and surrounding areas";
locations[19] = "<p class='locationHover'><strong>Chicago, IL</strong>Servicing Chicago Metropolitan area, southern Wisconsin, northern Indiana and surrounding areas";
locations[20] = "<p class='locationHover'><strong>Indianapolis, IN</strong>Servicing Indianapolis and surrounding area";
locations[21] = "<p class='locationHover'><strong>Cincinnati, OH</strong>Servicing Cincinnati, Dayton, northern Kentucky and surrounding area";
locations[22] = "<p class='locationHover'><strong>Columbus, OH</strong>Servicing Columbus and surrounding area";
locations[23] = "<p class='locationHover'><strong>Cleveland, OH</strong>Servicing Cleveland and surrounding area";
locations[24] = "<p class='locationHover'><strong>Detroit, MI</strong>Servicing Detroit, Lansing, Port Huron and surrounding areas";
locations[25] = "<p class='locationHover'><strong>Cincinnati, OH</strong>Servicing Cincinnati, Dayton, northern Kentucky and surrounding area";
locations[26] = "<p class='locationHover'><strong>Nashville, TN</strong>Servicing Nashville, TN, Hopkinsville, KY and surrounding areas";
locations[27] = "<p class='locationHover'><strong>Memphis, TN</strong>Servicing Memphis, TN and surrounding area";
locations[28] = "<p class='locationHover'><strong>St. Louis, MO</strong>Servicing St. Louis and surrounding area";
locations[29] = "<p class='locationHover'><strong>Boston, MA</strong>Servicing Boston, Worcester, southern New Hampshire and surround area";
locations[30] = "<p class='locationHover'><strong>Boston, MA</strong>Servicing Boston, Worcester, southern New Hampshire and surround area";
locations[31] = "<p class='locationHover'><strong>Providence, RI</strong>Servicing Providence and surrounding area";
locations[32] = "<p class='locationHover'><strong>Hartford, CT</strong>Servicing state of CT";
locations[33] = "<p class='locationHover'><strong>Albany, NY</strong>Servicing Albany, Syracuse and surrounding area";
locations[34] = "<p class='locationHover'><strong>Pittsburgh, PA</strong>Servicing Pittsburgh, PA, Stubenville, OH, northern West Virginia, and surrounding area";
locations[35] = "<p class='locationHover'><strong>Lancaster, PA</strong>Servicing Lancaster, York, Reading, Harrisburg, Lehigh Valley and surrounding area";
locations[36] = "<p class='locationHover'><strong>Philadelphia, PA</strong>Servicing Philadelphia, PA and surrounding areas";
locations[37] = "<p class='locationHover'><strong>Clifton, NJ</strong>Servicing state of NJ";
locations[38] = "<p class='locationHover'><strong>Long Island City, NY</strong>Servicing Long Island, Brooklyn, Queens, Bronx, Manhattan, Westchester county and surrounding area";
locations[39] = "<p class='locationHover'><strong>Baltimore, MD</strong> Servicing Baltimore and surrounding area";
locations[40] = "<p class='locationHover'><strong>Washington, D.C.</strong> Servicing Washington, D.C. and surrounding area";
locations[41] = "<p class='locationHover'><strong>Greensboro, NC</strong>Servicing Greensboro, Winston Salem, Raleigh, Durham and surrounding area";
locations[42] = "<p class='locationHover'><strong>Charlotte, NC</strong>Servicing Charlotte, Gastonia, Rock Hill, SC and surrounding area";
locations[43] = "<p class='locationHover'><strong>Greenville / Spartanburg, SC</strong>Servicing Greenville, Spartanburg and surrounding area";
locations[44] = "<p class='locationHover'><strong>Atlanta, GA</strong>Servicing Atlanta, Dalton, Gainesville, Athens, Macon and surrounding area";
locations[45] = "<p class='locationHover'><strong>Birmingham, AL</strong> Servicing Birmingham and surrounding area";
locations[46] = "<p class='locationHover'><strong>Jacksonville, FL</strong>Servicing Jacksonville, St. Augustine, Gainesville, Ocala and surrounding area<br />800-717-5512";
locations[47] = "<p class='locationHover'><strong>Orlando, FL</strong>Servicing Orlando, Kissimmee, Winter Park and surrounding area<br />888-605-5550";
locations[48] = "<p class='locationHover'><strong>Tampa, FL</strong>Servicing Tampa, St. Petersburg, Sarasota and surrounding area<br />888-605-5550";
locations[49] = "<p class='locationHover'><strong>Ft. Myers, FL</strong>Servicing Ft. Myers, Cape Coral, Naples and surrounding area";
locations[50] = "<p class='locationHover'><strong>Miami, FL</strong>Servicing Miami, Ft. Lauderdale, West Palm Beach, Melbourne and surround area";
locations[51] = "<p class='locationHover'><strong>Cayey, Puerto Rico</strong>Servicing all of Puerto Rico";
locations[52] = "<p class='locationHover'><strong>Wilmington, DE</strong>Servicing Wilmington, DE and surrounding areas";

centerWidths = new Array();

centerWidths[1] = 150;
centerWidths[2] = 150;
centerWidths[3] = 200;
centerWidths[4] = 190;
centerWidths[5] = 180;
centerWidths[6] = 100;
centerWidths[7] = 160;
centerWidths[8] = 150;
centerWidths[9] = 160;
centerWidths[10] = 150;
centerWidths[11] = 160;
centerWidths[12] = 160;
centerWidths[13] = 160;
centerWidths[14] = 190;
centerWidths[15] = 190;
centerWidths[16] = 220;
centerWidths[17] = 192;
centerWidths[18] = 160;
centerWidths[19] = 134;
centerWidths[20] = 220;
centerWidths[21] = 180;
centerWidths[22] = 180;
centerWidths[23] = 140;
centerWidths[24] = 130;
centerWidths[25] = 190;
centerWidths[26] = 190;
centerWidths[27] = 190;
centerWidths[28] = 190;
centerWidths[29] = 190;
centerWidths[30] = 190;
centerWidths[31] = 190;

centerHeights = new Array();
centerHeights[1] = 40;
centerHeights[2] = 40;
centerHeights[3] = 40;
centerHeights[4] = 40;
centerHeights[5] = 40;
centerHeights[6] = 40;
centerHeights[7] = 40;
centerHeights[8] = 40;
centerHeights[9] = 40;
centerHeights[10] = 40;
centerHeights[11] = 40;
centerHeights[12] = 40;
centerHeights[13] = 40;
centerHeights[14] = 40;
centerHeights[15] = 40;
centerHeights[16] = 40;
centerHeights[17] = 40;
centerHeights[18] = 40;
centerHeights[19] = 40;
centerHeights[20] = 40;
centerHeights[21] = 40;
centerHeights[22] = 40;
centerHeights[23] = 40;
centerHeights[24] = 40;
centerHeights[25] = 40;
centerHeights[26] = 40;
centerHeights[27] = 60;
centerHeights[28] = 60;
centerHeights[29] = 60;
centerHeights[30] = 60;
centerHeights[31] = 60;

var theCharacterTimeout = 40;
var theStoryTimeout     = 4000;

var theWidgetOne        = "";

var theWidgetTwo        = "";

var theWidgetNone       = "";

var theLeadString       = "";



var theSummaries = new Array();

var theSiteLinks = new Array();




// Ticker startup

function startTicker()

{

	// Define run time values

	theCurrentStory     = -1;

	theCurrentLength    = 0;

	// Locate base objects

	if (document.getElementById) {

		    theAnchorObject     = document.getElementById("tickerAnchor");

			runTheTicker();

		 }

	else {

            document.write("<style>.ticki{display:none;}.ticko{border:0px; padding:0px;}</style>");

            return true;

	}

}

// Ticker main run loop

function runTheTicker()

{

	var myTimeout;

	// Go for the next story data block

	if(theCurrentLength == 0)

	{

		theCurrentStory++;

		theCurrentStory      = theCurrentStory % theItemCount;

		theStorySummary      = theSummaries[theCurrentStory].replace(/&quot;/g,'"');

		theTargetLink        = theSiteLinks[theCurrentStory];

		theAnchorObject.href = theTargetLink;

		thePrefix 	     = "<span class=\"tickls\">" + theLeadString + "</span>";

	}

	// Stuff the current ticker text into the anchor

	theAnchorObject.innerHTML = thePrefix +

	theStorySummary.substring(0,theCurrentLength) + whatWidget();

	// Modify the length for the substring and define the timer

	if(theCurrentLength != theStorySummary.length)

	{

		theCurrentLength++;

		myTimeout = theCharacterTimeout;

	}

	else

	{

		theCurrentLength = 0;

		myTimeout = theStoryTimeout;

	}

	// Call up the next cycle of the ticker

	setTimeout("runTheTicker()", myTimeout);

}

// Widget generator

function whatWidget()

{

	if(theCurrentLength == theStorySummary.length)

	{

		return theWidgetNone;

	}



	if((theCurrentLength % 2) == 1)

	{

		return theWidgetOne;

	}

	else

	{

		return theWidgetTwo;

	}

}

