function ahah(url, target)
{
//  Simplified AHAH sender
//  See: http://microformats.org/wiki/rest/ahah

   document.getElementById(target).innerHTML = 'loading data...';
   if(window.XMLHttpRequest)
   {
       req = new XMLHttpRequest();
       req.onreadystatechange = function() {ahahDone(target);};
       req.open("GET", url, true);
       req.send(null);
   }
   else if(window.ActiveXObject)
   {
       req = new ActiveXObject("Microsoft.XMLHTTP");
       if(req)
       {
           req.onreadystatechange = function() {ahahDone(target);};
           req.open("GET", url, true);
           req.send();
       }
   }
}

function ahahDone(target)
{
//  Simplified AHAH receiver
//  See: http://microformats.org/wiki/rest/ahah

    if(req.readyState == 4)
    {
        if(req.status == 200)
        {
            document.getElementById(target).innerHTML = req.responseText;
        }
        else
        {
            document.getElementById(target).innerHTML = "Error: " + req.statusText;
        }
    }
}

function newsChange()
{
    uid = document.nav.songselect.options[document.nav.songselect.selectedIndex].value;
    url = "/get_lyrics.php?id=" + uid;
    target = "lyrics";
    ahah(url, target);
}

function OpenMedia(newin, wide, high)
{
    var myleft = (screen.width - wide) / 2;
    var mytop = (screen.height - high) / 2;
    var myparams = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + wide + ',height=' + high + ',left=' + myleft + ',top=' + mytop;
    flyout=window.open(newin,'flyout',myparams);
}

function tabNews()
{
    tabimage = document.getElementById('mediatabs');
    tabimage.src = "/images/bandnewstab.gif";
    url = "/get_news.php";
    target = "content";
    ahah(url, target);
}

function tabShows()
{
    tabimage = document.getElementById('mediatabs');
    tabimage.src = "/images/showdatestab.gif";
    url = "/get_shows.php";
    target = "content";
    ahah(url, target);
}

