var visibleMenu = "";
function hideMenu(a) { document.getElementById(a).style.display = "none"; visibleMenu = "" }
function affiche_menu(a, b) { if (document.getElementById(a) != null) { document.getElementById(a).style.display = "" } document.getElementById(b).className = "actif" } function cache_menu(a, b) { if (document.getElementById(a) != null) { document.getElementById(a).style.display = "none" } document.getElementById(b).className = "" }
function viewMenu(a) { if (visibleMenu != "" && visibleMenu != a) { hideMenu(visibleMenu, 1) } if (visibleMenu != a) { document.getElementById(a).style.display = "block"; visibleMenu = a } }

$(document).ready(function() {
    bindClickAutoDiagnose();
    bindClickGarantie();
});

function bindClickGarantie() {
    $('.sendAutoDiagnose').bind('click',
    function() {
    if ($('.NbCarteDecathlon').val() == '' && $('.trAdresse').is(":hidden")) {
            $("#sendAutoDiagnose").dialog({
                modal: true,
                width: 500,
                close: function(event, ui) {
                    $("#sendAutoDiagnose").dialog("destroy");
                }
            });
            return false;
        }
        }
    );
    }

    function AfficherAdresse() {

        $("#sendAutoDiagnose").dialog("destroy");
        //$('.trNbCarteDecathlon').hide();
        $('.trAdresse').show();     
    }

function bindClickAutoDiagnose() {
    $('.garantie').bind('click',
    function() {
        $("#garantie").dialog({
            modal: true,
            width: 500,
            close: function(event, ui) {
                $("#garantie").dialog("destroy");
            }
        });
        return false;
    }
    );
}
		
var ImageLoader = {
	show: function(obj) {
		var $j = jQuery.noConflict();
		$j('#imgSelectedContainer').css('display', 'block');
		$j('#imgSelected').attr('src', $j('#' + obj).attr('src'));
	},
	hideAll: function() {
		var $j = jQuery.noConflict();
		$j('#imgSelectedContainer').css('display', 'none');
		$j('#imgSelected').attr('src', '');
	}
}
var Search = {
	popup: function() {
		//var $j = jQuery.noConflict();
		$(document).ready(function() {
			$("#dialog").dialog({
				modal: true,
				width: 500
			});
		});
	}
}

var FAQ = {
note: function(url, idQuestion, value, diagnose, idCat, idP) {

    var $j = jQuery.noConflict();
    $j.ajax({
        type: "POST",
        url: url,
        data: "id="+idQuestion+"&note="+value+"&diagnose="+diagnose+"&idcat="+idCat+"&idP="+idP,
        cache: false,
        success: function(data) {
            $j('#divSatisfait').dialog('destroy');
            $j('#divSatisfait').html(data).dialog({
                modal: true,
                width: 500
            });
        }
    });
	}
}

var Diagnose = {
    dptChange: function(obj) {
        var $j = jQuery.noConflict();
        $j('#tableDiagnoseForm2').css('display', obj.value != '0' ? '' : 'none');
    },

    loadDpt: function(obj) {
        //var $j = jQuery.noConflict();
        //$j('#tableDiagnoseForm2').css('display', $j('#' + obj).val() != '0' ? '' : 'none');
    },

    sendForm: function(url, json) {
        var $j = jQuery.noConflict();
        $j.ajax({
            type: "POST",
            url: url,
            data: json,
            cache: false,
            success: function(data) {
                //alert(data);
                $j('#divEnvoiOk').dialog('destroy');
                $j('#divEnvoiOk').html(data).dialog({
                    modal: true,
                    width: 500
                });
            }
        });
        /* var $j = jQuery.noConflict();
        $j.post(url, json,
        function(data, textStatus) {
        alert(data.Result);
        if (data.success) {
        $j('#divEnvoiOk').dialog('destroy');
        $j('#divEnvoiOk').html(data.message).dialog({
        modal: true,
        width: 500
        });
        //alert(data.message);
        //window.location = data.returnUrl;
        }
        }, "json");*/
    }
}

