
var dlgRoot = '';
var g_sSSLang = '';

function nba_ss_display( nba_product_name, nba_ss_anchor, nba_ss_product, nba_ss_affiliate, nba_ss_site, nba_ss_subid )
{
	head_element = document.getElementsByTagName( 'head' ).item( 0 );
	new_script = document.createElement( 'script' );
	new_script.setAttribute( 'src', 'http://www.screensavers.com/js/landing_main.js' );
	new_script.setAttribute( 'type', 'text/javascript' );
	head_element.appendChild( new_script );
	new_script = document.createElement( 'script' );
	new_script.setAttribute( 'src', 'http://www.screensavers.com/js/landing_ns/landing' + nba_ss_product + '.js' );
	new_script.setAttribute( 'type', 'text/javascript' );
	head_element.appendChild( new_script );
	dlgRoot = 'http://greg.hawking/Dlg/';
	document.write( '<script language="javascript"> var g_iAffID = 1142; </script>' );
	document.write( '<a href="#" onmouseover="window.status=\'' + nba_product_name + '\';" onclick="nba_ss_click( ' + nba_ss_product + ', ' + nba_ss_affiliate + ', ' + nba_ss_site + ', \'' + nba_ss_subid + '\' ); return false;">' + nba_ss_anchor + '</a>' );
}

var nba_ss_click_pixel = null;
function nba_ss_click( nba_ss_product, nba_ss_affiliate, nba_ss_site, nba_ss_subid )
{
	nba_ss_click_pixel = new Image();
	nba_ss_click_pixel.src = 'http://nbjmp.com/click/image/?o=31&a=' + nba_ss_affiliate + '&c=19038&s=' + nba_ss_site + '&subid=' + url_encode( nba_ss_subid );
	eval( 'getSS' + nba_ss_product + '();' );
}

function url_encode( value )
{
	var safe_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.!~*'()";
	var hex_chars = '0123456789ABCDEF';
	var plain_text = value;
	var build = '';
	for ( i = 0; i < plain_text.length; i++ )
	{
		var ch = plain_text.charAt( i );
	    if ( ch == ' ' )
	    {
		    build += '+';
		}
		else if ( safe_chars.indexOf( ch ) != -1 )
		{
		    build += ch;
		}
		else
		{
		    var charCode = ch.charCodeAt( 0 );
			if ( charCode > 255 )
			{
				build += '';
			}
			else
			{
				build += '%';
				build += hex_chars.charAt( ( charCode >> 4 ) & 0xF );
				build += hex_chars.charAt( charCode & 0xF );
			}
		}
	}
	return build;
}

