﻿// JavaScript Document
document.write("<style type=text/css>");
document.write("#content .breadcrumb {font-size:x-small; line-height:110%;  margin:0 0 16px 0; padding: 0; text-transform:capitalize; }");
document.write("#content .breadcrumb a {font-size:x-small; text-decoration:underline; white-space:nowrap}");
document.write("#content .separator {color:#666}");
document.write("</style>");

function HNav() {

var BaseURL1 = "www.ab.com/"
var BaseURL2 = "wwwdev.ab.com/"
var IndexFile = ""

var DocURLRef = document.URL
var DocURL = DocURLRef
var DocURLSplit = ''
var DocTitle = '' //document.title

var HomeURL = ''
var TextURL = 'Sensors'
var LinkURL = ''
var LinkURLSpacer = ''
var HTMLString = ''
var HTMLString1 = '<p id=breadcrumb class=breadcrumb>  ' 
var HTMLString2 = ' <span class=separator>&gt;</span> '
var HTMLString3 = ' <span class=separator>&gt;</span> '
var HTMLString4 = '</p>'
	

if (BaseURL1 || BaseURL2 !='') {
	if (DocURL.search(BaseURL1)!= -1){
		DocURL=DocURL.slice(DocURL.indexOf(BaseURL1) + BaseURL1.length)
		HomeURL = DocURLRef.slice(0, DocURLRef.indexOf(BaseURL1) + BaseURL1.length) + 'products.html'
		}
	if (DocURL.search(BaseURL2)!= -1 && BaseURL2 !='') {
		DocURL=DocURL.slice(DocURL.indexOf(BaseURL2) + BaseURL2.length)
		HomeURL = DocURLRef.slice(0, DocURLRef.indexOf(BaseURL2) + BaseURL2.length) + 'products.html'
		}
	}


DocURLSplit = DocURL.split('/')

for (var i=0; i<(DocURLSplit.length-1); i++) {
	LinkURLSpacer+='../'
	}
	
for (var i=0; i<(DocURLSplit.length-1); i++) {
	LinkURL = LinkURLSpacer + DocURLSplit[i] + '/'+ IndexFile
	TextURL = DocURLSplit[i].replace(/_/g, " ")

TextURL = TextURL.replace(/capacitive/g,"Capacitive Proximity")
TextURL = TextURL.replace(/devicenet/g,"DeviceNet")
TextURL = TextURL.replace(/auxiliarypower/g, "Auxiliary Power")
TextURL = TextURL.replace(/flatmedia/g, "Flat Media")
TextURL = TextURL.replace(/roundmedia/g, "Round Media")
TextURL = TextURL.replace(/inductive/g, "Inductive Proximity")
TextURL = TextURL.replace(/foodbev/g, "Food & Beverage")
TextURL = TextURL.replace(/welding/g, "Welding")
TextURL = TextURL.replace(/safe/g, "Intrinsically Safe")
TextURL = TextURL.replace(/specialty/g, "Specialty Series")
TextURL = TextURL.replace(/general/g, "General Purpose")
TextURL = TextURL.replace(/backgroundsuppression/g, "Background Suppression")
TextURL = TextURL.replace(/clearobjectdetection/g, "Clear Object Detection")
TextURL = TextURL.replace(/colorcontrast/g, "Color/Contrast")
TextURL = TextURL.replace(/fiberoptic/g, "Fiber Optic")
TextURL = TextURL.replace(/harshduty/g, "Harsh Duty")
TextURL = TextURL.replace(/hazardouslocation/g, "Hazardous Location")
TextURL = TextURL.replace(/lightarrays/g, "Light Arrays")
TextURL = TextURL.replace(/zeropressure/g, "Zero Pressure Accumulation")
TextURL = TextURL.replace(/ethernet/g, "EtherNet Media")
TextURL = TextURL.replace(/receptacles/g, "Receptacles & Adaptors")
TextURL = TextURL.replace(/cords/g, "Cordsets & Patchcords")
TextURL = TextURL.replace(/whatsnew/g, "What's New")

if(i==(DocURLSplit.length-1)){ // the far right folder is not a link.
	HTMLString += HTMLString2 + TextURL
	LinkURLSpacer = LinkURLSpacer.slice(0,-3)
	}
	else{ // but every other folder is.
	HTMLString += HTMLString2 + '<a href="'+LinkURL+'" class="breadcrumb" target="_parent">'+TextURL+'</a>'
	LinkURLSpacer = LinkURLSpacer.slice(0,-3)
	}
	}

HTMLString = HTMLString1.concat("Products".link(HomeURL), HTMLString, HTMLString3, DocTitle)
HTMLString = HTMLString.replace(/devicenet/g, "DeviceNet")

document.writeln(HTMLString)
}