var wimpyWindow;
var winOpen=0;
var graphicURL = 'cover.jpg';
var graphicURL2 = 'radio.jpg';
var hotlinkURL = 'http://www.teaglefoundation.org/media/podcasts.aspx';

function wimpyPopPlayer(wimpyPopPage,theWidth,theHeight) {
	wimpyWindow = window.open(wimpyPopPage,'wimpyMP3player','width='+theWidth+',height='+theHeight);
	wimpyWindow.moveTo(5,5);
	winOpen=1;
}
function wimpyPopPlayerWithFile(wimpyPopPage,initialFile,theWidth,theHeight) {
	wimpyWindow = window.open(wimpyPopPage+'?theFile='+initialFile,'wimpyMP3player','width='+theWidth+',height='+theHeight);
	wimpyWindow.moveTo(5,5);
	winOpen=1;
}
function wimpyIsOpen(){
	if (winOpen==1){
		if (wimpyWindow.closed){
			return false;
		} else {
			wimpyWindow.focus();
			return true;
		}
	} else {
		return false;
	}
}

//function wimpyPopAndPlay(theFile, theArtist, theTitle, hotlinkURL, graphicURL){

function wimpyPopAndPlay(theFile, theArtist, theTitle){

	if(wimpyIsOpen()){
		wimpyWindow.wimpy_loadAndPlay(theFile, theArtist, theTitle.split("'").join("\'"), hotlinkURL, graphicURL);
	} else {
		wimpyPopPlayer('/podcast/wimpy.htm','480','140');
		setTimeout('wimpyWindow.wimpy_loadAndPlay(\'' + theFile + '\',\'' + theArtist + '\',\'' + theTitle.split("'").join("\\'") + '\',\'' + hotlinkURL + '\',\'' + graphicURL + '\');', 3500);
	}
}

function wimpyPopAndPlay2(theFile, theArtist, theTitle){

	if(wimpyIsOpen()){
		wimpyWindow.wimpy_loadAndPlay(theFile, theArtist, theTitle.split("'").join("\'"), hotlinkURL, graphicURL2);
	} else {
		wimpyPopPlayer('/podcast/wimpy.htm','480','140');
		setTimeout('wimpyWindow.wimpy_loadAndPlay(\'' + theFile + '\',\'' + theArtist + '\',\'' + theTitle.split("'").join("\\'") + '\',\'' + hotlinkURL + '\',\'' + graphicURL2 + '\');', 3500);
	}
}

