


function js_change_status(status, content_model_name, content_id, redirect_to) { // svilupare con jq

    if (document.getElementById('recursive').checked) {
        location.href = '/change_status/' + status + '/recursive/' + content_model_name + '/' + content_id + '?next=' + redirect_to;
    }
    else {
        location.href = '/change_status/' + status + '/' + content_model_name + '/' + content_id + '?next=' + redirect_to;
    };
}; 


function js_submit(action) { // svilupare con jq
    
    document.getElementById('action').setAttribute('value', action);
    document.edit_objs_form.submit();
};


function js_single_submit(button) { // svilupare con jq

        button.value="Processing...";
        button.disabled = true;
        return true;
};


function show_or_hide_all_password_input_fields(value) { // svilupare con jq

    input_pass1 = $('tr td input[name="password1"]');
    input_pass2 = $('tr td input[name="password2"]');

    tr_pass1 = input_pass1.parent().parent();
    tr_pass2 = input_pass2.parent().parent();

    // show or hide error messages
    tr_pass1.next().css('display', value);
    tr_pass2.next().css('display', value);
    // show or hide password fields
    tr_pass1.css('display', value);
    tr_pass2.css('display', value);
    // show or hide help texts
    tr_pass1.prev().css('display', value);
    tr_pass2.prev().css('display', value);
};


function show_password_input_fields_on_change() {

    $(':radio').change(function () {
        if ($(this).attr('value') == 'change') {
            show_or_hide_all_password_input_fields('table-row');
        }
        else {
            show_or_hide_all_password_input_fields('none');
        };
    });    
};


function show_hide (id) {
    if ($('#'+id).css('display') != 'none') {
        $('#'+id).css('display','none');
        $('#'+id+'_switch a img').attr('src','/store/static/cms/icons/plus.gif');
    }
    else {
        $('#'+id).css('display','block');
        $('#'+id+'_switch a img').attr('src','/store/static/cms/icons/minus.gif');
    }
};


function set_all_plus () {
    $('.show_hide a img').attr({src: '/store/static/cms/icons/plus.gif',
                                title: 'plus',
                                alt: 'plus'
                               });
};


function set_all_minus () {
    $('.show_hide a img').attr({src: '/static/custodian/icons/minus.gif',
                                title: 'minus',
                                alt: 'minus'
                               });
};


function init_fancybox () {

    $('a.fancybox').fancybox({

        'padding'           :   10,
        'margin'            :   20,
        'opacity'           :   true,
        //'modal'             :   false,
        //'cyclic'            :   false,
        'scrolling'         :   'no',
        'width'             :   700,
        'height'            :   500,
        //'autoDimensions'    :   true,
        'autoScale'         :   true,
        //'centerOnScroll'    :   true,
        'hideOnOverlayClick':   false,
        //'hideOnContentClick':   false,
        //'overlayShow'       :   true,
        'overlayOpacity'    :   0.3,
        'overlayColor'      :   '#666',
        'titleShow'         :   false,
        //'titlePosition'     :   'over',
        //'titleFormat'       :   null,
        'transitionIn'	    :	'fade',
		'transitionOut'	    :	'fade',
		'speedIn'		    :	300, 
		'speedOut'		    :	200, 
		//'changeSpeed'	    :	300,
		//'changeFade'	    :	'fast',
		//'easingIn'  	    :	'swing',
		//'easingOut  '	    :	'swing',
		//'showCloseButton'	:	true,
		//'showNavArrows'	    :	true,
		'enableEscapeButton':	true,
        //'onStart'           : 	null,
        //'onCancel'          : 	null,
        //'onComplete'        : 	null,
        //'onCleanup'         : 	null,
        //'onClosed'          :    null

        // advanced options
    });
    
    // public methods

};


$(document).ready(function() {
    init_fancybox();
});



