
	document.write( '<script src="/js/ads.js" type="text/javascript"><\/script>' );
	var XS_ROOT_PATH = '/';
	var XS_IMG_PATH = XS_ROOT_PATH + 'images/';
	var XS_JS_PATH = XS_ROOT_PATH + 'js/';
	var XS_CSS_PATH = XS_ROOT_PATH + 'css/';
	var XS_ICON_PATH = XS_ROOT_PATH + XS_IMG_PATH + '/icons';
	var XS_ALT_ROW_COLOR_1 = '#FFFFFF',						XS_ALT_ROW_COLOR_2 = '#F7F7F7';
    var playJSloaded = 0;

	/* Place holders Variables */
	var strCountryCodeUpperCase = '',	strCountryCodeLowerCase = '';

	/*
		These variables are used to create links to the JS and CSS files for each page. The strThisFile variable
		is also used to execute the onload function for each page. If you use it, make sure that the page has a
		function the is named the same as the page file name without the extention.
	*/
	var strThisPath = location.pathname;
	var strThisFile = '';
	
	var strThisFile = strThisPath.replace( XS_ROOT_PATH, '' );
	if( strThisFile.indexOf( '.' ) > -1 )
		strThisFile = strThisFile.substring( 0, strThisFile.lastIndexOf( '.' ) );
	else
		strThisFile += 'index';
	var strCSSImportURL = XS_CSS_PATH + strThisFile + '.css';
	var strJSImportURL = XS_JS_PATH + strThisFile + '.js';
	
	/*
		aryPageSpecificStyleSheets allows you to designate non global/page specific style sheets for pages that
		require shared styles.
	*/
	var aryPageSpecificStyleSheets = new Array();

	/*																 File Path~!~File Name Sans Extension~!~Style Sheet File Name*/
	aryPageSpecificStyleSheets[aryPageSpecificStyleSheets.length] = 'login~!~index~!~login/login_registration_global.css';
	aryPageSpecificStyleSheets[aryPageSpecificStyleSheets.length] = 'registration~!~register~!~login/login_registration_global.css';
	aryPageSpecificStyleSheets[aryPageSpecificStyleSheets.length] = 'registration~!~registration_confirm~!~login/login_registration_global.css';

	function GetPageSpecificStyleSheets( strThisFile ){
		var strReturnValue = '';
		var aryPathFile = strThisFile.split( '/' );
		for( var i = 0; i < aryPageSpecificStyleSheets.length; i++ ){
			var aryTemp = aryPageSpecificStyleSheets[i].split( '~!~' );
			if( aryTemp[0] == aryPathFile[0] && aryTemp[1] == aryPathFile[1] ){
				strReturnValue += '		@import url("' + XS_CSS_PATH + aryTemp[2] + '" );\n';
			}
		}
		return strReturnValue;
	}

	/*
		DEFINED PAGE SPECIFIC javascript
	
		aryPageSpecificJS allows you to designate non global/page specific javascript files for pages that
		require shared javascript.
	*/
	var aryPageSpecificJS = new Array();

	/*											   File Path~!~File Name Sans Extension~!~JS File Name*/
	aryPageSpecificJS[aryPageSpecificJS.length] = 'browse~!~index~!~table_constructor.js';
	aryPageSpecificJS[aryPageSpecificJS.length] = 'search~!~results~!~table_constructor.js';
	aryPageSpecificJS[aryPageSpecificJS.length] = 'view~!~album~!~table_constructor.js';

	function GetPageSpecificJS( strThisFile ){
		var strReturnValue = '';
		var aryPathFile = strThisFile.split( '/' );
		for( var i = 0; i < aryPageSpecificJS.length; i++ ){
			var aryTemp = aryPageSpecificJS[i].split( '~!~' );
			if( aryTemp[0] == aryPathFile[0] && aryTemp[1] == aryPathFile[1] ){
				strReturnValue += '<sc' + 'ript language="JavaScript1.2" type="text/javascript" src="' + XS_JS_PATH + aryTemp[2] + '"></' + 'script>\n'
			}
		}
		return strReturnValue;
	}

	/*
		Function Name: N/A
		Description: Writes the js and css file links for each page based on the page name. Most of these are default values.
		Date Modified: 2/14/2006
	*/
	document.writeln( '<sc' + 'ript language="JavaScript1.2" type="text/javascript" src="' + XS_JS_PATH + 'prototype.js"></' + 'script>' );
	document.writeln( '<sc' + 'ript language="JavaScript1.2" type="text/javascript" src="' + XS_JS_PATH + 'query_parsing.js"></' + 'script>' );
	document.writeln( '<sc' + 'ript language="JavaScript1.2" type="text/javascript" src="' + XS_JS_PATH + 'cookies.js"></' + 'script>' );
	document.writeln( '<sc' + 'ript language="JavaScript1.2" type="text/javascript" src="' + XS_JS_PATH + 'my_account.js"></' + 'script>' );
	document.writeln( '<sc' + 'ript language="JavaScript1.2" type="text/javascript" src="' + XS_JS_PATH + 'play_link.js"></' + 'script>' );
	document.writeln( '<sc' + 'ript language="JavaScript1.2" type="text/javascript" src="' + XS_JS_PATH + 'google_adsense.js"></' + 'script>' );
	document.writeln( '<sc' + 'ript language="JavaScript1.2" type="text/javascript" src="' + XS_JS_PATH + 'browse_functions.js"></' + 'script>' );
	document.writeln( '<sc' + 'ript language="JavaScript1.2" type="text/javascript" src="' + XS_JS_PATH + 'pop_up_window_function.js"></' + 'script>' );

	/* Page specific java script link starts. */
	//document.writeln( '<sc' + 'ript language="JavaScript1.2" type="text/javascript" src="' + strJSImportURL + '"></' + 'script>' );
	document.writeln( GetPageSpecificJS( strThisFile ) );
	/* Page specific java script link ends. */

	document.writeln( '<style type="text/css">' );
	document.writeln( '	<!--' );
	document.writeln( '		@import url("' + XS_CSS_PATH + 'global.css" );' );
	document.writeln( '		@import url("' + XS_CSS_PATH + 'google_adsense.css" );' );
	document.writeln( '		@import url("' + XS_CSS_PATH + 'navigation.css" );' );
	document.writeln( '		@import url("' + XS_CSS_PATH + 'search_form.css" );' );

	/* Page specific style sheet link starts. */
	document.writeln( '		@import url("' + strCSSImportURL + '" );' );
	document.writeln( GetPageSpecificStyleSheets( strThisFile ) );
	/* Page specific style sheet link ends. */
	document.writeln( '	-->' );
	document.writeln( '</style>' );
	
	document.writeln( '<object id="objNapsterPlugin" classid="CLSID:C2F18352-A7FC-487E-9B44-8FF0AB12B58B"></object>' );

	function ImageErrorHandler( objImage, intSize ){
		if( intSize == null )
			intSize = 50;
		objImage.src = "/images/albums/gfc_" + intSize + "x" + intSize + "_default.gif";
	}
	
	function GetBreadCrumb(){
		if( strThisFile != 'index' )
			return '<a href="/index.html" class="BreadCrumbLink">Home</a> > ' + $T();
		else
			return '';
	}
	
	var objGenreIDsByName = new Object();
	objGenreIDsByName['Alternative'] = '1';
	objGenreIDsByName['Blues'] = '2';
	objGenreIDsByName['Christian'] = '4';
	objGenreIDsByName['Classical'] = '5';
	objGenreIDsByName['Comedy'] = '6';
	objGenreIDsByName['Country'] = '7';
	objGenreIDsByName['Dance/Electronic'] = '8';
	objGenreIDsByName['Dance / Electronic'] = '8';
	objGenreIDsByName['Electronic'] = '8';
	objGenreIDsByName['Dance'] = '8';
	objGenreIDsByName['Easy Listening'] = '9';
	objGenreIDsByName['Folk'] = '10';
	objGenreIDsByName['Hip Hop'] = '11';
	objGenreIDsByName['Hip-Hop'] = '11';
	objGenreIDsByName['Holiday and Miscellaneous'] = '12';
	objGenreIDsByName['Jazz'] = '13';
	objGenreIDsByName['Latin'] = '14';
	objGenreIDsByName['Pop'] = '16';
	objGenreIDsByName['R&amp;B'] = '17';
	objGenreIDsByName['R&B'] = '17';
	objGenreIDsByName['Reggae'] = '18';
	objGenreIDsByName['Rock'] = '19';
	objGenreIDsByName['Vocal/Nostalgia'] = '21';
	objGenreIDsByName['Vocal'] = '21';
	objGenreIDsByName['Nostalgia'] = '21';
	objGenreIDsByName['World'] = '22';
	
	function BrowseGenreByName( strGenreName ){
                if (objGenreIDsByName[strGenreName] != null)
    		    document.location.href = XS_ROOT_PATH + 'browse/index.html?genre=' + objGenreIDsByName[strGenreName];
	}
	
	function Buy( strID, intType, strAlbumPrice, strAlbumID ){
		var type = parseInt(intType);
		var isAFS;
		
		if( $C( 'COUNTRYCODE' ) != 'US' )
			document.location.href = '/subscribe/unsupported_country.html';
		/* old code
		else{
			if( intType == 0 ){
				$SCEG( 'Click', 'var s_eVar3="Purchase_Track_' + strID + '_' + $FILEPATH() + '"' );
				buyURL = 'http://free.napster.com/nweb/subscribe/purchase.html?track_id=' + strID;
				OpenPopupWindow( buyURL, "buyWindow", 700, 800, 0, 0, 1);
			}
			else if( intType == 1 ){
				$SCEG( 'Click', 'var s_eVar3="Purchase_Album_' + strID + '_' + $FILEPATH() + '"' );
				buyURL = 'http://free.napster.com/nweb/subscribe/purchase.html?album_id=' + strID;
				OpenPopupWindow( buyURL, "buyWindow", 700, 800, 0, 0, 1);
			}
			else if( intType == 2 ){
				$SCEG( 'Click', 'var s_eVar3="Purchase_Track_' + strID + '_' + $FILEPATH() + '"' );
				buyURL = 'http://free.napster.com/nweb/subscribe/purchase.html?work_id=' + strID;
				OpenPopupWindow( buyURL, "buyWindow", 700, 800, 0, 0, 1);
			}
			else if( intType == 99 ){
				$SCEG( 'Click', 'var s_eVar3="Purchase_Track_' + strID + '_' + $FILEPATH() + '"' );
				var strQuery = "track_id=" + strID + "&album_cost=" + strAlbumPrice + "&album_id=" + strAlbumID;
				buyURL = 'http://free.napster.com/nweb/subscribe/purchase.html?' + strQuery;
				OpenPopupWindow( buyURL, "buyWindow", 700, 800, 0, 0, 1);
			}
		}
		*/
		//Matt added 5/7/2008
		else {
			if (type == 99 ) {
				type = 1;
				strID = strAlbumID;
				isAFS = true;
			}
			
			switch(type) {
				case 1:
					Buy_mp3(strID, type, isAFS);
					break;
				default:
					Buy_mp3(strID, type);
			}
		}
	}
	
	function Redeem(){
		$OC( "op=switch%26dlg%3dmyaccount%26tab%3daccountstatus", $C( 'CLID' ), "document.location.href = \"http://www.napster.com/subscribe/redeem.html\"" )
	}
	
	function AddEvent( objElement, strEvent, funcAction ){
		try{
			objElement.attachEvent( 'on' + strEvent, function(){ eval( funcAction ) } );
		}
		catch(e){
			try{
				objElement.addEventListener( strEvent, function(){ eval( funcAction ) } , false );
			}
			catch(e){}
		}
	}
	
	function P_Buy(){
		var blnDoBuy = false;
		if( query.p_track_id != null && query.p_track_id != '' ){
			var strID = query.p_track_id;
			var intType = 0;
			blnDoBuy = true;
		}
		else if( query.p_album_id != null && query.p_album_id != '' ){
			var strID = query.p_album_id;
			var intType = 1;
			blnDoBuy = true;
		}
		else if( query.p_work_id != null && query.p_work_id != '' ){
			var strID = query.p_work_id;
			var intType = 2;
			blnDoBuy = true;
		}
		if( blnDoBuy )
			Buy( strID, intType );
	}
	
	AddEvent( window, 'load', "P_Buy()" );

	/* Prototypes */

	String.prototype.strip = function( strStripWhat ){
		var strToModify = this;
		switch( strStripWhat.toLowerCase() ){
			case 'punc':
			case 'punctuation':
				strToModify = strToModify.replace( /[\\+]+/gi, ' ' );
				var RegExpPattern = new RegExp( '[\\s\\w\\d]+', 'gi' );
				var objMatch = strToModify.match( RegExpPattern );
				strToModify = objMatch.toString( '' ).replace( /[\\,]+/g, ' ' );
				strToModify = strToModify.replace( /\s+/g, ' ' );
				return strToModify;
				break;
			default:
				return strToModify;
		}
	};
	
	String.prototype.trim = function(){
		strToModify = this;
		var RegExpPattern = new RegExp( '^[\\s]+', 'gi' );
		strToModify = strToModify.replace( RegExpPattern, '' );
		var RegExpPattern = new RegExp( '[\\s]+$', 'gi' );
		strToModify = strToModify.replace( RegExpPattern, '' );
		return strToModify;
	};
	
	String.prototype.escapeURL = function(){
		var strValue = this;
		aryEscapeCodes = new Array( ':,%3A', '/,%2F', '.,%2E', '_,%5F', '&,%26', '=,%3D', '©,%A9', 'Ã,%C3' );
		for( intCodes = 0; intCodes < aryEscapeCodes.length; intCodes++ ){
			aryTemp = aryEscapeCodes[intCodes].split( ',' );
			objRegExp = new RegExp( '[\\' + aryTemp[0] + ']', 'gi' );
			strValue = strValue.replace( objRegExp, aryTemp[1] );
		}
		return strValue;
	};
	
	String.prototype.escapeString = function(){
		var strValue = this;
		aryEscapeCodes = new Array( '&,&amp;', '",&quot;', '<,&lt;', '>,&gt;' );
		for( intCodes = 0; intCodes < aryEscapeCodes.length; intCodes++ ){
			aryTemp = aryEscapeCodes[intCodes].split( ',' );
			objRegExp = new RegExp( '[\\' + aryTemp[0] + ']', 'gi' );
			strValue = strValue.replace( objRegExp, aryTemp[1] );
		}
		return strValue;
	};
	
	String.prototype.decode = function(){
		var strValue = this;
		return strValue;
	};
	
	function Arguments(){
		var objScriptRegExp = new RegExp( '[\\\<\\\%3ca]+script', 'gi' );
		var objNewLineRegExp = new RegExp( '[\\\n\\\r]+', 'gi' );
		var strQuery = location.search.substring( 1 );
		strQuery = strQuery.replace( objScriptRegExp, '' );
		strQuery = strQuery.replace( objNewLineRegExp, '' );
		if( arguments[0] != null && arguments[0] != '' )
			strQuery += ( ( strQuery == '' && strQuery.indexOf( 'plid' ) == -1 )? '' : '&' ) + arguments[0].substring(1);
		var aryArgumentPairs = strQuery.split( '&' );
		for( intArgumentIndex = 0; intArgumentIndex < aryArgumentPairs.length; intArgumentIndex++ ){
			var intPosition = aryArgumentPairs[intArgumentIndex].indexOf('=');
			if( intPosition == -1 ) continue;
			var strArgumentName = aryArgumentPairs[intArgumentIndex].substring( 0, intPosition );
			var strArgumentValue = aryArgumentPairs[intArgumentIndex].substring( intPosition + 1 );
			eval( 'this.' + strArgumentName + ' = "' + unescape( strArgumentValue ) + '"' );
		}
	}
	
	function ParseSpecChar( strPassedValue ){
		return strPassedValue;
	}
