
var direction = new Array(10);
var directionabbr = new Array(10);
var shieldType = new Array(10);
var signText = new Array(10);
var url = new Array(10);
var roadName = new Array(10);
var roadNameDescription = new Array(10);
var wrapperStyle = new Array(10);
var trendingStyle = new Array(10);
var jamFactorStyle = new Array(10);
var jamFactor = new Array(10);
var incidents = new Array(10);
var incidentsHighestCriticality = new Array(10);

function getDirection(fullName, loopcounter)
{
	if(fullName == "(Eastbound)")
	{
		directionabbr[loopcounter] = "EB";
		direction[loopcounter] = "Eastbound";
	}
	else if(fullName == "(Westbound)")
	{
		directionabbr[loopcounter] = "WB";
		direction[loopcounter] = "Westbound";
	}
	else if(fullName == "(Northbound)")
	{
		directionabbr[loopcounter] = "NB";
		direction[loopcounter] = "Northbound";
	}
	else if(fullName == "(Southbound)")
	{
		directionabbr[loopcounter] = "SB";
		direction[loopcounter] = "Southbound";
	}
	else if(fullName == "(Innerloop)")
	{
		directionabbr[loopcounter] = "IL";
		direction[loopcounter] = "Innerloop";
	}
	else if(fullName == "(Outerloop)")
	{
		directionabbr[loopcounter] = "OL";
		direction[loopcounter] = "Outerloop";
	}
	else 
	{
		directionabbr[loopcounter] = fullName;
		direction[loopcounter] = fullName;
	}
}

function getJamFactor(styleId, loopcounter)
{
	c = '<div class="jamFactorDiv_' + styleId + '">';
	c += '<div class="' + wrapperStyle[loopcounter] + '">';
	c += '<div class="' + trendingStyle[loopcounter] + '">';
	c += '<div class="' + jamFactorStyle[loopcounter] + '">' + jamFactor[loopcounter] + '</div>';
	c += '</div></div></div>';
	
	return c;
}


	shieldType[1] = "state";
	signText[1] = "99";
	url[1] = "http://www.traffic.com/Portland-Traffic/Hwy-99_(East)-SOUTHBOUND-29_99West_SB.html";
	roadName[1] = "Hwy-99 (East)";
	roadNameDescription[1] = "From Broadway St To Oregon City Brg";
	wrapperStyle[1] = "Number6Wrapper";
	trendingStyle[1] = "WorseLevel2";
	jamFactorStyle[1] = "Number6";
	jamFactor[1] = "6.8";
	incidents[1] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[1] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[1] = "";
	}

	getDirection("(Southbound)", 1);
	
	

	shieldType[2] = "state";
	signText[2] = "99";
	url[2] = "http://www.traffic.com/Portland-Traffic/Hwy-99_(West)-SOUTHBOUND-29_99East_SB.html";
	roadName[2] = "Hwy-99 (West)";
	roadNameDescription[2] = "From Naito Pkwy To Beaverton-Tigard Hwy";
	wrapperStyle[2] = "Number5Wrapper";
	trendingStyle[2] = "BetterLevel1";
	jamFactorStyle[2] = "Number5";
	jamFactor[2] = "5.4";
	incidents[2] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[2] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[2] = "";
	}

	getDirection("(Southbound)", 2);
	
	

	shieldType[3] = "state";
	signText[3] = "8";
	url[3] = "http://www.traffic.com/Portland-Traffic/Hwy-8-EASTBOUND-29_8EB.html";
	roadName[3] = "Hwy-8";
	roadNameDescription[3] = "Oak St To 217 Tigard Hwy";
	wrapperStyle[3] = "Number5Wrapper";
	trendingStyle[3] = "WorseLevel3";
	jamFactorStyle[3] = "Number5";
	jamFactor[3] = "5.2";
	incidents[3] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[3] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[3] = "";
	}

	getDirection("(Eastbound)", 3);
	
	

	shieldType[4] = "state";
	signText[4] = "43";
	url[4] = "http://www.traffic.com/Portland-Traffic/Hwy-43-NORTHBOUND-29_43NB.html";
	roadName[4] = "Hwy-43";
	roadNameDescription[4] = "Main St To Hwy-26/Ross Island Brg";
	wrapperStyle[4] = "Number4Wrapper";
	trendingStyle[4] = "WorseLevel1";
	jamFactorStyle[4] = "Number4";
	jamFactor[4] = "4.4";
	incidents[4] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[4] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[4] = "";
	}

	getDirection("(Northbound)", 4);
	
	

	shieldType[5] = "state";
	signText[5] = "213";
	url[5] = "http://www.traffic.com/Portland-Traffic/Hwy-213-SOUTHBOUND-29_213SB.html";
	roadName[5] = "Hwy-213";
	roadNameDescription[5] = "From Alderwood Rd To I-205";
	wrapperStyle[5] = "Number4Wrapper";
	trendingStyle[5] = "WorseLevel1";
	jamFactorStyle[5] = "Number4";
	jamFactor[5] = "4.1";
	incidents[5] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[5] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[5] = "";
	}

	getDirection("(Southbound)", 5);
	
	

	shieldType[6] = "state";
	signText[6] = "99";
	url[6] = "http://www.traffic.com/Portland-Traffic/Hwy-99_(West)-NORTHBOUND-29_99West_NB.html";
	roadName[6] = "Hwy-99 (West)";
	roadNameDescription[6] = "Beaverton-Tigard Hwy To Naito Pkwy";
	wrapperStyle[6] = "Number4Wrapper";
	trendingStyle[6] = "Steady";
	jamFactorStyle[6] = "Number4";
	jamFactor[6] = "4.0";
	incidents[6] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[6] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[6] = "";
	}

	getDirection("(Northbound)", 6);
	
	

	shieldType[7] = "state";
	signText[7] = "213";
	url[7] = "http://www.traffic.com/Portland-Traffic/Hwy-213-NORTHBOUND-29_213NB.html";
	roadName[7] = "Hwy-213";
	roadNameDescription[7] = "I-205 To Alderwood Rd";
	wrapperStyle[7] = "Number3Wrapper";
	trendingStyle[7] = "Steady";
	jamFactorStyle[7] = "Number3";
	jamFactor[7] = "3.9";
	incidents[7] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[7] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[7] = "";
	}

	getDirection("(Northbound)", 7);
	
	

	shieldType[8] = "state";
	signText[8] = "99";
	url[8] = "http://www.traffic.com/Portland-Traffic/Hwy-99_(East)-NORTHBOUND-29_99East_NB.html";
	roadName[8] = "Hwy-99 (East)";
	roadNameDescription[8] = "Oregon City Brg To Broadway St";
	wrapperStyle[8] = "Number3Wrapper";
	trendingStyle[8] = "BetterLevel2";
	jamFactorStyle[8] = "Number3";
	jamFactor[8] = "3.5";
	incidents[8] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[8] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[8] = "";
	}

	getDirection("(Northbound)", 8);
	
	

	shieldType[9] = "state";
	signText[9] = "224";
	url[9] = "http://www.traffic.com/Portland-Traffic/Hwy-224__Clackamas_Hwy-EASTBOUND-29_224EB.html";
	roadName[9] = "Hwy-224  Clackamas Hwy";
	roadNameDescription[9] = "Hwy-99E Mcloughlin Blvd To I-205";
	wrapperStyle[9] = "Number3Wrapper";
	trendingStyle[9] = "Steady";
	jamFactorStyle[9] = "Number3";
	jamFactor[9] = "3.4";
	incidents[9] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[9] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[9] = "";
	}

	getDirection("(Eastbound)", 9);
	
	

	shieldType[10] = "state";
	signText[10] = "8";
	url[10] = "http://www.traffic.com/Portland-Traffic/Hwy-8-WESTBOUND-29_8WB.html";
	roadName[10] = "Hwy-8";
	roadNameDescription[10] = "From 217 Tigard Hwy To Oak St";
	wrapperStyle[10] = "Number3Wrapper";
	trendingStyle[10] = "BetterLevel1";
	jamFactorStyle[10] = "Number3";
	jamFactor[10] = "3.3";
	incidents[10] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[10] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[10] = "";
	}

	getDirection("(Westbound)", 10);
	
	

	shieldType[11] = "state";
	signText[11] = "43";
	url[11] = "http://www.traffic.com/Portland-Traffic/Hwy-43-SOUTHBOUND-29_43SB.html";
	roadName[11] = "Hwy-43";
	roadNameDescription[11] = "From Hwy-26/Ross Island Brg To Main St";
	wrapperStyle[11] = "Number3Wrapper";
	trendingStyle[11] = "Steady";
	jamFactorStyle[11] = "Number3";
	jamFactor[11] = "3.1";
	incidents[11] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[11] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[11] = "";
	}

	getDirection("(Southbound)", 11);
	
	

function widesky_hotspot(styleId, hotspotId, magnetId, analytics)
{

    if(url[hotspotId]) 
    {	
	var c = "";
	
	c += '<div class="magnetRoadDiv_160">';
	c += '<div class="MagnetContainerDiv160Padding">';
	c += '<div class="shieldAndRoad_160">';
	if(signText[hotspotId] == "")
	{
		c += '<div class="noshield_160">';
	}
	else
	{
		c += '<div class="shield_160">';
	}
	c += '<div class="' + shieldType[hotspotId] + '160">';
	c += '<span>' + signText[hotspotId] + '</span>';
	c += '</div>';
	c += '<div class="roadNameAndDirection_160">';
	if(signText[hotspotId] == "")
	{
		c += '<div class="magnetRoadLink160NoShield">';
	}
	else	
	{
		c += '<div class="magnetRoadLink160">';
	}
	c += '<a href="' + url[hotspotId] + '?magnetref=' + magnetId + '&AWOPARTNER=' + awo2partner + '&' + analytics + '" target="_new">' + roadName[hotspotId] + '</a></div>';
	c += '<div class="magnetRoadwayDir_160">' + direction[hotspotId] + '</div>';
	c += '</div></div></div>';

	c += getJamFactor(styleId, hotspotId);
	
	if(incidents[hotspotId] != "")
	{
		c += '<div class="incidentCount_160">';
		c += 'incidents: ' + incidents[hotspotId] + ' (' + incidentsHighestCriticality[hotspotId] + ')';
		c += '</div>'
	}

	c += '</div></div>';

	return c;
    }
    return "";
}

function halfbanner_hotspot(styleId, hotspotId, magnetId, analytics)
{

    if(url[hotspotId]) 
    {	
	var c = "";

	c += '<div class="magnetRoadDiv_' + styleId + '">';
	c += '<div class="MagnetContainerDiv' + styleId + 'Padding">';
	c += '<div class="shieldAndRoad_' + styleId + '">';
	c += '<div class="shield_' + styleId + '">';
	c += '<div class="' + shieldType[hotspotId] + styleId + '"><span>' + signText[hotspotId] + '</span></div>';
	c += '<div class="roadNameAndDirection_' + styleId + '">';
	c += '<div class="magnetRoadLink' + styleId + '"><a href="' + url[hotspotId] + '?magnetref=' + magnetId + '&AWOPARTNER=' + awo2partner + '&' + analytics + '" target="_new">' + roadName[hotspotId] + ' - ' + directionabbr[hotspotId] + '</a></div><!-- end magnetRoadLink234 -->';
	
	c += '<div class="incidents_234">';
	if(incidents[hotspotId] > 0)
	{
		c += 'incidents: ' + incidents[hotspotId] + ' (' + incidentsHighestCriticality[hotspotId] + ')';
	}
	
	c += '</div><!-- end incidents_234 - added by jess -->';
	
  	c += '</div><!-- end roadNameAndDirection -->';
	
	c += '</div><!-- end shield --></div><!-- end shieldAndRoad -->';
	
	c += getJamFactor(styleId, hotspotId);

	c += '</div><!-- end MagnetContainerDiv234Padding --><div class="clear234"></div></div><!-- end magnetRoadDiv -->';
	
	return c;
    }
    return "";
}

function narrowsky_hotspot(styleId, hotspotId, magnetId, analytics)
{

    if(url[hotspotId]) 
    {	
	var c = "";

	c += '<div class="magnetRoadDiv_' + styleId + '">';
	c += '<div class="MagnetContainerDiv' + styleId + 'Padding">';
	c += '<div class="magnetRoadLink' + styleId + '"><a href="' + url[hotspotId] + '?magnetref=' + magnetId + '&AWOPARTNER=' + awo2partner + '&' + analytics + '" target="_new">' + roadName[hotspotId] + '</a></div>';
	c += '<div class="magnetShieldAndDirection' + styleId + '">';
	c += '<div class="' + shieldType[hotspotId] + styleId + '"><span>' + signText[hotspotId] + '</span></div>';

			c += '<div class="magnetRoadwayDir_' + styleId + '">' + direction[hotspotId] + '</div>';
	
	c += '</div>';

	c += getJamFactor(styleId, hotspotId);

	incidents = incidents[hotspotId];
	if(incidents == "0")
	{
		incidents = "";
	}
	else
	{
		incidents = 'Incidents:' + incidents;
	}

	c += '<div class="incidentCount_120">' + incidents + '</div>';
	c += '</div></div>';

	return c;
    }
    return "";
}

function largerect_hotspot(styleId, hotspotId, magnetId, analytics)
{
    if(url[hotspotId]) 
    {	
	var c = "";

	c += '<div class="magnetRoadDiv_336">';
	c += '<div class="MagnetContainerDiv336Padding">';
	if(signText[hotspotId] == "")
	{
		c += '<div class="noshield_336">';
	}
	else
	{
		c += '<div class="shieldAndRoad_336">';
		c += '<div class="shield_336">';
		c += '<div class="' + shieldType[hotspotId] + '336"><span>' + signText[hotspotId] + '</span></div>';
		c += '</div>';
	}

	if(signText[hotspotId] == "")
	{
		c += '<div class="roadNameAndDirectionNoShield_336">';
	}
	else
	{
		c += '<div class="roadNameAndDirection_336">';
	}
	c += '<div class="magnetRoadLink336"><a href="' + url[hotspotId] + '?magnetref=' + magnetId + '&AWOPARTNER=' + awo2partner + '&' + analytics + '" target="_new">' + roadName[hotspotId] + '</a></div>';
	c += '<div class="magnetRoadwayDir_336">' + direction[hotspotId] + '</div>';
	c += '</div></div>';

	c += '<div class="incidentAndJF_336">';

	c += '<div class="incidentCount_336">';

	if(incidents[hotspotId] != "")
	{
		c += '<div class="incidentCountIMG_' + incidentsHighestCriticality[hotspotId] + '">';
		c += '<p>' + incidents[hotspotId] + '</p>';
		c += '</div>';
		c += '<p class="incidentsLabel">incidents</p>';
	}
	
	c += '</div>';

	c += getJamFactor(styleId, hotspotId);
	
	c += '</div></div></div>'
	
	return c;
    }
    return "";
}



function smallmap_hotspot(styleId, hotspotId, magnetId, analytics)
{

    if(url[hotspotId]) 
    {	
	var c = "";
	var oddOrEven = hotspotId % 2;
	if(oddOrEven == 0)
	{
		c += '<div class="magnetRoadDiv_sMap_even">';
	}
	else
	{
		c += '<div class="magnetRoadDiv_sMap_odd">';
	}
	c += '<div class="magnetRoadDiv_sMapPadding">';
	c += '<div class="shieldRoadway_sMap">';
	c += '<div class="' + shieldType[hotspotId] + 'SMap">';
	c += '<span>' + signText[hotspotId] + '</span>';
	c += '</div>';
	c += '<div class="roadNameAndDirection_sMap">';
	c += '<div class="magnetRoadLinkSMap"><a href="' + url[hotspotId] + '?magnetref=' + magnetId + '&AWOPARTNER=' + awo2partner + '&' + analytics + '" target="_new">' + roadName[hotspotId] + ' - </a><a href="' + url[hotspotId] + '?magnetref=${iteratorvalue.getId()}&AWOPARTNER=' + awo2partner + '" class="roadDirLink_sMap" target="_new">' + directionabbr[hotspotId] + '</a></div>';
	c += '<div class="roadwayFromTo_sMap">' + roadNameDescription[hotspotId] + '</div>';
	c += '</div>';
	c += '<div class="clear_sMap"></div>';
	c += '</div>';
	c += '<div class="incidentsAndJF_sMap">';
	c += '<div class="incidentCount_sMap">';

	if(incidents[hotspotId] != "")
	{
		c += '<div class="incidentCountIMG_' + incidentsHighestCriticality[hotspotId] + '">'
		c += '<p>' + incidents[hotspotId] + '</p>';
		c += '</div>';
	}			

	c += '</div>';

	c += getJamFactor(styleId, hotspotId);

	c += '<div class="clear_sMap"></div>';
	c += '</div></div></div>';

	return c;
    }
    return "";
}
	
function largemap_hotspot(styleId, hotspotId, magnetId, analytics)
{

    if(url[hotspotId]) 
    {	
	var c = "";
	var oddOrEven = hotspotId % 2;
	if(oddOrEven == 0)
	{
		c += '<div class="magnetRoadDiv_lMap_even">';
	}
	else
	{
		c += '<div class="magnetRoadDiv_lMap_odd">';
	}
	c += '<div class="magnetRoadDiv_lMapPadding">';
	c += '<div class="shieldRoadway_lMap">';
	c += '<div class="' + shieldType[hotspotId] + 'LMap"><span>' + signText[hotspotId] + '</span></div>';
	c += '<div class="roadNameAndDirection_lMap">';
	c += '<div class="magnetRoadLinkLMap"><a href="' + url[hotspotId] + '?magnetref=' + magnetId + '&AWOPARTNER=' + awo2partner + '&' + analytics + '" target="_new">' + roadName[hotspotId] + ' - </a><a href="' + url[hotspotId] + '?magnetref=${iteratorvalue.getId()}&AWOPARTNER=' + awo2partner + '" class="roadDirLink_lMap" target="_new">' + directionabbr[hotspotId] + '</a></div>';
	//c += '<div class="roadwayFromTo_lMap">${hotspot.getRoadnamedescription()}</div>';
	c += '<div class="roadwayFromTo_lMap">' + roadNameDescription[hotspotId] + '</div>';
	c += '</div>';
	c += '<div class="clear_lMap"></div>';
	c += '</div>';

	c += '<div class="incidentsAndJF_lMap">';
	c += '<div class="incidentCount_lMap">';

	if(incidents[hotspotId] != "")
	{
		c += '<div class="incidentCountIMG_' + incidentsHighestCriticality[hotspotId] + '">'
		c += '<p>' + incidents[hotspotId] + '</p>';
		c += '</div>';
	}		

	c += '</div>';

	c += getJamFactor(styleId, hotspotId);

	c += '<div class="clear_lMap"></div>';
	c += '</div></div></div>';

	return c;
    }
    return "";
}	
