/***********************/
/****** VARIABLES ******/
/***********************/


/**************************/
/****** INTERMEDIAIRE *******/
/**************************/

$(document).ready(function(){
	
	$("#lien_sun").hover(function(){
		$("#sun").attr("style", "display:block;visibility:visible;");
		$("#alu").attr("style", "display:none;visibility:hidden;");
		$("#sombrano").attr("style", "display:none;visibility:hidden;");
	});
	$("#lien_alu").hover(function(){
		$("#alu").attr("style", "display:block;visibility:visible;");
		$("#sun").attr("style", "display:none;visibility:hidden;");
		$("#sombrano").attr("style", "display:none;visibility:hidden;");
	});
	$("#lien_sombrano").hover(function(){
		$("#sombrano").attr("style", "display:block;visibility:visible;");
		$("#sun").attr("style", "display:none;visibility:hidden;");
		$("#alu").attr("style", "display:none;visibility:hidden;");
	});

});



/***********************/
/****** FONCTIONS ******/
/***********************/

function getElementsByName_iefix(tag, name) {
         
         var elem = document.getElementsByTagName(tag);
         var arr = new Array();
         for(i = 0,iarr = 0; i < elem.length; i++) {
                  att = elem[i].getAttribute("name");
                  if(att == name) {
                           arr[iarr] = elem[i];
                           iarr++;
                  }
         }
         return arr;
}

/**************************/
/****** CARROUSSELS *******/
/**************************/

/* CAROUSEL PAGE D'ACCUEIL */
jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        vertical: true,
        scroll: 1

    });
});

/* CAROUSEL MENU PRODUITS */
jQuery(document).ready(function() {
    jQuery('#menu_gamme').jcarousel({
        scroll: 1

    });
});		    	


/* CAROUSEL TYPE DE TOILE */
jQuery().ready(function(){
	// simple accordion
	jQuery('#list1b').accordion({
		autoheight: false
	});
});

/* VIGNETTE & IMAGES PRODUITS */
$(document).ready(function(){
	$("#thumbnail li a").click(function(){
		$("#large img").hide().attr({"src": $(this).attr("href"), "title": $("> img", this).attr("title")});
		$("#large h2").html($("> img", this).attr("title"));
		return false;
	});
	$("#large>img").load(function(){$("#large>img:hidden").fadeIn("slow")});
});


/*****************************************/
/****** CHOIX DES COLORIS DE TOILE *******/
/*****************************************/

/* LISTE TOILE PAR COULEURS */
$(document).ready(function(){ 
	$("#choix_couleur").click(function () {
		if ($("#resultat_decli").is(":hidden")) {
			$("#resultat_decli").fadeIn();
		}else {
			$("#resultat_decli").fadeOut();
		}
	});	
});

/* CHOIX D'UNE COULEUR */
function choixCouleur(obj){
	var myCouleurs = getElementsByName_iefix("li","choix_couleur");	
	var doc=document.location.href;
	if(doc.match("1")=="1" || doc.match("2")=="2" || doc.match("3")=="3" || doc.match("3")=="3" || doc.match("4")=="4" || doc.match("5")=="5" || doc.match("6")=="6"){
	for(var i=0; i<myCouleurs.length;i++){
		myCouleurs[i].style.backgroundColor = '#cbe2e8';
	}
	}
	else{
	for(var i=0; i<myCouleurs.length;i++){
		myCouleurs[i].style.backgroundColor = '#ececec';
	}
	}

	obj.style.backgroundColor = '#f27d66';
	$("#id_toile").attr("value", obj.id);
};

/* VALIDATION CHOIX COLORI TOILES */
function valideChoixColoriToile(obj){
		var id_toile = $("#id_toile").val();
		if(id_toile != '0' && id_toile != ''){
			obj.form.submit();
		}
		else
		{
			alert("Veuillez choisir une toile");
		}
}


/******************************/
/****** ACHAT DE STORES *******/
/******************************/

/* CALCUL DES DIMENSIONS */
function choixDesDimensions(obj) {
  	var value = $(obj).val();
  	   	if((value >= 190) && (value <= 240)){
  	   			$("#150").attr("disabled", false);
  	   			$("#200").attr("disabled", false);
  	   			$("#250").attr("disabled", true);
  	   			$("#300").attr("disabled", true);
  	   			$("#350").attr("disabled", true);
  	   	}
  	   	else if((value >= 241) && (value <= 358)){
  	   			$("#150").attr("disabled", false);
  	   			$("#200").attr("disabled", false);
  	   			$("#250").attr("disabled", false);
  	   			$("#300").attr("disabled", false);
  	   			$("#350").attr("disabled", true);
  	   	}
  	   	else if((value >= 359) && (value <= 476)){
  	   			$("#150").attr("disabled", false);
  	   			$("#200").attr("disabled", false);
  	   			$("#250").attr("disabled", false);
  	   			$("#300").attr("disabled", false);
  	   			$("#350").attr("disabled", false);
  	   	}
  	   	else if((value >= 477) && (value <= 592)){
  	   			$("#150").attr("disabled", false);
  	   			$("#200").attr("disabled", false);
  	   			$("#250").attr("disabled", false);
  	   			$("#300").attr("disabled", false);
  	   			$("#350").attr("disabled", false);
  	   	}
  	   	else
  	   	{
  	   		$("#150").attr("disabled", true);
  	   		$("#200").attr("disabled", true);
  	   		$("#250").attr("disabled", true);
  	   		$("#300").attr("disabled", true);
  	   		$("#350").attr("disabled", true);
  	   	}
  	   	
} 
 
/* CHOIX DIMENSIONS */
$(document).ready(function(){ 
calculPrixDimension();  
$("#largeur").keyup(function(event){
	$("input[type=radio]").attr("checked", "");
	choixDesDimensions(this)
  	calculPrixDimension();   	
    }); 
$("#largeur").blur(function(event){
	$("input[type=radio]").attr("checked", "");
	choixDesDimensions(this)
  	calculPrixDimension();   	
    });     
});

/* VALIDATION DIMENSIONS */
function valideDimensions(obj){
	var largeur = $("#largeur").val();
	if((largeur >= '190') && (largeur <= '592')){
		var n = $("input:checked").length;
		if(n == 1){
			obj.form.submit();
		}
		else
		{
			alert("Veuillez choisir une projection");
		}
	}
	else
	{
		alert("Veuillez choisir une largeur entre 190 et 592cm");
	}
}

/* VALIDATION OPTIONS */
function valideOptions(obj){
	var n = $("input:checked").length;
	if(n == 5){
		$("#prix_estim").val($("#prix_exact").text());
		obj.form.submit();
	}
	else
	{
		alert("Veuillez choisir chaque option");
	}
}

/* CALCUL DU PRIX DES DIMENSIONS */
function calculPrixDimension(){
var largeur = $("#largeur").val();
	if((largeur >= '190') && (largeur <= '592')){
		var projection = $("input:checked").length;
		if(projection == 1){
			if((largeur>='190') && (largeur<='240'))
			{
				switch($("input:checked").val()){
					case '150':
						$("#estimation").text('600 €');
						$("#prix_estim").val('600');
					break;
					case '200':
						$("#estimation").text('630 €');
						$("#prix_estim").val('630');
					break;
				}
			}
			if((largeur>='241') && (largeur<='358'))
			{
				switch($("input:checked").val()){
					case '150':
						$("#estimation").text('660 €');
						$("#prix_estim").val('660');
					break;
					case '200':
						$("#estimation").text('700 €');
						$("#prix_estim").val('700');
					break;
					case '250':
						$("#estimation").text('760 €');
						$("#prix_estim").val('760');
					break;
					case '300':
						$("#estimation").text('800 €');
						$("#prix_estim").val('800');
					break;
				}
			}
			if((largeur>='359') && (largeur<='476'))
			{
				switch($("input:checked").val()){
					case '150':
						$("#estimation").text('810 €');
						$("#prix_estim").val('810');
					break;
					case '200':
						$("#estimation").text('850 €');
						$("#prix_estim").val('850');
					break;
					case '250':
						$("#estimation").text('900 €');
						$("#prix_estim").val('900');
					break;
					case '300':
						$("#estimation").text('950 €');
						$("#prix_estim").val('950');
					break;
					case '350':
						$("#estimation").text('1350 €');
						$("#prix_estim").val('1350');
					break;
				}
			}
			if((largeur>='477') && (largeur<='592'))
			{
				switch($("input:checked").val()){
					case '150':
						$("#estimation").text('900 €');
						$("#prix_estim").val('900');
					break;
					case '200':
						$("#estimation").text('950 €');
						$("#prix_estim").val('950');
					break;
					case '250':
						$("#estimation").text('1000 €');
						$("#prix_estim").val('1000');
					break;
					case '300':
						$("#estimation").text('1100 €');
						$("#prix_estim").val('1100');
					break;
					case '350':
						$("#estimation").text('1520 €');
						$("#prix_estim").val('1520');
					break;
				}
			}
		}
	}
	
}

/* CALCUL DU PRIX DES OPTIONS */
function calculPrixOption(){
		if($("#bouton").attr("checked") == true){
			$("#prix_exact").text(parseInt($("#prix_estim").val())+350);
			if($("#avec").attr("checked") == true){
				if(($("#largeur_save").text() >='190') && ($("#largeur_save").text() <='240')){
					if($("#plafond").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+625);
					else if($("#facade").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+580);
				}
				else if(($("#largeur_save").text() >='241') && ($("#largeur_save").text() <='358')){
					if($("#plafond").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+655);
					else if($("#facade").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+610);	
				}
				else if(($("#largeur_save").text() >='359') && ($("#largeur_save").text() <='476')){
					if($("#plafond").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+665);
					else if($("#facade").attr("checked") == true)	
						$("#prix_exact").text(parseInt($("#prix_estim").val())+620);	
				}
				else if(($("#largeur_save").text() >='477') && ($("#largeur_save").text() <='592')){
					if($("#plafond").attr("checked") == true)	
						$("#prix_exact").text(parseInt($("#prix_estim").val())+755);
					else if($("#facade").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+710);
				}
			}
		  else if($("#sans").attr("checked") == true){
					if($("#plafond").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+395);
					else if($("#facade").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+350);
		  }			
		}
		else if($("#telecommande").attr("checked") == true){
			$("#prix_exact").text(parseInt($("#prix_estim").val())+380);
			if($("#avec").attr("checked") == true){
				if(($("#largeur_save").text() >='190') && ($("#largeur_save").text() <='240')){
					if($("#plafond").attr("checked") == true)	
						$("#prix_exact").text(parseInt($("#prix_estim").val())+655);
					else if($("#facade").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+610);
				}
				else if(($("#largeur_save").text() >='241') && ($("#largeur_save").text() <='358')){
					if($("#plafond").attr("checked") == true)	
						$("#prix_exact").text(parseInt($("#prix_estim").val())+685);
					else if($("#facade").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+640);
				}
				else if(($("#largeur_save").text() >='359') && ($("#largeur_save").text() <='476')){
					if($("#plafond").attr("checked") == true)	
						$("#prix_exact").text(parseInt($("#prix_estim").val())+695);
					else if($("#facade").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+650);
				}
				else if(($("#largeur_save").text() >='477') && ($("#largeur_save").text() <='592')){
					if($("#plafond").attr("checked") == true)	
						$("#prix_exact").text(parseInt($("#prix_estim").val())+785);
					else if($("#facade").attr("checked") == true)	
						$("#prix_exact").text(parseInt($("#prix_estim").val())+740);
				}
			}
			else if($("#sans").attr("checked") == true){
					if($("#plafond").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+425);
					else if($("#facade").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+380);
		  }	
		}
		else if($("#manivelle").attr("checked") == true){
			$("#prix_exact").text(parseInt($("#prix_estim").val()));
			if($("#avec").attr("checked") == true){
				if(($("#largeur_save").text() >='190') && ($("#largeur_save").text() <='240')){
					if($("#plafond").attr("checked") == true)	
						$("#prix_exact").text(parseInt($("#prix_estim").val())+275);
					else if($("#facade").attr("checked") == true)		
						$("#prix_exact").text(parseInt($("#prix_estim").val())+230);
				}
				else if(($("#largeur_save").text() >='241') && ($("#largeur_save").text() <='358')){
					if($("#plafond").attr("checked") == true)	
						$("#prix_exact").text(parseInt($("#prix_estim").val())+305);
					else if($("#facade").attr("checked") == true)	
						$("#prix_exact").text(parseInt($("#prix_estim").val())+260);
				}
				else if(($("#largeur_save").text() >='359') && ($("#largeur_save").text() <='476')){
					if($("#plafond").attr("checked") == true)	
						$("#prix_exact").text(parseInt($("#prix_estim").val())+315);
					else if($("#facade").attr("checked") == true)		
						$("#prix_exact").text(parseInt($("#prix_estim").val())+270);
				}
				else if(($("#largeur_save").text() >='477') && ($("#largeur_save").text() <='592')){
					if($("#plafond").attr("checked") == true)	
						$("#prix_exact").text(parseInt($("#prix_estim").val())+405);
					else if($("#facade").attr("checked") == true)			
						$("#prix_exact").text(parseInt($("#prix_estim").val())+360);
				}
			}
			else if($("#sans").attr("checked") == true){
					if($("#plafond").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val())+45);
					else if($("#facade").attr("checked") == true)
						$("#prix_exact").text(parseInt($("#prix_estim").val()));
		  }	
			 
		}
}



/******************************/
/****** ACHAT DE TOILES *******/
/******************************/


/* CHOIX DIMENSIONS TOILE */
$(document).ready(function(){ 
calculPrixDimension();  
$("#largeur_t").keyup(function(event){
	var value = $(this).val();
		if(parseInt(value) > 1168){
			$("#largeur_t").val('');
			alert("Veuillez choisir une largeur inférieure à 1168cm");
		}	
    }); 
$("#largeur_t").blur(function(event){
	var value = $(this).val();
		if(parseInt(value) > 1168){
			$("#largeur_t").val('');
			alert("Veuillez choisir une largeur inférieure à 1168cm");
		}	
    });    
});

/* VALIDATION DIMENSIONS TOILES */
function valideDimensionsToiles(obj){
		var largeur_t = $("#largeur_t").val();
		var n = $("input[type=radio]:checked").length;
		if(n == 1 && largeur_t > 0 && largeur_t < 1168){
			obj.form.submit();
		}
		else
		{
			alert("Veuillez choisir une largeur et une projection");
		}
}

/* CHOIX DIMENSIONS TOILES*/
$(document).ready(function(){ 
calculPrixDimensionToile();  
$("#largeur_t").keyup(function(event) {
  calculPrixDimensionToile();   	
    });   
});


/* CALCUL DU PRIX DES DIMENSIONS TOILE */
function calculPrixDimensionToile(){
var largeur_t = parseInt($("#largeur_t").val());
	if((largeur_t >= 1) && (largeur_t <= 1168)){
		var nblargeur = $("input:checked").length;
		if(nblargeur == 1){
			var coef=0;
			var avancee = parseInt($("input:checked").val());
			
			if((largeur_t>=1) && (largeur_t<=113)){
				coef = 1;}
			if((largeur_t>=114) && (largeur_t<=229)){
				coef = 2;}
			if((largeur_t>=230) && largeur_t<=347){
				coef = 3;}
			if((largeur_t>=348) && (largeur_t<=464)){
				coef = 4;}
			if((largeur_t>=465) && (largeur_t<=582)){
				coef = 5;}
			if((largeur_t>=583) && (largeur_t<=695)){
				coef = 6;}
			if((largeur_t>=696) && (largeur_t<=817)){
				coef = 7;}
			if((largeur_t>=818) && (largeur_t<=933)){
				coef = 8;}
			if((largeur_t>=934) && (largeur_t<=1051)){
				coef = 9;}
			if((largeur_t>=1052) && (largeur_t<=1168)){
				coef = 10;}
			
			$("#estimation").text(parseInt(Math.round(((((avancee+37)*20*coef)/(100))+20)*1.196))+" €");
			$("#prix_estim").val(parseInt(Math.round(((((avancee+37)*20*coef)/(100))+20)*1.196)));
	
		}
	}
}


/***************************************/
/****** ACHAT D'ABRI DE TERRASSE *******/
/***************************************/


/* VALIDATION DIMENSIONS ABRI */
function valideDimensionsAbri(obj){
		var n = $("input:checked").length;
		if(n == 1){
			obj.form.submit();
		}
		else
		{
			alert("Veuillez choisir une dimension");
		}
}

/* VALIDATION OPTIONS ABRI */
function valideOptionsAbri(obj){
	var n = $("input:checked").length;
	if(n == 3){
		$("#prix_estim").val($("#prix_exact").text());
		obj.form.submit();
	}
	else
	{
		alert("Veuillez choisir chaque option");
	}
}

/* CALCUL DU PRIX DES DIMENSIONS ABRI */
function calculPrixDimensionAbri(){
	var largeur_projection = $("input:checked").val();
	if(largeur_projection == '358_150'){
		$("#estimation").text('1600 €');
		$("#prix_estim").val('1600');
	}
	else if(largeur_projection == '358_200'){
		$("#estimation").text('1710 €');
		$("#prix_estim").val('1710');
	}
	else if(largeur_projection == '478_150'){
		$("#estimation").text('1790 €');
		$("#prix_estim").val('1790');
	}
	else if(largeur_projection == '478_200'){
		$("#estimation").text('1920 €');
		$("#prix_estim").val('1920');
	}
}

$(document).ready(function(){ 
calculPrixDimensionAbri();  
	$("input").click(function(event) {
		calculPrixDimensionAbri();
	})
});

/* CALCUL DU PRIX DES OPTIONS ABRI */
function calculPrixOptionAbri(){
		if($("#avec_pied").attr("checked") == true){
			if($("#avec").attr("checked") == true){
				if(($("#largeur_save").text() =='358'))
					$("#prix_exact").text(parseInt($("#prix_estim").val())+870);
				else if((parseInt($("#largeur_save").text()) >= 478))
					$("#prix_exact").text(parseInt($("#prix_estim").val())+920);
			}
			else if($("#sans").attr("checked") == true){
				$("#prix_exact").text(parseInt($("#prix_estim").val())+320);
			}
		}
		else if($("#pied_t").attr("checked") == true){
			if($("#avec").attr("checked") == true){
				if(($("#largeur_save").text() =='358'))
					$("#prix_exact").text(parseInt($("#prix_estim").val())+870);
				else if((parseInt($("#largeur_save").text()) >= 478))
					$("#prix_exact").text(parseInt($("#prix_estim").val())+920);
			}
			else if($("#sans").attr("checked") == true){
				$("#prix_exact").text(parseInt($("#prix_estim").val())+320);
			} 
		}
		else if($("#sans_pied").attr("checked") == true){
			if($("#avec").attr("checked") == true){
				if(($("#largeur_save").text() =='358'))
					$("#prix_exact").text(parseInt($("#prix_estim").val())+550);
				else if((parseInt($("#largeur_save").text()) >= 478))
					$("#prix_exact").text(parseInt($("#prix_estim").val())+600);
			}
			else if($("#sans").attr("checked") == true){
				$("#prix_exact").text(parseInt($("#prix_estim").val()));
			} 
		}
}


/****************************************/
/****** ACHAT DE STORE BRISE VENT *******/
/****************************************/

/* VALIDATION DIMENSIONS STORE BRISE */
function valideDimensionsStoreBrise(obj){
		var n = $("input:checked").length;
		if(n == 1){
			obj.form.submit();
		}
		else
		{
			alert("Veuillez choisir une dimension");
		}
}

/* CALCUL DU PRIX DES DIMENSIONS STORE BRISE */
function calculPrixDimensionStoreBrise(){
	var largeur_projection = $("input:checked").val();
	if(largeur_projection == '300_200'){
		$("#estimation").text('850 €');
		$("#prix_estim").val('850');
	}
	else if(largeur_projection == '400_200'){
		$("#estimation").text('950 €');
		$("#prix_estim").val('950');
	}
}

$(document).ready(function(){ 
calculPrixDimensionStoreBrise();  
	$("input").click(function(event) {
		calculPrixDimensionStoreBrise();
	})
});



/***************************************/
/****** ACHAT STORE BANNE COFFRE *******/
/***************************************/

/* CALCUL DES DIMENSIONS */
function choixDesDimensionsBanne(obj) {
  	var value = $(obj).val();
  	   	if((value >= 283) && (value <= 476)){
  	   			$("#150").attr("disabled", false);
  	   			$("#200").attr("disabled", false);
  	   			$("#250").attr("disabled", false);
  	   			$("#300").attr("disabled", false);
  	   			$("#350").attr("disabled", true);
  	   	}
  	   	else if((value >= 477) && (value <= 592)){
  	   			$("#150").attr("disabled", false);
  	   			$("#200").attr("disabled", false);
  	   			$("#250").attr("disabled", false);
  	   			$("#300").attr("disabled", false);
  	   			$("#350").attr("disabled", false);
  	   	}
   	   	else
  	   	{
  	   		$("#150").attr("disabled", true);
  	   		$("#200").attr("disabled", true);
  	   		$("#250").attr("disabled", true);
  	   		$("#300").attr("disabled", true);
  	   		$("#350").attr("disabled", true);
  	   	}
  	   	
} 

/* VALIDATION DIMENSIONS BANNE */
function valideDimensionsBanne(obj){
	var largeur = $("#largeur_b").val();
	if((largeur >= '283') && (largeur <= '592')){
		var n = $("input:checked").length;
		if(n == 1){
			obj.form.submit();
		}
		else
		{
			alert("Veuillez choisir une projection");
		}
	}
	else
	{
		alert("Veuillez choisir une largeur entre 358 et 592cm");
	}
}

/* VALIDATION OPTIONS BANNE */
function valideOptionsBanne(obj){
	var n = $("input:checked").length;
	if(n == 2){
		$("#prix_estim").val($("#prix_exact").text());
		obj.form.submit();
	}
	else
	{
		alert("Veuillez choisir chaque option");
	}
}

/* CALCUL DU PRIX DES DIMENSIONS BANNE */
function calculPrixDimensionBanne(){
var largeur = $("#largeur_b").val();
	if((largeur >= '283') && (largeur <= '592')){
		var projection = $("input:checked").length;
		if(projection == 1){
			if((largeur>='283') && (largeur<='476'))
			{
				switch($("input:checked").val()){
					case '150':
						$("#estimation").text('1600 €');
						$("#prix_estim").val('1600');
					break;
					case '200':
						$("#estimation").text('1726 €');
						$("#prix_estim").val('1726');
					break;
					case '250':
						$("#estimation").text('1754 €');
						$("#prix_estim").val('1754');
					break;
					case '300':
						$("#estimation").text('1819 €');
						$("#prix_estim").val('1819');
					break;
					case '350':
						$("#estimation").text('1892 €');
						$("#prix_estim").val('1892');
					break;
				}
			}
			if((largeur>='477') && (largeur<='592'))
			{
				switch($("input:checked").val()){
					case '150':
						$("#estimation").text('1769 €');
						$("#prix_estim").val('1769');
					break;
					case '200':
						$("#estimation").text('1906 €');
						$("#prix_estim").val('1906');
					break;
					case '250':
						$("#estimation").text('1947 €');
						$("#prix_estim").val('1947');
					break;
					case '300':
						$("#estimation").text('2023 €');
						$("#prix_estim").val('2023');
					break;
					case '350':
						$("#estimation").text('2104 €');
						$("#prix_estim").val('2104');
					break;
				}
			}
		}
	}
	
}


/* CHOIX DIMENSIONS */
$(document).ready(function(){ 
calculPrixDimensionBanne();  
$("#largeur_b").keyup(function(event){
	$("input[type=radio]").attr("checked", "");
	choixDesDimensionsBanne(this)
  	calculPrixDimensionBanne();   	
    }); 
$("#largeur_b").blur(function(event){
	$("input[type=radio]").attr("checked", "");
	choixDesDimensionsBanne(this)
  	calculPrixDimensionBanne();   	
    });     
});


/* CALCUL DU PRIX DES OPTIONS BANNE */
function calculPrixOptionBanne(){
		if($("#bouton").attr("checked") == true){
			$("#prix_exact").text(parseInt($("#prix_estim").val())+350);
		}
		else if($("#telecommande").attr("checked") == true){
				$("#prix_exact").text(parseInt($("#prix_estim").val())+380);
		} 
	
}

/****************************************/
/****** ACHAT DE PARASOL ALU *******/
/****************************************/

/* VALIDATION DIMENSIONS ALU  */
function valideDimensionsAlu(obj){
		var n = $("input[name=dimensions]:checked").length;
		if(n == 1){
			var m = $("input[name=type_tissu]:checked").length;
			if(m == 1){
				obj.form.submit();
			}
			else
			{
				alert("Veuillez choisir un type de toile");
			}
		}
		else
		{
			alert("Veuillez choisir une dimension");
		}
}

/* CALCUL DU PRIX DES DIMENSIONS ALU */
function calculPrixDimensionAlu(){
	var dimensions = $("input[name=dimensions]:checked").val();
	var type_tissu = $("input[name=type_tissu]:checked").val();
	if(type_tissu == 'polypropylene'){
		if(dimensions == 'carree_240_240'){
			$("#estimation").text('226 €');
			$("#prix_estim").val('226');
		}
		else if(dimensions == 'rond_270'){
			$("#estimation").text('184 €');
			$("#prix_estim").val('184');
		}
	}
	else if(type_tissu == 'dickson'){
		if(dimensions == 'carree_240_240'){
			$("#estimation").text('412 €');
			$("#prix_estim").val('412');
		}
		else if(dimensions == 'rond_270'){
			$("#estimation").text('359 €');
			$("#prix_estim").val('359');
		}
	}
	else if(type_tissu == 'sunbrella'){
		if(dimensions == 'carree_240_240'){
			$("#estimation").text('539 €');
			$("#prix_estim").val('539');
		}
		else if(dimensions == 'rond_270'){
			$("#estimation").text('444 €');
			$("#prix_estim").val('444');
		}
	}
}

$(document).ready(function(){ 
calculPrixDimensionAlu();  
	$("input").click(function(event) {
		calculPrixDimensionAlu();
	})
});

/* VALIDATION OPTIONS */
function valideOptionsAlu(obj){
	var n = $("input:checked").length;
	if(n == 3){
		$("#prix_estim").val($("#prix_exact").text());
		obj.form.submit();
	}
	else
	{
		alert("Veuillez choisir chaque option");
	}
}

/* CALCUL DU PRIX DES PARASOL ALU */
function calculPrixOptionAlu(){
	var fixation = $("input[name=fixation]:checked").val();
	var protection = $("input[name=protection]:checked").val();
	var eclairage = $("input[name=eclairage]:checked").val();
	
	var prix_fixation = 0;
	var prix_protection = 0;
	var prix_eclairage = 0;
	
	switch(fixation){
		case 'beton':
			prix_fixation = 133;
		break;
		case 'acier':
			prix_fixation = 329;
		break;
		case 'granit':
			prix_fixation = 242;
		break;
		case 'douille':
			prix_fixation = 176;
		break;
		case 'bride':
			prix_fixation = 132;
		break;
		case 'pointe':
			prix_fixation = 111;
		break;
	}
	
	if(protection=="avec"){
		prix_protection = 41;
	}
	if(eclairage=="avec"){
		prix_eclairage = 139;
	}
	
	$("#prix_exact").text(parseInt($("#prix_estim").val())+prix_fixation+prix_protection+prix_eclairage);	
}

/****************************************/
/****** ACHAT DE PARASOL SUNWING *******/
/****************************************/

/* VALIDATION DIMENSIONS SUNWING  */
function valideDimensionsSunwing(obj){
		var n = $("input[name=dimensions]:checked").length;
		if(n == 1){
			var m = $("input[name=type_tissu]:checked").length;
			if(m == 1){
				obj.form.submit();
			}
			else
			{
				alert("Veuillez choisir un type de toile");
			}
		}
		else
		{
			alert("Veuillez choisir une dimension");
		}
}

/* CALCUL DU PRIX DES DIMENSIONS SUNWING */
function calculPrixDimensionSunwing(){
	var dimensions = $("input[name=dimensions]:checked").val();
	var type_tissu = $("input[name=type_tissu]:checked").val();
	if(type_tissu == 'polypropylene'){
		if(dimensions == 'carree_260_260' || dimensions == 'rond_330'){
			$("#estimation").text('673 €');
			$("#prix_estim").val('673');
		}
		else if(dimensions == 'rond_265'){
			$("#estimation").text('462 €');
			$("#prix_estim").val('462');
		}
		else if(dimensions == 'rond_300'){
			$("#estimation").text('567 €');
			$("#prix_estim").val('567');
		}
	}
	else if(type_tissu == 'dickson'){
		if(dimensions == 'carree_260_260' || dimensions == 'rond_330'){
			$("#estimation").text('831 €');
			$("#prix_estim").val('831');
		}
		else if(dimensions == 'rond_265'){
			$("#estimation").text('673 €');
			$("#prix_estim").val('673');
		}
		else if(dimensions == 'rond_300'){
			$("#estimation").text('726 €');
			$("#prix_estim").val('726');
		}
	}
	else if(type_tissu == 'sunbrella'){
		if(dimensions == 'carree_260_260' || dimensions == 'rond_330'){
			$("#estimation").text('1095 €');
			$("#prix_estim").val('1095');
		}
		else if(dimensions == 'rond_265'){
			$("#estimation").text('884 €');
			$("#prix_estim").val('884');
		}
		else if(dimensions == 'rond_300'){
			$("#estimation").text('989 €');
			$("#prix_estim").val('989');
		}
	}
}

$(document).ready(function(){ 
calculPrixDimensionSunwing();  
	$("input").click(function(event) {
		calculPrixDimensionSunwing();
	})
});

/* VALIDATION OPTIONS */
function valideOptionsSunwing(obj){
	var n = $("input:checked").length;
	if(n == 3){
		$("#prix_estim").val($("#prix_exact").text());
		obj.form.submit();
	}
	else
	{
		alert("Veuillez choisir chaque option");
	}
}

/* CALCUL DU PRIX DES PARASOL SUNWING */
function calculPrixOptionSunwing(){
	var fixation = $("input[name=fixation]:checked").val();
	var protection = $("input[name=protection]:checked").val();
	var eclairage = $("input[name=eclairage]:checked").val();
	
	var prix_fixation = 0;
	var prix_protection = 0;
	var prix_eclairage = 0;
	
	switch(fixation){
		case 'beton':
			prix_fixation = 235;
		break;
		case 'acier':
			prix_fixation = 240;
		break;
		case 'granit':
			prix_fixation = 235;
		break;
		case 'douille':
			prix_fixation = 193;
		break;
		case 'console':
			prix_fixation = 403;
		break;
	}
	
	if(eclairage=="avec"){
		prix_eclairage = 104;
	}
	
	$("#prix_exact").text(parseInt($("#prix_estim").val())+prix_fixation+prix_protection+prix_eclairage);	
}


/****************************************/
/****** ACHAT DE PARASOL SOMBRANO *******/
/****************************************/

/* VALIDATION DIMENSIONS SOMBRANO  */
function valideDimensionsSombrano(obj){
		var n = $("input[name=dimensions]:checked").length;
		if(n == 1){
			var m = $("input[name=type_tissu]:checked").length;
			if(m == 1){
				obj.form.submit();
			}
			else
			{
				alert("Veuillez choisir un type de toile");
			}
		}
		else
		{
			alert("Veuillez choisir une dimension");
		}
}

/* CALCUL DU PRIX DES DIMENSIONS SOMBRANO */
function calculPrixDimensionSombrano(){
	var dimensions = $("input[name=dimensions]:checked").val();
	var type_tissu = $("input[name=type_tissu]:checked").val();
	if(type_tissu == 'polypropylene'){
		if(dimensions == 'rond_350'){
			$("#estimation").text('1117 €');
			$("#prix_estim").val('1117');
		}
		else if(dimensions == 'rond_400'){
			$("#estimation").text('1381 €');
			$("#prix_estim").val('1381');
		}
		else if(dimensions == 'carree_300_300'){
			$("#estimation").text('1201 €');
			$("#prix_estim").val('1201');
		}
		else if(dimensions == 'carree_350_350'){
			$("#estimation").text('1486 €');
			$("#prix_estim").val('1486');
		}
	}
	else if(type_tissu == 'dickson'){
		if(dimensions == 'rond_350'){
			$("#estimation").text('1381 €');
			$("#prix_estim").val('1381');
		}
		else if(dimensions == 'rond_400'){
			$("#estimation").text('1687 €');
			$("#prix_estim").val('1687');
		}
		else if(dimensions == 'carree_300_300'){
			$("#estimation").text('1539 €');
			$("#prix_estim").val('1539');
		}
		else if(dimensions == 'carree_350_350'){
			$("#estimation").text('1856 €');
			$("#prix_estim").val('1856');
		}
	}
	else if(type_tissu == 'sunbrella'){
		if(dimensions == 'rond_350'){
			$("#estimation").text('1697 €');
			$("#prix_estim").val('1697');
		}
		else if(dimensions == 'rond_400'){
			$("#estimation").text('2067 €');
			$("#prix_estim").val('2067');
		}
		else if(dimensions == 'carree_300_300'){
			$("#estimation").text('1908 €');
			$("#prix_estim").val('1908');
		}
		else if(dimensions == 'carree_350_350'){
			$("#estimation").text('2278 €');
			$("#prix_estim").val('2278');
		}
	}
}

$(document).ready(function(){ 
calculPrixDimensionSombrano();  
	$("input").click(function(event) {
		calculPrixDimensionSombrano();
	})
});

/* VALIDATION OPTIONS */
function valideOptionsSombrano(obj){
	var n = $("input:checked").length;
	if(n == 3){
		$("#prix_estim").val($("#prix_exact").text());
		obj.form.submit();
	}
	else
	{
		alert("Veuillez choisir chaque option");
	}
}

/* CALCUL DU PRIX DES PARASOL SOMBRANO */
function calculPrixOptionSombrano(){
	var fixation = $("input[name=fixation]:checked").val();
	var protection = $("input[name=protection]:checked").val();
	var eclairage = $("input[name=eclairage]:checked").val();
	
	var prix_fixation = 0;
	var prix_protection = 0;
	var prix_eclairage = 0;
	
	switch(fixation){
		case 'acier120':
			prix_fixation = 263;
		break;
		case 'acier180':
			prix_fixation = 295;
		break;
		case 'douille':
			prix_fixation = 195;
		break;
		case 'console48':
			prix_fixation = 379;
		break;
		case 'console10':
			prix_fixation = 379;
		break;
	}
	
	if(eclairage=="avec"){
		prix_eclairage = 104;
	}
	
	$("#prix_exact").text(parseInt($("#prix_estim").val())+prix_fixation+prix_protection+prix_eclairage);	
}


/****************************************/
/****** ACHAT DE COUSSIN BIEN ETRE *******/
/****************************************/

/* VALIDATION DIMENSIONS COUSSIN BIEN ETRE  */
function valideDimensionsBienEtre(obj){
	var m = $("input[name=type_tissu]:checked").length;
	if(m == 1){
		obj.form.submit();
	}
	else
	{
		alert("Veuillez choisir un type de toile");
	}
}


/* VALIDATION OPTIONS */
function valideOptionsBienEtreOmbra(obj){
	var n = $("input:checked").length;
	if(n == 1){
		calculPrixOptionBienEtreOmbra();
		$("#prix_estim").val($("#prix_exact").text());
		obj.form.submit();
	}
	else
	{
		alert("Veuillez choisir chaque option");
	}
}

/* VALIDATION OPTIONS */
function valideOptionsBienEtreSunbrella(obj){
	var n = $("input:checked").length;
	if(n == 1){
		calculPrixOptionBienEtreSunbrella();
		$("#prix_estim").val($("#prix_exact").text());
		obj.form.submit();
	}
	else
	{
		alert("Veuillez choisir chaque option");
	}
}

/* CALCUL DU PRIX DES COUSSIN BIEN ETRE OMBRA */
function calculPrixOptionBienEtreOmbra(){
	var modele = $("input[name=modele]:checked").val();
	var prix_modele = 0;
	
	switch(modele){
		case 'oreiller':
			prix_modele = 28;
		break;
		case 'galette_ronde':
			prix_modele = 32;
		break;
		case 'assise_fauteuil_monobloc':
			prix_modele = 34;
		break;
		case 'assise_loom':
			prix_modele = 36;
		break;
		case 'assise_fauteuil':
			prix_modele = 30;
		break;
		case 'assise_dossier_fauteuil_separes':
			prix_modele = 59;
		break;
		case 'assise_dossier_fauteuil':
			prix_modele = 60;
		break;
		case 'assise_dossier_fauteuil_multi_positions':
			prix_modele = 68;
		break;
		case 'assise_dossier_bain_de_soleil':
			prix_modele = 123;
		break;
		case 'matelas_de_piscine':
			prix_modele = 123;
		break;
	}

	
	$("#prix_exact").text(parseInt(prix_modele));	
}

/* CALCUL DU PRIX DES COUSSIN BIEN ETRE SUNBRELLA */
function calculPrixOptionBienEtreSunbrella(){
	var modele = $("input[name=modele]:checked").val();
	var prix_modele = 0;
	
	switch(modele){
		case 'oreiller':
			prix_modele = 39;
		break;
		case 'galette_ronde':
			prix_modele = 43;
		break;
		case 'assise_fauteuil_monobloc':
			prix_modele = 45;
		break;
		case 'assise_loom':
			prix_modele = 51;
		break;
		case 'assise_fauteuil':
			prix_modele = 39;
		break;
		case 'assise_dossier_fauteuil_separes':
			prix_modele = 78;
		break;
		case 'assise_dossier_fauteuil':
			prix_modele = 93;
		break;
		case 'assise_dossier_fauteuil_multi_positions':
			prix_modele = 105;
		break;
		case 'assise_dossier_bain_de_soleil':
			prix_modele = 194;
		break;
		case 'matelas_de_piscine':
			prix_modele = 190;
		break;
	}

	
	$("#prix_exact").text(parseInt(prix_modele));	
}


/****************************************/
/****** ACHAT DE COUSSIN PRESTIGE *******/
/****************************************/

/* VALIDATION DIMENSIONS COUSSIN PRESTIGE  */
function valideDimensionsPrestige(obj){
	var m = $("input[name=type_tissu]:checked").length;
	if(m == 1){
		obj.form.submit();
	}
	else
	{
		alert("Veuillez choisir un type de toile");
	}
}

/* VALIDATION OPTIONS */
function valideOptionsPrestigeOmbra(obj){
	var n = $("input:checked").length;
	if(n == 1){
		calculPrixOptionPrestigeOmbra();
		$("#prix_estim").val($("#prix_exact").text());	
		obj.form.submit();
	}
	else
	{
		alert("Veuillez choisir chaque option");
	}
}

/* VALIDATION OPTIONS */
function valideOptionsPrestigeSunbrella(obj){
	var n = $("input:checked").length;
	if(n == 1){
		calculPrixOptionPrestigeSunbrella();
		$("#prix_estim").val($("#prix_exact").text());
		obj.form.submit();
	}
	else
	{
		alert("Veuillez choisir chaque option");
	}
}


/* CALCUL DU PRIX DES COUSSIN BIEN ETRE OMBRA */
function calculPrixOptionPrestigeOmbra(){
	var modele = $("input[name=modele]:checked").val();
	var prix_modele = 0;
	
	switch(modele){
		case 'oreiller':
			prix_modele = 28;
		break;
		case 'galette_ronde':
			prix_modele = 43;
		break;
		case 'assise_fauteuil_monobloc':
			prix_modele = 45;
		break;
		case 'assise_loom':
			prix_modele = 45;
		break;
		case 'assise_fauteuil':
			prix_modele = 39;
		break;
		case 'assise_dossier_fauteuil_separes':
			prix_modele = 78;
		break;
		case 'assise_dossier_fauteuil':
			prix_modele = 76;
		break;
		case 'assise_dossier_fauteuil_multi_positions':
			prix_modele = 87;
		break;
		case 'assise_dossier_bain_de_soleil':
			prix_modele = 163;
		break;
		case 'matelas_de_piscine':
			prix_modele = 150;
		break;
	}

	
	$("#prix_exact").text(parseInt(prix_modele));	
}

/* CALCUL DU PRIX DES COUSSIN BIEN ETRE SUNBRELLA */
function calculPrixOptionPrestigeSunbrella(){
	var modele = $("input[name=modele]:checked").val();
	var prix_modele = 0;
	
	switch(modele){
		case 'oreiller':
			prix_modele = 39;
		break;
		case 'galette_ronde':
			prix_modele = 60;
		break;
		case 'assise_fauteuil_monobloc':
			prix_modele = 60;
		break;
		case 'assise_loom':
			prix_modele = 60;
		break;
		case 'assise_fauteuil':
			prix_modele = 53;
		break;
		case 'assise_dossier_fauteuil_separes':
			prix_modele = 103;
		break;
		case 'assise_dossier_fauteuil':
			prix_modele = 114;
		break;
		case 'assise_dossier_fauteuil_multi_positions':
			prix_modele = 131;
		break;
		case 'assise_dossier_bain_de_soleil':
			prix_modele = 236;
		break;
		case 'matelas_de_piscine':
			prix_modele = 218;
		break;
	}

	
	$("#prix_exact").text(parseInt(prix_modele));	
}
