var http = false;

if(navigator.appName == "Microsoft Internet Explorer") {
  http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
  http = new XMLHttpRequest();
}



var ratehttp = false;

if(navigator.appName == "Microsoft Internet Explorer") {
  ratehttp = new ActiveXObject("Microsoft.XMLHTTP");
} else {
  ratehttp = new XMLHttpRequest();
}



function rate(type, id, ud, container) {
randno = Math.floor(Math.random()*999999)
  ratehttp.abort();
  ratehttp.open("GET", "/rate.php?type="+type+"&id="+id+"&ud="+ud+"&rand="+randno, true);
  ratehttp.onreadystatechange=function() {
    if(ratehttp.readyState == 4) {
      document.getElementById(container).innerHTML = ratehttp.responseText;
    }
  }
  ratehttp.send(null);
}


function confirmation($question) {
return confirm($question);
}


function addband(bandname, ref) {
bandname = bandname.replace("&", "%26")
var randno = Math.floor(Math.random()*999999)
  http.abort();
  http.open("GET", "/ajax.php?action=addband&ref="+ref+"&bandname="+bandname+"&rand="+randno, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {

      if (ref == 'artistpage') {
        document.getElementById('fansbox').innerHTML = http.responseText;
      }
      else {
        document.getElementById('bandlist').innerHTML = document.getElementById('bandlist').innerHTML + http.responseText;
        document.addbandform.bandname.value='';
        document.addbandform.addbutton.disabled=false;
      }

    }

  }
  http.send(null);
return false;
}


function limitText(limitField, limitNum) {
    if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    } 
}


function showsignupform() {
  document.getElementById('artistregister').style.display=''; // Show registration form
}
