// this .js file handles finding an old page and determining what page to link to when it is encounted
// the principal is that if we have converted an old site, there will be pages in the search engine index that we might 
// want to maintain.  This .js will look based on the current url and determine the appropriate page in the new web site
// to redirect to and do it
//<!--

{
// Array of pages to link to
var aLinkTo = new Array();
// Array of url
var aCurrUrl = new Array();
// based on current url, index will determine the page to link to

// hold the current url
cCurrUrl = location.href;
cHost = location.hostname;

cIndex = cCurrUrl.lastIndexOf(cHost);

cHostLength = cIndex + cHost.length;
cPathLength = cCurrUrl.length;

cHostSubstr = cCurrUrl.substring(cHostLength, cPathLength);


// document.write(cHost + "<br />");
// document.write(cCurrUrl + "<br />");
// document.write(cIndex + "<br />");
// document.write(cHostLength + "<br />");
// document.write(cPathLength + "<br />");
// document.write(cHostSubstr + "<br />");
// document.write(location.href);

 
// set the default link to be the root of the site
cLinkTo="/";

aLinkTo[0] = "/index.asp";
aLinkTo[1] = "/community-information.asp";
aLinkTo[2] = "/agents.asp";
aLinkTo[3] = "/Patrick-Carey.asp";
aLinkTo[4] = "/Jim-Giampa.asp";
aLinkTo[5] = "/Paula-Munch.asp";
aLinkTo[6] = "/Hugh-Boyle.asp";
aLinkTo[7] = "/Kathy-Callan.asp";
aLinkTo[8] = "/Jacqui-Coons.asp";
aLinkTo[9] = "/Mary-Helen-Corcoran.asp";
aLinkTo[10] = "/Pamela-Davis.asp";
aLinkTo[11] = "/Darlene-Dolan.asp";
aLinkTo[12] = "/Corey-Fatello.asp";
aLinkTo[13] = "/Celine-Frechette.asp";
aLinkTo[14] = "/Susan-Howland.asp";
aLinkTo[15] = "/Kelly-McAndrew.asp";
aLinkTo[16] = "/Donna-Mercer.asp";
aLinkTo[17] = "/Bette-&-Richard-Marceau.asp";
aLinkTo[18] = "/Amy-Pender.asp";
aLinkTo[19] = "/Keith-Prince.asp";
aLinkTo[20] = "/Dean-Savastano.asp";
aLinkTo[21] = "/Judy-Sepanski.asp";
aLinkTo[22] = "/Linda-Sequin.asp";
aLinkTo[23] = "/Shane-Smith.asp";
aLinkTo[24] = "/Bob-Wallace.asp";
aLinkTo[25] = "/Jason-Zak.asp";
aLinkTo[26] = "/our-vision.asp";
aLinkTo[27] = "/offices.asp";
aLinkTo[28] = "/list-with-us.asp";
aLinkTo[29] = "/contact-us.asp";
aLinkTo[30] = "/search-properties.asp";
aLinkTo[31] = "/search-properties.asp";
aLinkTo[32] = "/open-houses.asp";
aLinkTo[33] = "/open-houses.asp";
aLinkTo[34] = "/contact-us.asp";


// http://www.neseminars.com/nes3/products.nsf/subjects/articles1/testit.htm

aCurrUrl[0] = "/index.cfm";
aCurrUrl[1] = "/towns/index.htm";
aCurrUrl[2] = "/agents/index.htm";
aCurrUrl[3] = "/agents/patrick.htm";
aCurrUrl[4] = "/agents/jim.htm";
aCurrUrl[5] = "/agents/paula.htm";
aCurrUrl[6] = "/agents/boyle.htm";
aCurrUrl[7] = "/agents/callan.htm";
aCurrUrl[8] = "/agents/coon.htm";
aCurrUrl[9] = "/agents/corcoran.htm";
aCurrUrl[10] = "/agents/davis.htm";
aCurrUrl[11] = "/agents/dolan.htm";
aCurrUrl[12] = "/agents/fatello.htm";
aCurrUrl[13] = "/agents/frechette.htm";
aCurrUrl[14] = "/agents/howland.htm";
aCurrUrl[15] = "/agents/mcandrew.htm";
aCurrUrl[16] = "/agents/mercer.htm";
aCurrUrl[17] = "/agents/marceau.htm";
aCurrUrl[18] = "/agents/pender.htm";
aCurrUrl[19] = "/agents/prince.htm";
aCurrUrl[20] = "/agents/savastano.htm";
aCurrUrl[21] = "/agents/judy.htm";
aCurrUrl[22] = "/agents/sequin.htm";
aCurrUrl[23] = "/agents/smith.htm";
aCurrUrl[24] = "/agents/wallace.htm";
aCurrUrl[25] = "/agents/zak.htm";
aCurrUrl[26] = "/company/index.htm";
aCurrUrl[27] = "/offices/index.htm";
aCurrUrl[28] = "/listwithus/index.htm";
aCurrUrl[29] = "/contactus/index.htm";
aCurrUrl[30] = "/search/property.cfm";
aCurrUrl[31] = "/search/detail.cfm";
aCurrUrl[32] = "/openhouses/list-open-houses.asp";
aCurrUrl[33] = "/openhouses/detail-open-house.asp";
aCurrUrl[34] = "/test.html";


// loop through and compare current url with array of current urls to find index value.  When found, break out of the loop
// get out of the loop for sure if index value becomes greater than max size
// if gets out without finding will link to the default set at top of this routine
var i=0
for (i=0;i < aCurrUrl.length ;i++)
{
	if (aCurrUrl[i].toUpperCase() == cHostSubstr.toUpperCase()) {break}
}
if (i < aLinkTo.length ){
	cLinkTo=aLinkTo[i];
}

document.write("The Web Site has been updated, directing you to the replacement page " + i)
document.write("<br />")
window.location = cLinkTo

}
//-->

