/*$('#ultop > li').onmouseover = function() {
    this.className += ' over';
    this.addClass('over');
};
$('#ultop > li').onmouseout = function() {
    //this.className  = this.className.replace(' over', '')
};*/



function getDemo(p) {
    $('#dialog').html("<img src='/public/images/progress.gif' />");
    $('#dialog').dialog('open');
    $.post('/manage/getmailform/',
    {
        run : 'get'
    },
    function(data) {
        $('#dialog').html(data.form);
        $('#p').val(p);
    }, 'json');
}

$(document).ready(function(){
    $('#ultop>li').mouseover(function(){
        $(this).addClass('over');
    });
    $('#ultop>li').mouseout(function(){
        $(this).removeClass('over');
    });
    
    //баннеры
    $('#kkm').flash({
        src :   '/public/flash/baner_right_dont_www.swf',
        width   :   270,
        height  :   90,
        version: '10',
        wmode: 'opaque',
        expressInstall: true

    });
    $('#kkmcto').flash({
        src :   '/public/flash/baner_right_dont_www.swf',
        width   :   270,
        height  :   90,
        version: '10',
        wmode: 'opaque',
        expressInstall: true

    });

    $('#dialog').dialog({
        autoOpen : false,
        width : 400
    });

    $('#kkm2').flash({
        src :   '/public/flash/ban2.swf',
        width   :   270,
        height  :   90,
        version: '10',
        wmode: 'opaque',
        expressInstall: true

    });
    $('#kkm2cto').flash({
        src :   '/public/flash/ban2.swf',
        width   :   270,
        height  :   90,
        version: '10',
        wmode: 'opaque',
        expressInstall: true

    });

    $('#pr-ch').flash({
        src :   '/public/flash/pri_ch.swf',
        width   :   160,
        height  :   94,
        version: '10',
        wmode: 'opaque',
        expressInstall: true

    });
    
    
    $('.datep').datepicker({
        changeYear: true,
        changeMonth: true
    });
    //
    //редактор
    if (jQuery('.wedit').length) {
        jQuery('.wedit').wysiwyg({

            css : '/public/css/edit.css',
            controls : {
                bold : {
                    visible : true,
                    tags : ["b", "strong"],
                    css : {
                        fontWeight : "bold"
                    }
                },
                italic : {
                    visible : true,
                    tags : ["i", "em"],
                    css : {
                        fontStyle : "italic"
                    }
                },
                strikeThrough : {
                    visible : true
                },
                underline : {
                    visible : true
                },
                separator00 : {
                    visible : true
                },
                justifyLeft : {
                    visible : true
                },
                justifyCenter : {
                    visible : true
                },
                justifyRight : {
                    visible : true
                },
                justifyFull : {
                    visible : true
                },
                separator01 : {
                    visible : true
                },
                indent : {
                    visible : true
                },
                outdent : {
                    visible : true
                },
                separator02 : {
                    visible : true
                },
                subscript : {
                    visible : true
                },
                superscript : {
                    visible : true
                },
                separator03 : {
                    visible : true
                },
                undo : {
                    visible : true
                },
                redo : {
                    visible : true
                },
                separator04 : {
                    visible : true
                },
                insertOrderedList : {
                    visible : true
                },
                insertUnorderedList : {
                    visible : true
                },
                insertHorizontalRule : {
                    visible : true
                },
                separator06 : {
                    separator : true
                },
                separator07 : {
                    visible : true
                },
                cut : {
                    visible : false
                },
                copy : {
                    visible : false
                },
                paste : {
                    visible : false
                },
                html : {
                    visible : true
                }
            }
        });
    }
});

$('.aform').livequery(function() {
    $(this).submit(function() {
        var action = $(this).attr('action');
        $(this).effect('pulsate', '', 1000) ;
        $.post(action,
            $(this).serialize(),
            function(data) {
                if (data.done){
                    $('#dialog').dialog('close');
                }
                else {
                    $('#dialog').html(data.form);
                }
            },'json');
        return false;
    })
});
//$('.mtel').livequery(function(){$(this).mask('+(9)999-999-99-99');});

