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}
clearTimeout();customParams=new Hash({"id":id_content,"adauga":adauga,"pag":pag});doAjaxActionUpdater("AmvcCmsFe","showNewsComments",customParams,"comentarii",0,function(){set_ajax_login_top($('comentarii'),customParams);});}
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("AmvcCmsFe","showNewsComments",customParams,"comentarii",0);}
function set_ajax_login(id_container,customParams){try{var f;if(!id_container||!$(id_container)||!(f=$(id_container).select('form#userLogin'))||!f||!f.length)
return;f=f[0];f.stopObserving('submit');f.observe('submit',function(ev){var p=new Hash(f.serialize(true));p=customParams.merge(p.toObject());if(!$(id_container).id)
$(id_container).id='needs_id_'+Math.round(Math.random()*1000000);doAjaxActionUpdater("AmvcCmsFe","showNewsReply",p,$(id_container).id,0,function(){set_ajax_login(id_container,p);});ev.stop();});}catch(e){alert('set_ajax_login: '+e)}}
function set_ajax_login_top(id_container,customParams){try{var f;if(!id_container||!$(id_container)||!(f=$(id_container).select('form#userLogin'))||!f||!f.length)
return;f=f[0];f.stopObserving('submit');f.observe('submit',function(ev){var p=new Hash(f.serialize(true));p=customParams.merge(p.toObject());if(!$(id_container).id)
$(id_container).id='needs_id_'+Math.round(Math.random()*1000000);doAjaxActionUpdater("AmvcCmsFe","showNewsComments",p,$(id_container).id,0,function(){set_ajax_login_top(id_container,p);});ev.stop();});}catch(e){alert('set_ajax_login: '+e)}}
function reply(id_content,parent_id,adauga,div){customParams=new Hash({"id":id_content,"adauga":adauga,"parent_id":parent_id});doAjaxActionUpdater("AmvcCmsFe","showNewsReply",customParams,div,0,function(){set_ajax_login(div,customParams);});}
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("AmvcCmsFe","showNewsReply",customParams,div,function(){});}
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("AmvcCmsFe","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+"")){document.getElementById(""+result.spanname+"").innerHTML="";}}}
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 comenteazaGames(id_content,adauga,pag){if(typeof pag=="undefined"){pag=1}
clearTimeout();customParams=new Hash({"id":id_content,"adauga":adauga,"pag":pag});doAjaxActionUpdater("AmvcCmsFe","showGamesComments",customParams,"games",0);}
function comenteazaGamesAdd(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("AmvcCmsFe","showGamesComments",customParams,"games",0);}
function replyGames(id_content,parent_id,adauga,div){customParams=new Hash({"id":id_content,"adauga":adauga,"parent_id":parent_id});doAjaxActionUpdater("AmvcCmsFe","showGamesReply",customParams,div,0);}
function replyGamesAdd(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("AmvcCmsFe","showGamesReply",customParams,div,0);setTimeout("comenteazaGames("+id_content+",0)",3000);}
function VotCommentGames(id_content,comment_id,nota){customParams=new Hash({"id":id_content,"nota":nota,"comment_id":comment_id});doAjaxAction("AmvcCmsFe","VotCommentGames",customParams,"VotCommentGames",1);}
function VotCommentGamesResponseHandler(result,params){if(!result.eroare){document.getElementById("votcommentgames"+result.comment_id).innerHTML=result.notanoua;}else{alert(result.eroare);}}
function displayVotareGames(id_content,nota){customParams=new Hash({"id":id_content,"nota":nota});doAjaxAction("AmvcCmsFe","voteazaGames",customParams,"displayVotare",1);}
function displayVotareGamesResponseHandler(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 comenteazaImagine(id_content,adauga,pag,album_id){if(typeof pag=="undefined"){pag=1}
if(typeof album_id=="undefined"){album_id=-1}
clearTimeout();customParams=new Hash({"id":id_content,"adauga":adauga,"pag":pag,"album_id":album_id});doAjaxActionUpdater("AmvcCmsFe","showImagineComments",customParams,"comentarii",0);}
function comenteazaImagineAdd(id_content,adauga,pag,album_id){if(typeof pagina=="undefined"){pag=1}
if(typeof album_id=="undefined"){album_id=-1}
customParams=new Hash({"id":document.getElementById("id").value,"album_id":document.getElementById("album_id").value,"adauga":document.getElementById("adauga").value,"adaugaConfirma":document.getElementById("adaugaConfirma").value,"comment":document.getElementById("comment").value,"pag":pag});doAjaxActionUpdater("AmvcCmsFe","showImagineComments",customParams,"comentarii",0);}
function replyImagine(id_content,parent_id,adauga,div,album_id){customParams=new Hash({"id":id_content,"adauga":adauga,"parent_id":parent_id,"album_id":album_id});doAjaxActionUpdater("AmvcCmsFe","showImagineReply",customParams,div,0);}
function replyImagineAdd(id_content,parent_id,adauga,div,album_id){customParams=new Hash({"id":document.getElementById("id").value,"album_id":document.getElementById("album_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("AmvcCmsFe","showImagineReply",customParams,div,0);setTimeout("comenteazaImagine("+id_content+",0,0,"+document.getElementById("album_id").value+")",3000);}
function VotCommentImagine(id_content,comment_id,nota){customParams=new Hash({"id":id_content,"nota":nota,"comment_id":comment_id});doAjaxAction("AmvcCmsFe","VotCommentImagine",customParams,"VotCommentImagine",1);}
function VotCommentImagineResponseHandler(result,params){if(!result.eroare){document.getElementById("votcommentimagine"+result.comment_id).innerHTML=result.notanoua;}else{alert(result.eroare);}}
function showImagesPromo(id_articol,view){if(typeof view=="undefined"){view=0}
customParams=new Hash({"id_articol":id_articol,"view":view});doAjaxActionUpdater("AmvcCmsAdmin","showImagesPromo",customParams,"showImagesPromo",0);}
function altejocuri(gameId,categoryId,categoryUrl,pag){if(typeof pag=="undefined"){pag=1}
clearTimeout();customParams=new Hash({"gameId":gameId,"categoryId":categoryId,"categoryUrl":categoryUrl,"pag":pag});doAjaxActionUpdater("AmvcCmsFe","altejocuri",customParams,"altejocuri",0);}
function cereOfertaBrand(brandId,view){if(typeof view=="undefined"){view=0}
customParams=new Hash({"brandId":brandId,"view":view});doAjaxActionUpdater("AmvcEcommFe","cereOfertaBrand",customParams,"cereOfertaBrand",0);}
function cereOfertaBrandAdd(brandId,view){if(typeof view=="undefined"){view=0}
customParams=new Hash({"brandId":brandId,"view":view,"nume":document.getElementById("nume").value,"prenume":document.getElementById("prenume").value,"telefon":document.getElementById("telefon").value,"email":document.getElementById("email").value,"marca_id":document.getElementById("marca_id").value,"model_id":document.getElementById("model_id").value,"an":document.getElementById("an").value,"category_id":document.getElementById("category_id").value,"adauga":document.getElementById("adauga").value,"captcha":document.getElementById("captcha").value,"mesaj":document.getElementById("mesaj").value});doAjaxActionUpdater("AmvcEcommFe","cereOfertaBrand",customParams,"cereOfertaBrand",0);}
function selectModel(carmakerId,modelId){customParams=new Hash({"carmakerId":carmakerId,"modelId":modelId});doAjaxActionUpdater("AmvcEcommFe","selectModel",customParams,"selectModel",0);}
function cereOfertaSupplier(supplierId,view){if(typeof view=="undefined"){view=0}
customParams=new Hash({"supplierId":supplierId,"view":view});doAjaxActionUpdater("AmvcEcommFe","cereOfertaSupplier",customParams,"cereOfertaSupplier",0);}
function cereOfertaSupplierAdd(supplierId,view){if(typeof view=="undefined"){view=0}
customParams=new Hash({"supplierId":supplierId,"view":view,"nume":document.getElementById("nume").value,"prenume":document.getElementById("prenume").value,"telefon":document.getElementById("telefon").value,"email":document.getElementById("email").value,"marca_id":document.getElementById("marca_id").value,"model_id":document.getElementById("model_id").value,"an":document.getElementById("an").value,"category_id":document.getElementById("category_id").value,"adauga":document.getElementById("adauga").value,"captcha":document.getElementById("captcha").value,"mesaj":document.getElementById("mesaj").value});doAjaxActionUpdater("AmvcEcommFe","cereOfertaSupplier",customParams,"cereOfertaSupplier",0);}
function newsletterAdd(){customParams=new Hash({"email":document.getElementById("email").value});doAjaxActionUpdater("AmvcCmsFe","newsletterAdd",customParams,"newsletteradd",0);}
function verifyElementsForm(){var num_of_elements=document.forms[0].elements.length;var checkbox_selected=false;for(var i=0;i<num_of_elements;i++){var theElement=document.forms[0].elements[i];var element_type=theElement.type;var element_name=theElement.name;var element_value=theElement.value;if(element_type=='checkbox'&&(element_name.indexOf("article_category")!=-1))
{if(theElement.checked==true){checkbox_selected=true;}}}
if(!checkbox_selected){alert("Nu ai selectat nici o categorie");return false;}
return true;}