﻿
document.write('<link rel="stylesheet" type="text/css" href="css/opcvminfo.css" />');
function fuOpcvmInfo() {
  var CodeIsin = getCookie('codeisin');
  if (CodeIsin!=null && CodeIsin.length > 0) {
    setCookie('codeisin',CodeIsin,50);
    var imgSlogan = $('imgSlogan');
    var divOpcvmInfo = $(document.createElement('div'));
    divOpcvmInfo.addClassName('opcvminfo');
    divOpcvmInfo.style.display = 'none';
    divOpcvmInfo.id = 'opcvminfo';
  /*  Position.absolutize(divOpcvmInfo);*/
    Position.clone(imgSlogan,divOpcvmInfo);
    document.body.appendChild(divOpcvmInfo);
	var param = 'CodeIsin='+CodeIsin+'&langue='+fuLangue();
    this.updater = new Ajax.PeriodicalUpdater(divOpcvmInfo, 'opcvminfo.ashx', {
      method: 'get', frequency: 5, 
	  decay: 2,
	  parameters:param,
	  onSuccess:function () {
	    new Effect.Opacity('imgSlogan', {duration:0.5, from:1.0, to:0.25});
	    new Effect.Appear('opcvminfo', { duration: 3.0 });
	    this.updater.options.onSuccess = function () {};
	    }
  });
  }
}
function fuChange(strCodeIsin) {
  var tmpCodeIsin = getCookie('codeisin');
  if (tmpCodeIsin!=null && tmpCodeIsin.length > 11) {
    if (tmpCodeIsin.indexOf(strCodeIsin) >= 0) {
        tmpCodeIsin = tmpCodeIsin.replace(strCodeIsin,'').replace('||','|').replace('^|','').replace('|$','');
      if (tmpCodeIsin.length < 11) {
        deleteCookie('codeisin');
		    this.updater.stop();
        new Effect.DropOut('opcvminfo');
		    $('opcvminfo').remove();
  	    new Effect.Opacity('imgSlogan', {duration:0.5, from:0.25, to:1.0});
      } else {
        setCookie('codeisin',tmpCodeIsin,50);
		var param = 'CodeIsin='+tmpCodeIsin+'&langue='+fuLangue();
		this.updater.stop();
		this.updater.options.parameters = param;
		this.updater.start();
		}
	}
  }
}

//FastInit.addOnLoad(fuOpcvmInfo); ! ne pas utiliser car le this.updater ne marche plus apres...
Event.observe(window, 'load', fuOpcvmInfo);