var sF="";var url=window.document.URL.toLowerCase();url=url.substring(0,url.indexOf('.nsf')+4);var song="";var idoc="";var song=new Array();var fcontent = new Array();var iSong="";fcontent[0]="To browse by title, click a letter below 'Browse Songs'";fcontent[1]="To browse by artist, click a letter below 'Browse Artist'";fcontent[2]="Search by typing a keyword and pressing 'Song' or 'Artist'";function eescape(s){  r = "";for (i=0; i < s.length; i++) {if (s.charAt(i) != '\n' && s.charAt(i) != '\r' && s.charAt(i) !=')' && s.charAt(i) !="(" && s.charAt(i) != '\t') {r += s.charAt(i);}}  return escape(r);}function callSong(mydoc,msg){}function doQuery(sort,keyword,start){var d=document.forms[0];sort=sort||'';start=start||'0';query=keyword||document.forms[0].query.value;keyword=keyword|'';sbd='';if (d.sortDate.selectedIndex!=null) sbd='&'+d.sortDate.options[d.sortDate.selectedIndex].value;sbg='';if (d.sortCategory.selectedIndex!=null) sbg='&'+d.sortCategory[d.sortCategory.selectedIndex].value;addStatus('Searching Database for Results....');var sz=start+sbd+sbg;$.getJSON(url+"/rss_qmdb?open",{Q:query,O:sort,K:keyword,A:"0",S:sz}, function(json){addStatusHTML(json.count+" Song(s) found - Ready to Search");fcontent[0]="To browse by title, click a letter below 'Browse Songs'";fcontent[1]="To browse by artist, click a letter below 'Browse Artist'";fcontent[2]="Search by typing a keyword and pressing 'Song' or 'Artist'";clearmsg();TABLE_CONTENT=json.TABLE_CONTENT;mdb.changeCont('TABLE_CONTENT',10);});}function clearmsg(){index=0;}function showInfo(tA,tB){addStatusHTML('Searching for more info...');song[0]=tA[0];song[1]=tA[2];song[2]=tA[1];$.getJSON(url+"/rss_qmdb?open",{A:"7",F:tA[1]}, function(json){//fcontent=msg;iSong=json.unid;fcontent[0]="You have selected "+json.title;fcontent[1]="Sung by "+json.artist;fcontent[2]="Playing time: "+json.time;aurl='<a href="#" onClick="javascript:myWin('+"'"+eescape(json.title)+"','"+eescape(json.artist)+"'"+')"><u>Listen</u></a>';addStatusHTML('You have selected '+json.title+" - "+aurl);//fcontent[fcontent.length]="Use the drop-down box (below) to add this song...";clearmsg();});return;}function addStatus(d){sT=gE("oTableStatus");sT.childNodes[0].nodeValue=d;}function addStatusHTML(d){gE("oTableStatus").innerHTML=d;}function myWin(t,a){var s=$('#filterListen').val();//url="http://music.barnesandnoble.com/search/results.asp?WRD="+a+"+"+t;var xurl="http://www.amazon.com/s/ref=nb_ss_gw?url=search-alias%3Ddigital-music&field-keywords="+t+" "+a;switch(s){case "rhapsody" : xurl="http://mp3.rhapsody.com/-search?query="+a+" "+t+"&searchtype=RhapKeyword";break;case "yahoo" : xurl="http://search.music.yahoo.com/search/?m=all&p="+a+" "+t;break;case "pandora" : xurl="http://www.pandora.com/music/song/"+a+"/"+t.replace("%20","+");break;case "amazon" : xurl="http://www.amazon.com/s/ref=nb_ss_gw?url=search-alias%3Ddigital-music&field-keywords="+t+" "+a;break;case "napster" : xurl="http://home.napster.com/#cgi-bin/searchXML?type=all&search_string="+t+"+"+a+"&count=10&index=0&enc=utf8&hot_tracks=0&format=json";break;case "noble" : xurl="http://music.barnesandnoble.com/search/results.asp?WRD=&TYP=P&NME="+a+"&TTL=&SNG="+t;break;case "ilike" : xurl="http://www.ilike.com/artist/"+a+"/track/"+t+"?src=onebox";break;}window.open(xurl,'bn',"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=80,top=10,width=900,height=650");}// scroller starts herebegintag=''; //set opening tag, such as font declarationsclosetag=''  // Scroller appears below //var scDelay=1500;var fadescheme=0;var fadelinks=1;var hex=(fadescheme==0)? 255 : 0;var startcolor=(fadescheme==0)? "rgb(255,255,255)" : "rgb(0,0,0)";var endcolor=(fadescheme==0)? "rgb(0,0,0)" : "rgb(255,255,255)";var frame=20;var faderdelay=0;var index=0;var faderdelay=1000;function changecontent(){if (index>=fcontent.length) index=0;document.getElementById("fscroller").style.color=startcolor;document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag;linksobj=document.getElementById("fscroller").getElementsByTagName("A");if (fadelinks) linkcolorchange(linksobj);colorfade();index++;setTimeout("changecontent()",scDelay+faderdelay);}function linkcolorchange(obj){if (obj.length>0){for (i=0;i<obj.length;i++) obj[i].style.color="rgb("+hex+","+hex+","+hex+")";}}function colorfade(){if(frame>0) {hex=(fadescheme==0)? hex-12 : hex+12;document.getElementById("fscroller").style.color="rgb("+hex+","+hex+","+hex+")";if (fadelinks) linkcolorchange(linksobj);frame--;setTimeout("colorfade()",20);} else{document.getElementById("fscroller").style.color=endcolor;frame=20;hex=(fadescheme==0)? 255 : 0;}}function loadRequests(mydoc,element){	gE(element).innerHTML=mydoc.getElementById("results").innerHTML;}function loadAllRequests(mydoc){      gE("mustPlay").innerHTML=mydoc.getElementById("mustPlay").innerHTML;      gE("shouldPlay").innerHTML=mydoc.getElementById("shouldPlay").innerHTML;      gE("dontPlay").innerHTML=mydoc.getElementById("dontPlay").innerHTML;      gE("specialRequests").innerHTML=mydoc.getElementById("specialRequests").innerHTML;}function killTitle(){var f=$('#killf').val();var x=$('#killx').val();   if (confirm("Do you want to REMOVE this Request?"))   {        addwin.hide();		$.get(url+"/rss_qmdb?open",{F:f,D:x,A:"5",P:gE("pid").value}, function(data){		$('#'+f).html(data);		});	}}function noteTitle(){var x=$('#killx').val();var n=eescape($('#songNotes').val());$.get(url+"/rss_qmdb?open",{A:"20",P:x,N:n},function(data){alert(data);addwin.hide();});}function getTitle(x,f){addwin=dhtmlwindow.open("addbox", "div", "songEdit", "Modify Song", "width=400px,height=220px,resize=0,scrolling=0,center=1");$('#killx').val(x);$('#killf').val(f);$.getJSON(url+"/rss_qmdb?open",{A:"19",P:x},function(data){	$('#songTitle').html(data.title);	$('#songArtist').html(data.artist);	$('#songNotes').val(unescape(data.note));});		}		function requestDlg(){addwin=dhtmlwindow.open("requestBox", "div", "songAdd", "Add New Song", "width=350px,height=260px,resize=1,scrolling=1,center=1");}function addRequest(id){addwin.hide();var title=$('#getSongTitle').val();var artist=$('#getSongArtist').val();var n=eescape($('#getSongNotes').val());if (title==null) return false;if (title.length<3) return false;$.get(url+"/rss_qmdb?open",{F:id,Q:title,D:artist,N:n,A:"16",P:gE("pid").value}, function(data){if (data.substring(0,5)=="ERROR"){alert(data)} else{$('#'+id).html(data);}});}function addSong(myList){var song=myList.options[myList.selectedIndex].value;myList.selectedIndex=0;if (iSong.length<5) return false;$.get(url+"/rss_qmdb?open",{F:song,Q:iSong,A:"2",P:gE("pid").value}, function(data){if (data.substring(0,5)=="ERROR"){alert(data)} else{$('#'+song).html(data);}});}     function loadAllContent(){$.get(url+"/rss_qmdb?open",{A:"4",F:"mustPlay",P:gE("pid").value}, function(data){$('#mustPlay').html(data);});$.get(url+"/rss_qmdb?open",{A:"4",F:"shouldPlay",P:gE("pid").value}, function(data){$('#shouldPlay').html(data);});$.get(url+"/rss_qmdb?open",{A:"4",F:"dontPlay",P:gE("pid").value}, function(data){$('#dontPlay').html(data);});$.get(url+"/rss_qmdb?open",{A:"4",F:"specialRequests",P:gE("pid").value}, function(data){$('#specialRequests').html(data);});}function loadMe(){changecontent();loadAllContent();}function getList(glist,gcount,title){var x="";$.getJSON("http://www2.gigbuilder.com/gbmusic.nsf/musicList?open&gb=1&list="+glist+"&count="+gcount+"&jsoncallback=?",function(data){for ( var i=0;i<data.event.length;i++ ){x=x+unescape(data.event[i]);}$('#myMusic').html(x)+"</table>";$('#showList').html(title);$("a[class*=song]").click(function() {myUnid=($(this).attr('id'));addwin=dhtmlwindow.open("addbox", "div", "songRequest", "Add Song to List", "width=400px,height=470px,resize=0,scrolling=0,center=1");$.getJSON(url+"/rss_qmdb?open",{A:"23",P:myUnid},function(data){	$('#rSongTitle').html(data.title);	$('#rSongArtist').html(data.artist);	$('#songLyrics').val(unescape(data.lyrics));		$('#songLyrics').attr('readonly', true).css('color','purple');	if (data.attachment.length>15){  	so = new SWFObject('/gbmusic.nsf/player.swf','ply','100%','240','9','#ffffff');  	so.addParam('allowfullscreen','false');  	so.addParam('allowscriptaccess','always');  	so.addParam('wmode','opaque');  	so.addVariable('file',data.attachment);  	so.write('wrapper');}	else{		u$='http://www.ilike.com/artist/'+escape(data.artist)+'/track/'+escape(data.title)+'?src=onebox';		v$="javascript:window.open('"+u$+"','bn','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=80,top=10,width=900,height=650');return(false)";		$('#wrapper').html('<br><br><br><br><br><center><a onclick="'+v$+'" href="#">Click to Find Song Sample</a></center>');		}	});	});});}
