function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		NavBG_Tabs_Lanux_over = newImage("images/NavBG-Tabs_Lanux_over.gif");
		preloadFlag = true;
	}
}





	if (document.layers){
		//Netscape 4 specific code
		pre = 'document.';
		post = '';
		post2 = '';
	}
	if (document.getElementById){
		//Netscape 6 specific code
		pre = 'document.getElementById("';
		post = '").style';
		post2 = '")';
	}
	if (document.all){
		//IE4+ specific code
		pre = 'document.all.';
		post = '.style';
		post2 = '';
	}
   
	
	
   
	function showLayer(lyr){
		hideLayer(currentLayer);
		eval(pre + lyr + post).display = '';
		currentLayer = lyr;
		
	}
	function hideLayer(lyr){
		eval(pre + lyr + post).display = 'none';
	}				
							
	function toneTypeToggle(object, current){
		
		if (object == 'newReleases'){
			linkPre = 'new_';
			layerPre = 'newReleases_';
		}
		else if (object == 'topSellers'){
			linkPre = 'top_';
			layerPre = 'topSellers_';
		}
		else if (object == 'featured'){
			linkPre = 'feat_';
			layerPre = 'featured_';
		}
		else if (object == 'top10'){
			linkPre = '10_';
			layerPre = 'top10_';
		}
		else if (object == 'topGenre'){
			linkPre = 'topG_';
			layerPre = 'topGenre_';
		}
		else if (object == 'featRings'){
			linkPre = 'featR_';
			layerPre = 'featRings_';
		}
		else if (object == 'artistOnly'){
			linkPre = 'artist_';
			layerPre = 'artistOnly_';
		}
		else if (object == 'brwsRings'){
			linkPre = 'brwsR_';
			layerPre = 'brwsRings_';
		}
		else if (object == 'genreNewReleases'){
			linkPre = 'genreNew_';
			layerPre = 'genreNewReleases_';
		}
		else if (object == 'genreTopSellers'){
			linkPre = 'genreTop_';
			layerPre = 'genreTopSellers_';
		}
		else if (object == 'search5'){
			linkPre = 'search5_';
			layerPre = 'searchRings5_';
		}
		else if (object == 'search25'){
			linkPre = 'search25_';
			layerPre = 'searchRings25_';
		}
		
		
		
		if (current == 'truetone'){
			other1 = 'voicetone';
			other2 = 'polyphonic';
		}
		else if (current == 'voicetone'){
			other1 = 'truetone';
			other2 = 'polyphonic';
		}
		else if (current == 'polyphonic'){
			other1 = 'truetone';
			other2 = 'voicetone';
		}	
		
		eval(pre + linkPre + other1 + post).color = '#49166D';
		eval(pre + linkPre + other2 + post).color = '#49166D';
		eval(pre + linkPre + current + post).color = '#999999';

		
		eval(pre + layerPre + other1 + post).display = 'none';
		eval(pre + layerPre + other2 + post).display = 'none';
		eval(pre + layerPre + current + post).display = 'block';
		
	}
	
	
	
		//	This is the folder where MP3's are located
		var site = "http://www.liquidreality.ca/other/tm/loadtest/";
		
		// Programatically write this from session variable at run-time to determine the windows presented to the user
		var logState = "logged";
		// var logState = "notLogged";
	
		
		// This sets the variables for current iFrame & current content
		var currentFrame = 'none';
		var currentFrameContent = 'none';
		var linkDiv = "none";
		var lastLinkDiv = 'none';
		var lastCurrentFrame = 'none';
		
		
		//	This function handles the communication between the flash player and the javaScript
		function callExternalInterface(name, artist, url, ptype) {
			switch (ptype)
			{
				case "Ringtone":
					thisMovie("ListeningStation").loadRingtone(name, artist, url);
					break;
				case "Image":					
					thisMovie("PreviewStation").loadIMG(name, url);
					break;
			}
			
		}
		
		//	This function tells JavaScript how to address the flash movie
		function thisMovie(movieName) {
			if (navigator.appName.indexOf("Microsoft") != -1) {
				
				//return window[movieName]				
				return document[movieName];
			}
			else {
				
				return document[movieName]
			}
		}

	
		function popBuyLayer(linkObject) {
		
			linkDiv = (linkObject + '_div');
			
			
			if(lastLinkDiv != 'none'){
				eval(pre + lastLinkDiv + post2).className = 'buyBoxOff';
				eval(pre + lastCurrentFrame + post).display = 'none';
			}
				
			if (linkObject == currentFrameContent){
				//alert('open');
				
				eval(pre + currentFrame + post).display = 'none';
				eval(pre + currentFrame + post).top = "1000px";
				eval(pre + currentFrame + post).left = "1px";
				eval(pre + linkDiv + post2).className = 'buyBoxOff';
			
				// This sets the variables for current iFrame & current content
				currentFrame = 'none';
				currentFrameContent = 'none';
				//alert('now closed');
				
			} 
			else {
				//alert('closed');
				
				
				//	get the actual page position of linking div object
				var c = getAnchorPosition(linkObject);
				//	alert("cX = " + c.x + " , cY = " + c.y);
				
				
				
				//	get the width of the link object
				objWidth = eval(pre + linkDiv + post2).offsetWidth;
				// alert(objWidth);
				
				//	get the width of the link object
				objHeight = eval(pre + linkDiv + post2).offsetHeight;
				// alert(objHeight);
				
				
				
				//	This statement determines the current authorization state and affects the appropriate layer and frame
				if(logState == "logged"){
					//alert('you are logged in');
					
					// specify the correct File To Open
					var BUYLINK = ("buyLoggedIn.html" + "?searchURL=" + linkObject);
					
					// specify the correct iFrame to Target
					var BUYLINKTARGET = "buyLoggedInFrame";
					
					var BUYWIDTH = 180;
					var BUYHEIGHT = 155;
					
					//var Px = 157;
					//var Py = 157;
					
					var openLayer = "buyLoggedInLayer";
				}
				else if(logState == "notLogged"){
					//alert('you are NOT logged in');
					
					// specify the correct File To Open
					var BUYLINK = ("buyNotLoggedIn.html" + "?searchURL=" + linkObject);
					
					// specify the correct iFrame to Target
					var BUYLINKTARGET = "buyNotLoggedInFrame";
					
					var BUYWIDTH = 180;
					var BUYHEIGHT = 235;
					
					//var Px = 157;
					//var Py = 237;
					
					var openLayer = "buyNotLoggedInLayer";
					
					
				}
				
				//	determine the appropriate xy position for the appropriate layer
				lyrOffsetW = (BUYWIDTH - objWidth + 4);
				lyrOffsetY = (BUYHEIGHT);
				
				
				
				Nx = (c.x - lyrOffsetW + 'px');
				Ny = (c.y - lyrOffsetY + 'px');
				
				
				eval(pre + openLayer + post).top = Ny;
				eval(pre + openLayer + post).left = Nx;
				eval(pre + openLayer + post).display = 'block';
				eval(pre + linkDiv + post2).className = 'buyBox';
				
				// This sets the variables for current iFrame & current content
				currentFrame = openLayer;
				currentFrameContent = linkObject;
				lastLinkDiv = linkDiv;
				lastCurrentFrame = currentFrame;
				
				
				
				//	Actually sends the correct URL to the correct iFrame
				eval(BUYLINKTARGET + '.location=\'' + BUYLINK + '\'');
				
				
				
				
				// alert('test');
			}
				
		}
		
		function popRecLayer(linkObject) {
			
			linkDiv = (linkObject + '_div');
			
			if(lastLinkDiv != 'none'){
				eval(pre + lastLinkDiv + post2).className = 'buyBoxOff';
				eval(pre + lastCurrentFrame + post).display = 'none';
			}
				
			if (linkObject == currentFrameContent){
				//alert('open');
				
				eval(pre + currentFrame + post).display = 'none';
				eval(pre + currentFrame + post).top = "1000px";
				eval(pre + currentFrame + post).left = "1px";
				eval(pre + linkDiv + post2).className = 'buyBoxOff';
			
				// This sets the variables for current iFrame & current content
				currentFrame = 'none';
				currentFrameContent = 'none';
				
			} 
			else {
				// alert('closed');
				
				
				//	get the actual page position of linking div object
				var c = getAnchorPosition(linkObject);
					//	alert("cX = " + c.x + " , cY = " + c.y);
				
				
				
				//	get the width of the link object
				objWidth = eval(pre + linkDiv + post2).offsetWidth;
				// alert(objWidth);
				
				//	get the width of the link object
				objHeight = eval(pre + linkDiv + post2).offsetHeight;
				// alert(objHeight);
				
				
				
				//	This statement determines the current authorization state and affects the appropriate layer and frame
				if(logState == "logged"){
					//alert('you are logged in');
					
					// specify the correct File To Open
					var RECLINK = ("recLoggedIn.html" + "?searchURL=" + linkObject);
					
					// specify the correct iFrame to Target
					var RECLINKTARGET = "recLoggedInFrame";
					
					var RECWIDTH = 380;
					var RECHEIGHT = 155;
					
					// var Px = 317;
					// var Py = 157;
					
					var openLayer = "recLoggedInLayer";
				}
				else if(logState == "notLogged"){
					//alert('you are NOT logged in');
					
					// specify the correct File To Open
					var RECLINK = ("recNotLoggedIn.html" + "?searchURL=" + linkObject);
					
					// specify the correct iFrame to Target
					var RECLINKTARGET = "recNotLoggedInFrame";
					
					var RECWIDTH = 380;
					var RECHEIGHT = 155;
					
					// var Px = 317;
					// var Py = 237;
					
					var openLayer = "recNotLoggedInLayer";
				}
				
				
				//	determine the appropriate xy position for the appropriate layer
				lyrOffsetW = (RECWIDTH - objWidth + 4);
				lyrOffsetY = (RECHEIGHT);
				
				
				
				Nx = (c.x - lyrOffsetW + 'px');
				Ny = (c.y - lyrOffsetY + 'px');
				
				
				eval(pre + openLayer + post).top = Ny;
				eval(pre + openLayer + post).left = Nx;
				eval(pre + openLayer + post).display = 'block';
				eval(pre + linkDiv + post2).className = 'buyBox';
				
				
				// This sets the variables for current iFrame & current content
				currentFrame = openLayer;
				currentFrameContent = linkObject;
				lastLinkDiv = linkDiv;
				lastCurrentFrame = currentFrame;
				
				//	Actually sends the correct URL to the correct iFrame
				eval(RECLINKTARGET + '.location=\'' + RECLINK + '\'');
				
				
			}
				
		}
		
		function menu_goto(menuForm){
			
			selecteditem = menuForm.browseCats.selectedIndex ;
			browseCats = menuForm.browseCats.options[ selecteditem ].value ;
			if (browseCats.length != 0) {
			  location.href = browseCats ;
			}
		}
		function menu_goto2(menuForm){
			
			selecteditem = menuForm.newGenres.selectedIndex ;
			newGenres = menuForm.newGenres.options[ selecteditem ].value ;
			if (newGenres.length != 0) {
			  location.href = newGenres ;
			}
		}