var imagePath="images/";var handSrc={up_off:imagePath+"up_off.png",down_off:imagePath+"down_off.png"};for(var x in handSrc)
{var y=new Image();y.src=handSrc[x];}
function postdown(id)
{Effect.BlindDown('p'+id,{duration:0.5});document.getElementById('listen_p'+id).innerHTML="<span style='cursor:pointer;' onClick='postup("+id+")'>[Nascondi]</span>";document.getElementById("p"+id).style.backgroundColor="#ececec";return false;}
function postup(id)
{Effect.BlindUp('p'+id,{duration:0.5});document.getElementById('listen_p'+id).innerHTML="<span style='cursor:pointer;' onClick='postdown("+id+")'>[Mostra]</span>";return false;}
function ratepost(url)
{new Ajax.Request(url,{onComplete:callback_hands,method:'get'});return false;}
function callback_hands(xml)
{var x=xml.responseXML;var xmlRating=x.getElementsByTagName('value');var rating=xmlRating[0].firstChild.nodeValue;var xmlPostId=x.getElementsByTagName('id');var id=xmlPostId[0].firstChild.nodeValue;var xmlErrorBit=x.getElementsByTagName('errorbit');var errorbit=parseInt(xmlErrorBit[0].firstChild.nodeValue);var xmlMsg=x.getElementsByTagName('msg');var msg=xmlMsg[0].firstChild.nodeValue;var xmlBg=x.getElementsByTagName('bg');var bgcol=parseInt(xmlBg[0].firstChild.nodeValue);if(errorbit==1){return alert(msg);}
var handup=document.getElementById("handup"+id);var handdown=document.getElementById("handdown"+id);handup.src=handSrc.up_off;handup.style.cursor='default';handup.onclick='return false';handdown.src=handSrc.down_off;handdown.style.cursor='default';handdown.onclick='return false';if(rating==1){document.getElementById("mp_rating_postval_"+id).innerHTML=parseInt(document.getElementById("mp_rating_postval_"+id).innerHTML)+1;if((bgcol%2)==1)
document.getElementById("p"+id).style.backgroundColor="#ECF3F7";else
document.getElementById("p"+id).style.backgroundColor="#e1ebf2";document.getElementById("mp_post_listener_"+id).style.display="none";}
else{document.getElementById("mp_rating_postval_"+id).innerHTML=parseInt(document.getElementById("mp_rating_postval_"+id).innerHTML)-1;document.getElementById("mp_post_listener_l_"+id).innerHTML=parseInt(document.getElementById("mp_post_listener_l_"+id).innerHTML)-1;document.getElementById("p"+id).style.backgroundColor="#ececec";document.getElementById("mp_post_listener_"+id).style.display="block";postup(id);}}
