//HBX Tracking for special editions and police , fire/rescue
//"section" and "family" variables are required 
//"model" can be empty or not entered at all
function sePoHBX(section, family, model)
{
	//Tracking Codes
	var sepo       = "/Products/Motorcycles/Special+Editions/Peace+Officer";   
  	var sepoflstc  = "/Products/Motorcycles/Special+Editions/Peace+Officer/flstc";   
  	var sepoflstf  = "/Products/Motorcycles/Special+Editions/Peace+Officer/flstf";   
  	var sepoflhr   = "/Products/Motorcycles/Special+Editions/Peace+Officer/flhr";   
  	var sepoflhtcu = "/Products/Motorcycles/Special+Editions/Peace+Officer/flhtcu";   
  	var seff       = "/Products/Motorcycles/Special+Editions/Firefighter";   
  	var seffflstc  = "/Products/Motorcycles/Special+Editions/Firefighter/flstc";   
  	var seffflstf  = "/Products/Motorcycles/Special+Editions/Firefighter/flstf";   
   	var seffflhr   = "/Products/Motorcycles/Special+Editions/Firefighter/flhr";
	var seffflhtcu = "/Products/Motorcycles/Special+Editions/Firefighter/flhtcu";   
  	var sesr       = "/Products/Motorcycles/Special+Editions/Shrine";   
  	var sesrflstc  = "/Products/Motorcycles/Special+Editions/Shrine/flstc";   
    var sesrflstf  = "/Products/Motorcycles/Special+Editions/Shrine/flstf";   
    var sesrflhr   = "/Products/Motorcycles/Special+Editions/Shrine/flhr";   
  	var sesrflhtcu = "/Products/Motorcycles/Special+Editions/Shrine/flhtcu";   
    var prpl       = "/Products/Motorcycles/Police/Police+Motorcycles";   
    var prplflhtp  = "/Products/Motorcycles/Police/Police+Motorcycles/flhtp";   
    var prplflhp   = "/Products/Motorcycles/Police/Police+Motorcycles/flhp";   
    var prplxl883  = "/Products/Motorcycles/Police/Police+Motorcycles/xl883";   
    var prpltle    = "/Products/Motorcycles/Police/Police+Motorcycles/tle";   
    var prfr       = "/Products/Motorcycles/Police/Fire+Motorcycles";   
    var prfrflhtp  = "/Products/Motorcycles/Police/Fire+Motorcycles/flhtp";   
    var prfrflhp   = "/Products/Motorcycles/Police/Fire+Motorcycles/flhp";   
    var prfrtle    = "/Products/Motorcycles/Police/Fire+Motorcycles/tle";
	
	hbxCodes = new Array();	
	hbxCodes.push("sepo","sepoflstc","sepoflstf","sepoflhr","sepoflhtcu","seff","seffflstc","seffflstf","seffflhr","seffflhtcu","sesr","sesrflstc","sesrflstf");
	hbxCodes.push("sesrflhr","sesrflhtcu","prpl","prplflhtp","prplflhp","prplxl883","prpltle","prfr","prfrflhtp","prfrflhp","prfrtle");		
		
	//Section codes
	var sectionName;
	var specialEdition = "se";
	var policeRescue   = "pr";
	
	//Section
	if(specialEdition == section)
		sectionName = "2009 Motorcycles Special Editions";
	else if(policeRescue == section)
		sectionName = "2009 Motorcycles Police & Fire/Rescue";
	else
		sectionName = "2009 Motorcycles";
	
	//model is the only variable that can be null so we will check
	//and set if appropriate
	if(model == null)
		model = "";
		
	//Convert variables to lower case
	var sectionLower = section.toLowerCase();
	var familyLower  = family.toLowerCase();
	var modelLower   = model.toLowerCase();  

	//Create HBX variable string
	var codeString = sectionLower + familyLower + modelLower;
	var trackingCode;
	var hit = false;
	
	//Search hbxCodes
	for(var x=0; x < hbxCodes.length; x++)
	{
		if(hbxCodes[x] == codeString)	
		{
			trackingCode = eval(hbxCodes[x]);
			hit = true;			
		}	
	}		

	//Fire HBX
	if(hit){
		_hbPageView(sectionName, trackingCode);			
	}
}


//Unobtrusive JS for leftside navigation
function leftNavHBX(linkId, section, model) {
	var linkTag = $(linkId);
	if (linkTag) {
		linkTag.onclick = function () {				
			//Make HBX Call
			sePoHBX(section,model);			
		}			
	}
}
	
leftNavHBX('/en_us/content/pages/external/hd/2009_motorcycles/se_peace_officer', 'se', 'po');
leftNavHBX('/en_us/content/pages/external/hd/2009_motorcycles/se_firefighter', 'se', 'ff');
leftNavHBX('/en_us/content/pages/external/hd/2009_motorcycles/se_shrine', 'se', 'sr');
leftNavHBX('/en_us/content/pages/external/hd/2009_motorcycles/pf_police', 'pr', 'pl');
leftNavHBX('/en_us/content/pages/external/hd/2009_motorcycles/pf_firerescue', 'pr', 'fr');
