function initTargBlk()
{
	$('.fondationalstom a').click(function()
	{
		this.target = "_blank";
	});
}

function initCycle()
{
	$('#photoliste').cycle({ 
		fx:     'fade', 
		speed:  1000, 
		timeout: 0, 
		next:   '#next', 
		prev:   '#prev' 
	});
}

function initScrollTo()
{	
	var hasContent = $('.content').length;
	var hasItems = $('.items').length;

	if (hasContent > 0 && hasItems > 0)
	{	
		var hauteur = $('.content').css('height').replace('px', '');
		var hauteurmax = $('.items').css('height').replace('px', '');
		var isactive = eval(hauteur - hauteurmax);
		
		if (hauteur!="undefined" && hauteurmax!="undefined" && isactive > 0)
		{
			$('.next').click(function()
			{
				$('.items').scrollTo('+=250px', 800);
			});
			
			$('.prev').click(function()
			{
				$('.items').scrollTo('-=250px', 800);
			});	
			
			$('.next').show();
			$('.prev').show();
		}
	}
}

function updateCad()
{
	$.get("?page=my-cad", function(data){
		$("#cadinfo").html(data);
		$("#cadinfo a[rel^='prettyPopin']").prettyPopin({width: 900, height:450});
		$("#cadinfo").show();
	});
}

function initPopin()
{
	$("a[rel^='prettyPopin']").prettyPopin({width: 900, height:450});
}

function refreshPopin()
{
	$(".prettyContent-container a.refreshpopin").click(function()
	{
		$.post($(this).attr("href"), function(data)
		{
			$(".prettyContent-container").html(data);
			refreshPopin();
		});
		return false;
	});
}

function initMedia()
{
	$('.media').media(
	{
		width: 320,
		height: 240,
		caption: false,
		attrs: { flashvars: 'autostart=true' },
    	params: { flashvars: 'autostart=true' }
	});	
}

function initAlstom()
{
	$('.logoalstom').click(function()
	{
		$(".fondationalstom").fadeIn("slow");
		return false;
	});
	
	$('.fondationalstom .close a').click(function()
	{
		$(".fondationalstom").fadeOut("slow");
		return false;
	});
}

function initOpenInNewWindow()
{
	$('.newwindow').click(function()
	{
		var url = $(this).attr('href');
		window.open(url);
		return false;
	});
}