function displayVotare(id_content,nota)
{customParams=new Hash({"id":id_content,"nota":nota});doAjaxAction("content","voteaza",customParams,"displayVotare",1);}
function displayVotareResponseHandler(result,params)
{if(!result.eroare)
{document.getElementById("content_nr_votes").innerHTML=result.content.nr_votes;document.getElementById("vot_content_media").innerHTML='<li class="voted" style="width:'+Math.round(result.content.media*20)+'%;" ></li>';}
else{alert(result.eroare);}}
function comenteaza(id_content,adauga,pag)
{if(typeof pag=="undefined"){pag=1}
customParams=new Hash({"id":id_content,"adauga":adauga,"pag":pag});doAjaxActionUpdater("content","comenteaza",customParams,"comentarii",0);}
function shoutit(id_content,user_id,firststep){customParams=new Hash({"id":id_content,"reclamant":user_id,"firststep":firststep});doAjaxActionUpdater("content","shoutit",customParams,"shout",0);if(firststep==1){document.getElementById("adaugareport").innerHTML='<a class="report" href="javascript:void(0);"  onfocus="this.blur()"  onclick="shoutit('+id_content+','+user_id+',0)">Raporteaza o problema</a>';}
if(firststep==0){document.getElementById("adaugareport").innerHTML='<a class="report" href="javascript:void(0);"  onfocus="this.blur()"  onclick="shoutit('+id_content+','+user_id+',1)">Raporteaza o problema</a>';}}
function resendShout(id_content,user_id,firststep){customParams=new Hash({"id":id_content,"reclamant":user_id,"firststep":firststep,"job":document.getElementById("job").value,"mesaj":document.getElementById("mesaj").value});doAjaxActionUpdater("content","shoutit",customParams,"shout",0);if(firststep==1){document.getElementById("adaugareport").innerHTML='<a class="report" href="javascript:void(0);"  onfocus="this.blur()"  onclick="'+id_content+','+user_id+',0">Raporteaza o problema</a>';}
if(firststep==0){document.getElementById("adaugareport").innerHTML='<a class="report" href="javascript:void(0);"  onfocus="this.blur()"  onclick="'+id_content+','+user_id+',1">Raporteaza o problema</a>';}}
function comenteazaAdd(id_content,adauga,pag)
{if(typeof pagina=="undefined"){pag=1}
customParams=new Hash({"id":document.getElementById("id").value,"adauga":document.getElementById("adauga").value,"adaugaConfirma":document.getElementById("adaugaConfirma").value,"comment":document.getElementById("comment").value,"pag":pag});doAjaxActionUpdater("content","comenteaza",customParams,"comentarii",0);}
function reply(id_content,parent_id,adauga,div)
{customParams=new Hash({"id":id_content,"adauga":adauga,"parent_id":parent_id});doAjaxActionUpdater("content","reply",customParams,div,0);}
function replyAdd(id_content,parent_id,adauga,div)
{customParams=new Hash({"id":document.getElementById("id").value,"adauga":document.getElementById("adauga").value,"adaugaConfirma":document.getElementById("adaugaConfirma").value,"comment":document.getElementById("comment").value,"parent_id":document.getElementById("parent_id").value});doAjaxActionUpdater("content","reply",customParams,div,0);}
function sleep(milliseconds){var start=new Date().getTime();for(var i=0;i<1e7;i++){if((new Date().getTime()-start)>milliseconds){break;}}}
function addFav(id_content,callback)
{customParams=new Hash({"id_content":id_content});if(callback==0)
{callback="standardAddFav"}
doAjaxAction("AmvcUser","addFav",customParams,callback,1);}
function standardAddFavResponseHandler(result,params)
{if(result.error=="")
{alert("Itemul a fost adaugat la favoritele tale");}else{alert(result.error)}}
function showLoginFormAt(divname)
{customParams=new Hash({"divname":divname});doAjaxAction("AmvcUser","loginx",customParams,"showLoginFormAt",1);}
function showLoginFormAtResponseHandler(result,params)
{alert(params['divname'])
alert(result.formContent)
document.getElementById('logform').innerHTML=result.formContent;}
function similare(id_content,user_id,similare)
{customParams=new Hash({"id":id_content,"similare":similare,"user_id":user_id});doAjaxActionUpdater("content","similare",customParams,"similare",0);}
function bookmarksite(title,url){if(window.sidebar){window.sidebar.addPanel(title,url,"");}else if(window.opera&&window.print){elem.setAttribute('href',url);elem.setAttribute('title',title);elem.setAttribute('rel','sidebar');elem.click();}
else if(document.all){window.external.AddFavorite(url,title);}else{alert("Ne pare rau, browserul dvs nu e suportat \nPentru Safari apsati Ctrl/Cmd + D \nPentru Konqueror apsati Ctrl + B");}}
function VotComment(id_content,comment_id,nota)
{customParams=new Hash({"id":id_content,"nota":nota,"comment_id":comment_id});doAjaxAction("content","VotComment",customParams,"VotComment",1);}
function VotCommentResponseHandler(result,params)
{if(!result.eroare)
{document.getElementById("votcomment"+result.comment_id).innerHTML=result.notanoua;}
else{alert(result.eroare);}}
function playlist(id_content,vezi)
{customParams=new Hash({"id":id_content,"vezi":vezi});doAjaxActionUpdater("content","playlist",customParams,"playlist",0);if(document.getElementById("adaugaplaylist"))
{if(vezi==1){document.getElementById("adaugaplaylist").innerHTML='<a class="add_playlist" href="javascript:void(0);"  onfocus="this.blur()"  onclick="playlist('+id_content+',0)">Playlist</a>';}
if(vezi==0){document.getElementById("adaugaplaylist").innerHTML='<a class="add_playlist" href="javascript:void(0);"  onfocus="this.blur()"  onclick="playlist('+id_content+',1)">Playlist</a>';}}}
function playlistAdd()
{if(document.getElementById("playlist_id").value==0){window.location=""+baseURL+"index.php?module=playlist&action=add&id="+document.getElementById("id").value;}
customParams=new Hash({"id":document.getElementById("id").value,"vezi":document.getElementById("vezi").value,"adauga":document.getElementById("adauga").value,"playlist_id":document.getElementById("playlist_id").value});doAjaxActionUpdater("content","playlist",customParams,"playlist",0);}
function makeCheck(form,check){var options=form.elements['selection[]']
var lungime=1;if(typeof options.length=='undefined'){lungime=1;}
else{lungime=options.length;}
if(lungime==1)
{options.checked=check}
else{for(var i=0;i<lungime;i++)
options[i].checked=check}}
function editPlaylist(id,view)
{customParams=new Hash({"id":id,"view":view});doAjaxActionUpdater("playlist","edit",customParams,"playlist",0);}
function editPlaylistAdd(id,view)
{customParams=new Hash({"id":id,"view":view,"adauga":document.getElementById("adauga").value,"nume":document.getElementById("nume").value,"description":document.getElementById("description").value});doAjaxActionUpdater("playlist","edit",customParams,"playlist",0);}
function resetStyleMenu(){list=$$('.hpMenu').toArray();for(i=0;i<list.length;i++){list[i].style.backgroundColor='#FFFFFF';list[i].style.color='#333333';}}
function clickMenu(elem){resetStyleMenu();elem.style.backgroundColor='#D31313';elem.style.color='#FFFFFF';}
function hideAllHpContentDivs(){$('hp-daily').hide();$('hp-newest').hide();$('hp-viewed').hide();$('hp-commented').hide();}
function hpToggleDiv(divId,menuItem){if($(divId)){hideAllHpContentDivs();$(divId).show();}
return false;}
function quicklistAdd(id_content)
{customParams=new Hash({"id_content":id_content});doAjaxAction("quicklist","adauga",customParams,"quicklistAdd",1);}
function quicklistAddResponseHandler(result,params)
{if(!result.eroare)
{document.getElementById("quicklist").innerHTML=result.counter;if(document.getElementById(""+result.spanname+""))
{document.getElementById(""+result.spanname+"").innerHTML="";}}}
function quicklistToplaylist(vezi)
{customParams=new Hash({"vezi":vezi});doAjaxActionUpdater("quicklist","quicklisttoplaylist",customParams,"quicklistToplaylist",0);if(vezi==1){document.getElementById("spanquicktoplay").innerHTML='<a href="javascript:void(0);"  onfocus="this.blur()"  onclick="quicklistToplaylist(0)"><img src="'+baseTemplate+'templates/default/img/quit.gif"></a>';}
if(vezi==0){document.getElementById("spanquicktoplay").innerHTML='<a href="javascript:void(0);"  onfocus="this.blur()"  onclick="quicklistToplaylist(1)"><img src="'+baseTemplate+'templates/default/img/save_playlist.gif"></a>';}}
function quicklistToplaylistAdd()
{if(document.getElementById("playlist_id").value==0){window.location=""+baseURL+"index.php?module=playlist&action=addQuicklist";}
customParams=new Hash({"vezi":document.getElementById("vezi").value,"adauga":document.getElementById("adauga").value,"playlist_id":document.getElementById("playlist_id").value});doAjaxActionUpdater("quicklist","quicklisttoplaylist",customParams,"quicklistToplaylist",0);vezi=document.getElementById("vezi").value;if(vezi==1){document.getElementById("spanquicktoplay").innerHTML='<a href="javascript:void(0);"  onfocus="this.blur()"  onclick="quicklistToplaylist(0)">Salveaza ca playlist</a>';}
if(vezi==0){document.getElementById("spanquicktoplay").innerHTML='<a href="javascript:void(0);"  onfocus="this.blur()"  onclick="quicklistToplaylist(1)">Salveaza ca playlist</a>';}}
function showQuick(div,divtype)
{if(typeof divtype=="undefined"){divtype=0}
customParams=new Hash({"div":div,"divtype":divtype});doAjaxActionUpdater("quick","show",customParams,""+div+"",0);}
function deleteFromshowQuick(idContent,div,divtype)
{if(typeof divtype=="undefined"){divtype=0}
customParams=new Hash({"div":div,"idContent":idContent,"divtype":divtype});doAjaxAction("quick","delete",customParams,"deleteFromshowQuick",1);}
function deleteFromshowQuickResponseHandler(result,params)
{if(!result.eroare)
{document.getElementById("quicklist").innerHTML=result.counter;if(result.div)
{showQuick(result.div,result.divtype);}}}
function addToshowQuick(idContent,div,divtype)
{if(typeof divtype=="undefined"){divtype=0}
customParams=new Hash({"div":div,"divtype":divtype,"idContent":idContent});doAjaxAction("quick","adauga",customParams,"addToshowQuick",1);}
function addToshowQuickResponseHandler(result,params)
{if(!result.eroare)
{document.getElementById("quicklist").innerHTML=result.counter;if(result.div)
{showQuick(result.div,result.divtype);}
if(document.getElementById(""+result.spanname+""))
{$(result.spanname).update('');var f=$$("."+result.spanname+"");f[0].update('');}}}
function loginajax(vezi)
{customParams=new Hash({"vezi":vezi});doAjaxActionUpdater("AmvcUser","loginajax",customParams,"loginajax",0);if(document.getElementById("loginajaxspan"))
{if(vezi==1){document.getElementById("loginajaxspan").innerHTML="<a href=\"javascript:void(0);\"  onfocus=\"getElementById('loginholder').style.display='block';\"  onclick=\"loginajax(0);\">Intra in cont</a>";}
if(vezi==0){document.getElementById("loginajaxspan").innerHTML="<a href=\"javascript:void(0);\"  onfocus=\"getElementById('loginholder').style.display='block';\"  onclick=\"loginajax(1);\">Intra in cont</a>";}}}
function getProg(keyId)
{customParams=new Hash({"keyId":keyId});doAjaxAction("AmvcUser","barprogress",customParams,"getProg",1);}
function getProgResponseHandler(result,params)
{if(result)
{document.getElementById("progressinner").style.width=result.procent+"%";if(result.procent<100)
{document.getElementById("procent").innerHTML=Math.ceil(result.procent)+"%";}
else{document.getElementById("procent").innerHTML='<center>Upload finalizat</center>';}
if(result.procent<100){setTimeout("getProg('"+result.keyId+"')",10);}}}
function startProgress(key){err='';if(document.formular.uplfile.value==""){err='Trebuie sa alegi un fisier\n';}
if(document.formular.category_id.value<1){err=err+'Trebuie sa alegi o categorie\n';}
if(document.formular.name.value==""){err=err+'Numele este obligatoriu\n';}
if(document.formular.description.value==""){err=err+'Descrierea este obligatorie\n';}
if(document.formular.tags.value==""){err=err+'Alege cel putin un tag\n';}
if(err=='')
{document.getElementById("progressouter").style.display="block";setTimeout("getProg('"+key+"')",10);return true;}
else{alert(err);err='';return false;}}