// JavaScript Document
    var r=null;
    function PlayMP3(a,b,c,d,e)
    {
        if(document.getElementById(e))
        {
            document.getElementById(e).innerHTML="<img src=\"http://www.spiritvoyage.com/images/fbloader.gif\" alt=\"Loading\" Title=\"Loading\">";
        }            
        //setTimeout('Track(\"'+a+'\",\"'+b+'\",\"'+c+'\")', 1000);
        Track(a,b,c,d,e);
    }
    function Track(a,b,c,d,e)
    {
        if(document.getElementById(e))
        {
            document.getElementById(e).className="addPlayer";
            document.getElementById(e).innerHTML="Added to player";
        }
        
        //name
        c=replaceAll(c,"&","-");
        c=replaceAll(c,"'","-");
        c=replaceAll(c,"?","-");
        //artist
        d=replaceAll(d,"&","-");
        d=replaceAll(d,"'","-");
        d=replaceAll(d,"?","-");
        if(r==null)
        {
            r=window.open("http://www.spiritvoyage.com/flash/play.aspx?id="+a+"&case="+b+"&nm="+c+"&arnm="+d,"mywindow","width=300,height=440,statusbar=no,status=no,toolbar=no,menubar=no");
            r.focus();
            return false; 
        }
        else
        {
            r=window.open("http://www.spiritvoyage.com/flash/play.aspx?id="+a+"&case="+b+"&nm="+c+"&arnm="+d,"mywindow","width=300,height=440,statusbar=no,status=no,toolbar=no,menubar=no");
            r.focus();
            return false; 
        } 
    }
    function replaceAll(oldStr,findStr,repStr) 
    {
        var srchNdx = 0;    // srchNdx will keep track of where in the whole line
                            // of oldStr are we searching.
        var newStr = "";    // newStr will hold the altered version of oldStr.
        while (oldStr.indexOf(findStr,srchNdx) != -1)  
        // As long as there are strings to replace, this loop
        // will run. 
        {
            newStr += oldStr.substring(srchNdx,oldStr.indexOf(findStr,srchNdx));
            // Put it all the unaltered text from one findStr to
            // the next findStr into newStr.
            newStr += repStr;
            // Instead of putting the old string, put in the
            // new string instead. 
            srchNdx = (oldStr.indexOf(findStr,srchNdx) + findStr.length);
            // Now jump to the next chunk of text till the next findStr.           
        }
        newStr += oldStr.substring(srchNdx,oldStr.length);
        // Put whatever's left into newStr.             
        return newStr;
    }



