<!-- Hide script from older browsers

		// Creat new image objects
		function newImage(arg) {
			if (document.images) {
				rslt = new Image();
				rslt.src = arg;
				return rslt;
			}
		}

		// Change the image if the rest of the page is loaded
		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];
				}
			}
		}

		// Preloads the images
		var preloadFlag = false;
		function preloadImages() {
			if (document.images) {
				img01 = newImage("layout/area-asia1-over.gif");
				img02 = newImage("layout/area-africa1-over.gif");
				img03 = newImage("layout/area-australia1-over.gif");
				img04 = newImage("layout/area-europe1-over.gif");
				img05 = newImage("layout/area-northamerica1-over.gif");
				img06 = newImage("layout/area-southamerica1-over.gif");
				img07 = newImage("layout/area-asia2-over.gif");
				img08 = newImage("layout/area-africa2-over.gif");
				img09 = newImage("layout/area-australia2-over.gif");
				img10 = newImage("layout/area-europe2-over.gif");
				img11 = newImage("layout/area-northamerica2-over.gif");
				img12 = newImage("layout/area-southamerica2-over.gif");
				preloadFlag = true;
			}
		}

		function artist_window(ID) {
			window.open("http://calabashmusic.com/world/?pop=" + ID + "&artist=1", 'moreinfo', 'width=400,height=450,scrollbars=1,resizable=1');
		}

		function jukebox() {
			window.open("jukebox.htm", 'jukebox', 'width=358,height=366,scrollbars=1,resizable=1');
		}

// end hiding script from older browsers -->


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function movieIsLoaded (theMovie) {
  // First make sure the movie's defined.
  if (typeof(theMovie) != "undefined") {
    // If it is, check how much of it is loaded.
    return theMovie.PercentLoaded() == 100;
  } else {
    // If the movie isn't defined, it's not loaded.
    return false;
  }
}

function delay(gap,obj){ /* gap is in millisecs */
var then,now; then=new Date().getTime();
now=then;
while((now-then)<gap)

{now=new Date().getTime();}
}



function initializePlayer(Id,type) {
	alert('init');
	alert(test);
	
	if (ref) {	
		alert(ref.name)	;		
		/*
		if (ref.document.xspf_player) {		
			
			var obj=ref.document.xspf_player;	
				obj.SetVariable("playlist",playlistId);
				obj.TCallFrame("/",1);
					
			//ref.document.xspf_player.testJS();
		}
		ref.focus();
		*/
		//ref.focus();
	}
			if(ref.document.location.href == "about:blank") {
				alert(type);
				switch(type) {
				
					case "sample":					
					ref.location.href = "http://calabashmusic.net/player.php?newSample="+Id;
					break;
					
					case "playlist":
					
					ref.location.href = "http://calabashmusic.net/player.php?playlist="+Id;
					break;
				
				}
			}
			return ref;
}

function openPlayer(Id,type) {
	
	switch(type) {
				
		case "sample":					
		newUrl = "http://calabashmusic.net/player.php?newSample="+Id;
		break;
		
		case "playlist":
		
		newUrl= "http://calabashmusic.net/player.php?playlist="+Id;
		
		break;
	
	}

		if (ref = window.open(newUrl,'xspfPlayer','resizable=1,scrollbars=1,height=400,width=368') ) {
		
		
			return ref;
		}else {			
			return 	window.open("http://calabashmusic.net/player.php",'xspfPlayer','height=200,width=300');
		}
		return false;
}


function loadSample(songId) {


	if (ref = openPlayer(songId,"sample") ) {	
			
		
		ref.focus();
		//ref.focus();
	}
	
}

function loadPlaylist(playlistId) {
	
	if (ref = openPlayer(playlistId,"playlist") ) {	
			
		
		
		ref.focus();
		//ref.focus();
	}
	
	
}

function switchHelpTab(activeTab) {
	document.getElementById('helpTabPane').style.display='block';
	switch(activeTab) {

		case 'getstarted':
	
		  document.getElementById('aboutus').style.display='none';	
		break;
		
		case 'aboutus':
		
			document.getElementById('getstarted').style.display='none';	
		break;
	}
	
	document.getElementById(activeTab).style.display='block';
	
	
		
}

function toggleTrackList (trackListId) {
	
	toggleDisplay(trackListId);
	
	if(box = document.getElementById(trackListId) ) {
	
		if (box.style.height > 0 ) {
			box.style.height = 0;	
		}else {
			box.style.height = 'auto';	
		}	
		
	}	
}

