
// Pour IE / menu
var sfHover = function() {
	var sfEls = document.getElementById("menu1").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover = function() {
			this.className+=" sfhover"
		}
		sfEls[i].onmouseout = function() {
			this.className = this.className.replace(new RegExp(' sfhover\\b'), "");
		}
	}
}
if (window.attachEvent) {
	window.attachEvent("onload", sfHover);
}

/**
 * jQuery implementation of the Prototype absolutize method
 *
 * @url		http://blog.carbonfive.com/2008/09/javascript-ajax/absolutize-for-jquery
 **/
jQuery.fn.absolutize = function()
{
  return this.each(function()
  {
    var element = jQuery(this);
    if (element.css('position') == 'absolute')
    {
      return element;
    }

    var offsets = element.offset();
    var top = offsets.top;
    var left = offsets.left;
    var width = element[0].clientWidth;
    var height = element[0].clientHeight;

    element._originalLeft = left - parseFloat(element.css("left") || 0);
    element._originalTop = top - parseFloat(element.css("top") || 0);
    element._originalWidth = element.css("width");
    element._originalHeight = element.css("height");

    element.css("position", "absolute");
    element.css("top", top + 'px');
    element.css("left", left + 'px');
    element.css("width", width + 'px');
    element.css("height", height + 'px');
    return element;

  });
}

var expandText = {fr: 'Lire la suite', en : 'Read more'};

$(document).ready(function () {

	$('.list-infos').expander({
		slicePoint : 500,
		expandText : expandText[langShort],
		//expandEffect : 'slideDown',
		expandSpeed : 'slow',
		userCollapse : false
	});

	// Coins arrondis IE -> pas concluant avec Effect.corner de corner.js
	if (jQuery.browser.msie) {
		$("#footer-bottom").append('<div id="inner">&nbsp;<br/></div>').css("position", "relative")
		$("#inner").corner("round bottom 10px").parent().css('padding', '1px').css('padding-top', '0').corner("round bottom 10px") // .css("height", "20px")
	}

	$('#contact-us').bind('click', function (event) {
		$(this).fadeOut("fast", function () {
			$("#contact").remove();
			$("#accordion").slideDown("slow")
		})
	})

	$('#search').bind('blur', function (event) {
		if ($(this).attr('value')  == "")
			$(this).attr('value', $(this).attr('defaultValue'))
	});

	$('#search').bind('focus', function (event) {
		if ($(this).attr('value') == $(this).attr('defaultValue'))
			$(this).attr('value', "")
	});

	/*if (Object.isElement($('contact-us'))) {
		//$('accordion').hide();

		Event.observe($('contact-us'), 'click', function(ev){
			Effect.Fade('contact', {
				afterFinish : function () {
					$('contact').remove();
					Effect.SlideDown('accordion', {
						duration: 0.8333,
						transition: Effect.Transitions.sinoidal
					});
				}
			});
		});

		Event.observe($('search'), 'blur', function(){
			if (this.value == "")
				this.value = this.defaultValue
		});

		Event.observe($('search'), 'focus', function(){
			if (this.value == this.defaultValue)
				this.value = ""

		});
	}*/
});
