
function portail_reload_bloc(bloc_id,function_executed_at_end,params){opt={};if(params=='undefined')
{params={};}
if(function_executed_at_end!='undefined')
{opt={method:'post',parameters:params,onComplete:function_executed_at_end,evalJS:true};}
var url=REQUEST_HTTP_ROOT+'portail.php/page/blocReload/bloc_id/'+bloc_id;if(typeof(CMS_RUBRIQUE_ID)!='undefined')url+='/id_rubrique/'+CMS_RUBRIQUE_ID;if(typeof(CMS_ARTICLE_ID)!='undefined')url+='/id_article/'+CMS_ARTICLE_ID;new Ajax.Updater('portail_bloc_'+bloc_id,url,opt);}
function bloc_setIconHeader(el_handle,el_content,el_bloc,fn_reload,el_loading)
{$J(el_handle).addClass("ui-widget-header").prepend('<span class="ui-icon ui-icon-refresh" title="Rafraichir"></span>').prepend('<span class="ui-icon ui-icon-plusthick" title="Réduire"></span>');$J(el_handle+" .ui-icon-plusthick").click(function(){$J(this).toggleClass("ui-icon-minusthick").attr('title',$J(this).hasClass("ui-icon-minusthick")?'Agrandir':'Réduire');$J(this).parents().next(el_content).toggle(100);});$J(el_handle+" .ui-icon-refresh").click(function(){bloc_reload(el_bloc,fn_reload,el_loading);});}
function bloc_reload(el,fn,el_loading,params)
{if(typeof(el_loading)!='undefined')$J(el_loading).show();var id=$J($J(el).parents('div.portail_default').get(0)).parent().attr('id');portail_reload_bloc(id.replace(/portail_bloc_/g,""),fn,params);}
function bloc_ajaxQuery(url,el_reload,fn_reload,el_loading)
{$J.ajax({type:"POST",url:url,beforeSend:function(){$J(el_loading).show();},success:function(){bloc_reload(el_reload,fn_reload,el_loading);}});}
function bloc_ajaxQueryWithConfirm(url,msg,el_reload,fn_reload,el_loading)
{if(confirm(msg))
{bloc_ajaxQuery(url,el_reload,fn_reload,el_loading);}}
function bloc_toggle(expr)
{var bloc=$J(expr);var link=bloc.prev().find('a.link-toggle');if(bloc&&link)
{link.append(' (...)');bloc.hide();link.attr('title','Afficher');link.click(function(){var bloc=$J(expr);var link=bloc.prev().find('a.link-toggle');bloc.toggle();var title=link.html();if(/ \(...\)/g.test(title))
{link.html(title.replace(/ \(...\)/g,""));link.attr('title','Masquer');}
else
{link.html(title+' (...)');link.attr('title','Afficher');}
return false;});}}
function renderPortailConnecteurNom(val,p,record,rowIndex,colIndex,store){return renderOpenReadOnlyFormLink('connecteur',val,p,record,rowIndex,colIndex,store);}
function renderPortailCadreNom(val,p,record,rowIndex,colIndex,store){return renderOpenReadOnlyFormLink('cadre',val,p,record,rowIndex,colIndex,store);}
function renderPortailKeywordNom(val,p,record,rowIndex,colIndex,store){return renderOpenReadOnlyFormLink('keyword',val,p,record,rowIndex,colIndex,store);}
function renderPortailModeleBlocNom(val,p,record,rowIndex,colIndex,store){return renderOpenReadOnlyFormLink('modelebloc',val,p,record,rowIndex,colIndex,store);}
function renderPortailBlocNom(val,p,record,rowIndex,colIndex,store){return renderOpenReadOnlyFormLink('bloc',val,p,record,rowIndex,colIndex,store);}
function renderPortailModeleBlocRef(val,p,record,rowIndex,colIndex,store){return renderOpenReadOnlyFormLink('modelebloc',val,p,record,rowIndex,colIndex,store,null,'bloc_id');}
function renderPortailPageRef(val,p,record,rowIndex,colIndex,store){var url=REQUEST_SCRIPT_NAME+'/page/bloc/id/'+record.get('page_id');return'<a href="'+url+'"><b>'+val+'</b></a>';}
function changeLink(store,record,options)
{$$('#listeCategories a[rel=linkCategorie]').each(function(link){});}
$J(document).ready(function(){if(typeof Ext!='undefined'&&typeof Ext.ctkForms!='undefined')Ext.ctkForms.updateAddLinks('a.ajout_entite');$J("a.reset_entite").click(function(event){return confirmLink(this,__("Êtes-vous sûr de vouloir réinitialiser tous les blocs ?"));});$J("a.rewrite_entite").click(function(event){return confirmLink(this,__("Êtes-vous sûr de vouloir mettre à jour tous les blocs ?"));});if(document.URL.indexOf("_dev")>0)
mouseTrace();$J('.login-extranet form').submit(function(){if(""==$J(this.login).val())
{this.login.focus();alert('Veuillez saisir votre login !');return false;}
if(""==$J(this.mdp).val())
{this.mdp.focus();alert('Veuillez saisir votre mot de passe !');return false;}});var info=$J("#info_du_jour");if(info.length)
{var wnd=$J(window);var infoTitre=info.find(".info-jour-titre");var infoActions=info.find(".info-jour-action");var titre=infoTitre.text();var params={modal:true,title:titre,width:640,close:function(event,ui){$J(this).dialog('destroy').remove();}};infoTitre.remove();infoActions.remove();if(info.outerHeight()>wnd.height()/2)
params.height=Math.max(wnd.height()/2,300);info.show().dialog(params);}});
