   function handleover1(){
   
        document.imgWhite1.src="images/bstar.gif"; 
     }
    function handleout1(){
        document.imgWhite1.src="images/wstar.gif";
     }
    function handleover2(){
        handleover1();
        document.imgWhite2.src="images/bstar.gif";
       }
    function handleout2(){
        handleout1();
        document.imgWhite2.src="images/wstar.gif";
        }
    function handleover3(){
        handleover1();
        handleover2();
        document.imgWhite3.src="images/bstar.gif";
        }
   function handleout3(){
        handleout1();
        handleout2();
        document.imgWhite3.src="images/wstar.gif";
        }
   function handleover4(){
        handleover1();
        handleover2();
        handleover3();
        document.imgWhite4.src="images/bstar.gif";
        }
   function handleout4(){
        handleout1();
        handleout2();
        handleout3();
        document.imgWhite4.src="images/wstar.gif";
        }
   function handleover5(){
       handleover1();
       handleover2();
       handleover3();
       handleover4();
       document.imgWhite5.src="images/bstar.gif";
       }
   function handleout5(){
       handleout1();
       handleout2();
       handleout3();
       handleout4();
       document.imgWhite5.src="images/wstar.gif";
       }
   function handleover6(){
       handleover1();
       handleover2();
       handleover3();
       handleover4();
       handleover5();
       document.imgWhite6.src="images/bstar.gif";
       }
   function handleout6(){
       handleout1();
       handleout2();
       handleout3();
       handleout4();
       handleout5();
       document.imgWhite6.src="images/wstar.gif";
       }
  function handleover7(){
       handleover1();
       handleover2();
       handleover3();
       handleover4();
       handleover5();
       handleover6();
       document.imgWhite7.src="images/bstar.gif";
       }
   function handleout7(){
       handleout1();
       handleout2();
       handleout3();
       handleout4();
       handleout5();
       handleout6();
       document.imgWhite7.src="images/wstar.gif";
       }
   function handleover8(){
       handleover1();
       handleover2();
       handleover3();
       handleover4();
       handleover5();
       handleover6();
       handleover7();
       document.imgWhite8.src="images/bstar.gif";
       }

   function handleout8(){
       handleout1();
       handleout2();
       handleout3();
       handleout4();
       handleout5();
       handleout6();
       handleout7();
       document.imgWhite8.src="images/wstar.gif";
       }
  function handleover9(){
       handleover1();
       handleover2();
       handleover3();
       handleover4();
       handleover5();
       handleover6();
       handleover7();
       handleover8();
       document.imgWhite9.src="images/bstar.gif";
       }
   function handleout9(){
       handleout1();
       handleout2();
       handleout3();
       handleout4();
       handleout5();
       handleout6();
       handleout7();
       handleout8();
       document.imgWhite9.src="images/wstar.gif";
       }
   function handleover10(){
       handleover1();
       handleover2();
       handleover3();
       handleover4();
       handleover5();
       handleover6();
       handleover7();
       handleover8();
       handleover9();
       document.imgWhite10.src="images/bstar.gif";
       }
   function handleout10(){
       handleout1();
       handleout2();
       handleout3();
       handleout4();
       handleout5();
       handleout6();
       handleout7();
       handleout8();
       handleout9();
       document.imgWhite10.src="images/wstar.gif";
       }    

	// function to send XML request for updating the article rating
	function updateRating(articleId,rating) {
		var url = "/article.do?detail=SetRating&articleID=" + articleId + "&rating="+ rating;
		if (window.XMLHttpRequest) {
			req = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			req = new ActiveXObject("Microsoft.XMLHTTP");
		}
		req.open("POST", url, true);
		req.onreadystatechange = getStatusRating;
		req.send(null);	
	}

 	// function to check the status of XML request
	function getStatusRating() {
		if (req.readyState == 4) {
			if (req.status == 200) {
				populateRating();
			}
		}
	}

	// function to populate the html table with XML request details
	function populateRating(){
		myTable = document.getElementById("article_rating");
		myTable.innerHTML="";
		
		var childDiv1 = document.createElement("DIV");
		//childDiv1.id= "article_ratethis";
	    //childDiv1.innerHTML="";
		
		var updateRating =  req.responseXML.getElementsByTagName("updateRating")[0];
		var rating = (updateRating.getElementsByTagName("rating")[0]).firstChild.nodeValue;
		var totalVotes = (updateRating.getElementsByTagName("totalVotes")[0]).firstChild.nodeValue;
		var noOfFullImage = (updateRating.getElementsByTagName("noOfFullImage")[0]).firstChild.nodeValue;
		var noOfBlankImage = (updateRating.getElementsByTagName("noOfBlankImage")[0]).firstChild.nodeValue;
		var smallStar =  (updateRating.getElementsByTagName("smallStar")[0]).firstChild.nodeValue;
		var mediumStar = (updateRating.getElementsByTagName("mediumStar")[0]).firstChild.nodeValue;
		var bigStar = (updateRating.getElementsByTagName("bigStar")[0]).firstChild.nodeValue;
		content = '';
		var i = 0;
		
		var childDiv2 = document.createElement("DIV");
		//childDiv2.id= "rating_bg"
		
		for(i = 0; i < noOfFullImage; i++){
			content += '<IMG SRC="/mnc/images/ratfull.gif" name="imgWhite12" width="14" height="13" border="0">';
		}
		if(smallStar != 'null'){
			content += '<IMG SRC="/mnc/images/ratlesfull.gif" name="imgWhite12" width="14" height="13" border="0">';
		}
		if(mediumStar != 'null'){
			content += '<IMG SRC="/mnc/images/rathalf.gif" name="imgWhite12" width="14" height="13" border="0">';
		}
		if(bigStar != 'null'){
			content += '<IMG SRC="/mnc/images/ratfull.gif" name="imgWhite12" width="14" height="13" border="0">';
		}						
		var j = 0;
		for(j = 0; j < noOfBlankImage; j++){
			content += '<IMG SRC="/mnc/images/ratnone.gif" name="imgWhite12" width="14" height="13" border="0">';
		}
		childDiv2.innerHTML = content;
		var childDiv3 = document.createElement("DIV");
		//childDiv3.id= "rating_msg"
        childDiv3.innerHTML = "&nbsp;Rating :" + rating + "&nbsp;out of " + totalVotes + " votes cast";
        myTable.appendChild(childDiv1);
        myTable.appendChild(childDiv2);
        myTable.appendChild(childDiv3);
	}
       
       
       