/* FauxSelect */
/* Author: Mathieu Fastjack Quisefit */
/* Date: 02-03-2010 */
var JEFauxSelect = Class.create({
	initialize: function(id)
	{
		this.Element = $(id);
		// On sauvegarde la largeur (IE)
		var width = this.Element.getWidth();
		
		this.Container = Builder.node('div', {className: 'faux-select'});
		Element.insert(this.Element, {after: this.Container});
		Element.setStyle(this.Container, {width: width+'px', height:'26px'});
		Element.hide(this.Element);
		var label = '';
		this.List = Builder.node('ul', {className:'faux-select'});
		this.Element.select('option').each(function(e){
			var li = Builder.node('li', e.innerHTML);
			li.__value = e.value;
			Event.observe(li, 'click', this.selectRow.bind(this));
			Element.insert(this.List, li);
			if ( Element.readAttribute(e, 'selected') == 'selected' ) label = e.innerHTML;
		}, this);
		this.Label = Builder.node('div', Builder.node('span', label));
		
		Element.setStyle(this.Label.down('span'), {width: (width-18)+'px'});
		Element.insert(this.Container, this.Label);
		Element.insert(this.Container, this.List);
		this.hideMe();
		Event.observe(this.Container, 'click', this.openMe.bind(this));
	},
	openMe: function() { Element.toggle(this.List); },
	closeMe: function() { Effect.BlindUp(this.List, {duration: 0.3}); },
	hideMe: function() { Element.hide(this.List); },
	setValue: function(value) { Form.Element.setValue(this.Element, value); },
	selectRow: function(e) { var element = Event.element(e); this.Label.down('span').update(element.innerHTML); this.setValue(element.__value); this.closeMe(); }
});

/* Galleries */
/* Author: Mathieu Fastjack Quisefit */
/* Date: 01-03-2010 */
var JEGallery = Class.create({
	initialize: function(id)
	{
		this.CurrentPosition = 0;
		this.Element = $(id);
		this.AutoSlide = false;
		if ( Element.hasClassName(this.Element, 'gallery-auto') )
		{
			var classNames = $w(this.Element.className);
			var timer = null;
			classNames.each(function(c){
				var regs = c.match(/^gallery-timer-([0-9]+)$/);
				if ( regs != null ) timer = Math.round(regs[1]);
			});
			var width = null;
			classNames.each(function(c){
				var regs = c.match(/^gallery-width-([0-9]+)$/);
				if ( regs != null ) width = Math.round(regs[1]);
			});
			this.AutoSlide = timer;
		}
		this.timeout = null;
		this.Slides = this.Element.select('li');
		this.Slides.each(function(e){
								
			if ( Element.hasClassName(e,'gallery-swf') )
			{
				swfobject.embedSWF(e.title, e.down('a').id, Element.getWidth(e), Element.getHeight(e), '8.0.0', null, {}, {wmode: 'transparent'});
			}
			else
			{
				var w = Element.getWidth(e);
				if (w > width) var w = width;
				
				Element.update(e, Builder.node('img', {src: e.title, width:w}));	
			}
			e.title = '';
		});
		
		var n = Builder.node('a', {className:'gallery-next', href:'javascript:void(0);'});
		n.__gallery = this;
		this.Element.insert(n);
		Event.observe(n, 'click', this.goNext.bind(this));
		p = Builder.node('a', {className:'gallery-previous', href:'javascript:void(0);'});
		p.__gallery = this;
		this.Element.insert(p);
		Event.observe(p, 'click', this.goPrevious.bind(this));
		this.update();
	},
	update: function()
	{
		this.Slides.each(function(e){ if (Element.visible(e)) if ( Element.hasClassName(e,'gallery-swf') ){ Element.hide(e); } else{ Element.fade(e,{duration:0.2}); } });
		Element.appear(this.Slides[this.CurrentPosition],{duration:0.2});
		if ( this.AutoSlide ) this.timeout = this.goNext.delay(this.AutoSlide, null, this);
	},
	clearTimer: function() { window.clearTimeout(this.timeout); },
	goNext: function(e, obj) { if ( obj == undefined ) obj = this; obj.clearTimer(); obj.incrementPosition(); obj.update(); },
	goPrevious: function(e, obj) { if ( obj == undefined ) obj = this; obj.clearTimer(); obj.decrementPosition(); obj.update(); },
	incrementPosition: function() { this.CurrentPosition++; if ( this.CurrentPosition >= this.Slides.size() ) this.CurrentPosition = 0;	 },
	decrementPosition: function() { this.CurrentPosition--; if ( this.CurrentPosition < 0 ) this.CurrentPosition = this.Slides.size() - 1;	 }
});
							
/* Slideshows */
/* Author: Mathieu Fastjack Quisefit */
/* Date: 01-03-2010 */
var JESlideshow = Class.create({
	initialize: function(id)
	{
		this.CurrentPosition = 0;
		this.Element = $(id);
		this.AutoSlide = false;
		if ( Element.hasClassName(this.Element, 'slideshow-auto') )
		{
			var classNames = $w(this.Element.className);
			var timer = null;
			classNames.each(function(c){
				var regs = c.match(/^slideshow-timer-([0-9]+)$/);
				if ( regs != null ) timer = Math.round(regs[1]);
			});
			this.AutoSlide = timer;
		}
		this.timeout = null;
		this.Slides = this.Element.select('li');
		this.Slides.each(function(e){
			if ( Element.hasClassName(e,'slide-swf') )
			{
				swfobject.embedSWF(e.title, e.down('.slideshow-slide span').id, Element.getWidth(e), Element.getHeight(e), '8.0.0', null, {}, {wmode: 'transparent'});
			}
			else
			{
				Element.update(e.down('.slideshow-slide'), Builder.node('img', {src: e.title, width: e.getWidth()}));
			}
			e.title = '';
		});
		this.Element.select('.slideshow-label-box').each(function(e){ e.setOpacity(0.7) });
		this.Index = this.Element.down('.slideshow-index');
		for (var i=1; i<=this.Slides.size();i++)
		{
			var pos = Builder.node('a', {href:'javascript:void(0);'}, i);
			Event.observe(pos, 'click', this.goToSlide.bind(this));
			Element.insert(this.Index, pos);
		}
		this.update();
	},
	update: function()
	{
		var indexes = this.Index.select('a');
		indexes.each(function(e){ e.removeClassName('active') });
		this.Slides.each(function(e){ if (Element.visible(e)) if ( Element.hasClassName(e,'slide-swf') ){ Element.hide(e); } else{ Element.fade(e,{duration:0.2}); } });
		var e = this.Slides[this.CurrentPosition];
		Element.appear(e,{duration:0.2});
		Element.addClassName(indexes[this.CurrentPosition], 'active');
		if ( this.AutoSlide ) this.timeout = this.goNext.delay(this.AutoSlide, null, this);
	},
	goToSlide: function(e) {
		var pos = Event.element(e).innerHTML;
		if ( this.CurrentPosition == pos - 1 ) return;
		this.clearTimer();
		this.CurrentPosition = pos - 1;
		this.update();
	},
	clearTimer: function() { window.clearTimeout(this.timeout); },
	goNext: function(e, obj) { obj.clearTimer(); obj.incrementPosition(); obj.update(); },
	goPrevious: function(e, obj) { obj.clearTimer(); obj.decrementPosition(); obj.update(); },
	incrementPosition: function() { this.CurrentPosition++; if ( this.CurrentPosition >= this.Slides.size() ) this.CurrentPosition = 0;	 },
	decrementPosition: function() { this.CurrentPosition--; if ( this.CurrentPosition < 0 ) this.CurrentPosition = this.Slides.size() - 1;	 }
});
							
/*
 *
 *  Ajax Autocomplete for Prototype, version 1.0.4
 *  (c) 2010 Tomas Kirda
 *
 *  Ajax Autocomplete for Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the web site: http://www.devbridge.com/projects/autocomplete/
 *
 */

var Autocomplete = function(el, options){
  this.el = $(el);
  this.id = this.el.identify();
  this.el.setAttribute('autocomplete','off');
  this.suggestions = [];
  this.data = [];
  this.badQueries = [];
  this.selectedIndex = -1;
  this.currentValue = this.el.value;
  // -----
  // MQ: language attribute for ajax query
  this.languageID = options.languageID;
  // -----
  this.intervalId = 0;
  this.cachedResponse = [];
  this.instanceId = null;
  this.onChangeInterval = null;
  this.ignoreValueChange = false;
  this.serviceUrl = options.serviceUrl;
  this.options = {
    autoSubmit:false,
    minChars:1,
    maxHeight:300,
    deferRequestBy:0,
    width:0,
    container:null
  };
  if(options){ Object.extend(this.options, options); }
  if(Autocomplete.isDomLoaded){
    this.initialize();
  }else{
    Event.observe(document, 'dom:loaded', this.initialize.bind(this), false);
  }
};

Autocomplete.instances = [];
Autocomplete.isDomLoaded = false;

Autocomplete.getInstance = function(id){
  var instances = Autocomplete.instances;
  var i = instances.length;
  while(i--){ if(instances[i].id === id){ return instances[i]; }}
};

Autocomplete.highlight = function(value, re){
  return value.replace(re, function(match){ return '<strong>' + match + '<\/strong>' });
};

Autocomplete.prototype = {

  killerFn: null,

  initialize: function() {
    var me = this;
    this.killerFn = function(e) {
      if (!$(Event.element(e)).up('.autocomplete')) {
        me.killSuggestions();
        me.disableKillerFn();
      }
    } .bindAsEventListener(this);

    if (!this.options.width) { this.options.width = this.el.getWidth(); }

    var div = new Element('div', { style: 'position:absolute;' });
    div.update('<div class="autocomplete-w1"><div class="autocomplete-w2"><div class="autocomplete" id="Autocomplete_' + this.id + '" style="display:none; width:' + this.options.width + 'px;"></div></div></div>');

    this.options.container = $(this.options.container);
    if (this.options.container) {
      this.options.container.appendChild(div);
      this.fixPosition = function() { };
    } else {
      document.body.appendChild(div);
    }

    this.mainContainerId = div.identify();
    this.container = $('Autocomplete_' + this.id);
    this.fixPosition();
    
    Event.observe(this.el, window.opera ? 'keypress':'keydown', this.onKeyPress.bind(this));
    Event.observe(this.el, 'keyup', this.onKeyUp.bind(this));
    Event.observe(this.el, 'blur', this.enableKillerFn.bind(this));
    Event.observe(this.el, 'focus', this.fixPosition.bind(this));
    this.container.setStyle({ maxHeight: this.options.maxHeight + 'px' });
    this.instanceId = Autocomplete.instances.push(this) - 1;
  },

  fixPosition: function() {
    var offset = this.el.cumulativeOffset();
    $(this.mainContainerId).setStyle({ top: (offset.top + this.el.getHeight()) + 'px', left: offset.left + 'px' });
  },

  enableKillerFn: function() {
    Event.observe(document.body, 'click', this.killerFn);
  },

  disableKillerFn: function() {
    Event.stopObserving(document.body, 'click', this.killerFn);
  },

  killSuggestions: function() {
    this.stopKillSuggestions();
    this.intervalId = window.setInterval(function() { this.hide(); this.stopKillSuggestions(); } .bind(this), 300);
  },

  stopKillSuggestions: function() {
    window.clearInterval(this.intervalId);
  },

  onKeyPress: function(e) {
    if (!this.enabled) { return; }
    // return will exit the function
    // and event will not fire
    switch (e.keyCode) {
      case Event.KEY_ESC:
        this.el.value = this.currentValue;
        this.hide();
        break;
      case Event.KEY_TAB:
      case Event.KEY_RETURN:
        if (this.selectedIndex === -1) {
          this.hide();
          return;
        }
        this.select(this.selectedIndex);
        if (e.keyCode === Event.KEY_TAB) { return; }
        break;
      case Event.KEY_UP:
        this.moveUp();
        break;
      case Event.KEY_DOWN:
        this.moveDown();
        break;
      default:
        return;
    }
    Event.stop(e);
  },

  onKeyUp: function(e) {
    switch (e.keyCode) {
      case Event.KEY_UP:
      case Event.KEY_DOWN:
        return;
    }
    clearInterval(this.onChangeInterval);
    if (this.currentValue !== this.el.value) {
      if (this.options.deferRequestBy > 0) {
        // Defer lookup in case when value changes very quickly:
        this.onChangeInterval = setInterval((function() {
          this.onValueChange();
        }).bind(this), this.options.deferRequestBy);
      } else {
        this.onValueChange();
      }
    }
  },

  onValueChange: function() {
    clearInterval(this.onChangeInterval);
    this.currentValue = this.el.value;
    this.selectedIndex = -1;
    if (this.ignoreValueChange) {
      this.ignoreValueChange = false;
      return;
    }
    if (this.currentValue === '' || this.currentValue.length < this.options.minChars) {
      this.hide();
    } else {
      this.getSuggestions();
    }
  },

  getSuggestions: function() {
    var cr = this.cachedResponse[this.currentValue];
    if (cr && Object.isArray(cr.suggestions)) {
      this.suggestions = cr.suggestions;
      this.data = cr.data;
      this.suggest();
    } else if (!this.isBadQuery(this.currentValue)) {
	  new Ajax.Request(this.serviceUrl, {
        parameters: { query: this.currentValue, lang: this.languageID },
        onComplete: this.processResponse.bind(this),
        method: 'get'
      });
    }
  },

  isBadQuery: function(q) {
    var i = this.badQueries.length;
    while (i--) {
      if (q.indexOf(this.badQueries[i]) === 0) { return true; }
    }
    return false;
  },

  hide: function() {
    this.enabled = false;
    this.selectedIndex = -1;
    this.container.hide();
  },

  suggest: function() {
    if (this.suggestions.length === 0) {
      this.hide();
      return;
    }
    var content = [];
    var re = new RegExp('\\b' + this.currentValue.match(/\w+/g).join('|\\b'), 'gi');
    this.suggestions.each(function(value, i) {
      content.push((this.selectedIndex === i ? '<div class="selected"' : '<div'), ' title="', value, '" onclick="Autocomplete.instances[', this.instanceId, '].select(', i, ');" onmouseover="Autocomplete.instances[', this.instanceId, '].activate(', i, ');">', Autocomplete.highlight(value, re), '</div>');
    } .bind(this));
    this.enabled = true;
    this.container.update(content.join('')).show();
  },

  processResponse: function(xhr) {
    var response;
    try {
      response = xhr.responseText.evalJSON();
      if (!Object.isArray(response.data)) { response.data = []; }
    } catch (err) { return; }
    this.cachedResponse[response.query] = response;
    if (response.suggestions.length === 0) { this.badQueries.push(response.query); }
    if (response.query === this.currentValue) {
      this.suggestions = response.suggestions;
      this.data = response.data;
      this.suggest(); 
    }
  },

  activate: function(index) {
    var divs = this.container.childNodes;
    var activeItem;
    // Clear previous selection:
    if (this.selectedIndex !== -1 && divs.length > this.selectedIndex) {
      divs[this.selectedIndex].className = '';
    }
    this.selectedIndex = index;
    if (this.selectedIndex !== -1 && divs.length > this.selectedIndex) {
      activeItem = divs[this.selectedIndex]
      activeItem.className = 'selected';
    }
    return activeItem;
  },

  deactivate: function(div, index) {
    div.className = '';
    if (this.selectedIndex === index) { this.selectedIndex = -1; }
  },

  select: function(i) {
    var selectedValue = this.suggestions[i];
    if (selectedValue) {
      this.el.value = selectedValue;
      if (this.options.autoSubmit && this.el.form) {
        this.el.form.submit();
      }
      this.ignoreValueChange = true;
      this.hide();
      this.onSelect(i);
    }
  },

  moveUp: function() {
    if (this.selectedIndex === -1) { return; }
    if (this.selectedIndex === 0) {
      this.container.childNodes[0].className = '';
      this.selectedIndex = -1;
      this.el.value = this.currentValue;
      return;
    }
    this.adjustScroll(this.selectedIndex - 1);
  },

  moveDown: function() {
    if (this.selectedIndex === (this.suggestions.length - 1)) { return; }
    this.adjustScroll(this.selectedIndex + 1);
  },

  adjustScroll: function(i) {
    var container = this.container;
    var activeItem = this.activate(i);
    var offsetTop = activeItem.offsetTop;
    var upperBound = container.scrollTop;
    var lowerBound = upperBound + this.options.maxHeight - 25;
    if (offsetTop < upperBound) {
      container.scrollTop = offsetTop;
    } else if (offsetTop > lowerBound) {
      container.scrollTop = offsetTop - this.options.maxHeight + 25;
    }
    this.el.value = this.suggestions[i];
  },

  onSelect: function(i) {
    (this.options.onSelect || Prototype.emptyFunction)(this.suggestions[i], this.data[i]);
  }

};

Event.observe(document, 'dom:loaded', function(){
	Autocomplete.isDomLoaded = true;
	$$('div.gallery').each(function(e){
		new JEGallery(e);							
	});
	$$('div.ads').each(function(e){
					
		var id = e.id;
		var slot = null;
		var num = null;
			
		var classNames = $w(e.className);
		
		classNames.each(function(c){
			var regs = c.match(/^ad-slot-([0-9]+)$/);
			if ( regs != null ) slot = regs[1];
			var regs = c.match(/^ad-number-([0-9]+)$/);
			if ( regs != null ) num = regs[1];
		});

		if ( id != undefined && slot != null && num != null  ) loadAdverts(id, num, slot);
	});
});
/* Chargement des publicités
** @param slot		ID de l'objet html sur la page
** @param number	Nombre maximum de publicités
** @param format	Format des publicités
*/
function loadAdverts(id, number, slot)
{
	
	var purgeCache = 0;
	var param = window.location.search.slice(1,window.location.search.length);
	var first = param.split('&');
	
	for( i=0 ; i < first.length ; i++ )
	    {
		    var second = first[i].split("=");
		    if( second[0] == 'purgeCache' ) purgeCache = second[1];
	}
	
	new Ajax.Request(
					 'ajax/adverts.php',
					 {
						 method: 'get', 
						 parameters: {Num: number, Slot:slot, purgeCache:purgeCache},
						 asynchronous:true,
						 onSuccess: function(transport){
					
								var result = transport.responseJSON;	
								
								if (result.display) 
								{
									$(id).innerHTML = result.display;
								}
								else
								{
									/*eval('google_ad_client = "pub-1786064320471949"; google_ad_slot = "9428856760"; google_ad_width = 120; google_ad_height = 600;');
									
									var html_doc = document.getElementsByTagName('head').item(0);
									var js = document.createElement('script');
									js.setAttribute('type', 'text/javascript');
									js.setAttribute('src','http://pagead2.googlesyndication.com/pagead/show_ads.js');
									alert('1');
									
									html_doc.appendChild(js);
									return false;*/
									//$(id).innerHTML = result.googleAds;
									
									/*var scripts = $(id).getElementsByTagName('script');
									for (var i=0, j=scripts.length; i<j; i++) {
										// javascript utilisant un fichier externe
										if (scripts[i].src) {
											include_dom_js_file(scripts[i].src);
										} else {
											// javascript code must not contain "<!--" and "//-->" to eval
											var scriptText = scripts[i].text;
											scriptText = scriptText.replace("<!--", "");
											scriptText = scriptText.replace("//-->", "");
											eval(scriptText);
										}
									}*/
								}
							}
					  }
	);	
	
}

// exécution à la volée du fichier javascript donné
/*function include_dom_js_file(script_filename) {
    var html_doc = document.getElementsByTagName('head').item(0);
    var js = document.createElement('script');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', script_filename);
    html_doc.appendChild(js);
    return false;
}*/

/*
** Changement de type Login
*/
var changeType = function (el)
{
    if (el.type.toLowerCase () != "password" )
    {
        var pw = document.createElement ("input" );
        pw.setAttribute ("type", "password" );
        pw.setAttribute ("value", el.value);
        pw.setAttribute ("name", el.name);
        pw.setAttribute ("id", el.id);
        pw.setAttribute ("onFocus", "javascript:if(this.value=='Mot de passe')this.value=''; changeType(this);");
        pw.setAttribute ("onBlur", "javascript:if(this.value=='')this.value='Mot de passe'; changeTypeInv(this);");
        el.parentNode.replaceChild (pw, el);
        pw.focus(); 
    }
    return true;
}
var changeTypeInv = function (el)
{
    if (el.type.toLowerCase () != "text" && el.value == "Mot de passe")
    {
		var pw = document.createElement ("input" );
		pw.setAttribute ("type", "text" );
		pw.setAttribute ("value", el.value);
		pw.setAttribute ("name", el.name);
		pw.setAttribute ("id", el.id);
		pw.setAttribute ("onFocus", "javascript:if(this.value=='Mot de passe')this.value=''; changeType(this);");
		pw.setAttribute ("onBlur", "javascript:if(this.value=='')this.value='Mot de passe'; changeTypeInv(this);");
		el.parentNode.replaceChild (pw, el);
    }
    return true;
}
/*********/

function setVal(objID, selIndex) { var obj = document.getElementById(objID); obj.selectedIndex = selIndex; }
function displayToottip(id) { new Tip(id, $(id).down().innerHTML, { width: 'auto', style: 'tooltip', stem: 'topLeft' }); }
function hideToottip(id) { Tips.remove(id);	}
function displayBloc(id) { $(id).setStyle('display:block;'); }
function hideBloc(id) { $(id).setStyle('display:none'); }
function ifExistPseudo(elt) { new Ajax.Updater('pseudo','ajax/pseudo.php',{method:'get',parameters:{Value:elt.value}}); }

/* 
** Affichage des thèmes pour une recherche avancée
*/
function showThemesSearch()
{
	// Tout afficher en enlevant le style overflow:hidden
	$('div_themes_search').setStyle('overflow:visible;');
	// Afficher le bouton -
	$('moins_search').setStyle('display:block');
	// Cacher le bouton +
	$('plus_search').setStyle('display:none');
	//Afficher
	$('div_themes_search').invoke('show');
}

function hideThemesSearch()
{
	// Cacher en mettant le style overflow:hidden
	$('div_themes_search').setStyle('overflow:hidden;');
	// Afficher le bouton +
	$('plus_search').setStyle('display:block');
	// Cacher le bouton -
	$('moins_search').setStyle('display:none');
	//Masquer
	$('div_themes_search').invoke('hide');
}

/* 
** Affichage des thèmes
*/
function showThemes()
{
	// Tout afficher en enlevant le style overflow:hidden
	$('themes-content').setStyle({overflow:'visible'});
	// Pour IE -> height firefox -> min-height IE
	$('themes-content').setStyle({height:'auto'});
	// Afficher le bouton -
	$('themes-moins').setStyle({display:'block'});
	// Cacher le bouton +
	$('themes-plus').setStyle({display:'none'});
}

function hideThemes()
{
	// Cacher en mettant le style overflow:hidden
	$('themes-content').setStyle({'overflow':'hidden'});
	// Pour IE -> height firefox -> min-height IE
	$('themes-content').setStyle({height:'60px'});
	// Afficher le bouton +
	$('themes-plus').setStyle({'display':'block'});
	// Cacher le bouton -
	$('themes-moins').setStyle({'display':'none'});
}

/** 
** Déclare l'action sur la validation d'un sondage
** @display		une rubrique & l'affichage des résultats du sondage à la place du sondage
*/ 
function submitPoll()
{
	var url = new String(window.location);
	var param = url.toQueryParams();
	
	$('LBContent').innerHTML = $('upload_obj_container').innerHTML;
	showLightBox('LightBox', 560);
	// Récuperer l'id de la réponse dans le formulaire poll
	var id = $RF("poll","response");		
	if (id)
	{
		new Ajax.Request(
			'ajax/poll.php',
			{
				method: 'get',
				parameters: {ID: id, sid:param.sid},
				onSuccess: function(transport){
					
					var result = transport.responseJSON;	
					
					// Affichage dans la lighbox d'un message suivant si la personne est co ou pas
					$('LBContent').innerHTML = result.display;
					// Si la personne est co -> sondage ok
					// => on affiche les résultats du sondage 
					if (result.poll) $('poll').innerHTML = result.poll;
				}
			}
		);
	}
}

/** 
** Déclare l'action sur la validation d'un sondage
** @params	id	identifiant de la div à mettre en avant
*/ 
function displayNews(id)
{
	$(id).removeClassName('hide'); 
	$(id).addClassName('display');
	$('header-'+id).addClassName('focus');
	if (id != 'last')
	{
		$('last').removeClassName('display');
		$('last').addClassName('hide'); 
		$('header-last').removeClassName('focus');
	}
	if (id != 'best-read')
	{
		$('best-read').removeClassName('display');
		$('best-read').addClassName('hide'); 
		$('header-best-read').removeClassName('focus');
	}
	if (id != 'best-send')
	{
		$('best-send').removeClassName('display');
		$('best-send').addClassName('hide'); 
		$('header-best-send').removeClassName('focus');
	}
}

function postRating(obj)
{
	var id = obj.id;
	var temp = id.split("-");
	var note = temp[1];
	new Ajax.Request
	(
		'ajax/rating.php',
		{
			method: 'get',
			parameters: {j:note, id:$('news_id').value},
			onSuccess: function(transport)
			{
				var result = transport.responseJSON;
				switch ( result.status )
				{
					case 'ok':
						alert(result.message);
						break;
					default:
					case 'error':
						alert(result.message);
						opt.onFailure(t);
						break;
				}
			},
			onFailure: function(transport)
			{
				var result = transport.responseJSON;
				alert(result.message);
			}
		}
	);
	return false;
}

function postComment()
{
	if ( $('CommentText').value != '' )
	{
		Form.Element.disable('post-comment-button');
		Element.hide('post-comment-form');
		Element.show('post-comment-loading');
		var opt = new Hash();
		var params = $H( $('post-comment').serialize(true) );
		new Ajax.Request(
					'ajax/comments.php',
					{
						method: 'get',
						parameters: params,
						onSuccess: function(transport){
							var result = transport.responseJSON;
							switch ( result.status )
							{
								case 'ok':
									Form.Element.setValue('CommentText', '');
									Form.Element.enable('post-comment-button');
									Element.show('comments');
									Element.show('post-comment-form');
									displayCommentMsg(result.message, 'msg-valid');
									break;
								default:
								case 'error':
									opt.onFailure(t);
									break;
							}
						},
						onFailure: function(transport) {
							var result = transport.responseJSON;
							Form.Element.setValue('CommentText', '');
							Element.hide('PostCommentLoading');
							Element.hide('PostCommentForm');
							displayCommentMsg(result.message, 'msg-error');
						}
					}
		);
	}
	return false;
}

function updateContent(node,value) { node.update(value); alert(value); }

function switchContact(contact_id)
{	
	if (contact_id)
	{
		$$('.contact-'+contact_id).each(function(node){node.update($('upload_obj_container').innerHTML);});
		$('LBContent').innerHTML = $('upload_obj_container').innerHTML;
		showLightBox('LightBox', 300);
		new Ajax.Request(
				'ajax/switch_contact.php',
				{
					method: 'get',
					parameters: {id:contact_id},
					onSuccess: function(transport){
						var result = transport.responseJSON; 
						$('LBContent').innerHTML = result.display;
						$$('.contact-'+contact_id).each(function(node){var img = document.createElement('IMG');	img.src = result.icon; node.update(img);});
					}
				}
		);
	}
	return false;
}

// Oldies
function checkAlreadySelectedContact(id)
{
	var opts = $('display-selected-contacts').options;
	for ( var i = 0 ; i < opts.length ; i++ )
	{
		if ( opts[i].value == id ) return i;
	}
	return -1;
}

function selectContact(elt)
{
	var test = checkAlreadySelectedContact(elt.id);

	if ( test < 0 )
	{
		Element.addClassName(elt, 'selected-contact');
		
		var opt = document.createElement('OPTION');
		
		opt.text = elt.title;
		opt.value = elt.id;
		
		$('display-selected-contacts').options.add(opt);
	}
	else
	{
		Element.removeClassName(elt, 'selected-contact');
		
		var obj = $('display-selected-contacts');
		
		obj.remove(test);
	}
	
	var opts = $('display-selected-contacts').options;
	
	var txt = '';
	
	for ( var i = 0 ; i < opts.length ; i++ )
	{
		txt += opts[i].value;
		if ( i < opts.length - 1 ) txt += ',';
	}
	
	$('selected-contacts').value = txt;
}

function sendFriend(id,type)
{
	// Récupération du sid
	var url = new String(window.location);
	var param = url.toQueryParams();
	
	// 
	$('LBContent').innerHTML = $('upload_obj_container').innerHTML;
	showLightBox('LightBox', 560);
	new Ajax.Updater('LBContent','ajax/send_friend.php',{method: 'get',parameters: {ID: id, Type: type, sid:param.sid}});	
}

function sendToAFriend()
{
	
	
	// GUI
	Form.Element.disable('share-form-button');
	
	Element.hide('send-share-form');
	Element.show('send-share-loading');
	Element.hide('send-share-success');
	Element.hide('send-share-error');
	
	// Form data
	params = $H( $('send-share-form').serialize(true) );
	
	// Envoyer le message au destinataire
	new Ajax.Request(
						'do.php',
						{
							method: 'get',
							parameters: params,
							onSuccess: function(transport){
								
								var result = transport.responseJSON; 
								
								Element.hide('send-share-loading');
															
								switch ( result.status )
								{
									case 'ok':
										Element.show('send-share-success');
										
										break;
									case 'error':
										
										if ( result.error != '' ) Element.firstDescendant('send-share-error').update( result.error );
										Element.show('send-share-error');
										
										break;
								}
								
								if ( result.retry == true )
								{
									Element.show('send-share-form');
									Form.Element.enable('share-form-button');
								}
								else Element.hide('send-share-form');	
								
							}
						}
	);
	return false;
}

/** 
* Returns the value of the selected radio button in the radio group 
* returns "" if the radio is not found or if nothing is checked 
*/ 
function $RF(form, radioName){ 
  var array = $$('#'+form+' input[type="radio"]'); 
  var value = ""; 
  array.each( 
    function (radio){ 
      if (radio.hasAttribute("name") && radio.readAttribute("name")==radioName) 
        if (radio.checked=="true" || radio.checked) value=radio.getValue();  
    } 
  );
  return value;  
} 

/**/
function displayCommentMsg(msg, className)
{
	$('comments-msg').update(msg);
	Element.removeClassName('comments-msg', 'msg-error');
	Element.removeClassName('comments-msg', 'msg-valid');
	Element.addClassName('comments-msg', className);
	Element.show('comments-msg');
}
/**/
function limitTextFieldLength(text, length, update)
{
	if ( $F(text).length > length ) Form.Element.setValue(text, $F(text).substr(0,length));
	if ( update ) Element.update(update, (length - $F(text).length));
}
/**/
function requestAndReplaceCommentsHTML(url, id, loading_id)
{
	Element.hide(id);
	Element.show(loading_id);
	
	var updateCommentsUrl = url;

	new Ajax.Updater(id, url, {onSuccess: function(){Element.hide(loading_id); Element.show(id)}});
}


// Pop Up
function popup(page,largeur,hauteur,options) 
{
	var top=(screen.height-hauteur)/2;     
	var left=(screen.width-largeur)/2;  
	
	window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options); 
} 

// Ouverture d'une nouvelle fenêtre du navigateur
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


// fonction de validation de formulaire amélioré multi-langage V1.0
function MM_validateFormMultiLang()
{
	var i,p,q,nm,test,num,min,max,errors = '',args=MM_validateFormMultiLang.arguments;

	for (i=6; i<(args.length-2); i+=3)
	{
		test=args[i+2]; 
		val=MM_findObj(args[i]);
	
		if (val)
		{
			affich=args[i+1];
			nm=val.name;
	
			if (test == 'isChecked')
			{
				test = $$('input.'+args[i]).findAll(function(element) { return element.checked == true; });
				
				if (!Object.isElement(test[0]))
				{
					errors+= '- '+affich+'.\n';	
				}
			}
			else if ((val=val.value)!="")
			{
				if (test.indexOf('isEmail')!=-1)
				{
					p=val.indexOf('@');
					if (p<1 || p==(val.length-1)) errors+= '- '+affich+' '+args[0]+'.\n';
				}
				else if (test!= 'R')
				{
					if (isNaN(val)) errors+= '- '+affich+' '+args[1]+'.\n';
					if (test.indexOf('inRange') != -1)
					{
						p=test.indexOf(':');
						min=test.substring(8,p); max=test.substring(p+1);
						if (val<min || max<val) errors+= '- '+affich+' '+args[2]+' '+min+' '+args[3]+'et '+max+'.\n';
					}
				}
			}
			else if (test.charAt(0) == 'R') errors += '- '+affich+'.\n';

		}
  	}
    
	var Compt = 0;
	var Deb = errors.indexOf('\n');
	while (Deb != -1)
	{
		Compt++;
		Deb = errors.indexOf('\n',++Deb);
	}
   	
	if (errors)
   	{
   		if (Compt>1)
   		{
   			alert(''+args[4]+' :\n'+errors);
   		}
   		else
   		{
   		  alert(''+args[5]+' :\n'+errors);  		
   		}   	
   	}
  	document.MM_returnValue = (errors == '');
}

// Confirmation de suppression
function doConfirm(msg, url)
{
	var res = confirm(msg);
	
	if ( res )
	{
		if ( url != '' )
		{
			self.location = url;
		}
		else
		{
			return res;
		}
	}
	else
	{
		if ( url == '' )
		{
			return res;
		}
	}
}

function showPageLightBox(url, width)
{
	if ( width == undefined ) width = 650;	
	
	new Ajax.Updater('LBContent', url);
	showLightBox('LightBox', width);
}

/* LIGHTBOXES */
function showLightBox(id, width)
{
	if ( width == undefined ) width = 400;	
	hideAllLightBoxes();
		
	$('lbOverlay').hide().observe('click', (function() { hideLightBox(id); }));
	//$(id).hide().observe('click', (function(event) { if (event.element().id == id) hideLightBox(id); }));
	$$('select', 'object', 'embed', 'iframe').each(function(node){ if( !Element.descendantOf(node, id) ) node.style.visibility = 'hidden' });

	// stretch overlay to fill page and fade in
	
	var arrayPageSize = getPageSize();
	$('lbOverlay').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });

	new Effect.Appear('lbOverlay', { duration: 0.25, from: 0.0, to: 0.7 });

	// calculate top and left offset for the lightbox 
	var arrayPageScroll = document.viewport.getScrollOffsets();
	var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 7);

	var lightboxLeft = arrayPageScroll[0] + ((document.viewport.getWidth()-width)/2);
	
	$(id).setStyle({ width: width + 'px', top: lightboxLeft + 'px' });
	
	new Effect.Appear(id, { duration: 0.25, from: 0.0, to: 1 });
}

function hideLightBox(id)
{
	$(id).hide();
	$('lbOverlay').hide();
	$$('select', 'object', 'embed', 'iframe').each(function(node){ if( !Element.descendantOf(node, id) ) node.style.visibility = 'visible' });
}

function hideAllLightBoxes()
{
	var boxes = document.getElementsByClassName('LightBox');
	for(var i = 0;i<boxes.length;i++) hideLightBox(boxes[i]);
}
function getPageSize()
{
	 var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	return [pageWidth,pageHeight];
}

var Cookie = {
  set: function(name, value, daysToExpire) {
    var expire = '';
    if (daysToExpire != undefined) {
      var d = new Date();
      d.setTime(d.getTime() + (86400000 * parseFloat(daysToExpire)));
      expire = '; expires=' + d.toGMTString();
    }
    return (document.cookie = escape(name) + '=' + escape(value || '') + expire + '; path=/');
  },
  get: function(name) {
    var cookie = document.cookie.match(new RegExp('(^|;)\\s*' + escape(name) + '=([^;\\s]*)'));
    return (cookie ? unescape(cookie[2]) : null);
  },
  erase: function(name) {
    var cookie = Cookie.get(name) || true;
    Cookie.set(name, '', -1);
    return cookie;
  },
  accept: function() {
    if (typeof navigator.cookieEnabled == 'boolean') {
      return navigator.cookieEnabled;
    }
    Cookie.set('_test', '1');
    return (Cookie.erase('_test') === '1');
  }
};
	
/* Calendar */
function initIntervalCalendar(JsStartDate, StartDate, JsEndDate, EndDate,LangID)
{
	
	var Event = YAHOO.util.Event,
		Dom = YAHOO.util.Dom,
		dialog,
		calendar;
		
	var inTxt = YAHOO.util.Dom.get("StartDate"),
	outTxt = YAHOO.util.Dom.get("EndDate"),
	inDate, outDate, interval;
	
	inTxt.value = StartDate;
	outTxt.value = EndDate;
	
	var showBtn = Dom.get("filter-calendar");
	
	Event.on(showBtn, "click", function() {

		// Lazy Dialog Creation - Wait to create the Dialog, and setup document click listeners, until the first time the button is clicked.
		
		if (!dialog) {

			// Hide Calendar if we click anywhere in the document other than the calendar
			Event.on(document, "click", function(e) {
				var el = Event.getTarget(e);
				var dialogEl = dialog.element;
				/*if (el != dialogEl && !Dom.isAncestor(dialogEl, el) && el != showBtn && !Dom.isAncestor(showBtn, el)) {
					dialog.hide();
				}*/
			});
			
			
			dialog = new YAHOO.widget.Dialog("container", {
				visible:false,
				context:["show", "tl", "bl"],
				buttons:[ {text:"Reset", handler: resetHandler, isDefault:true}, {text:"Close", handler: closeHandler}],
				draggable:false,
				close:true
			});
			
			//dialog.closeHandler(function() {dialog.hide();})

			//dialog.setHeader('Pick A Period');
			dialog.setBody('<div id="cal1Container"></div>');
			dialog.render(document.body);

			dialog.showEvent.subscribe(function() {
				if (YAHOO.env.ua.ie) {
					// Since we're hiding the table using yui-overlay-hidden, we 
					// want to let the dialog know that the content size has changed, when
					// shown
					dialog.fireEvent("changeContent");
				}
			})
		}
		
		// Lazy Calendar Creation - Wait to create the Calendar until the first time the button is clicked.
		if (!calendar) {
			
			
			var currentTime = new Date();
			var month = currentTime.getMonth() + 1;
			var day = currentTime.getDate();
			var year = currentTime.getFullYear();
			var temp = month + "/" + day + "/" + year;
			
			//calendar = new YAHOO.widget.Calendar("cal", {
			calendar = new YAHOO.example.calendar.IntervalCalendar("cal1Container", {
				iframe:false,          // Turn iframe off, since container has iframe support.
				hide_blank_weeks:true,  // Enable, to demonstrate how we handle changing height, using changeContent
				maxdate: currentTime
			});

			
			if (JsStartDate !='' && JsEndDate!='')
			{
				calendar.cfg.setProperty("selected",JsStartDate+"-"+JsEndDate,false); 
			}
			
			setLanguageCalendar(calendar,LangID);
			
			calendar.render();

			// Reset l'interval
			calendar.resetInterval();
			
			calendar.selectEvent.subscribe(function() {
				
				interval = calendar.getInterval();
				
				if (interval.length == 2) {
					
					inDate = interval[0];
					inTxt.value = inDate.getDate() + "/" + (inDate.getMonth() + 1) + "/" + inDate.getFullYear();
		
					if (interval[0].getTime() != interval[1].getTime()) {
						outDate = interval[1];
						outTxt.value = outDate.getDate() + "/" + (outDate.getMonth() + 1) + "/" + outDate.getFullYear();
						dialog.hide();
					} else {
						outTxt.value = "";
					}
				}

			});

			calendar.renderEvent.subscribe(function() {
				// Tell Dialog it's contents have changed, which allows 
				// container to redraw the underlay (for IE6/Safari2)
				dialog.fireEvent("changeContent");
			});
		}

		var seldate = calendar.getSelectedDates();

		if (seldate.length > 0) {
			// Set the pagedate to show the selected date if it exists
			calendar.cfg.setProperty("pagedate", seldate[0]);
			calendar.render();
		}

		dialog.show();
	});
			
	resetHandler = function()
	{
		
		// Reset l'interval
		calendar.resetInterval();
		
		inTxt.value = '';
		outTxt.value = '';
		
		dialog.hide();
	}
	
	closeHandler = function () 
	{
		dialog.hide();
	}

}

/* 
Définit le language du calendrier
*/
function setLanguageCalendar(calendar, lang)
{
	if (lang == 'jp')
	{
		// Correct formats for Japan: yyyy/mm/dd, mm/dd, yyyy/mm
		calendar.cfg.setProperty("MDY_YEAR_POSITION", 1);
		calendar.cfg.setProperty("MDY_MONTH_POSITION", 2);
		calendar.cfg.setProperty("MDY_DAY_POSITION", 3);
		
		calendar.cfg.setProperty("MY_YEAR_POSITION", 1);
		calendar.cfg.setProperty("MY_MONTH_POSITION", 2);
		
		// Date labels for Japanese locale
		calendar.cfg.setProperty("MONTHS_SHORT",   ["1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708"]);
		calendar.cfg.setProperty("MONTHS_LONG",    ["1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708"]);
		calendar.cfg.setProperty("WEEKDAYS_1CHAR", ["\u65E5", "\u6708", "\u706B", "\u6C34", "\u6728", "\u91D1", "\u571F"]);
		calendar.cfg.setProperty("WEEKDAYS_SHORT", ["\u65E5", "\u6708", "\u706B", "\u6C34", "\u6728", "\u91D1", "\u571F"]);
		calendar.cfg.setProperty("WEEKDAYS_MEDIUM",["\u65E5", "\u6708", "\u706B", "\u6C34", "\u6728", "\u91D1", "\u571F"]);
		calendar.cfg.setProperty("WEEKDAYS_LONG",  ["\u65E5", "\u6708", "\u706B", "\u6C34", "\u6728", "\u91D1", "\u571F"]);
		
		calendar.cfg.setProperty("MY_LABEL_YEAR_POSITION",  1);
		calendar.cfg.setProperty("MY_LABEL_MONTH_POSITION",  2);
		calendar.cfg.setProperty("MY_LABEL_YEAR_SUFFIX",  "\u5E74");
		calendar.cfg.setProperty("MY_LABEL_MONTH_SUFFIX",  "");		
	}
	else if(lang == 'fr')
	{
		// Correct formats for Germany: dd.mm.yyyy, dd.mm, mm.yyyy
		calendar.cfg.setProperty("DATE_FIELD_DELIMITER", ".");

		calendar.cfg.setProperty("MDY_DAY_POSITION", 1);
		calendar.cfg.setProperty("MDY_MONTH_POSITION", 2);
		calendar.cfg.setProperty("MDY_YEAR_POSITION", 3);

		calendar.cfg.setProperty("MD_DAY_POSITION", 1);
		calendar.cfg.setProperty("MD_MONTH_POSITION", 2);

		// Date labels for German locale
		calendar.cfg.setProperty("MONTHS_SHORT",   ["Jan", "Fev", "Mars", "Avr", "Mai", "Jun", "Jul", "Aout", "Sep", "Oct", "Nov", "Dec"]);
		calendar.cfg.setProperty("MONTHS_LONG",    ["Janvier", "F\u00E9vrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Ao\u00FBt", "Septembre", "Octobre", "Novembre", "D\u00E9cember"]);
		calendar.cfg.setProperty("WEEKDAYS_1CHAR", ["D", "L", "M", "M", "J", "V", "S"]);
		calendar.cfg.setProperty("WEEKDAYS_SHORT", ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"]);
		calendar.cfg.setProperty("WEEKDAYS_MEDIUM",["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"]);
		calendar.cfg.setProperty("WEEKDAYS_LONG",  ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"]);
	}
}


//	SWFObject v2.2
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();


//  Prototip 1.3.5.1 - 18-05-2008
var Prototip = {
  Version: '1.3.5.1'
};

var Tips = {
  options: {
    className: 'default',      // default class for all tips
	closeButtons: false,       // true | false
	zIndex: 6000               // raise if required
  }
};

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('q.1z(z,{3R:"1.6.0.2",3P:"1.8.1",2N:c(){5.28("25");f.24();t.10(2m,"2j",5.2j)},28:c(A){b((3u 2m[A]=="3s")||(5.2i(2m[A].3k)<5.2i(5["2z"+A]))){3e("37 4c "+A+" >= "+5["2z"+A]);}},2i:c(A){i B=A.40(/31.*|\\./g,"");B=3T(B+"0".3S(4-B.1Z));r A.3J("31")>-1?B-1:B},1H:c(A){b(!25.2T.2R){A=A.1V(c(E,D){i C=q.2f(5)?5:5.e,B=D.3q;b(B!=C&&!$A(C.2E("*")).3m(B)){E(D)}})}r A},1C:c(B){B=$(B);i A=B.3j(),C=[],E=[];A.1p(B);A.20(c(F){b(F!=B&&F.s()){r}C.1p(F);E.1p({1v:F.1u("1v"),1g:F.1u("1g"),Y:F.1u("Y")});F.j({1v:"47",1g:"44",Y:"s"})});i D={N:B.3Z,P:B.3V};C.20(c(G,F){G.j(E[F])});r D},2j:c(){f.30()}});q.1z(f,{Z:[],s:[],24:c(){5.23=5.13},19:(c(A){r{1i:(A?"1N":"1i"),X:(A?"1J":"X"),1N:(A?"1N":"1i"),1J:(A?"1J":"X")}})(25.2T.2R),1f:(c(B){i A=v 3K("3I ([\\\\d.]+)").3H(B);r A?(3E(A[1])<7):U})(3z.3y),2O:c(A){5.Z.1p(A)},1h:c(A){i B=5.Z.3v(c(C){r C.e==$(A)});b(B){B.2M();b(B.Q){B.h.1h();b(f.1f){B.17.1h()}}5.Z=5.Z.2I(B)}},30:c(){5.Z.20(c(A){5.1h(A.e)}.18(5))},2c:c(B){b(B.2e){r}b(5.s.1Z==0){5.23=5.9.13;1U(i A=0;A<5.Z.1Z;A++){5.Z[A].h.j({13:5.9.13})}}B.h.j({13:5.23++});b(B.k){B.k.j({13:5.23})}1U(i A=0;A<5.Z.1Z;A++){5.Z[A].2e=U}B.2e=1y},2Q:c(A){5.27(A);5.s.1p(A)},27:c(A){5.s=5.s.2I(A)},T:c(B,E){B=$(B),E=$(E);i I=q.1z({e:"2C",m:"3i",15:{x:0,y:0}},2X[2]||{});i D=E.2n();D.11+=I.15.x;D.V+=I.15.y;i C=E.38(),A=1I.1P.2w();D.11+=(-1*(C[0]-A[0]));D.V+=(-1*(C[1]-A[1]));i G={e:z.1C(B),m:z.1C(E)},H={e:q.2u(D),m:q.2u(D)};1U(i F 34 H){4a(I[F]){1r"48":H[F][0]+=G[F].N;1w;1r"46":H[F][0]+=(G[F].N/2);1w;1r"45":H[F][0]+=G[F].N;H[F][1]+=(G[F].P/2);1w;1r"2C":H[F][1]+=G[F].P;1w;1r"43":H[F][0]+=G[F].N;H[F][1]+=G[F].P;1w;1r"42":H[F][0]+=(G[F].N/2);H[F][1]+=G[F].P;1w;1r"41":H[F][1]+=(G[F].P/2);1w}}D.11+=-1*(H.e[0]-H.m[0]);D.V+=-1*(H.e[1]-H.m[1]);B.j({11:D.11+"1G",V:D.V+"1G"})}});f.24();i 3Y=3X.3W({24:c(C,D){5.e=$(C);f.1h(5.e);i A=(q.2q(D)||q.2f(D)),B=A?2X[2]||[]:D;5.1j=A?D:2p;5.9=q.1z({O:U,R:f.9.R,14:f.9.3U,1e:!(B.p&&B.p=="1D")?0.12:U,1O:0.3,S:U,1t:U,1s:"1J",T:B.T,15:B.T?{x:0,y:0}:{x:16,y:16},1m:B.T?1y:U,p:"21",m:5.e,u:U,1P:B.T?U:1y},B);5.m=$(5.9.m);b(5.9.O){5.9.O.9=q.1z({2o:25.3O},5.9.O.9||{})}5.2W();b(5.9.S){z.28("3N");5.1q={1g:"3M",3L:1,2l:5.h.2V()}}f.2O(5);5.2U()},2W:c(){5.h=v t("1c",{R:"1X"}).j({1v:"22",13:f.9.13});5.h.2V();b(f.1f){5.17=v t("3G",{R:"17",3F:"3D:U;",3C:0}).j({1v:"22",13:f.9.13-1,3A:0})}b(5.9.O){5.1L=5.1L.1V(5.2S)}5.1B=v t("1c",{R:"1j"});5.u=v t("1c",{R:"u"}).n();b(5.9.14||(5.9.1s.e&&5.9.1s.e=="14")){5.14=v t("a",{3x:"#",R:"2P"})}},2h:c(){b(f.1f){$(1I.26).W(5.17)}b(5.9.O){$(1I.26).W(5.k=v t("1c",{R:"3w"}).n())}i A="h";b(5.9.S){A="o";5.h.W(5.o=v t("1c",{R:"o"}))}5[A].W(5.Q=v t("1c",{R:"Q "+5.9.R}).W(5.1o=v t("1c",{R:"1o"}).W(5.u)));5.Q.W(5.1B).W(v t("1c").j("2L:2K"));$(1I.26).W(5.h);b(!5.9.O){5.1K({u:5.9.u,1j:5.1j})}},1K:c(E){i A=5.Q.1u("Y"),B=5.h.j("P:1x;N:1x;").1u("Y");[5.Q,5.h].1A("j","Y:2J;");5.1o.j("N: 1x;");b(5.9.S){5.o.j("P:1x;N:1x;")}b(E.u){5.u.l().1K(E.u);5.1o.l()}1n{b(!5.14){5.u.n();5.1o.n()}}b(q.2q(E.1j)||q.2f(E.1j)){5.1B.1K(E.1j).W(v t("1c").j("2L:2K;"))}i C={N:z.1C(5.h).N+"1G"},D=[5.h];b(5.9.S){D.1p(5.o)}b(f.1f){D.1p(5.17)}b(5.14){5.u.l().W({V:5.14});5.1o.l()}5.1o.j("N: 3t%;");C.P=2p;5.h.j({Y:B});5.Q.j({Y:A});D.1A("j",C)},2U:c(){5.2g=5.1L.1d(5);5.2H=5.n.1d(5);b(5.9.1m&&5.9.p=="21"){5.9.p="1i"}b(5.9.p==5.9.1s){5.1k=5.2G.1d(5);5.e.10(5.9.p,5.1k)}i C={e:5.1k?[]:[5.e],m:5.1k?[]:[5.m],1B:5.1k?[]:[5.h],14:[],22:[]};i A=5.9.1s.e;5.2d=A||(!5.9.1s?"22":"e");5.1l=C[5.2d];b(!5.1l&&A&&q.2q(A)){5.1l=5.1B.2E(A)}i D={1N:"1i",1J:"X"};$w("l n").20(c(H){i G=H.3r(),F=(5.9[H+"2F"].2s||5.9[H+"2F"]);5[H+"2Y"]=F;b(["1N","1J","1i","X"].3p(F)){5[H+"2Y"]=(f.19[F]||F);5["2s"+G]=z.1H(5["2s"+G])}}.18(5));b(!5.1k){5.e.10(5.9.p,5.2g)}b(5.1l){5.1l.1A("10",5.3o,5.2H)}b(!5.9.1m&&5.9.p=="1D"){5.1Q=5.1g.1d(5);5.e.10("21",5.1Q)}5.2D=5.n.1V(c(G,F){i E=F.3n(".2P");b(E){F.3l();E.3B();G(F)}}).1d(5);b(5.14){5.h.10("1D",5.2D)}b(5.9.p!="1D"&&(5.2d!="e")){5.1T=z.1H(c(){5.1b("l")}).1d(5);5.e.10(f.19.X,5.1T)}i B=[5.e,5.h];5.2b=z.1H(c(){f.2c(5);5.2k()}).1d(5);5.2a=z.1H(5.1t).1d(5);B.1A("10",f.19.1i,5.2b).1A("10",f.19.X,5.2a);b(5.9.O&&5.9.p!="1D"){5.1W=z.1H(5.2B).1d(5);5.e.10(f.19.X,5.1W)}},2M:c(){b(5.9.p==5.9.1s){5.e.1a(5.9.p,5.1k)}1n{5.e.1a(5.9.p,5.2g);b(5.1l){5.1l.1A("1a")}}b(5.1Q){5.e.1a("21",5.1Q)}b(5.1T){5.e.1a("X",5.1T)}5.h.1a();5.e.1a(f.19.1i,5.2b).1a(f.19.X,5.2a);b(5.1W){5.e.1a(f.19.X,5.1W)}},2S:c(C,B){b(!5.Q){5.2h()}5.1g(B);b(5.29){C(B);r}1n{b(5.1M){r}}i D={2A:{1S:1R.1S(B),1Y:1R.1Y(B)}};i A=q.2u(5.9.O.9);A.2o=A.2o.1V(c(F,E){5.1K({u:5.9.u,1j:E.3h});5.1g(D);b(5.k&&!5.k.s()){5.29=1y;5.1M=U;r}(c(){F(E);b(5.k&&5.k.s()){5.l()}5.1b("k");5.k.1h();5.29=1y;5.1M=U}.18(5)).1e(0.3)}.18(5));5.3g=t.l.1e(5.9.1e,5.k);5.h.n();5.1M=1y;(c(){5.3f=v 3Q.3d(5.9.O.3c,A)}.18(5)).1e(5.9.1e)},2B:c(){5.1b("k")},1L:c(A){b(!5.Q){5.2h()}b(!5.9.O){5.1g(A)}b(5.h.s()){r}5.1b("l");5.3b=5.l.18(5).1e(5.9.1e)},1b:c(A){b(5[A+"2Z"]){3a(5[A+"2Z"])}},l:c(){b(5.h.s()&&5.9.S!="39"){r}b(f.1f){5.17.l()}f.2Q(5.h);b(5.9.S){5.o.j({P:z.1C(5.o).P+"1G"});5.Q.n();5.o.n();5.h.l();b(5.1F){1E.2y.33(5.1q.2l).1h(5.1F)}5.1F=1E[1E.2x[5.9.S][0]](5.o,{36:t.l.35(5.Q),1O:5.9.1O,1q:5.1q,32:c(){5.o.j({P:"1x"});5.e.2r("1X:2v")}.18(5)})}1n{5.Q.l();5.h.l();5.e.2r("1X:2v")}},1t:c(A){b(5.9.O){b(5.k&&5.9.p!="1D"){5.k.n()}5.1b("O");5.1M=2p}b(!5.9.1t){r}5.2k();5.4b=5.n.18(5).1e(5.9.1t)},2k:c(){b(5.9.1t){5.1b("1t")}},n:c(){5.1b("l");5.1b("k");b(!5.h.s()){r}b(5.9.S){b(5.1F){1E.2y.33(5.1q.2l).1h(5.1F)}5.1F=1E[1E.2x[5.9.S][1]](5.o,{1O:5.9.1O,1q:5.1q,32:5.2t.18(5)})}1n{5.2t()}},2t:c(){b(f.1f){5.17.n()}b(5.k){5.k.n()}5.h.n();f.27(5.h);5.e.2r("1X:2J")},2G:c(A){b(5.h&&5.h.s()){5.n(A)}1n{5.1L(A)}},1g:c(A){f.2c(5);b(5.9.S){i D=5.o.1u("Y"),E=5.o.1u("1v");5.o.j({Y:"s"}).l()}b(5.9.T){i L=q.1z({15:5.9.15},{e:5.9.T.1B,m:5.9.T.m});f.T(5.h,5.m,L);b(5.k){f.T(5.k,5.m,L)}b(f.1f){f.T(5.17,5.m,L)}}1n{i G=5.m.2n(),K=z.1C(5.h),C=A.2A||{},H={11:((5.9.1m)?G[0]:C.1S||1R.1S(A))+5.9.15.x,V:((5.9.1m)?G[1]:C.1Y||1R.1Y(A))+5.9.15.y};b(!5.9.1m&&5.e!==5.m){i B=5.e.2n();H.11+=-1*(B[0]-G[0]);H.V+=-1*(B[1]-G[1])}b(!5.9.1m&&5.9.1P){i M=1I.1P.2w(),I=1I.1P.49(),F={11:"N",V:"P"};1U(i J 34 F){b((H[J]+K[F[J]]-M[J])>I[F[J]]){H[J]=H[J]-K[F[J]]-2*5.9.15[J=="V"?"x":"y"]}}}H={11:H.11+"1G",V:H.V+"1G"};5.h.j(H);b(5.k){5.k.j(H)}b(f.1f){5.17.j(H)}}b(5.9.S){5.o.j({Y:D,1v:E})}}});z.2N();',62,261,'|||||this||||options||if|function||element|Tips||wrapper|var|setStyle|loader|show|target|hide|effectWrapper|showOn|Object|return|visible|Element|title|new||||Prototip||||||||||||||width|ajax|height|tooltip|className|effect|hook|false|top|insert|mouseout|visibility|tips|observe|left||zIndex|closeButton|offset||iframeShim|bind|useEvent|stopObserving|clearTimer|div|bindAsEventListener|delay|fixIE|position|remove|mouseover|content|eventToggle|hideTargets|fixed|else|toolbar|push|queue|case|hideOn|hideAfter|getStyle|display|break|auto|true|extend|invoke|tip|getHiddenDimensions|click|Effect|activeEffect|px|capture|document|mouseleave|update|showDelayed|ajaxContentLoading|mouseenter|duration|viewport|eventPosition|Event|pointerX|eventCheckDelay|for|wrap|ajaxHideEvent|prototip|pointerY|length|each|mousemove|none|zIndexTop|initialize|Prototype|body|removeVisible|require|ajaxContentLoaded|activityLeave|activityEnter|raise|hideElement|highest|isElement|eventShow|build|convertVersionString|unload|cancelHideAfter|scope|window|cumulativeOffset|onComplete|null|isString|fire|event|afterHide|clone|shown|getScrollOffsets|PAIRS|Queues|REQUIRED_|ajaxPointer|ajaxHide|bottomLeft|buttonEvent|select|On|toggle|eventHide|without|hidden|both|clear|deactivate|start|add|close|addVisibile|IE|ajaxShow|Browser|activate|identify|setup|arguments|Action|Timer|removeAll|_|afterFinish|get|in|curry|beforeStart|Lightview|cumulativeScrollOffset|appear|clearTimeout|showTimer|url|Request|throw|ajaxTimer|loaderTimer|responseText|topLeft|ancestors|Version|stop|member|findElement|hideAction|include|relatedTarget|capitalize|undefined|100|typeof|find|prototipLoader|href|userAgent|navigator|opacity|blur|frameBorder|javascript|parseFloat|src|iframe|exec|MSIE|indexOf|RegExp|limit|end|Scriptaculous|emptyFunction|REQUIRED_Scriptaculous|Ajax|REQUIRED_Prototype|times|parseInt|closeButtons|clientHeight|create|Class|Tip|clientWidth|replace|leftMiddle|bottomMiddle|bottomRight|absolute|rightMiddle|topMiddle|block|topRight|getDimensions|switch|hideAfterTimer|requires'.split('|'),0,{}));