
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] = "interstate";
	signText[1] = "5";
	url[1] = "http://www.traffic.com/Portland-Traffic/I-5-NORTHBOUND-29_5NB_205to405.html";
	roadName[1] = "I-5 Metzger";
	roadNameDescription[1] = "From I-205 (#288) To I-405 North (#299B)";
	wrapperStyle[1] = "Number7Wrapper";
	trendingStyle[1] = "BetterLevel1";
	jamFactorStyle[1] = "Number7";
	jamFactor[1] = "7.3";
	incidents[1] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[1] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[1] = "";
	}

	getDirection("(Northbound)", 1);
	
	

	shieldType[2] = "interstate";
	signText[2] = "84";
	url[2] = "http://www.traffic.com/Portland-Traffic/I-84-EASTBOUND-29_84EB_5to205.html";
	roadName[2] = "I-84 Hollywood";
	roadNameDescription[2] = "From I-5  To I-205 South (#6)";
	wrapperStyle[2] = "Number6Wrapper";
	trendingStyle[2] = "BetterLevel1";
	jamFactorStyle[2] = "Number6";
	jamFactor[2] = "6.5";
	incidents[2] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[2] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[2] = "";
	}

	getDirection("(Eastbound)", 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] = "Number2Wrapper";
	trendingStyle[3] = "Steady";
	jamFactorStyle[3] = "Number2";
	jamFactor[3] = "2.1";
	incidents[3] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[3] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[3] = "";
	}

	getDirection("(Eastbound)", 3);
	
	

	shieldType[4] = "state";
	signText[4] = "8";
	url[4] = "http://www.traffic.com/Portland-Traffic/Hwy-8-WESTBOUND-29_8WB.html";
	roadName[4] = "Hwy-8";
	roadNameDescription[4] = "From 217 Tigard Hwy To Oak St";
	wrapperStyle[4] = "Number2Wrapper";
	trendingStyle[4] = "WorseLevel1";
	jamFactorStyle[4] = "Number2";
	jamFactor[4] = "2.0";
	incidents[4] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[4] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[4] = "";
	}

	getDirection("(Westbound)", 4);
	
	

	shieldType[5] = "state";
	signText[5] = "99";
	url[5] = "http://www.traffic.com/Portland-Traffic/Hwy-99_(East)-SOUTHBOUND-29_99West_SB.html";
	roadName[5] = "Hwy-99 (East)";
	roadNameDescription[5] = "From Broadway St To Oregon City Brg";
	wrapperStyle[5] = "Number1Wrapper";
	trendingStyle[5] = "WorseLevel1";
	jamFactorStyle[5] = "Number1";
	jamFactor[5] = "1.8";
	incidents[5] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[5] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[5] = "";
	}

	getDirection("(Southbound)", 5);
	
	

	shieldType[6] = "us";
	signText[6] = "26";
	url[6] = "http://www.traffic.com/Portland-Traffic/Hwy-26-WESTBOUND-29_26_WB_1.html";
	roadName[6] = "Hwy-26";
	roadNameDescription[6] = "From I-405  To Hwy-217 (#69A)";
	wrapperStyle[6] = "Number1Wrapper";
	trendingStyle[6] = "WorseLevel2";
	jamFactorStyle[6] = "Number1";
	jamFactor[6] = "1.7";
	incidents[6] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[6] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[6] = "";
	}

	getDirection("(Westbound)", 6);
	
	

	shieldType[7] = "interstate";
	signText[7] = "205";
	url[7] = "http://www.traffic.com/Portland-Traffic/I-205-SOUTHBOUND-29_205SB_5to84.html";
	roadName[7] = "I-205 Ellsworth";
	roadNameDescription[7] = "From I-5 (Vancouver) To I-84 Banfield Exwy East (#22)";
	wrapperStyle[7] = "Number1Wrapper";
	trendingStyle[7] = "WorseLevel3";
	jamFactorStyle[7] = "Number1";
	jamFactor[7] = "1.3";
	incidents[7] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[7] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[7] = "";
	}

	getDirection("(Southbound)", 7);
	
	

	shieldType[8] = "state";
	signText[8] = "213";
	url[8] = "http://www.traffic.com/Portland-Traffic/Hwy-213-SOUTHBOUND-29_213SB.html";
	roadName[8] = "Hwy-213";
	roadNameDescription[8] = "From Alderwood Rd To I-205";
	wrapperStyle[8] = "Number1Wrapper";
	trendingStyle[8] = "Steady";
	jamFactorStyle[8] = "Number1";
	jamFactor[8] = "1.2";
	incidents[8] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[8] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[8] = "";
	}

	getDirection("(Southbound)", 8);
	
	

	shieldType[9] = "state";
	signText[9] = "224";
	url[9] = "http://www.traffic.com/Portland-Traffic/Hwy-224__Clackamas_Hwy-WESTBOUND-29_224WB.html";
	roadName[9] = "Hwy-224  Clackamas Hwy";
	roadNameDescription[9] = "From I-205 To Hwy-99E Mcloughlin Blvd";
	wrapperStyle[9] = "Number1Wrapper";
	trendingStyle[9] = "Steady";
	jamFactorStyle[9] = "Number1";
	jamFactor[9] = "1.1";
	incidents[9] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[9] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[9] = "";
	}

	getDirection("(Westbound)", 9);
	
	

	shieldType[10] = "us";
	signText[10] = "30";
	url[10] = "http://www.traffic.com/Portland-Traffic/Hwy-30_Columbia_River_Hwy-WESTBOUND-29_30WB.html";
	roadName[10] = "Hwy-30 Columbia River Hwy";
	roadNameDescription[10] = "From I-405 To Scappoose Vernonia Hwy";
	wrapperStyle[10] = "Number1Wrapper";
	trendingStyle[10] = "Steady";
	jamFactorStyle[10] = "Number1";
	jamFactor[10] = "1.0";
	incidents[10] = "0";
	if("" == null || "" == "")
	{
		incidentsHighestCriticality[10] = "Minor";
	}
	else
	{
		incidentsHighestCriticality[10] = "";
	}

	getDirection("(Westbound)", 10);
	
	

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 "";
}	