function pop() {
  popupWin = window.open('/music/miniplay/', 'miniplay',
'toolbar=0,menubar=0,status=0,resizable=0,scrollbars=0,width=320,height=160');
}

function djrequest() {
  popupWin = window.open('/request.php', 'request',
'toolbar=0,menubar=0,status=0,resizable=0,scrollbars=0,width=515,height=240');
}

function studiocam() {
  popupWin = window.open('/studiocam.html', 'cam',
'toolbar=0,menubar=0,status=0,resizable=1,scrollbars=0,width=350,height=310');
}

/*
	Lala header javascript
*/

var type = '';
var searchState = 'stabAll';
var oldSearchState = 'stabAll';

function handleSearchLinkClick (tabClicked) {
	// handle normal form submission
	if (tabClicked == 'default') {
		tabClicked = searchState.replace(/stab/, '');
	}
	
    // get the value in the input element
	var searchTerm = document.getElementById('query').value;
	oldSearchState = searchState;
	
	// reset rendering of previously selected search tab
	document.getElementById(oldSearchState).className = '';

    // generate the query for the lala server depending on which tab link was clicked.
    switch (tabClicked) {
     case 'All':     type = '';          searchState = 'stabAll';     break;
     case 'Artists': type = 'Artist%3A'; searchState = 'stabArtists'; break;
     case 'Albums':  type = 'Album%3A';  searchState = 'stabAlbums';  break;
     case 'Songs':   type = 'Song%3A';   searchState = 'stabSongs';   break;
     case 'Members': type = 'Member%3A'; searchState = 'stabMembers'; break;
     case 'Tag':     type = 'Tag%3A';    searchState = 'stabTag';     break;
    }
    
	document.getElementById(searchState).className = 'active';
	
	// if there is nothing in the input box
	if (isEmpty(searchTerm)) {
		return;
	}

    // prepend the type to the search term to generate the lala server query
    Q = type + searchTerm;
   window.location= "http://www.lala.com/landing?Q=" + Q + "&uQ=" + searchTerm + "&tab=" + tabClicked + "&fc=woxy";
 }

function isEmpty (str) {
	if (str) {
	    str = str.replace(/^\s+/, '');
	    str = str.replace(/\s+$/, '');
		if (str.length > 0) {
			return false;
		}
	}
	return true;
}