$(document).ready( function(){

$('.numbersonly').keyup(function () {
    this.value = this.value.replace(/[^0-9\.]/g,'');
});

$('.photo_maxi').css('display','block');

$('#carouselthreed').carousel3D({
        speed: 900,
        perspectiveZoom: 75,
        sideOffset: 55,
        topOffset:35,
        secondaryOpacity: 0.5,
        emClass:'photo_mini'
    });
var premiere_rubrique_budget=$(".photos_mini li:eq(1)").attr('class');
if(premiere_rubrique_budget!=""){
$('div.'+premiere_rubrique_budget).show();
}
});

function changePhoto(elem){
	var titre=$(elem).parents('li').children('a').children('span').html();
	var image=$(elem).parents('li').children('a').attr('href');
	var rubrique=$(elem).parents('li').attr('class');
	$('.photo_maxi li.photo_maxi_image').stop(true,true);
	$('.titre_robe span').stop(true,true);
	$('.titre_robe span').fadeOut("fast",function (){
		//$('.titre_robe img').css("opacity",0);
		//$('.titre_robe img').css("display","none");
		$('.photo_maxi li.photo_maxi_image').fadeOut("fast",function (){
			//$('.photo_maxi li img').css("opacity",0);
			//$('.photo_maxi li img').css("display","none");
			$('.titre_robe span').html(titre);
			$('.photo_maxi li.photo_maxi_image').html('<img src="'+image+'" alt="" style="display:none;"/>');
			$('.photo_maxi li.photo_maxi_image img').bind('load',function(){loadedPhoto(this);});
			if(rubrique!=""){
			$('div.createur:not(.'+rubrique+')').hide();
			$('div.'+rubrique).show();
			}
		});
	});
}

function loadedPhoto(elem){
	$(elem).css('display','block');
	$(elem).parent('li.photo_maxi_image').fadeIn("normal",function (){
		$('.titre_robe span').fadeIn("normal");							  
	});
}


