function askDelNews(newsId,infoPage){ if(confirm("Sei sicuro di voler cancellare la notizia?")){ delNews(newsId,infoPage); } } function delNews(newsId,infoPage){ ajaxGetRand('/ajax/news_del.php?newsId='+newsId,myHandler,newsId); function myHandler(aa,newsId){ if(aa!='ERROR'){ if(infoPage==true){location.href='/';} document.getElementById('news'+newsId).innerHTML=""; document.getElementById('news'+newsId).style.display='none'; document.getElementById('news'+newsId).style.visibility='hidden'; return true; }else{ alert("Non e' possibile cancellare la notizia"); return false; } } } function vote(vote,newsId,vs,inFrame){ var infoPage=false; vote2html(vote,newsId,vs,inFrame); voteLoading(newsId); if(document.getElementById('voteReport')){ infoPage=1; } ajaxGetRand('/ajax/vote.php?vote='+vote+'&newsid='+newsId+'&vs='+vs+'&infoPage='+infoPage+'&inframe='+inFrame+'&c=1',myHandler,newsId,inFrame); function myHandler(aa,newsId,inFrame){ callRS(); if(aa.substr(0,5)!='ERROR'){ document.getElementById('news'+newsId).innerHTML=aa; if(inFrame){ if(typeof(noreload) == 'undefined' && parent.opener.location) parent.opener.location.reload(); } if(infoPage){ updateReportVote(newsId); } registerVoteExpiredTip(); return true; }else{ newsUnloading(newsId); return false; } } } function updateReportVote(newsId){ ajaxGetRand('/ajax/update_report_vote.php?newsid='+newsId,myHandler); function myHandler(aa){ if(aa!='ERROR'){ document.getElementById('voteReport').innerHTML=aa; return true; }else return false; } } function vote2html(vote,newsId,vs,inFrame){ var OK; var NO; var styleAdd=""; if(inFrame==true){ styleAdd=" style=\"float:left;\" "; } if(!isLoggedIn()){ vs=ipSecret; } if(vote == 1){ OK="OK"; NO="NO"; }else if(vote == -1){ OK="OK"; NO="NO"; }else{ OK="OK"; NO="NO"; } var html='
'+OK+'
'+NO+'
'; document.getElementById('newsVote'+newsId).innerHTML=html; return false; } function voteComment2html(vote,commentId){ var OK; var NO; if(vote == 1){ OK="OK"; NO="NO"; }else if(vote == -1){ OK="OK"; NO="NO"; }else{ OK="OK"; NO="NO"; } var html='
'+OK+'
'+NO+'
'; document.getElementById('commentVote'+commentId).innerHTML=html; return false; } function voteLoading(newsId){ newsLoading(newsId,'Stiamo contabilizzando il voto.'); } function newsLoading(newsId,txt){ document.getElementById('loading'+newsId).innerHTML='  Attendere prego '+txt; } function newsUnloading(newsId){ document.getElementById('loading'+newsId).innerHTML=''; } function voteCommentLoading(commentId){ document.getElementById('loadingComment'+commentId).innerHTML='  Attendere prego Attendere...  ' } function voteCommentUnloading(commentId){ document.getElementById('loadingComment'+commentId).innerHTML='' } function voteComment(vote,commentId,vs){ voteCommentLoading(commentId); voteComment2html(vote,commentId); ajaxGetRand('/ajax/comment_vote.php?vote='+vote+'&commentId='+commentId+'&vs='+vs,myHandler,commentId); function myHandler(aa,commentId){ if(aa!='ERROR'){ document.getElementById('commentVoteInfo'+commentId).innerHTML=aa; voteCommentBackground(commentId); voteCommentUnloading(commentId); }else return false; } } function voteCommentBackground(commentId){ ajaxGetRand('/ajax/comment_vote_background.php?commentId='+commentId,myHandler,commentId); function myHandler(aa,commentId){ if(aa!='ERROR'){ document.getElementById('comment'+commentId).style.background=aa; return true; }else return false; } } function saveNews(newsId){ newsLoading(newsId,'Attendere...'); ajaxGetRand('/ajax/save_news.php?newsid='+newsId,myHandler,newsId); function myHandler(aa,newsId){ if(aa=='ERROR'){ document.getElementById('saveNews'+newsId).innerHTML=''; newsUnloading(newsId); return false; }else if(aa=='SAVED'){ document.getElementById('saveNews'+newsId).innerHTML='Salva'; newsUnloading(newsId); return true; }else if(aa=='UNSAVED'){ document.getElementById('saveNews'+newsId).innerHTML='Non salvare'; newsUnloading(newsId); return true; } } } function chref(el,v) { el.href = v; return true; }