
	function truncateto(astring,alength)
	{
		if ( astring == null ) return '';
		rstring=astring;
		if(astring.length>alength)
		{
		rstring=astring.substring(0,alength-5) + '...';
		}
		return rstring;
	}
	


	
	var N3HTML = ['<link rel="stylesheet" href="http://www.networkn3.com/syndication/flive/css/style120-green.css" type="text/css" media="screen" />'];
	N3HTML.push ( '<div id="bmWidgetOutlineOuter" class="bmWidgetOutline2"><div class="bmWidgetOutline"><div id="bmWidgetMenuOn" style="display:none">' );
	N3HTML.push ( '<table width="118" border="0" cellspacing="0" cellpadding="0" id="widget-table"><tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0" id="widget-table">' );
	N3HTML.push ( '<tr><td class="bmWidgetTopBar">' ); //<a style="letter-spacing:normal" id="bmWidgetTopBarLink" href="javascript:bmWidget.hotlistCancel()" title="one">' );
	N3HTML.push ( '<img src="http://www.networkn3.com/syndication/flive/img/down-green.gif" border="0" height="12"><span id="bmWidgetTopTitle" style="padding-left:2px"></span>' ); //</a>
	N3HTML.push ( '</td></tr></table></td></tr><tr><td>' );	
	N3HTML.push ( '<div id="bwWidgethotlistItems"></div>' );
	N3HTML.push ( '</td></tr><tr><td><div id="bmWidgetBottomBarCancel"><a style="letter-spacing:normal" href="javascript:bmWidget.hotlistCancel()" class="bmWidgetCancel">Cancel</a></div></td></tr></table></div>' );
	
	
	N3HTML.push ( '<div id="bmWidgetMenuOff">' );
	N3HTML.push ( '<table width="118" border="0" cellspacing="0" cellpadding="0" id="widget-table"><tr><td><table style="margin:0px; padding:0px;" width="100%" border="0" cellspacing="0" cellpadding="0"' );
	N3HTML.push ( 'id="widget-table"><tr><td class="bmWidgetTopBar">' ); //<a style="letter-spacing:normal" id="bmWidgetTopBarLink2" href="javascript:bmWidget.hotlist()" title="two">
	N3HTML.push ( '<span id="bmWidgetTopTitle2" style="letter-spacing:normal"></span>' ); //<img src="http://www.networkn3.com/syndication/flive/img/down-green.gif" border="0" height="12"></a>
	N3HTML.push ( '</td></tr></table></td></tr><tr><td class="bmWidgetLinkcell" height="170" valign="top">' );
	N3HTML.push ( '<a style="letter-spacing:normal; margin:0px; padding:0px;" id="bmWidgetLinkT2" class="bmWidgetLinks" href="" rel="lyteframe" title="" rev="width: 424px; height: 491px; scrolling: no;"></a>' );
	N3HTML.push ( '<a href="javascript:bmWidget.showBox()"><img id="bmWidgetImage" src="" height="79" width="118" border="0" style="margin:0px; padding:0px;">' );
	N3HTML.push ( '</a><div class="bmWidgetPad">' );
	N3HTML.push ( '<a href="javascript:bmWidget.showBox()"><strong id="bmWidgetTitle">Loading...</strong><span style="display:block" id="bmWidgetDesc"></span></a></div>' );
	N3HTML.push ( '</td></tr><tr><td style="letter-spacing:normal" align="center" valign="top" class="bmWidgetBottomBarPages">' );
	N3HTML.push ( '<a style="letter-spacing:normal" id="bmWidgetPrevLink" href="javascript:bmWidget.prevPage()"><img id="bmWidgetPrev" src="http://www.networkn3.com/syndication/flive/img/prev-off-green.gif" border="0" height="13" width="26" style="padding: 0px; margin: 0px"></a><span id="bmWidgetPageCurrent">0</span> of <span id="bmWidgetPageLength">0</span><a style="letter-spacing:normal" id="bmWidgetNextLink" href="javascript:bmWidget.nextPage()" onClick="this.blur()"><img id="bmWidgetNext" src="http://www.networkn3.com/syndication/flive/img/next-green.gif" border="0" height="13" width="26" style="padding: 0px; margin: 0px"></a>' );
	N3HTML.push ( '</td></tr></table></div></div></div>' );	


	document.write ( N3HTML.join ( '' ) );



	var n3json =
[{"content":{"userid":"13"},"items":[]}];



var bmWidget = {

	$ : function ( v ) { return document.getElementById ( v ); },

	load : function (  )
	{
		bmWidget.startIndex = 36;
		bmWidget.loadData();
	},
	
	
	showBox : function () 
	{
		var headID = document.getElementsByTagName("head")[0];
		var cssNode = document.createElement("link"); cssNode.type = "text/css"; cssNode.rel = "stylesheet";
		cssNode.href = "http://www.networkn3.com/syndication/flive/includes/lytebox/lyteboxcss-green.css"; 
		cssNode.media = "screen";
		headID.appendChild(cssNode); 
		
		var headID = document.getElementsByTagName("head")[0]; 
		var lyteboxScript = document.createElement("script");
		lyteboxScript.type = "text/javascript";
		var loadFunction = function() { 
			if (this.readyState == "complete" || this.readyState == "loaded") 
			{ 
				initLytebox(); 
				myLytebox.start( document.getElementById ( 'bmWidgetLinkT2' ) , false, true); 
			} 
		};  
		lyteboxScript.onreadystatechange = loadFunction;  
		lyteboxScript.onload = function () 
		{ 
			initLytebox(); 
			myLytebox.start( document.getElementById ( 'bmWidgetLinkT2' ), false, true); 
		}; 
		lyteboxScript.src = "http://www.networkn3.com/syndication/flive/includes/lytebox/lytebox.php?THEME=green"; 
		headID.appendChild(lyteboxScript); 
	},
	
	layoutPage : function ()
	{
	
		this.$ ( 'bmWidgetTopTitle' ).innerHTML = 
			truncateto(n3json[ this.getIndex() ].items[this.getPage()].hotListItem,15);
			
		//this.$ ( 'bmWidgetTopBarLink' ).title = 
		//	n3json[ this.getIndex() ].items[this.getPage()].hotListItem;	
			
		this.$ ( 'bmWidgetTopTitle2' ).innerHTML = 
			truncateto(n3json[ this.getIndex() ].items[this.getPage()].hotListItem,15);
			
		//this.$ ( 'bmWidgetTopBarLink2' ).title = 
		//	n3json[ this.getIndex() ].items[this.getPage()].hotListItem;	
	
		this.$ ( 'bmWidgetDesc' ).innerHTML = 
			truncateto(n3json[ this.getIndex() ].items[this.getPage()].description,40);
			
		this.$ ( 'bmWidgetTitle' ).innerHTML =
			truncateto(n3json[ this.getIndex() ].items[this.getPage()].title,35);
			
		this.$ ( 'bmWidgetPageLength' ).innerHTML =
			n3json[ this.getIndex() ].items.length;
			
		this.$ ( 'bmWidgetPageCurrent').innerHTML = this.getPage () + 1;
		
		
		this.$ ( 'bmWidgetNext').src= 
			this.getPage()+1>=n3json[ this.getIndex() ].items.length?
				'http://www.networkn3.com/syndication/flive/img/next-off-green.gif':
				'http://www.networkn3.com/syndication/flive/img/next-green.gif';
				
		this.$ ( 'bmWidgetPrev').src= 
			this.getPage()==0?
				'http://www.networkn3.com/syndication/flive/img/prev-off-green.gif':
				'http://www.networkn3.com/syndication/flive/img/prev-green.gif';
				
		this.$ ( 'bmWidgetImage').src = 
			n3json[ this.getIndex() ].items[this.getPage()].fullThumbPath;
			
		this.$ ( 'bmWidgetLinkT2' ).href =
			'http://www.networkn3.com/syndication/flive/widgetVideo.php?sid=' + 123 + '&vid=' + 
				n3json[ this.getIndex() ].items[this.getPage()].vid;

		
	},
	
	
	
	nextPage : function ()
	{
		if ( this.getPage()+1<n3json[ this.getIndex() ].items.length )
		{
			this.setPage ( this.getPage () + 1 );

		}
	},
	
	prevPage : function ()
	{
		if ( this.getPage() > 0 )
		{
			this.setPage ( this.getPage () - 1 );
		}
	},
	
	setIndex : function ( i )
	{
		
		this.index = i;
		// setup the page to 0
		this.setPage ( 0 );
		
		this.hotlistCancel ();
	},
	
	getIndex : function () 
	{
		return this.index;
	},
	
	setPage : function ( page ) 
	{
		this.page = page;
		this.layoutPage ( );
	},
	
	getPage : function () 
	{
		return this.page;
	},
	
	loadData : function ( )
	{
		html = ['<table width="100%" border="0" cellspacing="0" cellpadding="0" id="widget-table">'];
		
		var index = 0;
		
		

		for ( x = 0; x < n3json.length; x++ )
		{
			if ( n3json[x].content.id == bmWidget.startIndex )
			{
				index = x;
				html.push ( '<tr><td class="bmWidgetMenuItem lineBelow"><img src="http://www.networkn3.com/syndication/flive/img/space.gif" width="17" height="5"><a href="javascript:bmWidget.setIndex(' + x + ')" title="' + n3json[x].content.name + '">' + 
					truncateto(n3json[x].content.name,15) + '</a></td></tr>' );
				index = x;
			}		
		}


		var pos=0;
		for ( x = 0; x < n3json.length; x++ )
		{
			if ( index != x )
			{
				html.push ( '<tr><td class="bmWidgetMenuItem lineAboveAndBelow"><img src="http://www.networkn3.com/syndication/flive/img/space.gif" width="17" height="5"><a href="javascript:bmWidget.setIndex(' + x + ')" title="' + n3json[x].content.name + '">' + 
				truncateto(n3json[x].content.name,15) + '</a></td></tr>' );
				pos++;
			}
				
			
			// size gets a bit crazy after 6 items and the about box
			if ( pos == 3 ) break;
		}
		
		
		html.push ( '<tr><td class="bmWidgetMenuItem"><a href="http://www.networkn3.com" target="_blank"><img src="http://www.networkn3.com/syndication/flive/img/about-n3-black.gif" border="0"></a></td></tr></table>' );
		http://www.networkn3.com/syndication/flive/		
		bmWidget.$ ( 'bwWidgethotlistItems' ).innerHTML = html.join ( '' );
		
		// kick off the loading of the data
		bmWidget.setIndex ( index );
	},
	
	hotlist : function ( )
	{
	
		this.$ ( 'bmWidgetMenuOff' ).style.display = 'none';
		this.$ ( 'bmWidgetMenuOn' ).style.display = 'block';
	
	},
	
	
	hotlistCancel : function ( )
	{
		this.$ ( 'bmWidgetMenuOff' ).style.display = 'block';
		this.$ ( 'bmWidgetMenuOn' ).style.display = 'none';
	}

}

if (window.addEventListener) {
	window.addEventListener("load",bmWidget.load,false);
} else if (window.attachEvent) {
	window.attachEvent("onload",bmWidget.load);
} else {
	window.onload = function() {bmWidget.load();}
}