//cookie_name = 'blogorama_bar';

// redimensionne toutes les images de la page
/*
function redimAllImagesDescriptif() {
	return redimAllImagesBySize('div.header',740,99999, false);
}	
function redimAllImages() {
	return redimAllImagesBySize('div.text',525,99999, false);
}
function redimAllImages1000() {
	return redimAllImagesBySize('div.text',640,99999, true);
}
function redimAllImagesBySize(name,s1,s2, check) {
  if(check == false) {
  	if (navigator.appName!="Microsoft Internet Explorer") 
  		return false;
  }

	$$(name).each( function(divtext) {
		list_des = divtext.descendants();	// pour chaque descandants de la div article
		list_des.each( function(item) {
			if ( item.src != '' && item.src != undefined ) {
				// si item est une image, on redimensionne
				var currentTime = new Date();
				id = currentTime.getTime();
				item.id='insertedimage-'+id; 
				redimImage(item,s1,s2);
			}
		});
	});
	return true;
}
// redimensionne l'objet image inImg avec width-max=inMW height-max=inMH
function redimImage(inImg, maxWidth, maxHeight) {
	// ratio
	var dW = 0;
	var dH = 0;
	oImg=inImg;

	if ( !oImg ) return;

	var dim = oImg.getDimensions();
	var h = dim.height;
	var w = dim.width;

	// non ie ou non compatible, on quitte
	if ( h == 0 || w == 0 ) return;

	var dW=0;
	var dH=0;
	// Si la largeur ou la hauteur depasse la taille maximale
	if ((h > maxHeight) || (w > maxWidth)) {
		// Si la largeur et la hauteur depasse la taille maximale
		if ((h >= maxHeight) && (w >= maxWidth)) {
			// On cherche la plus grande valeur
			if (h > w) {
				dH = maxHeight;
				// On recalcule la taille proportionnellement
				dW = parseInt((w * dH) / h, 10);
			} else {
				dW = maxWidth;
				// On recalcule la taille proportionnellement
				dH = parseInt((h * dW) / w, 10);
			}
		} else if ((h > maxHeight) && (w < maxWidth)) {
			// Si la hauteur depasse la taille maximale
			dH = maxHeight;
			// On recalcule la taille proportionnellement
			dW = parseInt((w * dH) / h, 10);
		} else if ((h < maxHeight) && (w > maxWidth)) {
			// Si la largeur depasse la taille maximale
			dW = maxWidth;
			// On recalcule la taille proportionnellement
			dH = parseInt((h * dW) / w, 10);
		}
	}
	if ( dW == 0 || dH == 0 ) 
		return;

	// redimensionnement
	oImg.width=dW;
	oImg.height=dH;
	oImg.show();

	return -1;
}
// appel avec delai
function delayredim(image,inMW,inMH) {
	redimImage($(image),inMW,inMH);
}
*/
/**
 * Show a popup
 * @param	String	url
 * @param	String	name	Title of the page
 * @param	Int	width	Width of the popup
 * @param	Int	height	Height of the popup
 */
 /*
function popup(url,name,width,height) {
	window.open(url,name,'scrollbars=yes,width='+width+',height='+height+''); 
	return true;
}
*/
/**
 * Toggle the basic theme header
 */
 /*
function descToggle() {
	$('infoBlogOFF').toggle();
	$('infoBlogON').toggle();

	// We need to hide the objects because our deer Internet Explorer don't like that when we hide a block
	$$('#infoblogON object').each( function(Element) {
		Element.toggle();
	});
	$$('#infoblogON embed').each( function(Element) {
		Element.toggle();
	});
}
*/
/*
function replaceVid(id,type) {
	obj = $('flv'+id);
	flv = $("val"+id).value;

	if ( type == 'webcam' ) {
		url = '/webcam/'+flv+'/';
	}
	else {
		url = '/movie/'+flv+'/';
	}
	/* Ajax call 
	var ajax = new Ajax.Updater(
		'flv'+id,
		url ,
		{ 
			method:'get',
			asynchronous: true 
		}
	);	
}
*/
/*
function externalLinks() {
	$$('a').each( function(Element) {
		if( Element.getAttribute("href") && Element.getAttribute("rel") == "external") {
			Element.target = "_blank";
		}
	});
}
*/

/* VOTE */
/*
function starOver(note,text) {
	$('starbul').innerHTML=text;
	starInitJs(note);
}
function starOut() {
	starInitJs('');
	$('starbul').innerHTML='&nbsp;';
}
function starInitJs(forcenote) {

	urlbase = $('vote_urlbase').value;

	if ( forcenote == '') {
		x=document.getElementsByName('oldnote')[0];
		note = x.value;
	}
	else {
		note = forcenote;
	}

	for (i=1;i<=5;i++) {
		y=document.getElementsByName('note'+i)[0];
		if ( note < ( i - 0.6 ) ) {
			val=0;
			noteFinale = i;
		}
		else if ( note >= (i-0.6) && note < (i-0.3) ) {
			val=1;
		}
		else {
			val=2;
		}
		change = "background-image: url("+urlbase+val+".gif);";
		if ( change != 	y.style.cssText )
			y.style.cssText="background-image: url("+urlbase+val+".gif);";
	}
}
*/
/* END VOTE */
/*
function comment_show(type) {
  if(typeof(type) == 'string') {
    if(type == 'texte') {
      if($('codeCommWebcam') != null) { $('codeCommWebcam').hide(); }
      if(Prototype.Browser.IE6) {
        $('texteTD').show();
        $('texte').show();
        $('codeCommTxt').setStyle('display','none');
      } else {      
        $('codeCommTxt').show();
      }
      if($('block-smileys') != null && $('block-smileys').hasClassName('shown')) { $('block-smileys').show(); }
      if($$('.errormsg')[0] != null) { $$('.errormsg')[0].show(); }
      if($$('.bt-submit-form-webcam')[0] != null) { $$('.bt-submit-form-webcam')[0].hide(); }
      if($$('.bt-submit-form-texte')[0] != null) { $$('.bt-submit-form-texte')[0].show(); }
      $$('.comment-tabs-texte')[0].toggleClassName('selected'); 
      $$('.comment-tabs-webcam')[0].toggleClassName('selected');
      $('hidden_type').value = 'texte';
      if($$('.known-user-webcam')[0] != null) { $$('.known-user-webcam')[0].className = 'known-user-texte'; }
    } else {
      if($('codeCommWebcam') != null) {
        $('codeCommWebcam').show();
      }
      if(Prototype.Browser.IE6) {
        $('texteTD').hide();
        $('texte').hide();
        $('codeCommTxt').setStyle('display','block');
      } else {      
        $('codeCommTxt').hide();
      }
      if($('block-smileys') != null && $('block-smileys').hasClassName('shown')) { $('block-smileys').hide(); }
      if($$('.errormsg')[0] != null) { $$('.errormsg')[0].hide(); }
      if($$('.bt-submit-form-webcam')[0] != null) { $$('.bt-submit-form-webcam')[0].show(); }
      if($$('.bt-submit-form-texte')[0] != null) { $$('.bt-submit-form-texte')[0].hide(); }
      $$('.comment-tabs-texte')[0].toggleClassName('selected'); 
      $$('.comment-tabs-webcam')[0].toggleClassName('selected');
      $('hidden_type').value = 'webcam'; 
      if($$('.known-user-texte')[0] != null) { $$('.known-user-texte')[0].className = 'known-user-webcam'; }
    }
  } else {
    return false;
  }
}
*/

/*
function showSmileys () {
  if($('block-smileys').hasClassName('shown')) { $('block-smileys').removeClassName('shown'); }
  else { $('block-smileys').addClassName('shown'); }
  new Effect.toggle($('block-smileys'),'blind',{duration: 0.4});
  return false;
}
*/
/*
function rvb2hex(val){
  if (val.indexOf("rgb") >= 0)  {
    var rgb_string = val.slice(val.indexOf('(') + 1,val.indexOf(')'));
    var rgb_val = rgb_string.split(",");
    val = "#";
    var hexChars = "0123456789ABCDEF";
    for (var i = 0; i < 3; i++)  {
      var v = rgb_val[i].valueOf();
      val += hexChars.charAt(v/16) + hexChars.charAt(v%16);
    }
  }
  return val;
}
*/
/*
function display_ads() {
  if($$('.boxgoogle_content').length > 0) {
    $$('.boxgoogle_content').each(function(it) {
      it.setStyle({display:'block'});
    });
  }
}
*/
/*
function format_ads() {

  if(is_1000 == false) {
  
    if($$('div.text').length < 1 || $$('span.article-title-main').length < 1) {
      return false;
    }
  
    var ctitle = $$('span.article-title-main')[0].getStyle('color');
    var ctitle_fs = $$('span.article-title-main a')[0].getStyle('font-size');
    var ctitle_ff = $$('span.article-title-main a')[0].getStyle('font-family');
  
  } else {
  
    if($$('div.text').length < 1 || $$('.article-title-h2 a').length < 1) {
      return false;
    }
    $$('div.startup_killer').each(function(it) {
      var dv = it.select('div')[1];
      $(dv).style.marginTop = '40px';
    });
    
    var ctitle = $$('.article-title-h2 a')[0].getStyle('color');
    var ctitle_fs = '24px';
    var ctitle_ff = $$('.article-title-h2 a')[0].getStyle('font-family');
  
  }
    
  var ctext = $$('div.text')[0].getStyle('color');
  var ctext_fs = $$('div.text')[0].getStyle('font-size');
  var ctext_ff = $$('div.text')[0].getStyle('font-family');
  if(ctitle.charAt(0)!='#') { ctitle = rvb2hex(ctitle); }
  
  $$('span.killer_titulo1').each(function(elt) {
    elt.setStyle({ color : ctitle, fontSize : ctitle_fs, fontFamily : ctitle_ff });
  });
  $$('span.killer_slink').each(function(elt) {
    elt.setStyle({ color : ctext, fontSize : ctext_fs, fontFamily : ctext_ff });
  }); 
  $$('span.killer_texto').each(function(elt) {
    elt.setStyle({ color : ctext, fontSize : ctext_fs, fontFamily : ctext_ff });
  }); 
  $$('span.contendio').each(function(elt) {
    elt.setStyle({ color : ctext, fontSize : ctext_fs, fontFamily : ctext_ff });
  });
}
*/
/*
function favoris() {
  $$('#blogpotes li a').each(function(elt) {
    $(elt).observe('mouseover', function(event) {
      $(elt).select('span.over')[0].innerHTML = $(elt).select('span')[1].innerHTML;
      $(elt).select('span.over')[0].setStyle({ display : '' });
    });
    $(elt).observe('mouseout', function(event) {
      $(elt).select('span.over')[0].innerHTML = '';
      $(elt).select('span.over')[0].setStyle({ display : 'none' });
    });
  });
}
*/

/* récupération de CSS pour IE */
/*
function getStyleIE(oElm, strCssRule){
	var strValue = "";
	if(document.defaultView && document.defaultView.getComputedStyle){
		strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
	}
	else if(oElm.currentStyle){
		strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
			return p1.toUpperCase();
		});
		strValue = oElm.currentStyle[strCssRule];
	}
	return strValue;
}
*/

/* infobulle */
/*
function infobulle() {
  // évènement au survol sur les avatars    
  if($$('.infobulle').length > 0) {    
    $$('.infobulle').each(function (avatar) {
      var coord = Element.cumulativeOffset(avatar);      
      var infos = avatar.readAttribute('rel').evalJSON();      
      avatar.observe('mouseover', function() {
        $('infobulle').setStyle({'top': coord.top + 'px', 'left': coord.left + 5 + avatar.getWidth() + 'px'});
        $$('#infobulle span.avat_pseudo')[0].innerHTML = infos['pseudo'];
        descr = $$('#infobulle span.avat_descr');
        descr[0].innerHTML = infos['descr'];
        $('infobulle').setStyle({'display':'block'});
        if(Prototype.Browser.IE) {
          bugfix = $$('td.edit_avatar_ctx')[0];        
          $(bugfix).style.width = parseInt(getStyleIE($(descr[0]), "max-width"));
          if($(descr[0]).getWidth() >= parseInt(getStyleIE($(bugfix), "max-width"))) {
            $('infobulle').setStyles({'width': (parseInt(getStyleIE($(bugfix), "max-width")) + 11)+'px'});
            bugfix.setStyle({'float':'left'});
            bugfix.setStyle({'width':$(descr[0]).getWidth()+'px'});
          } else {
            $$('td.edit_avatar_ctx')[0].setStyle({'width':'auto'});
            $('infobulle').setStyle({'width': 'auto'});
            $(bugfix).setStyle({'float':'none'});
            $(bugfix).setStyle({'width':'auto'});
          }
        }
      });
      avatar.observe('mouseout', function() {
        $('infobulle').hide();
        if(Prototype.Browser.IE) {
          $$('td.edit_avatar_ctx')[0].setStyle({'width':'auto'});
          $('infobulle').setStyle({'width': 'auto'});
          bugfix.setStyle({'float':'none'});
          bugfix.setStyle({'width':'auto'});
        }
      });
    });
  }     
}
*/
/*
function loadBar() {
  if(!document.all) {
    win_w = window.innerWidth;
  } else {
    win_w = document.documentElement.clientWidth;
  }
  
  if($('toolbar') != null) {
   
    inner_bar_w = $('tablebar_ctx').getWidth();
    bar_w = (parseInt(win_w) - inner_bar_w) / 2;
    $('toolbar').down('div.arrow').style.width = bar_w + 'px';
    
    if($('toolbar').hasClassName('closed')) {
      $('toolbar_closed').setStyle({'bottom': '0px'});
    } else {
      $('toolbar').style.bottom = '0px';
      $('toolbar_closed').style.bottom = '-'+ $('toolbar').getHeight() + 'px';
    }
     
  }
  
}

function bar_alert_left(tab) {

  if(tab != undefined) {

    if($('bar_alert_left') != null) {
        if($('bar_alert_left').hasClassName('closed')) {
        
          $('bar_alert_'+ tab).removeClassName('hide').addClassName('opened');
          alert_h = $('bar_alert_left').getHeight() + 1; // on ajoute 1 pour caler correctement la div
          $('bar_alert_left').removeClassName('closed').addClassName('opened');
          alert_l = $('toolbar_td').positionedOffset().left + ($('toolbar_td').getWidth() - $('bar_alert_left').getWidth());
          alert_w = $('bar_alert_msg').getWidth() - 2 - 10; /* - bordure - padding /
          
          if(Prototype.Browser.IE6 || Prototype.Browser.IE7) {
            $('bar_alert_left').style.setAttribute('cssText','left:'+ alert_l + 'px !important; top:-' + alert_h + 'px !important');
          } else {
            $('bar_alert_left').setAttribute('style', 'left:'+ alert_l + 'px !important; top:-' + alert_h + 'px !important');
          }
          
          $$('#bar_alert_left .input_extend').each(function(elt) {
            if(Prototype.Browser.IE6 || Prototype.Browser.IE7) {
              elt.style.setAttribute('cssText','width:'+ alert_w + 'px !important;');
            } else {
              elt.setAttribute('style', 'width:'+ alert_w + 'px !important;');
            }
          });
          
        } else {
          if(tab == 'msg') { 
            if(!$('bar_alert_add').hasClassName('hide')) { 
              $('bar_alert_add').removeClassName('opened').addClassName('hide'); 
            }
            $('bar_alert_msg').removeClassName('hide').addClassName('opened');
          } else {
            if(!$('bar_alert_msg').hasClassName('hide')) { 
              $('bar_alert_msg').removeClassName('opened').addClassName('hide'); 
            }
            $('bar_alert_add').removeClassName('hide').addClassName('opened');
          }
          
          alert_p = $('bar_alert_left').getHeight() + 1; // on ajoute 1 pour caler correctement la div          
          if(Prototype.Browser.IE6 || Prototype.Browser.IE7) {
            $('bar_alert_left').style.setAttribute('cssText','top:-'+ alert_p + 'px !important;left:'+ $('bar_alert_left').getStyle('left') + ' !important;');
          } else {
            $('bar_alert_left').setAttribute('style', 'top:-'+ alert_p + 'px !important;left:'+ $('bar_alert_left').getStyle('left') + ' !important;');
          }

        }
      }
  
  } else {
  
    $('bar_alert_left').removeClassName('opened').addClassName('closed').setStyle({'top': ''});
    $('bar_alert_msg').removeClassName('opened').addClassName('hide');
    $('bar_alert_add').removeClassName('opened').addClassName('hide');
    
  }
  
}

function bar_alert() {
  if($('bar_alert') != null) {
  if($('bar_alert').hasClassName('closed')) {
  
    alert_h = $('bar_alert').getHeight() + 1; // on ajoute 1 pour caler correctement la div
    $('bar_alert').removeClassName('closed').addClassName('opened');
    if(Prototype.Browser.IE6 || Prototype.Browser.IE7) {
      $('bar_alert').style.setAttribute('cssText','top:-'+ alert_h + 'px !important;');
    } else {
      $('bar_alert').setAttribute('style', 'top:-'+ alert_h + 'px !important;');
    }
    $$('strong.bar_alert')[0].removeClassName('bar_alert').addClassName('bar_closed');
    
  } else {
  
    $('bar_alert').removeClassName('opened').addClassName('closed').setStyle({'top': ''});
    $$('strong.bar_closed')[0].removeClassName('bar_closed').addClassName('bar_alert');
  
  }
  }
}

function moveBar() {

  if($('toolbar').getStyle('top') == null) {
    $('toolbar').style.top = document.documentElement.offsetHeight - $('toolbar').getHeight() + 'px';
  }
  if($('toolbar_closed').getStyle('top') == null) {
    $('toolbar_closed').style.top = document.documentElement.offsetHeight - $('toolbar_closed').getHeight() + 'px';
  }
  t_top = document.documentElement.scrollTop + document.documentElement.clientHeight - $('toolbar').getHeight();
  new Effect.Parallel([
    new Effect.Morph($('toolbar'), { sync: true, style: 'top:'+ t_top + 'px' }), 
    new Effect.Morph($('toolbar_closed'), { sync: true, style: 'top:' + t_top + 'px' }) 
    ], { 
    duration: 0.25
  });
}
*/
/*
function getX(oElement) { // fonction pour position left sous IE <= 7
  var iReturnValue = 0;
  while( oElement != null ) {
  iReturnValue += oElement.offsetLeft;
  oElement = oElement.offsetParent;
  }
  return iReturnValue;
}
*/
/*
function bar(action, cookie_domain) {
      
  t_top = document.documentElement.scrollTop + document.documentElement.clientHeight;

  if(action == 'closed') {
  
    if($('bar_alert_left') != null && $('bar_alert_left').hasClassName('opened')) {
      $('bar_alert_left').removeClassName('opened').addClassName('closed');
      $('bar_alert_msg').removeClassName('opened').addClassName('hide');
      $('bar_alert_add').removeClassName('opened').addClassName('hide');
      if(Prototype.Browser.IE6 || Prototype.Browser.IE7) {      
        $('bar_alert_left').style.setAttribute('cssText','');
      } else {
        $('bar_alert_left').setAttribute('style','');
      }      
    }
    new Effect.Parallel([
      new Effect.Morph($('toolbar'), { sync: true, style: 'bottom:-'+ ($('toolbar').getHeight() + 1) + 'px' }), 
      new Effect.Morph($('toolbar_closed'), { sync: true, style: 'bottom:0px' }) 
      ], { 
      duration: 0.5
    });
  
  } else {
  
    if(!document.all) {
      win_w = window.innerWidth;
    } else {
      win_w = document.documentElement.clientWidth;
    }
  
    inner_bar_w = $('tablebar_ctx').getWidth();
    bar_w = (parseInt(win_w) - inner_bar_w) / 2;
    
    new Effect.Parallel([
      new Effect.Morph($('toolbar_closed'), { sync: true, style: 'bottom:-'+ ($('toolbar').getHeight() + 1) + 'px' }), 
      new Effect.Morph($('toolbar'), { sync: true, style: 'bottom:0px' }) 
      ], { 
      duration: 0.5
    });
        
  }
  
  document.cookie = 'toolbar='+ action+'; domain='+ cookie_domain +'; path=/;'
}
*/
//Prototype.Browser.IE6 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==6;
//Prototype.Browser.IE7 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==7;
/*
document.observe("dom:loaded" , function() {
  display_ads();
  if (is_1000 == true) {
	 redimAllImages1000();
  } else {
    redimAllImages();
  }
	externalLinks();
  if(is_1000 == true) { favoris(); }
  if(!Prototype.Browser.IE7) { loadBar(); }
});
*/
/*
window.onload = function() {
  infobulle();
  format_ads();
  if(Prototype.Browser.IE7) {
    loadBar();
  }
}
*/
/*
Event.observe(window, 'resize', function() {
  if($('toolbar') != null && $('bar_alert_left').hasClassName('opened')) {

    if(!document.all) {
      win_w = window.innerWidth;
    } else {
      win_w = document.documentElement.clientWidth;
    }

    if($('bar_alert_left') != null && !$('bar_alert_left').hasClassName('closed')) {      
      if(Prototype.Browser.IE6 || Prototype.Browser.IE7) {      
        place = 'left:' + (getX($('toolbar_td')) + ($('toolbar_td').getWidth() - $('bar_alert_left').getWidth())) +'px !important; top:' + parseInt($('bar_alert_left').getStyle('top')) + 'px !important';
        $('bar_alert_left').style.setAttribute('cssText',place);
      } else {
        place = 'left:' + ($('toolbar_td').positionedOffset().left + ($('toolbar_td').getWidth() - $('bar_alert_left').getWidth())) +'px !important; top:' + parseInt($('bar_alert_left').getStyle('top')) + 'px !important';
        $('bar_alert_left').setAttribute('style',place);
      }
    }
  
    imgs = $('tablebar_ctx').getElementsBySelector('img');
    if(win_w < 1024) {
      imgs.each(function(elt) {
        elt.style.display = 'none';
      });
    } else {
      imgs.each(function(elt) {
        elt.style.display = 'block';
      });
    }
  
    inner_bar_w = $('tablebar_ctx').getWidth();
    bar_w = (parseInt(win_w) - inner_bar_w) / 2;
    $('toolbar').down('div.arrow').style.width = bar_w + 'px';
  
  }  
});
*/
