
	

$(document).ready(function() {
	
	// IE PNG Fix
	if (document.all && document.styleSheets && document.styleSheets[0] && document.styleSheets[0].addRule){
		//document.styleSheets[0].addRule('*', 'behavior: url(js/iepngfix.htc)');
	}else{
		
		$("#menu li").children("a").before("<span class=\"vert\">&nbsp;</span>");
		$("#menu li").children(".vert").css("opacity","0");
		
		$("#menu li").hover(function() {
			$(this).children().stop();
			$(this).children("span").stop().animate({opacity:1},200);
		},function() {
			$(this).children("span").stop().animate({opacity:0},400);
		});
	}
	//$('#cadreclair').cornerz({corners:"tr bl"});
	//$('#menu').cornerz({corners:"tl tr", background:"#434343"});
	

	$("#ssIndexListe div:gt(0)").each(function(){
		$(this).hide();
	});
	$("#checkedUrl").blur(function(){
		$("#ajaxLoad").html('<img src="images/loader.gif" alt="" />');
		$("#checkedUrl").val($("#checkedUrl").val().replace("http://", ""));
		$("#checkedUrl").val($("#checkedUrl").val().replace("https://", ""));
		
		var posslash=$("#checkedUrl").val().indexOf ("/", 0);
		if (posslash !=-1) 
			$("#checkedUrl").val($("#checkedUrl").val().substring(0, posslash));
		
		$.ajax({
			type:"GET",
			url:"librairies/test_url.php",
			data:"url="+$("#checkedUrl").val()+"&lng="+$("#langue").val(),
			success: function(data){
				if(data == 1){
					$("#ajaxLoad").html('<img src="images/accept.png" alt="" />');
				}else if(data == 2){
						$("#ajaxLoad").html('');
				}else{
					$("#ajaxLoad").html('<img src="images/cross.png" alt="" />'+ data);
				}
			}
		});
	});
	$("#checkedEmail").blur(function(){
		$("#ajaxLoad2").html('<img src="images/loader.gif" alt="" />');
		$.ajax({
			type:"GET",
			url:"librairies/test_mail.php",
			data:"email="+$("#checkedEmail").val(),
			success: function(data){
				if(data==1){
					$("#ajaxLoad2").html('<img src="images/accept.png" alt="" />');
				}else if(data==2){
					if($("#langue").val() == "fr"){
						$("#ajaxLoad2").html('<img src="images/cross.png" alt="" /> L\'adresse renseignée est déjà enregistrée.');
					}else{
						$("#ajaxLoad2").html('<img src="images/cross.png" alt="" /> A customer has already subscribed with the same email address.');
					}
				}else{
					if($("#langue").val() == "fr"){
						$("#ajaxLoad2").html('<img src="images/cross.png" alt="" /> L\'adresse renseignée est incorrecte.');
					}else{
						$("#ajaxLoad2").html('<img src="images/cross.png" alt="" /> The email address is incorrect.');
					}
				}
			}
		});
	});
	$("#inscriptionDemo").submit(function(){
		var readyToSend = true;
		$("#checkedTel").blur();
		if($("#ajaxLoad").text() != ''){
			readyToSend = false;
			$("#checkedUrl").focus();
		}else if($("#ajaxLoad2").text() != ''){
			readyToSend = false;
			$("#checkedEmail").focus();
		}
		if(readyToSend == false){
			if($("#langue").val() == "fr"){
				alert('Tous les champs obligatoires n\'ont pas été renseignés correctement.');
			}else{
				alert('All mandatory fields must be correctly fulfilled.');
			}
		}
		return readyToSend;
	});	
});

function onglet(numOnglet){
	$("#indexListe li").each(function (){
		$(this).removeClass('fond');
	});
	$("#ssIndexListe div").each(function(){
		$(this).hide();
	});
	$("#indexListe li:eq("+numOnglet+")").addClass('fond');
	$("#ssIndexListe div:eq("+numOnglet+")").show();
}
