/* This Javascript is used to generate breadcrumbs in topic HTML output. */

function breadcrumb()
{
	sURL = new String;
	bits = new Object;
	var x = 0;
	var stop = 0;
	var output = "<A HREF=\"http://www.juniper.net/\">Home</A> > ";
	var name;

	sURL = location.href;
	sURL = sURL.slice(8,sURL.length);
	chunkStart = sURL.indexOf("/");
	sURL = sURL.slice(chunkStart+1,sURL.length)

	while(!stop){
		chunkStart = sURL.indexOf("/");
		if (chunkStart != -1){
			bits[x] = sURL.slice(0,chunkStart)
			sURL = sURL.slice(chunkStart+1,sURL.length);
		}else{
			stop = 1;
		}
		x++;
	}

	for(var i in bits){
		if(bits[i] == 'techpubs' | bits[i] == 'release-independent' | bits[i].indexOf('junos')!=-1)
		{
			if(bits[i] == 'techpubs')
			{
				name = 'Technical Documentation';
				output += "<A HREF=\"";
				for(y=1;y<x-i;y++){
					output += "../default.htm";
				}
				output += bits[i] + "http://www.juniper.net/\">" + name + "</A> > ";				
			}
			else if(bits[i] == 'release-independent')
			{				
				name  = 'EX-series TechPubs Home';
				output += "<A HREF=\"";
				for(y=1;y<x-i;y++){
					output += "../default.htm";
				}				
				output += "release-independent/junos/information-products/pathway-pages/ex-series/product/index.html" + "\">" + name + "</A> > ";
				
				name  = 'EX-series Hardware Home';
				output += "<A HREF=\"";
				for(y=1;y<x-i;y++){
					output += "../default.htm";
				}				
				output += "release-independent/junos/information-products/pathway-pages/ex-series/hardware/ex3200-ex4200.html" + "\">" + name + "</A> > ";					
				break;
			}
			else if(bits[i].indexOf('junos')!=-1)
			{
				name  = 'EX-series TechPubs Home';
				output += "<A HREF=\"";
				for(y=1;y<x-i;y++){
					output += "../default.htm";
				}				
				output += "release-independent/junos/information-products/pathway-pages/ex-series/product/index.html" + "\">" + name + "</A> > ";
				
				name  = 'EX-series Software';
				output += "<A HREF=\"";
				for(y=1;y<x-i;y++){
					output += "../default.htm";
				}				
				output += bits[i] + "/information-products/pathway-pages/ex-series/software/index.html" + "\">" + name + "</A> > ";					
				break;
			}
		}
	}
	document.write(output);
}

function breadcrumbPathway()
{
	var standardbc = '<a href="http://www.juniper.net/">Home</a> > <a href="http://www.juniper.net/support/">Support</a> > <a href="../../../../../default.htm">Technical Documentation</a> > ';
	
	if(window.location.href.indexOf("/junos9.")!=-1)
	{
		url = window.location.href;
		version = url.substring(url.indexOf("/junos9.")+8, url.indexOf("/junos9.")+9);
		if(version > 2){
			document.write(standardbc);
			return;
		}
	}
	if(window.location.href.indexOf("/ex-series/")==-1)
	{
		return;
	}

	var styles = '<style type="text/css" media="screen">';

	if(window.location.href.indexOf("/product/")!=-1)
	{
		styles += 'a.product {color: #FCB914 !important; background-image: url(/images/nav-arrow-rt.gif) !important;}';
	}
	else if(window.location.href.indexOf("/hardware/")!=-1)
	{
		styles += 'a.product {color: #FCB914 !important; background-image: url(/images/nav-arrow-rt.gif) !important;}';
		styles += 'a.hardware {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
	}
	else if(window.location.href.indexOf("/software/")!=-1)
	{
		styles += 'a.product {color: #FCB914 !important; background-image: url(/images/nav-arrow-rt.gif) !important;}';
		styles += 'a.software {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
	}
	else if(window.location.href.indexOf("/802-1x/")!=-1)
	{
		styles += 'a.product {color: #FCB914 !important; background-image: url(/images/nav-arrow-rt.gif) !important;}';
		styles += 'a.fe {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
		styles += 'a.voip {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
	}	
	else if(window.location.href.indexOf("/bridging/")!=-1)
	{
		styles += 'a.product {color: #FCB914 !important; background-image: url(/images/nav-arrow-rt.gif) !important;}';
		styles += 'a.fe {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
		styles += 'a.bridging {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
	}
	else if(window.location.href.indexOf("/cos/")!=-1)
	{
		styles += 'a.product {color: #FCB914 !important; background-image: url(/images/nav-arrow-rt.gif) !important;}';
		styles += 'a.fe {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
		styles += 'a.cos {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
	}
	else if(window.location.href.indexOf("/interfaces/")!=-1)
	{
		styles += 'a.product {color: #FCB914 !important; background-image: url(/images/nav-arrow-rt.gif) !important;}';
		styles += 'a.fe {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
		styles += 'a.interfaces {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
	}
	else if(window.location.href.indexOf("/l3-protocols/")!=-1)
	{
		styles += 'a.product {color: #FCB914 !important; background-image: url(/images/nav-arrow-rt.gif) !important;}';
		styles += 'a.fe {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
		styles += 'a.protocols {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
	}
	else if(window.location.href.indexOf("/packet-filters/")!=-1)
	{
		styles += 'a.product {color: #FCB914 !important; background-image: url(/images/nav-arrow-rt.gif) !important;}';
		styles += 'a.fe {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
		styles += 'a.packet {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
	}
	else if(window.location.href.indexOf("/poe/")!=-1)
	{
		styles += 'a.product {color: #FCB914 !important; background-image: url(/images/nav-arrow-rt.gif) !important;}';
		styles += 'a.fe {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
		styles += 'a.poe {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
	}
	else if(window.location.href.indexOf("/port-mirroring/")!=-1)
	{
		styles += 'a.product {color: #FCB914 !important; background-image: url(/images/nav-arrow-rt.gif) !important;}';
		styles += 'a.fe {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
		styles += 'a.port {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
	}
	else if(window.location.href.indexOf("/virtual-chassis/")!=-1)
	{
		styles += 'a.product {color: #FCB914 !important; background-image: url(/images/nav-arrow-rt.gif) !important;}';
		styles += 'a.fe {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
		styles += 'a.chassis {background-image: url(/images/subnav-arrow-rt.gif) !important;}';
	}
	styles += '</style>';
	document.write(styles);

	sURL = new String;
	bits = new Object;
	var x = 0;
	var stop = 0;
	var output = "<A HREF=\"http://www.juniper.net/\">Home</A> > ";
	var name;

	sURL = location.href;
	sURL = sURL.slice(8,sURL.length);
	chunkStart = sURL.indexOf("/");
	sURL = sURL.slice(chunkStart+1,sURL.length)

	while(!stop){
		chunkStart = sURL.indexOf("/");
		if (chunkStart != -1){
			bits[x] = sURL.slice(0,chunkStart)
			sURL = sURL.slice(chunkStart+1,sURL.length);
		}else{
			stop = 1;
		}
		x++;
	}

	for(var i in bits){
		if(bits[i] == 'techpubs')
		{
			name = 'Technical Documentation';
			output += "<A HREF=\"";
			for(y=1;y<x-i;y++){
				output += "../default.htm";
			}
			output += bits[i] + "http://www.juniper.net/\">" + name + "</A> > ";				
		}
		else if(bits[i] == 'product')
		{				
			name  = 'EX-series TechPubs Home';
			output += name;
		}
		else if(bits[i] == 'hardware')
		{				
			name  = 'EX-series TechPubs Home';
			output += "<A HREF=\"";
			for(y=1;y<x-i;y++){
				output += "../default.htm";
			}				
			output += "product/index.html" + "\">" + name + "</A> > ";

			name  = 'EX-series Hardware';
			output += name;
		}
		else if(bits[i].indexOf('junos')!=-1)
		{
			if(location.href.indexOf('release-independent') == -1){
				name  = 'EX-series TechPubs Home';
				output += "<A HREF=\"";
				for(y=1;y<x-i;y++){
					output += "../default.htm";
				}				
				output += "release-independent/junos/information-products/pathway-pages/ex-series/product/index.html" + "\">" + name + "</A> > ";
			}
		}
		else if(bits[i] == 'software')
		{
			name  = 'EX-series Software';
			output += name;
		}
		else if(bits[i] == '802-1x' | bits[i] == 'bridging' | bits[i] == 'cos'| bits[i] == 'interfaces'| bits[i] == 'l3-protocols' | bits[i] == 'mibs' | bits[i] == 'packet-filters' | bits[i] == 'poe'| bits[i] == 'port-mirroring' | bits[i] == 'virtual-chassis')
		{
			name  = 'EX-series Features';
			output += name;
		}
	}
	document.write(output);
}

function showSubList(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
		} else {
			document.getElementById(id).style.display = 'none';			
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				document.id.display = 'block';
			} else {
				document.id.display = 'none';
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = 'block';
			} else {
				document.all.id.style.display = 'none';
			}
		}
	}
}

function selectTheTab()
{

	var version = 0;
	
	if(window.location.href.indexOf("/junos9.")!=-1)
	{
		url = window.location.href;
		version = url.substring(url.indexOf("/junos9.")+8, url.indexOf("/junos9.")+9);
	}
	
	if(version > 2){
		showSubList('ex-series');
	}
	else if(window.location.href.indexOf("/ex-series/")!=-1)
	{
		if(window.location.href.indexOf("/product/")!=-1)
		{
			showSubList('subsubnav');
		}
		else if(window.location.href.indexOf("/hardware/")!=-1)
		{
			showSubList('subsubnav');
		}
		else if(window.location.href.indexOf("/software/")!=-1)
		{
			showSubList('subsubnav');
		}else
		{
			showSubList('subsubnav');
			showSubList('subsubsubnav');
		}	

	}
	else
	{
		showSubList('ex-series');
	}
	if ((window.location.href.lastIndexOf("?")) > 0) 
		switchTabs(window.location.search.substring(1,5))
	clearmailToFriend();
	return
}
			
function noUrl()
{
	return;
}

function sendMail()
{
	document.write('<a href="mailto:techpubs-comments-java-90@juniper.net?subject=EX-series beta documentation feedback&body='+top.location.href+'">Feedback</a>');
}

function printSWLinks()
{
	var swVersion;
	var url;
	var version;
	var pubsurl;
	url = window.location.href;	
	if(window.location.href.indexOf("/beta5")!=-1){
		pubsurl = "beta/junos/beta5/";
		if(window.location.href.indexOf("/junos9.")!=-1){
			version = url.substring(url.indexOf("/junos9.")+8, url.indexOf("/junos9.")+9);
			swVersion = "junos9." + version;
		}else{
			swVersion = "junos9.3";
		}
	}else{
		pubsurl = "techpubs/en_US/";
		if(window.location.href.indexOf("/junos9.")!=-1){
			version = url.substring(url.indexOf("/junos9.")+8, url.indexOf("/junos9.")+9);
			swVersion = "junos9." + version;
		}else{
			swVersion = "junos9.2";
		}
	}
	var markup = '<a class="product" onClick="showSubList(\'subsubnav\');" href="http://www.juniper.net/' + pubsurl + 'release-independent/junos/information-products/pathway-pages/ex-series/product/index.html">EX-series</a>';
	markup += '<ul style="display:none" id="subsubnav">';
	markup += '<li><a class="hardware" href="http://www.juniper.net/' + pubsurl + 'release-independent/junos/information-products/pathway-pages/ex-series/hardware/ex3200-ex4200.html">Hardware</a></li>';
	markup += '<li><a class="software" href="http://www.juniper.net/' + pubsurl + swVersion + '/information-products/pathway-pages/ex-series/software/index.html">Software</a></li>';
	markup += '<li><a class="fe" href="javascript:noUrl();" onClick="showSubList(\'subsubsubnav\');">Features</a>';
	markup += '<ul style="display:none" id="subsubsubnav">';
	markup += '<li><a class="voip" href="http://www.juniper.net/' + pubsurl + swVersion + '/information-products/pathway-pages/ex-series/802-1x/index.html">802.1X, Port Security, and VoIP</a></li>';
	markup += '<li><a class="bridging" href="http://www.juniper.net/' + pubsurl + swVersion + '/information-products/pathway-pages/ex-series/bridging/index.html">Bridging, VLANs, and Spanning Trees</a></li>';
	markup += '<li><a class="cos" href="http://www.juniper.net/' + pubsurl + swVersion + '/information-products/pathway-pages/ex-series/cos/index.html">CoS</a></li>';
	markup += '<li><a class="interfaces" href="http://www.juniper.net/' + pubsurl + swVersion + '/information-products/pathway-pages/ex-series/interfaces/index.html">Interfaces</a></li>';
	markup += '<li><a class="protocols" href="http://www.juniper.net/' + pubsurl + swVersion + '/information-products/pathway-pages/ex-series/l3-protocols/index.html">Layer 3 Protocols</a></li>';
	markup += '<li><a class="packet" href="http://www.juniper.net/' + pubsurl + swVersion + '/information-products/pathway-pages/ex-series/packet-filters/index.html">Packet Filters</a></li>';
	markup += '<li><a class="poe" href="http://www.juniper.net/' + pubsurl + swVersion + '/information-products/pathway-pages/ex-series/poe/index.html">PoE</a></li>';
	markup += '<li><a class="port" href="http://www.juniper.net/' + pubsurl + swVersion + '/information-products/pathway-pages/ex-series/port-mirroring/index.html">Port Mirroring</a></li>';
	markup += '<li><a class="chassis" href="http://www.juniper.net/' + pubsurl + swVersion + '/information-products/pathway-pages/ex-series/virtual-chassis/index.html">Virtual Chassis</a></li>';
	markup += '</ul>';
	markup += '</li>';
	markup += '</ul>';
	document.write(markup);
}

function replaceReleaseNumber(str)
{
	var swVersion;
	var url = window.location.href;
	var str1 = str.substring(0,str.indexOf("[RELEASE-NUMBER]/"));
	var str2 = str.substring(str1.lastIndexOf("/"),str1.length);

	var url1 = url.substring(url.indexOf("/en_US"));
	var url2 = url1.substring(url1.indexOf(str2)+str2.length);

	var releaseNum = url2.substring(0,url2.indexOf("/"));

	var newstr = str.replace(/\[RELEASE-NUMBER\]/g,releaseNum);
	document.write(newstr);
}

function clearmailToFriend(){
    var a = document.getElementsByTagName("a");
    
    for(var i=0;i<a.length;i++)
        if(a[i].href.indexOf('/mailToFriend/mail.jsp')>0)
            removeNode(a[i]);
}

function removeNode(node){
    node.parentNode.removeChild(node);
}