var wimpyWindow;var winOpen=0;var w=readCookie('w');if(w==1){wimpyWindow=window.open('','wimpyMP3player');winOpen=1;wimpyWindow.displayObject(wimpyWindow.wimpy_getTrackInfo());}
function wimpyPopPlayer(wimpyPopPage,theWidth,theHeight){wimpyWindow=window.open(wimpyPopPage,'wimpyMP3player','width='+theWidth+',height='+theHeight);winOpen=1;}
function wimpyPopPlayerWithFile(wimpyPopPage,startPlayingOnload,initialFile,theWidth,theHeight){if(startPlayingOnload){startPlayingOnload="yes";}else{startPlayingOnload="no";}
wimpyWindow=window.open(wimpyPopPage+'?startPlayingOnload='+startPlayingOnload+'&theFile=http://www.geniusmp3.com/colourboxes/makeplaylist.php?'+initialFile,'wimpyMP3player','width='+theWidth+',height='+theHeight);winOpen=1;}
function wimpyIsOpen(){if(winOpen==1){if(wimpyWindow.closed){return false;}else{return true;}}else{return false;}}
function wimpyPopAndPlay(startOnLoad,theFile,theArtist,theTitle,graphicURL,hotlinkURL){if(wimpyIsOpen()){wimpyWindow.wimpy_addTrack(startOnLoad,theFile,theArtist,theTitle,graphicURL,hotlinkURL);}else{wimpyPopPlayerWithFile('http://geniusmp3.com/colourboxes/popup.html',startOnLoad,theFile.substring(7)+"|"+theArtist+"|"+theTitle+"|"+graphicURL.substring(7)+"|"+hotlinkURL,'480','140');}}
function showAlert(){if(wimpyIsOpen()){winOpen=1;}
else{winOpen=0;}
alert('winOpen='+winOpen);}
function changePage(url){if(wimpyIsOpen()){eraseCookie('w');createCookie('w','1',0);}
else{eraseCookie('w');createCookie('w','0',0);}
window.location.href=url;}
function onSearch(){if(wimpyIsOpen()){eraseCookie('w');createCookie('w','1',0);}
else{eraseCookie('w');createCookie('w','0',0);}}
function playerFocus(){wimpyWindow.focus();}
function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function eraseCookie(name){createCookie(name,"",-1);}
