function SetRating(New_rating,New_rating2)
	{
		var selects=document.getElementById(ResponsePlaceImg).getElementsByTagName("img");
		for (is=0;is<selects.length;is++)
			{
				if (New_rating)
				{
				selects[is].onmouseout=function (s){SetOpacity(ResponsePlaceImg,LowOpacity,New_rating,'',New_rating2);};
				selects[is].onmouseover=function (s){SetOpacity(ResponsePlaceImg,LowOpacity,'10',this,New_rating2);InsertText(ResponsePlaceID,this.title+New_rating2);};
				}
				else
				{
				if (selects[is].id==""){selects[is].id="img_rating_"+is+200;}
				selects[is].onmouseover=function (s){SetOpacity(ResponsePlaceImg,LowOpacity,'10',this,New_rating2);InsertText(ResponsePlaceID,this.title+New_rating2);};
				selects[is].onmouseout=function (s){SetOpacity(ResponsePlaceImg,LowOpacity,DefaultRating,'',New_rating2);};
				selects[is].onclick=function (s){Send_Rating(ResponsePlaceImg,this);};
				selects[is].style["cursor"]="pointer";
				}
			}

	}

function SetOpacity(CS_divname,CS_opacity,CS_ht,CS_item,CS_newrating)
{
		var selects=document.getElementById(CS_divname).getElementsByTagName("img");
		for (is=0;is<selects.length;is++)
			{
			if (selects[is]==CS_item){CS_ht=is+1;}
			if (is<CS_ht){CS_newopacity=MediumOpacity;}
			else{CS_newopacity=CS_opacity;}
			if(is==CS_ht-1){CS_newopacity=HighOpacity;InsertText(ResponsePlaceID,selects[is].title+CS_newrating);}
			if(document.all)
				{
				selects[is].style.filter = "alpha(opacity=" + CS_newopacity + ");"
				}
			else
				{
				selects[is].style.setProperty("-moz-opacity", CS_newopacity/100, "");
				selects[is].style.setProperty("-khtml-opacity", CS_newopacity/100, "");
				selects[is].style.setProperty("opacity", CS_newopacity/100, "");
				}
			}
}

function Send_Rating(CS_divname,CS_item)
{
		var selects=document.getElementById(CS_divname).getElementsByTagName("img");
		for (is=1;is<=selects.length;is++)
			{
			if(selects[is-1]==CS_item){ReqUrl=URLS+DefaultNewsid+"&rating_num="+is;}
			}
    if (window.XMLHttpRequest)
	{
	ReqXhttp = new window.XMLHttpRequest();
	}
	else if(window.ActiveXObject)
	{
	ReqXhttp=new ActiveXObject('Microsoft.XMLHTTP');
	}
	ReqXhttp.onreadystatechange=function(){SendNoteCallBack();};
	ReqXhttp.open( 'GET', ReqUrl);
	ReqXhttp.send( null );
}

SendNoteCallBack=function()
{
	if ( ReqXhttp.readyState == 4 ) {
		if ( ReqXhttp.status == 200 ) {
			if (ReqXhttp.responseText != "")
			{
				var ResText=ReqXhttp.responseText.split('-');
			    if (ResText[0]=="true")
			    {
				 InsertText(ResponsePlaceSum,ResText[1]);
				 SetOpacity(ResponsePlaceImg,LowOpacity,ResText[2],''," ("+ResText[3]+")");
				 SetRating(ResText[2]," ("+ResText[3]+")");
				 InsertText(ResponsePlaceID,ResponseServerText1);
			    }
			    else if(ResText[0]=="alredyrating")
				{
				 InsertText(ResponsePlaceID,ResponseServerText2);
			    }
				else
				{
				 InsertText(ResponsePlaceID,ResponseServerText3);
			    }
			}
			else
			{
			 InsertText(ResponsePlaceID,ResponseServerText4);
			}
		}
	}
}

function InsertText(CS_resplace,CS_resptext)
{
document.getElementById(CS_resplace).innerHTML=CS_resptext;
}

