/** VH1 External Navigation System

This will put the VH1 Global Nav on ANY external hosted site via a js include to THIS file...
<script type="text/javascript" src="http://www.vh1.com/sitewide/navigation/js/external_nav.jhtml"></script>
Due to security issues with HTTPRequest and iFrames, the data is being piped in as an escaped string.
This means that any changes to the nav will need a change to escaped_nav.jhtml.

To make changes to escaped_nav.jhtml...
1) load the modified nav into firefox - http://www.vh1.com/sitewide/navigation/navigation.jhtml?external=true
2) view source on the above page
3) copy source to clipboard
4) paste source into plain text field of this page - http://www.xs4all.nl/~jlpoutre/BoT/Javascript/Utils/endecode.html
5) copy encode field to clipboard
6) open, select all, and paste the clipboard into /sitewide/navigation/js/escaped_nav.jhtml
7) publish /sitewide/navigation/js/escaped_nav.jhtml

Working on a method using flash that will eliminate this effort.

**/

var hoverDebug = [];
VH1External = {
	removeTitles : function(){

		if (window.attachEvent){
			this.sfHover();
		}
		document.getElementById('globalnav').style.overflow = 'visible';
		//remove text from top level navs
		try{
			document.getElementById('home').innerHTML = '&nbsp;';
			document.getElementById('music').innerHTML = '&nbsp;';
			document.getElementById('shows').innerHTML = '&nbsp;';
			document.getElementById('movies').innerHTML = '&nbsp;';
			document.getElementById('news').innerHTML = '&nbsp;';
			document.getElementById('photos').innerHTML = '&nbsp;';
			document.getElementById('video').innerHTML = '&nbsp;';
		}
		catch(e){  }
		
		try{
			document.getElementById('community').innerHTML = '&nbsp;';
		}catch(e){  }
		
		try{
			document.getElementById('blank').innerHTML = '&nbsp;';
		}catch(e){  }
		
		//this.sfHover(); // this is done for ie only - happens above
	},
	
	sfHover : function() {
		//System.out.println('sfHover');
		try
		{
			var sfEls = document.getElementById("nav").getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
					//System.out.println('mouseover');
					this.className+=" sfhover";
				}
				sfEls[i].onmouseout=function() {
					//System.out.println('mouseout');
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				}
			}
		}
		catch(err)
		{
			hoverDebug[0] = err;
		}
	}
}	


try{
VH1External.removeTitles();
}
catch(e){
	if(window.attachEvent){
		window.attachEvent('onload',VH1External.removeTitles);
	}
	else if(document.addEventListener){
	
		// safari
		if (/WebKit/i.test(navigator.userAgent)) { 
			var safari_timer = setInterval(function() {        
				if (/loaded|complete/.test(document.readyState)) {            
					clearInterval(safari_timer);            
					VH1External.removeTitles();  
				}    
			}, 10);
		}
		else // not safari
			document.addEventListener('DOMContentLoaded',VH1External.removeTitles,null);
	}

}

