// JavaScript Document


var http = getHTTPObject();
var bef_rate ;
var alb_id ;
function handleHttpResponse() {	
		if (http.readyState == 4) {
			  if(http.status==200) {
			  	var results=http.responseText;
			//	alert(results);
				if(results.length != 0){
					//alert(results.length);
					if(results.length < 100)
					 {
						document.getElementById('thnx_rating').style.display = 'none' ; 
					 alert("You already rated this album!");
					 ClearStars(0);
					 set = 0 ;
					 GlowStars(bef_rate);
					}
					else
					 {
					 document.getElementById('rating').innerHTML = '<span class="rating"><a>Average Rate&nbsp;</a></span> '+results;
					// document.getElementById('avg_rate').style.display = 'block' ; 
					 document.getElementById('rating_alb_'+alb_id).innerHTML = results;
					 }
				}
				
			  }
  			}
		}


  function send_to_ajax(swf_id,star,old_star) { 
  			bef_rate = old_star ;
			alb_id = swf_id ;
			var url = "ajaxRating.php?swf_id=" + swf_id+"&star="+star; // The server-side script		
		// window.open(url, swf_id, 'toolbar=no, resizable=no, status=yes, width=600, height=605');
	
			http.open("GET", url, true);
			http.onreadystatechange = handleHttpResponse;
			http.send(null);  
        }
		

function getHTTPObject() {
  var xmlhttp;
 
  if(window.XMLHttpRequest){
    xmlhttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject){
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (!xmlhttp){
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    
}
  return xmlhttp;

  
}

	