

// online tracking append to the cable URL
var cV = gCookie('vm_buspart')
var appendVal = (cV)?'?buspart='+cV:'';
document.writeln('<div class="linkbox"><a href="http://allyours.virginmedia.com/'+appendVal+'" onfocus="this.blur()" title="Back to on cable"><img src="/allyours/images/icon_backarrow.gif" width="15" height="15" alt="" border="0" style="float:left;margin-right:5px;"/> Back to on cable</a></div>');
if(pageName != 'error') { 

// outter nav
//d.writeln('<div class="nav-left" id="access-nav-local">');

// indepth nav
//d.writeln('<h2>Channels</h2>');
// variable declaration 
var subClass = 'subnav';
var childSelected = 'false';
//open nav list
d.write('<ul>\n');
// loop through each item
for(var i in mM){
		
		// this loop is to check if any child of this item is currently selected
	    for(var j in mM[i].sM){
		    if(mM[i].sM[j].iR==pageName || mM[i].sM[j].sSM.join().indexOf(pageName)>-1 ){
			    //if a children is selected then overwrite style display of the current item
			    subClass = 'subnavSelected';
				childSelected = 'true';
		    }
	    }
		
		// check if selected
		if(mM[i].iR==pageName || childSelected == 'true') {
			//currently selected
			d.write('<li><a class="current" '+ 'href="' + mM[i].u + '">'+ mM[i].t +'</a>');
			//childContainerDisplay = 'block';
			if(mM[i].endBlock == true){
			  d.writeln('<li><img src="/allyours/images/navdivider.gif" width="170" height="1" alt="" border="0" />');
			}			
		} else {
			d.write('<li><a href="' + mM[i].u + '">'+ mM[i].t +'</a>');
			if(mM[i].endBlock == true){
			  d.writeln('<li><img src="/allyours/images/navdivider.gif" width="170" height="1" alt="" border="0" />');
			}
		}
				
	    // check if the item got any children
	    if(mM[i].sM.length>0){
					
			d.write('\n<ul id="subnav'+i+'">\n');

			for(var j in mM[i].sM){

				if(mM[i].sM[j].iR==pageName || mM[i].sM[j].sSM.join().indexOf(pageName)>-1 ){
			    	// write the child sub item 
					d.write('<li class="subcurrent"><a'+' href="' + mM[i].sM[j].u + '">  '+ mM[i].sM[j].t +'</a></li>\n');
			    } else {
					d.write('<li><a href="' + mM[i].sM[j].u + '">'+ mM[i].sM[j].t +'</a></li>\n');
				}
		    }
		    // close the child container div
		    d.write('</ul><div class="clearfix"></div>\n');
	    }
		
		// close nav list
		d.write('</li>\n');
		
		// reset var
		subClass = 'subnav';
		childSelected = 'false';
    }
	
// close main list and final div nav
d.writeln('</ul>');

// end if not error
}