/*
 * Create by Jimmy.collazos
 */
$(document).ready(function(){
    if ($("#addArticle")) {
        $("#addArticle").click(function(){
            $.ajax({
                type: "GET",
                url: "app/ajax/colection_addarticle.asp",
                data: "ref=" + $('#image_reference').val(),
                success: function(datos){
                    $("#rmArticle").removeClass('hidden');
                    $("#addArticle").addClass('hidden');
                }
            });
        })
    }
    if ($("#rmArticle")) {
        $("#rmArticle").click(function(){
            $.ajax({
                type: "GET",
                url: "app/ajax/colection_rmarticle.asp",
                data: "ref=" + $('#image_reference').val(),
                success: function(datos){
                    $("#addArticle").removeClass('hidden');
                    $("#rmArticle").addClass('hidden');
                }
            });
        })
    }
    if ($("a.rmArticle").length > 0) {
        $("a.rmArticle").each(function(i){
            $(this).attr('ref', $($('input.image_reference').get(i)).val())
            $(this).click(function(){
                //alert( $(this).attr('ref') )
                $('#image_reference_for_rm').val($(this).attr('ref'));
                $.ajax({
                    type: "GET",
                    url: "app/ajax/colection_rmarticle.asp",
                    data: "ref=" + $('#image_reference_for_rm').val(),
                    success: function(datos){
                    
                    }
                });
                $('#' + $(this).attr('ref')).remove();
                return false
            })
        })
    }
    if($("a.nolink")){
        $("a.nolink").click(function(){return false})
    }
    
    
    // ÑaÑAÑa
    // Desactibar boton derecho
    function disableIE(){
        if (document.all) {
            return false;
        }
        
    }
    function disableNS(e){
        if (document.layers || (document.getElementById && !document.all)) {
        
            if (e.which == 2 || e.which == 3) {
                return false;
            }
            
        }
        
    }
    
    if (document.layers) {
        document.captureEvents(Event.MOUSEDOWN);
        document.onmousedown = disableNS;
        }
    else {
        document.onmouseup = disableNS;
        document.oncontextmenu = disableIE;
    }
    document.oncontextmenu = new Function("return false")
    
    

    // END ÑaÑAÑa
})
