$(document).ready(function(){

	//********************************
	// HOME RUBRIQUE
	//********************************
	$(".homeRubSet a").hover(
		function(){;
			//if($(this).attr("name")!="noTrans"){
				$(this).children().children().animate( {opacity: 0.4}, 300);
			//}
		},
		function(){
			//if($(this).attr("name")!="noTrans"){
				$(this).children().children().animate( {opacity: 1}, 300);
			//}
		}
	);



	$("#homeBlocTrans").fadeTo("fast", 0.4);



	//********************************
	// HOME RUBRIQUE
	//********************************
	$(".overlink").mouseover( function() { 
									   
		$(".overimg").css("display", "none");
		$(this).prev().css("display", "block");
	});
	
	$(".overimg").mouseout( function() { 
		$(this).css("display", "none");
	});



	//********************************
	// HOME REFERENCES
	//********************************
	$(".puce2 .jFlowControlPush").click( function() { 
		$(".puce2 .jFlowControlPush").removeClass("jFlowSelectedPush");
		$(this).addClass("jFlowSelectedPush");
		
		var decalBloc = (-($(this).attr("title") * 175)) +"px";
		
		$("#mySlidesPush").animate({
			marginLeft: decalBloc
		}, 400 );		
		
	});

	
	$("#nom").keyup( function() 
	{ 
		var chaine = $(this).val();
		$(this).val(chaine.substr(0,1).toUpperCase()+chaine.substr(1,chaine.length).toLowerCase());
	} 
	);
	$("#prenom").keyup( function() 
	{ 
		var chaine = $(this).val();
		$(this).val(chaine.substr(0,1).toUpperCase()+chaine.substr(1,chaine.length).toLowerCase());
	} 
	);
	$("#telephone").keypress( function(e) 
	{ 
		if (!checkNumeric(e))
			return false;
	} 
	);


});
 
function checkNumeric(e)
{
	var charValid = /[\d\b\t]/;
	var code = codeTouche(e);
	return charValid.test(String.fromCharCode(code));
}

function codeTouche(e)
{
	for (prop in e)
	{
		if(prop == 'which') return (e.which);
	}
	return (e.keyCode);
}

	//********************************
	// LINKS SEO
	//********************************
function getUnhashedUrl(url)
{
    url = url.replace(/h\-t\-t\-p\-:\-\/\-\/\-/, 'http://');
    url = url.replace(/h\-t\-t\-p\-s\-:\-\/\-\/\-/, 'https://');
    
    return url;
}

function gotoURL(url)
{
    url = getUnhashedUrl(url);

    window.location.href = url;
}

function gotoNewURL(url)
{
    url = getUnhashedUrl(url);

    window.open(url);
}
