//////////////////UTILITIES///////////////

function randomNumber(minNum, maxNum) {
	return (minNum + Math.floor(Math.random() * (maxNum - minNum + 1)));
}

/////////////// POP OUT////////////////


var wimpy_popout_window;

function wimpyIsOpen(){
	if (!wimpy_popout_window || wimpy_popout_window.closed){
		return false;
	} else {
		return true;
	}
}

function wimpy_popAndPlay(popPage, theWidth, theHeight, theLeft, thePlaylist, startPlayingOnload){
	var popPage = popPage || wimpyPopout;
	var theFile = theFile || "";
	var theWidth = theWidth || defaultWimpyConfigs.wimpyWidth;
	var theHeight = theHeight || defaultWimpyConfigs.wimpyHeight;
	var startPlayingOnload = startPlayingOnload || "";
	
	var winName = "a" + randomNumber(1, 1000);
	var winURL = popPage + "?w=" + theWidth + "&h=" + theHeight + "&l=" + theLeft + "&startPlayingOnload=" + startPlayingOnload + "&playlist=" + thePlaylist;
	wimpy_popout_window = window.open(winURL, winName,'width=' + theWidth + ',height=' + theHeight + ',left=' + theLeft);
}

function popCheckAndPlay(thePlaylist){
	if(wimpyIsOpen()){
		wimpy_popout_window.wimpy_loadExternalPlaylist(thePlaylist, true);
	} else {
		wimpy_popAndPlay('http://rarebro.com/rarebro_player.html', 572, 280, 0, thePlaylist, 'yes');
		}
}
////////WINDOW////////////

window.name='rarebro_window';
function toggleList(id){
 if(document.getElementById) {
 var le = document.getElementById(id);
 le.style.display = (le.style.display == 'none') ? 'block' : 'none';
 }
}

