﻿LOADING='/img/a_loading.gif';var LOADING_SMALL='/img/a_loading_small.gif';var AJAX_LOADING='<img src="'+LOADING+'" alt="Chargement..." height="32" width="32" />';var AJAX_LOADING_SMALL='<img src="'+LOADING_SMALL+'" alt="Chargement..." height="16" width="16" />';function ajax_get(dom_id,url){$(dom_id).innerHTML=AJAX_LOADING;new Ajax.Updater(dom_id,url,{asynchronous:true,method:'get'});}
function if_alert($msg){alert($msg);}
function js_getObj(obj_id){if(document.getElementById){return document.getElementById(obj_id);}
else if(document.all){return document.all[obj_id];}
else if(document.layers){return document.layers[obj_id];}
else{return false;}}
function nodclic(obj){obj.form.submit();obj.disabled=true;obj.style.opacity=0.5;}
var tviewport=document.viewport.getDimensions();var viewport_width=tviewport['width'];var viewport_height=tviewport['height'];var window_options='left=0,resizable=1,scroll=0';function popdiapo(url){var window_width=screen.availWidth;var window_height=screen.availHeight;return window.open(url,'clip',window_options+',width='+window_width+',height='+window_height);}
function popdiaporama(url){var window_width=screen.availWidth;var window_height=screen.availHeight;return window.open(url,'diaporama',window_options+',width='+window_width+',height='+window_height);}
function popcommentaire(url){return window.open(url,'popcommentaire','resizable=1,scrollbars=1,width=400,height=450');}
function popvideo(url,width,height){return window.open(url,'_blank','resizable=0,width='+width+',height='+height);}
function preview_in(url,width,height,focus){var window_width=screen.availWidth;if(window_width>=1024){window_width=window_width/2;window_width-=200;}
else{window_width-=100;}
var window_height=screen.availHeight-100;var popin=window.open('','popin','resizable=1,left=13,top=13,width='+window_width+',height='+window_height);if(typeof(popin)=='undefined'||popin==null){window.status='Pop-up window blocker in use';return;}
else if(popin.location.href==window.location.protocol+'//'+window.location.host+url){popin.location.reload();window.status='Preview window reloaded';}
else{popin.location.href=url;window.status='Preview window changed';}
if(focus&&window.top!=popin){popin.focus();}
return true;}
function popvideo_in(url,width,height){return window.open(url,'_blank','resizable=0,scrollbars=0,statusbar=0,toolbar=0,menubar=0,width='+width+',height='+height);}
function popvideo_edit(url,width,height){return window.open(url,'_blank','resizable=0,scrollbars=0,status=0,toolbar=0,menubar=0,width='+width+',height='+height);}
function obj_offsetTop(obj){if(obj.offsetParent){return obj.offsetTop+obj_offsetTop(obj.offsetParent);}
else{return obj.offsetTop;}}
function select_auto_size(obj_id,margin){var debug=0;var obj=js_getObj(obj_id);if(!obj){return;}
var obj_height=obj.getHeight();var bottom_avail=viewport_height-(obj.cumulativeOffset()['top']+obj_height+margin);var size_one=obj_height/obj.size;var elts_avail=Math.floor(bottom_avail/size_one);var size_auto=obj.size+elts_avail+1;if(size_auto>obj.size){obj.setAttribute('size',size_auto-1);}
if(debug){document.write('<div class="debug">');document.write('window       '+viewport_height+'<br />');document.write('obj_id       '+obj_id+'<br />');document.write('offsetTop    '+obj.cumulativeOffset()['top']+'<br />');document.write('offsetHeight '+obj_height+'<br />');document.write('obj.size     '+obj.size+'<br />');document.write('obj.length   '+obj.length+'<br />');document.write('bottom_avail '+bottom_avail+'<br />');document.write('size_one     '+size_one+'<br />');document.write('elts_avail   '+elts_avail+'<br />');document.write('size_auto    '+size_auto+'<br />');document.write('</div>');}}
