// JavaScript Document

var cpt = 0;
var height = Array();
height[0] = '';
function changeFontSize(size,change) {
	//change la taille pour la classe onze
	var fontSize11 = $(".onze").css('font-size');
	if (fontSize11!=undefined) {
		fontSize11 = fontSize11.split('px');
		var currentFontSize11 = parseInt(fontSize11[0]) + parseInt(size); 
		if(currentFontSize11 > 21) {
			currentFontSize11 = 21;
		}
		else {
			if(currentFontSize11 < 11) {
				currentFontSize11 = 11;
			}
		}
		$(".onze").css('font-size', currentFontSize11+'px');
		$(".onze b").css('font-size', currentFontSize11+'px');
	}
	//change la taille pour la classe treize
	var fontSize13 = $(".treize").css('font-size');
	if (fontSize13!=undefined) {
		fontSize13 = fontSize13.split('px');
		var currentFontSize13 = parseInt(fontSize13[0]) + parseInt(size); 
		if(currentFontSize13 > 23) {
			currentFontSize13 = 23;
		}
		else {
			if(currentFontSize13 < 13) {
				currentFontSize13 = 13;
			}
		}
		$(".treize").css('font-size', currentFontSize13+'px');
		$(".treize b").css('font-size', currentFontSize13+'px');
	}
	//change la taille pour la classe quatroze
	var fontSize14 = $(".quatorze").css('font-size');
	if (fontSize14!=undefined) {
		fontSize14 = fontSize14.split('px');
		var currentFontSize14 = parseInt(fontSize14[0]) + parseInt(size); 
		if(currentFontSize14 > 24) {
			currentFontSize14 = 24;
		}
		else {
			if(currentFontSize14 < 14) {
				currentFontSize14 = 14;
			}
		}
		$(".quatorze").css('font-size', currentFontSize14+'px');
		$(".quatorze b").css('font-size', currentFontSize14+'px');
	}
	//change la taille pour la classe seize
	var fontSize16 = $(".seize").css('font-size');
	if (fontSize16!=undefined) {
		fontSize16 = fontSize16.split('px');
		var currentFontSize16 = parseInt(fontSize16[0]) + parseInt(size); 
		if(currentFontSize16 > 25) {
			currentFontSize16 = 25;
		}
		else {
			if(currentFontSize16 < 16) {
				currentFontSize16 = 16;
			}
		}
		$(".seize").css('font-size', currentFontSize16+'px');
		$(".seizee b").css('font-size', currentFontSize16+'px');
	}
	//change la taille pour la classe douze
	var fontSize12 = $(".douze").css('font-size');
	if (fontSize12!=undefined) {
		fontSize12 = fontSize12.split('px');
		var currentFontSize12 = parseInt(fontSize12[0]) + parseInt(size); 
		if(currentFontSize12 > 22) {
			currentFontSize12 = 22;
		}
		else {
			if(currentFontSize12 < 12) {
				currentFontSize12 = 12;
			}
		}
		$(".douze").css('font-size', currentFontSize12+'px');
		$(".douze b").css('font-size', currentFontSize12+'px');
	}
	//change le padding pour la classe jour
	var paddingJour = $(".jour").css('padding-left');
	if (paddingJour!=undefined) {
		paddingJour = paddingJour.split('px');
		var currentPaddingJour = parseInt(paddingJour[0]) - parseInt(size); 
		if(currentPaddingJour > 11) {
			currentPaddingJour = 11;
		}
		else {
			if(currentPaddingJour < 1) {
				currentPaddingJour = 1;
			}
		}
		$(".jour").css('padding-left', currentPaddingJour+'px');
	}
	//change le padding pour la classe chiffre
	var paddingChiffre = $(".chiffre").css('padding-left');
	if (paddingChiffre!=undefined) {
		paddingChiffre = paddingChiffre.split('px');
		var currentPaddingChiffre = parseInt(paddingChiffre[0]) - parseInt(size); 
		if(currentPaddingChiffre > 11) {
			currentPaddingChiffre = 11;
		}
		else {
			if(currentPaddingChiffre < 1) {
				currentPaddingChiffre = 1;
			}
		}
		$(".chiffre").css('padding-left', currentPaddingChiffre+'px');
	}
	
	/*var margin = $(".separation_social_sante").css('margin');
	if (margin!=undefined) {
		alert(margin);
	}*/
	if(change=='augmente') {
		if(cpt<5) {
			cpt++;
		}
	}
	else {
		if(cpt>0) {
			cpt--;
		}
	}
	if(cpt>0) {
		$("#footer").css('padding','0 0 0 122px');
	}
	else {
		$("#footer").css('padding','0 0 0 152px');
	}
	switch(cpt) {
		case 0:$(".separation_social_sante").css("margin-bottom", "7px");$(".separation_associations").css("margin-bottom", "7px");$(".separation_heberge").css("margin-bottom", "7px");$(".separation_infos").css("margin-bottom", "7px");$(".separation_annuaire").css("margin-bottom", "14px");
		break;
		case 1:$(".separation_social_sante").css("margin-bottom", "17px");$(".separation_associations").css("margin-bottom", "12px");$(".separation_heberge").css("margin-bottom", "17px");$(".separation_infos").css("margin-bottom", "17px");$(".separation_annuaire").css("margin-bottom", "24px");
		break;
		case 2:$(".separation_social_sante").css("margin-bottom", "22px");$(".separation_associations").css("margin-bottom", "17px");$(".separation_heberge").css("margin-bottom", "22px");$(".separation_infos").css("margin-bottom", "22px");$(".separation_annuaire").css("margin-bottom", "40px");
		break;
		case 3:$(".separation_social_sante").css("margin-bottom", "32px");$(".separation_associations").css("margin-bottom", "22px");$(".separation_heberge").css("margin-bottom", "32px");$(".separation_infos").css("margin-bottom", "32px");$(".separation_annuaire").css("margin-bottom", "54px");
		break;
		case 4:$(".separation_social_sante").css("margin-bottom", "42px");$(".separation_associations").css("margin-bottom", "27px");$(".separation_heberge").css("margin-bottom", "42px");$(".separation_infos").css("margin-bottom", "42px");$(".separation_annuaire").css("margin-bottom", "74px");
		break;
		case 5:$(".separation_social_sante").css("margin-bottom", "47px");$(".separation_associations").css("margin-bottom", "32px");$(".separation_heberge").css("margin-bottom", "47px");$(".separation_infos").css("margin-bottom", "47px");$(".separation_annuaire").css("margin-bottom", "94px");
		break;
	}
	var taille = $("#container_news_1").css('height');
	if (taille!=undefined) {
		var length = $(".slider_1 li").length;
		if(cpt==0) {
			$("#container_news_1").css('height','214px');
			$(".slider_1").css('height','200px');
			$(".slider_1 .slider").css('height','200px');
			$(".slider_1 li").css('height','100px');
			height = $(".slider_1 li").css('height');
			height = height.split('px');
			ulHeight = length*height[0];
			$(".slider_1 ul").css('height',ulHeight+'px');
			
		}
		if(cpt==1) {
			$("#container_news_1").css('height','254px');
			$(".slider_1").css('height','240px');
			$(".slider_1 .slider").css('height','240px');
			$(".slider_1 li").css('height','120px');
			height = $(".slider_1 li").css('height');
			height = height.split('px');
			ulHeight = length*height[0];
			$(".slider_1 ul").css('height',ulHeight+'px');
		}
		if(cpt==2) {
			$("#container_news_1").css('height','274px');
			$(".slider_1").css('height','260px');
			$(".slider_1 .slider").css('height','260px');
			$(".slider_1 li").css('height','130px');
			height = $(".slider_1 li").css('height');
			height = height.split('px');
			ulHeight = length*height[0];
			$(".slider_1 ul").css('height',ulHeight+'px');
		}
		if(cpt==3) {
			$("#container_news_1").css('height','314px');
			$(".slider_1").css('height','300px');
			$(".slider_1 .slider").css('height','300px');
			$(".slider_1 li").css('height','150px');
			height = $(".slider_1 li").css('height');
			height = height.split('px');
			ulHeight = length*height[0];
			$(".slider_1 ul").css('height',ulHeight+'px');
		}
		if(cpt==4) {
			$("#container_news_1").css('height','454px');
			$(".slider_1").css('height','440px');
			$(".slider_1 .slider").css('height','440px');
			$(".slider_1 li").css('height','220px');
			height = $(".slider_1 li").css('height');
			height = height.split('px');
			ulHeight = length*height[0];
			$(".slider_1 ul").css('height',ulHeight+'px');
		}
		if(cpt==5) {
			$("#container_news_1").css('height','534px');
			$(".slider_1").css('height','520px');
			$(".slider_1 .slider").css('height','520px');
			$(".slider_1 li").css('height','260px');
			height = $(".slider_1 li").css('height');
			height = height.split('px');
			ulHeight = length*height[0];
			$(".slider_1 ul").css('height',ulHeight+'px');
		}
	}
}

function checkStatus() {
	if($('#reference').val() == "") {
		alert('Vous devez sélectionner une référence');	
	}
	else {
		$("#form_plu").attr('action','index.php?r=plu');
	}	
}
