var player = '';

//open and start the audio player
function launchLRPlayer() {
	player=window.open('player/player.html', 'player', 'toolbar=0,scrollbars=0,resizable=1,height=450,width=550'); 
	if (!player.opener) player.opener = self;

	return false;
}

function moreInfoLink(url){
	var opener_url = window.opener.location;
	var re = /grcmc.org\/radio\/local/i

	if(opener_url){
		//if the user is still in the local resonance structure
		if(re.test(opener_url)){
			//change the opener page location
			//alert('still in lr');
			window.opener.location.replace(url);
		} else {
			//alert('not in lr');
			window.opener.open(url);
		}
		window.opener.focus();
		return true;
	} else {
		alert('out of domain');
	}

}

function callFlash(audio_title, audio_date, audio_file){
	//it would be in the new window
	if(player){
		player.callExternalInterface(audio_title, audio_date, audio_file);
	}  else {
		launchLRPlayer();
		player.callExternalInterface(audio_title, audio_date, audio_file);
	}
}


//load new audio into the player
function callExternalInterface(audio_title, audio_date, audio_file) {
	
	if (navigator.appName.indexOf("Microsoft") != -1) {
		window.player_v10_noSearch.extPlayAudio(audio_title, audio_date, audio_file); 
	} else {
		document.player_v10_noSearch.extPlayAudio(audio_title, audio_date, audio_file);
	}

}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

//function to show or hide the playlist
function showHidePlaylist(){
	var playlist = document.getElementById('playlist');
	var playlist_controls = document.getElementById('playist_controls');

	if(playlist.style.display=='none'){
		playlist.style.display='block';
		playlist_controls.innerHTML = '<h2>Hide the Playlist</h2>';
	} else {
		playlist.style.display='none';
		playlist_controls.innerHTML = '<h2>Show the Playlist</h2>';
	}
}

