$(function(){

	$('#login-form').jqTransform();
	$('#search-form').jqTransform();
	$('#contact-form').jqTransform();
	$('#service-ask').jqTransform();
	$('#hardware-form').jqTransform();
	$('#customer-form').jqTransform();
	$('#invoice-form').jqTransform();
	$('#user-form').jqTransform();
  $("#container-invoice-form").hide();
    
	$("#clientNumber").autocomplete("core/check-client.php", {
		width: 260,
		selectFirst: false
	});

	$("#clientMacNumber").autocomplete("core/check-mac.php", {
		width: 260,
		selectFirst: false
	});
	
	$("#clientSearch").autocomplete("core/search-client.php", {
		width: 260,
		selectFirst: false
	});
	
	$("#clientNumber").result(function(event, data, formatted) {
		if (data)
			$(this).parent().next().find("input").val(data[1]);
	});

	$("#clientMacNumber").result(function(event, data, formatted) {
		if (data)
			$(this).parent().next().find("input").val(data[1]);
	});
	
	$("#clientSearch").result(function(event, data, formatted) {
		if (data)
			$(this).parent().next().find("input").val(data[1]);
	});
	
	$("#clientNumber1").autocomplete("core/check-client-nolimit.php", {
		width: 260,
		selectFirst: false
	});

	$("#clientMacNumber1").autocomplete("core/check-mac.php", {
		width: 260,
		selectFirst: false
	});

	$("#clientNumber1").result(function(event, data, formatted) {
		if (data)
			$(this).parent().next().find("input").val(data[1]);
	});

	$("#clientMacNumber1").result(function(event, data, formatted) {
		if (data)
			$(this).parent().next().find("input").val(data[1]);
	});

});

  // shortcut link avec le keyboard
  $(document).shortkeys({
    ';+o':       function () { 	$("div#panel").slideDown("slow"); $("#toggle a").toggle(); },
    ';+f':       function () { 	$("div#panel").slideUp("slow"); $("#toggle a").toggle(); },
    ';+c':       function () { gotoLink('client'); },
    ';+h':       function () { gotoLink('hardware'); }
 /* 'a+c':           function () { gotoLink('addclient'); },
    'a+h':           function () { gotoLink('addhardware'); },
*/
  });

function gotoLink($l) {
  if ($l == 'client') { window.location.href="index.php?_m=client&_a=gestion"; }
  if ($l == 'hardware') { window.location.href="index.php?_m=hardware&_a=gestion"; }
  if ($l == 'addclient') { window.location.href="index.php?_m=client&_a=new"; }
  if ($l == 'addhardware') { window.location.href="index.php?_m=hardware&_a=new"; }
}

function newCustomerComment(id) {
  alert("A venir...");
}



