$(document).ready(function()
{

	$("#identification #login").click(function() {
		if ($("#identification #login").val() == 'Votre mail')
		{
			$("#identification #login").val('');
		}
	});
	$("#identification #password").click(function() {
		if ($("#identification #password").val() == 'Votre mot de passe')
		{
			$("#identification #password").before("<input type='password' name='password' class='input_connexion' id='password' value='' />").remove().focus();
			$("#identification #password").focus();
		}
	});
	$("#identification #password").focus(function() {
		if ($("#identification #password").val() == 'Votre mot de passe')
		{
			$("#identification #password").before("<input type='password' name='password' class='input_connexion' id='password' value='' />").remove().focus();
			$("#identification #password").focus();
		}
	});

	$("#identification .button_ok").click(function() {
		$("#identification form").submit();
	});
	//$('#contenu').corner('keep round all 10px');

	$('#pa').corner('keep round all 10px');
	$('#form_pass label').corner('keep left 9px');
	$('.famille_corner').corner('keep right 9px');
	$('.overlay').corner('keep right 9px');
	$('#lien_compte h3').corner('keep right 9px');


	/*
	$('.select_ss').corner('keep right 9px');
	$('.no_select_ss').corner('keep right 9px');
	*/
	//$('h2').corner('keep top 5px');
	/*
	$('#dialog').corner('keep round all 10px');

	$('.diag_title').corner('keep round all 8px');
	$('.diag_valid').corner('keep round all 8px');
	*/



	/* valide */
	$('h1').click(function() { document.location.href='index.php'; });

	/* valide */
	$('.menu_nv1 a').hover(
	function() {
		if ($(this).parent().attr('class') !='menu_nv1 menu_nv1_selected') {
			$(this).animate({  marginLeft: '24px' }, 'fast');
		} else {
			$(this).animate({  marginLeft: '18px' }, 'fast');
		}
		if ($(this).parent().attr('class') !='menu_nv1 menu_nv1_selected') {
			$(this).parent().width('150px');
			$(this).parent().uncorner();
		}
	}, function() {
		$(this).animate({  marginLeft: '12px' }, 'fast' ,
						function () {
									$(this).parent().width('160px');
									$(this).parent().corner('round right 8px');
						});

	});
	/* valide */
	$('.ul_menu_nv2 a:not(.menu_nv2_selected)').hover(
		function() {
			$(this).css('color', $(this).parent().parent().parent().children('.menu_nv1').css('background-color'));
		},
		function() {
			$(this).css('color', '#000000');
		}
	);
	/* valide */
	$('#panier').click(function() { document.location.href='panier.php'; });

	/* valide */
	$('.details').hover (
	function() { $(this).css('border-color', '#555'); },
	function() { $(this).css('border-color', '#BBB'); }
	);
	/* valide */
	$('.menu_nv1').corner('round right 8px');
	$('#famille h3').corner('round right 10px;');
	$('.nomcreate').corner('left 10px;');
	$('.nom').corner('left 10px;');
	$('.corner_left').corner('keep left 10px;');
	//$('#menu_compte li').corner('keep right 10px;');
	//$('#menu_ss li').corner('keep round right 10px');
	$('#favoris .fav_fam').corner('round all 10px');
	$('#favoris .fav_sfam').corner('round all 10px');

	$('#form_contact label').corner('left 10px;');

	/*pour mot de passe du compte.php*/
	$('#uti_mdp').keyup(
		function() {
			$('#p_confirmation_compte').css('display','block');
			$('#p_confirmation_compte').addClass('on');
		}
	);

	if ($('#liste_choix').length)
	{
	  $('#liste_choix li').corner('round all 8px');
	}
});

/*

function menu_famille(input_id)
{
	if ($('#fam_id').val()=='')
	{
		$('#sous_famille_'+input_id).slideDown('slow', function() {});
		$('#fam_id').val(input_id);
	}
	else
	{
		$('#sous_famille_'+$('#fam_id').val()).slideUp('slow', function() {});
		$('#sous_famille_'+input_id).slideDown('slow', function() {});
		$('#fam_id').val(input_id);

	}

}
*/
function verifConnex()
{
	var error = '';
	if ($('#login_demande').val()=='')
	{
		$('#login_demande').css('border-color', 'red');
		error += '- votre email \n';
	}
	if ($('#password_demande').val()=='')
	{
		$('#password_demande').css('border-color', 'red');
		error += '- votre mot de passe \n';
	}
	if (error!=='')
	{
		alert("Vous n'avez pas indiqué : \n"+error);
	} else
	{
		$('#form_create').submit();
	}
	return false;
}
function verifConnexRapide()
{
	var error = '';
	if ($('#login_demande').val()=='')
	{
		$('#login_demande').css('border-color', 'red');
		error += '- votre email \n';
	}
	if ($('#password_demande').val()=='')
	{
		$('#password_demande').css('border-color', 'red');
		error += '- votre mot de passe \n';
	}
	if (error!=='')
	{
		alert("Vous n'avez pas indiqué : \n"+error);
	} else
	{
		$('#form_create_identification').submit();
	}
	return false;
}

function verif_form_create(type)
{

	var error = '';
	if ($('#uti_email').val()=='')
	{
		$('#uti_email').css('border-color', 'red');
		error += '- votre email \n';
	}
	/*if (type=='crea' || type=='update')
	{*/
		if ($('#uti_mail').val()=='')
		{
			$('#uti_mail').css('border-color', 'red');
			error += '- votre email \n';
		}
		if ($('#uti_mdp').val()=='')
		{
			if(type != "update")
			{
				$('#uti_mdp').css('border-color', 'red');
				error += '- votre mot de passe \n';
			}
		}
		if ($('#uti_societe').val()=='')
		{
			$('#uti_societe').css('border-color', 'red');
			error += '- votre raison sociale \n';
		}
		if ($('#uti_siren').val()=='')
		{
			$('#uti_siren').css('border-color', 'red');
			error += '- votre n° SIREN \n';
		}
		if ($('#uti_dpt').val().length != 2)
		{
			$('#uti_dpt').css('border-color', 'red');
			error += '- votre n° de département \n';
		}
		if ($('#uti_nom').val()=='')
		{
			$('#uti_nom').css('border-color', 'red');
			error += '- votre nom de contact \n';
		}
		if ($('#uti_tel').val()=='')
		{
			$('#uti_tel').css('border-color', 'red');
			error += '- votre n° de téléphone \n';
		}
		if ($('#uti_fonction').val()=='')
		{
			$('#uti_fonction').css('border-color', 'red');
			error += '- votre fonction \n';
		}
		if ($('#uti_adresse1').val()=='')
		{
			$('#uti_adresse1').css('border-color', 'red');
			error += '- votre adresse \n';
		}
		if ($('#uti_cp').val()=='')
		{
			$('#uti_cp').css('border-color', 'red');
			error += '- votre code postal \n';
		}
		if ($('#uti_ville').val()=='')
		{
			$('#uti_ville').css('border-color', 'red');
			error += '- votre ville \n';
		}
		if(type=='crea' || $('#p_confirmation_compte').hasClass('on'))
		{
			if ($('#uti_mdp').val()!=$('#uti_mdp_bis').val())
			{
				$('#uti_mdp').css('border-color', 'red');
				$('#uti_mdp_bis').css('border-color', 'red');
				error += '- vos mots de passe ne correspondent pas \n';
			}
		}
	//}
	/*if ($('#uti_mdp').val()!=$('#uti_mdp_bis').val())
	{
		$('#uti_mdp').css('border-color', 'red');
		$('#uti_mdp_bis').css('border-color', 'red');
		error += '- vos mots de passe ne correspondent pas \n';
	}*/
	/*if (type=='demande_suite')
	{
		if ($('#uti_mail').val()=='')
		{
			$('#uti_mail').css('border-color', 'red');
			error += '- votre email \n';
		}
		if ($('#uti_societe').val()=='')
		{
			$('#uti_societe').css('border-color', 'red');
			error += '- votre raison sociale \n';
		}
		if ($('#uti_dpt').val().length != 2)
		{
			$('#uti_dpt').css('border-color', 'red');
			error += '- votre n° de departement \n';
		}
		if ($('#uti_nom').val()=='')
		{
			$('#uti_nom').css('border-color', 'red');
			error += '- votre nom de contact \n';
		}
	}*/
	if (error!=='')
	{
		alert("Vous n'avez pas indiqué : \n"+error);
	} else
	{
		$('#form_create').submit();
	}
	return false;
}



/*
function genrerer_pdf(ord_id)
{
	$('#ord_id').val(ord_id);
	$('#commande_inpopup').submit();
}
*/
