/* http://www.harrymaugans.com/2007/03/18/tutorial-ajax-made-easy/   */
http = getHTTPObject();
 
function getHTTPObject(){
  var xmlhttp;
 
  /*@cc_on
 	http://www.harrymaugans.com/2007/03/18/tutorial-ajax-made-easy/
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
      try{
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }catch(E){
      xmlhttp = false;
    }
  }
  @else
    xmlhttp = false;
  @end @*/
 
  if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
    try {
      xmlhttp = new XMLHttpRequest();
    }catch(e){
      xmlhttp = false;
    }
  }
 
  return xmlhttp;
}
 
function ratePunchline( punchlineid, rating ){
  var url = "http://contests.sev.com.au/ratepunchline2.php?punchlineid=" + punchlineid + "&rating=" + rating; // live
  //var url = "ratepunchline.php?punchlineid=" + punchlineid + "&rating=" + rating; // local testing
  DivPunchlineId = punchlineid;
  //alert ( 'AJAX TEST (apologies, this will go soon) - url = ' + url );
  http.open("GET", url, true);
  http.onreadystatechange = handleHttpResponse;
  http.send(null);
	document.getElementById("submitter" + punchlineid).style.display = 'block';
}
 
function handleHttpResponse(){
  if(http.readyState == 4){
    document.getElementById( DivPunchlineId ).innerHTML = http.responseText;
  }
}

