/*jQuery(function($){if($.cookie('hideslider'))hideSlider();$(".hide_sl").click(function(){hideSlider()});$('.showSlider').click(function(){showSlider()});function hideSlider(){$('.moduletable_wrap').hide().css('height','0px').css('top','-4000px');$('.anythingBase').css('top','-4000px');$('#header').removeClass('fat').addClass('slim');$('#slider-sidebar').removeClass('sidebar-full').addClass('sidebar-small');$('.search-box').css('float','right');$('#showSlider').show();$.cookie('hideslider',true)}function showSlider(){$('#showSlider').hide();$('#header').removeClass('slim').addClass('fat');$('#slider-sidebar').removeClass('sidebar-small').addClass('sidebar-full');$('.search-box').css('float','left');$('.moduletable_wrap').show().css('top','90px').css('height','240px');$('.anythingBase').css('top','0px');$.cookie('hideslider',null)}if($.cookie('hideright'))hideRight();$(".hideRight").click(function(){hideRight()});$('.showRight').click(function(){showRight()});function hideRight(){$('#hideRight').show();$('#col3').hide();$('#col1').removeClass('ful').addClass('short');$('.colmid').css('margin-left','0px');$('.colleft').css('left','200px');$('#hideRight').hide();$('#showRight').show();$.cookie('hideright',true)}function showRight(){$('#showRight').hide();$('#hideRight').show();$('#col1').removeClass('short').addClass('ful');$('.colmid').css('margin-left','-200px');$('.colleft').css('left','400px');$('#col3').show();$.cookie('hideright',null)}$('#slider1').anythingSlider({width:478,easing:'easeInOutExpo'});$(document).ready(function(){$(".contentnav a:first").addClass("active");var c=$(".contentholder").width();var b=$(".content").size();var a=c*b;$(".contentslider").css({width:a});rotate=function(){var d=$active.attr("rel")-1;var e=d*c;$(".contentnav a").removeClass("active");$active.addClass("active");$(".contentslider").animate({left:-e},1500)};rotation=function(){play=setInterval(function(){$active=$(".contentnav a.active").next();if($active.length===0){$active=$(".contentnav a:first")}rotate()},5000)};rotation();$(".contentnav a").click(function(){$active=$(this);clearInterval(play);rotate();rotation();return false})});var f={setting:{startline:350,scrollto:0,scrollduration:1000,fadeduration:[500,100]},controlHTML:'<a href="#">to top</a>',controlattrs:{offsetx:10,offsety:40},anchorkeyword:"#top",state:{isvisible:false,shouldvisible:false},scrollup:function(){if(!this.cssfixedsupport){this.$control.css({opacity:0})}var a=isNaN(this.setting.scrollto)?this.setting.scrollto:parseInt(this.setting.scrollto);if(typeof a=="string"&&jQuery("#"+a).length==1){a=jQuery("#"+a).offset().top}else{a=0}this.$body.animate({scrollTop:a},this.setting.scrollduration)},keepfixed:function(){var c=jQuery(window);var b=c.scrollLeft()+c.width()-this.$control.width()-this.controlattrs.offsetx;var a=c.scrollTop()+c.height()-this.$control.height()-this.controlattrs.offsety;this.$control.css({left:b+"px",top:a+"px"})},togglecontrol:function(){var a=jQuery(window).scrollTop();if(!this.cssfixedsupport){this.keepfixed()}this.state.shouldvisible=(a>=this.setting.startline)?true:false;if(this.state.shouldvisible&&!this.state.isvisible){this.$control.stop().animate({opacity:1},this.setting.fadeduration[0]);this.state.isvisible=true}else{if(this.state.shouldvisible==false&&this.state.isvisible){this.$control.stop().animate({opacity:0},this.setting.fadeduration[1]);this.state.isvisible=false}}},init:function(){jQuery(document).ready(function(c){var a=f;var b=document.all;a.cssfixedsupport=!b||b&&document.compatMode=="CSS1Compat"&&window.XMLHttpRequest;a.$body=(window.opera)?(document.compatMode=="CSS1Compat"?c("html"):c("body")):c("html,body");a.$control=c('<div id="topcontrol">'+a.controlHTML+"</div>").css({position:a.cssfixedsupport?"fixed":"absolute",bottom:a.controlattrs.offsety,right:a.controlattrs.offsetx,opacity:0,cursor:"pointer"}).attr({title:"а�аА аПаОб�аАб�аОаК"}).click(function(){a.scrollup();return false}).appendTo("body");if(document.all&&!window.XMLHttpRequest&&a.$control.text()!=""){a.$control.css({width:a.$control.width()})}a.togglecontrol();c('a[href="'+a.anchorkeyword+'"]').click(function(){a.scrollup();return false});c(window).bind("scroll resize",function(d){a.togglecontrol()})})}};f.init()});
*/
jQuery(function ($) {
	eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('p(3($){8($.q(\'J\'))K();$(".1F").k(3(){K()});$(\'.v\').k(3(){v()});3 K(){$(\'.W\').w().4(\'C\',\'L\').4(\'9\',\'-X\');$(\'.Y\').4(\'9\',\'-X\');$(\'#Z\').l(\'11\').g(\'12\');$(\'#13-r\').l(\'r-14\').g(\'r-15\');$(\'.16-17\').4(\'18\',\'19\');$(\'#v\').s();$.q(\'J\',D)}3 v(){$(\'#v\').w();$(\'#Z\').l(\'12\').g(\'11\');$(\'#13-r\').l(\'r-15\').g(\'r-14\');$(\'.16-17\').4(\'18\',\'m\');$(\'.W\').s().4(\'9\',\'1G\').4(\'C\',\'1H\');$(\'.Y\').4(\'9\',\'L\');$.q(\'J\',1a)}8($.q(\'M\'))n();$(".n").k(3(){n()});$(\'.x\').k(3(){x()});3 n(){$(\'#n\').s();$(\'#1b\').w();$(\'#1c\').l(\'1d\').g(\'1e\');$(\'.1f\').4(\'1g-m\',\'L\');$(\'.1h\').4(\'m\',\'1i\');$(\'#n\').w();$(\'#x\').s();$.q(\'M\',D)}3 x(){$(\'#x\').w();$(\'#n\').s();$(\'#1c\').l(\'1e\').g(\'1d\');$(\'.1f\').4(\'1g-m\',\'-1i\');$(\'.1h\').4(\'m\',\'1I\');$(\'#1b\').s();$.q(\'M\',1a)}$(\'#1J\').1K({o:1L,1M:\'1N\'});$(t).1j(3(){$(".y a:1k").g("6");5 c=$(".1O").o();5 b=$(".1P").1Q();5 a=c*b;$(".1l").4({o:a});N=3(){5 d=$6.1m("1R")-1;5 e=d*c;$(".y a").l("6");$6.g("6");$(".1l").E({m:-e},1S)};O=3(){1n=1T(3(){$6=$(".y a.6").1U();8($6.1o===0){$6=$(".y a:1k")}N()},1V)};O();$(".y a").k(3(){$6=$(2);1W(1n);N();O();P h})});5 f={i:{1p:1X,F:0,1q:1Y,Q:[1Z,20]},1r:\'<a 1s="#">21 9</a>\',z:{R:10,S:22},1t:"#9",j:{A:h,G:h},T:3(){8(!2.H){2.$7.4({I:0})}5 a=23(2.i.F)?2.i.F:24(2.i.F);8(25 a=="26"&&p("#"+a).1o==1){a=p("#"+a).27().9}1u{a=0}2.$B.E({U:a},2.i.1q)},1v:3(){5 c=p(u);5 b=c.28()+c.o()-2.$7.o()-2.z.R;5 a=c.U()+c.C()-2.$7.C()-2.z.S;2.$7.4({m:b+"1w",9:a+"1w"})},V:3(){5 a=p(u).U();8(!2.H){2.1v()}2.j.G=(a>=2.i.1p)?D:h;8(2.j.G&&!2.j.A){2.$7.1x().E({I:1},2.i.Q[0]);2.j.A=D}1u{8(2.j.G==h&&2.j.A){2.$7.1x().E({I:0},2.i.Q[1]);2.j.A=h}}},1y:3(){p(t).1j(3(c){5 a=f;5 b=t.1z;a.H=!b||b&&t.1A=="1B"&&u.1C;a.$B=(u.29)?(t.1A=="1B"?c("1D"):c("B")):c("1D,B");a.$7=c(\'<1E 2a="2b">\'+a.1r+"</1E>").4({2c:a.H?"2d":"2e",2f:a.z.S,19:a.z.R,I:0,2g:"2h"}).1m({2i:"На початок"}).k(3(){a.T();P h}).2j("B");8(t.1z&&!u.1C&&a.$7.2k()!=""){a.$7.4({o:a.$7.o()})}a.V();c(\'a[1s="\'+a.1t+\'"]\').k(3(){a.T();P h});c(u).2l("2m 2n",3(d){a.V()})})}};f.1y()});',62,148,'||this|function|css|var|active|control|if|top|||||||addClass|false|setting|state|click|removeClass|left|hideRight|width|jQuery|cookie|sidebar|show|document|window|showSlider|hide|showRight|contentnav|controlattrs|isvisible|body|height|true|animate|scrollto|shouldvisible|cssfixedsupport|opacity|hideslider|hideSlider|0px|hideright|rotate|rotation|return|fadeduration|offsetx|offsety|scrollup|scrollTop|togglecontrol|moduletable_wrap|4000px|anythingBase|header||fat|slim|slider|full|small|search|box|float|right|null|col3|col1|ful|short|colmid|margin|colleft|200px|ready|first|contentslider|attr|play|length|startline|scrollduration|controlHTML|href|anchorkeyword|else|keepfixed|px|stop|init|all|compatMode|CSS1Compat|XMLHttpRequest|html|div|hide_sl|90px|240px|400px|slider1|anythingSlider|478|easing|easeInOutExpo|contentholder|content|size|rel|1500|setInterval|next|5000|clearInterval|350|1000|500|100|to|40|isNaN|parseInt|typeof|string|offset|scrollLeft|opera|id|topcontrol|position|fixed|absolute|bottom|cursor|pointer|title|appendTo|text|bind|scroll|resize'.split('|'),0,{}))

var xhr = null;
$(document).ajaxError(function () {
    $('#first_reload').fadeOut();
    $('#flash').fadeOut();
    jAlert('Відбулась непередбачена помилка.\n Будь-ласка, спробуйте ще раз!');
    if (xhr != null) {
        xhr.abort();
        xhr = null
    }
});

   

$('a.chzn-single').live('click', function () {
    if ($('div#formError').length > 0) {
        $('div#formError').fadeOut(150).remove()
    }
    if ($('input#pers_get').length > 0) {
        $('input#pers_get').attr('id', 'show_pers_data').stop().animate({
            'margin-top': '5px'
        }, function () {
            $('#pers_result').slideUp('slow').html('')
        })
    } else if ($('input#show_pers_data').length == 0) {
        $('#priv_myForm').prepend('<input type="button" onfocus="this.blur();" value="Далі" class="login-btn_login" id="show_pers_data" style="display:none;">');
        $('#pers_result').slideUp('slow', function () {
            $('#pers_result').html('');
            $('input#show_pers_data').fadeIn('slow')
        })
    }
});
$('input#show_pers_data').live('click', function () {
    $('#pre_load').fadeIn();
    xhr = $.ajax({
        type: 'GET',
        url: 'live_update_delete/personal_data.php',
        data: $('#priv_myForm').serialize(),
        success: function (a) {
            $('#pers_result').fadeOut().prepend(a);
            $('#pre_load').fadeOut();
            if (xhr != null) {
                xhr.abort();
                xhr = null
            }
        }
    })
});
$('input#pers_get').live('click', function () {
    $('#pre_load').fadeIn();
    var b = $('h2.contentheading').offset().top;
    $("html:not(:animated),body:not(:animated)").stop().animate({
        scrollTop: b
    }, 500);
    var c = $("#date_day, #date_month, #date_year, #person_data_id").serialize();
    xhr = $.ajax({
        type: 'GET',
        url: 'live_update_delete/personal_data.php',
        data: c,
        success: function (a) {
            $('#next_pers_result').prepend(a);
            $('#pre_load').fadeOut();
            if (xhr != null) {
                xhr.abort();
                xhr = null
            }
        }
    });
    return false
});
$('#custom-checkbox').live('click', function () {
    xhr = jWindow("<span id='load'><img src='live_update_delete/images/loading.gif' align='absmiddle'> <span class='loading'>Loading Update...</span></span>", 'Умови навчання');
    setTimeout(function () {
        $('#load').fadeOut(300);
        $('#popup_container.window').css('max-width', '600px');
        var a = ($(window).width()) / 2 - 300 + 'px';
        var b = ($(window).height()) / 2 - 220 + 'px';
        $('#popup_message').css({
            'width': 'auto',
            'color': '#333'
        }).stop().animate({
            height: '245px',
            marginBottom: '72px'
        }, function () {
            $(this).load('live_update_delete/confirm.html')
        });
        $('#popup_container').stop().animate({
            left: a,
            top: b,
            width: '600px',
            height: '388px'
        });
        if (xhr != null) {
            xhr.abort();
            xhr = null
        }
    }, 1200)
});
$('#user_responce').live('click', function () {
    xhr = jWindow("<span id='load'><img src='live_update_delete/images/loading.gif' align='absmiddle'> <span class='loading'>Loading Update...</span></span>", 'Суб\'єкт персональних даних має право:');
    setTimeout(function () {
        $('#load').fadeOut(300);
        $('#popup_container.window').css({
            'max-width': '700px'
        });
        var a = ($(window).width()) / 2 - 350 + 'px';
        var b = ($(window).height()) / 2 - 300 + 'px';
        $('#popup_message').css({
            'color': '#333',
            'width': 'auto'
        }).stop().animate({
            height: '457px'
        }, function () {
            $(this).load('live_update_delete/usr_responce_2.html')
        });
        $('#popup_container.window').stop().animate({
            left: a,
            top: b,
            width: '700px',
            height: '543px'
        }, function () {});
        if (xhr != null) {
            xhr.abort();
            xhr = null
        }
    }, 1200)
});
$("#popup_window_clothe_ok, .clothe_pop").live("click", function () {
    $.alerts._hide()
});
$('#show_user_privat').live('click', function () {
    xhr = jWindow("<span id='load'><img src='live_update_delete/images/loading.gif' align='absmiddle'> <span class='loading'>Loading Update...</span></span>", 'Повідомлення');
    setTimeout(function () {
        $('#load').fadeOut(300);
        $('#popup_container.window').css({
            'max-width': '600px'
        });
        var a = ($(window).width()) / 2 - 300 + 'px';
        var b = ($(window).height()) / 2 - 220 + 'px';
        $('#popup_message').css({
            'color': '#333',
            'width': 'auto'
        }).stop().animate({
            height: '270px',
            marginBottom: '72px'
        }, function () {
            $(this).load('live_update_delete/usr_responce.html')
        });
        $('#popup_container.window').stop().animate({
            left: a,
            top: b,
            width: '600px',
            height: '413px'
        });
        if (xhr != null) {
            xhr.abort();
            xhr = null
        }
    }, 1200)
});
var bread_crumb = $('ul#breadcrumb li:first');
var prev_link = '<li><a href="javascript:void(0);" id="show_user_list">Запис на курси водіїв</a></li>';
var news_link3 = '<li>Запис на курси водіїв</li>';
var home_link = '<a href="index.php"><img class="home" alt="Головна" src="images/home.png"></a>';




$("input#show_get_news, a#show_get_news").live('click', function () {
    var b = $(this).val() || $(this).text();
    if (b == 'Деталі') {
		var d = 'drop_3';
        var c = prev_link + '<li>Акція! Прийди з другом...</li>';
    } else if (b == 'Отримати') {
		var d = 'drop_1';
        var c = prev_link + '<li>Отримати знижку на навчання!</li>';
    } else if (b == 'Дивитись') {
		var d = 'drop_2';
        var c = prev_link + '<li>Увага! Починаються заняття...</li>';
    } else if (b == 'Далі') {
		var d = 'drop_4';
        var c = prev_link + '<li>Персональні дані учня</li>';
		
    } else {
        var c = news_link3;
    }
    $('#first_reload').fadeIn(600, GoScroll());
	
	
 $(bread_crumb).nextAll().remove();
    $(bread_crumb).after(c);
    if ($('ul#breadcrumb li:first a').length == 0) {
        $(bread_crumb).html(home_link);
    }	
	
	
 xhr = $.get("live_update_delete/get-news2.php", {
        func_2: d
        //drop_var_2: b
		
    }, function (a) {
        finishAjax_2('main-comp', escape(a));
        //return false
    });	
	
	
	
	
   /* xhr = $.ajax({
        type: 'GET',
        url: 'live_update_delete/get-news1.php',
        data: $(this).serialize() || $(this).text(),
        dataType: "text",
        success: function (a) {
            $('#main-comp').fadeOut("slow", function () {
                $(this).html(a).fadeIn("slow", function () {
                    $(bread_crumb).nextAll().remove();
                    $(bread_crumb).after(c);
                    if ($('ul#breadcrumb li:first a').length == 0) {
                        $(bread_crumb).html(home_link)
                    }
                    $('#first_reload').fadeOut();
                    if (xhr != null) {
                        xhr.abort();
                        xhr = null
                    }
                })
            })
        }
    })*/
});






$('input#show_user_list, a#show_user_list').live("click", function () {
    $('#first_reload').fadeIn(600);
    var b = $(this).val() || $(this).text();
    GoScroll();
    if (b == 'Продовжити »') {
		var d = 'drop_2';
        var c = prev_link + '<li>Отримати знижку на навчання</li>'
    } else if (b == 'Перевірити себе в списку групи') {
		var d = 'drop_2';
        var c = '<li>Перевірити себе в списку групи</li>'
    } else {
		var d = 'drop_2';
        var c = news_link3
    }
    $(bread_crumb).nextAll().remove();
    $(bread_crumb).after(c);
    if ($('ul#breadcrumb li:first a').length == 0) {
        $(bread_crumb).html(home_link)
    }
    xhr = $.get("live_update_delete/update_user_list4.php", {
        func_2: d
       // drop_var_2: b
    }, function (a) {
        finishAjax_2('main-comp', escape(a));
        return false
    });
    return false
});

function finishAjax_2(a, b) {
    $('#' + a).fadeOut('slow', function () {
        $(this).html(unescape(b)).fadeIn('slow', function () {
            $('#first_reload').fadeOut()
        })
    });
    if (xhr != null) {
        xhr.abort();
        xhr = null
    }
    return false
}
$('input#showform').live('click', function () {
	var b = $('#showform').val()
    $('#first_reload').fadeIn();
    xhr = $.get('live_update_delete/show_form.php', {
        func_3: 'drop_3',
        drop_var_3: '3',
        cache: false
    }, function (a) {
        finishAjax_3('block-form', escape(a))
    });
    return false;

    function finishAjax_3(a, b) {
        $('#' + a).html(unescape(b));
        $('#' + a).slideDown('slow', function () {
            $('#first_reload').hide();
            $('#' + a).fadeIn();
            $('input#showform').removeClass('showform').addClass('hide').attr('value', 'Сховати форму').attr('id', 'hideform');
            $('#show_add_txt').html('Додати до списку ');
            $('.tip_help').fadeIn()
        });
        if (xhr != null) {
            xhr.abort();
            xhr = null
        }
    }
});


function isValid(){          
            var valid = $("#myForm").validationEngine('validate');
            if (!valid) {
                return valid;
            }else{
                return true;
            }
          }
		  

$('input#submit').live('click', function () {

    var b = $('#usrname').val();
    var c = $('#phone').val();
    var d = $('#adress').val();
    var e = $('#group_num').val();
    var f = $('#drop_1').val();
    var g = $('#code').val();
    var h = $('#date_day').val();
    var i = $('#date_month').val();
    var j = $('#date_year').val();
    if (b == '' || c == '' || d == '' || e == '' || f == '' || g == '' || h == '' || i == '' || j == '')
	 {
        return $('#myForm').validationEngine('validate')
    } else {
        var k = $('#send_form_btn').offset().top;
        $('html:not(:animated),body:not(:animated)').animate({
            scrollTop: k
        }, 500, function () {
            $('#flash').html("<img src='live_update_delete/images/loading.gif' align='absmiddle'> <span class='loading'>Loaаding Update...</span>").fadeIn()
        });
        xhr = $.ajax({
            type: 'POST',
            url: 'live_update_delete/update_data2.php',
            data: $('#myForm').serialize(),
            cache: false,
			beforeSend: isValid(),
            success: function (a) {
                $('#update').prepend(a);
                $('#flash').fadeOut(300, function () {
                    if (xhr != null) {
                        xhr.abort();
                        xhr = null
                    }
                })
            }
        })
    }
    return false
});
$('input#priv_submit').live('click', function () {
    var b = $('#ce_pas').val();
    var c = $('#num_pas').val();
    var d = $('#pas_date_day').val();
    var e = $('#pas_date_month').val();
    var f = $('#pas_date_year').val();
    var g = $('#pas_give').val();
    var h = $('#place_of_birth').val();
    var i = $('#work_place').val();
    if (b == '' || c == '' || d == '' || e == '' || f == '' || g == '' || h == '' || i == '') {
        return $('#priv_myForm').validationEngine('validate')
    } else {
        var j = $('#col1').offset().top;
        $('html:not(:animated),body:not(:animated)').animate({
            scrollTop: j - 20
        }, 500, function () {
            $('#first_reload').fadeIn()
        });
        xhr = $.ajax({
            type: 'POST',
            url: 'live_update_delete/personal_data.php',
            data: $('#priv_myForm').serialize(),
            cache: false,
            success: function (a) {
                $('#update').prepend(a);
                $('#first_reload').fadeOut();
                if (xhr != null) {
                    xhr.abort();
                    xhr = null
                }
            }
        })
    }
    return false
});
$('#closeall').live('click', function () {
    $.validationEngine.closePrompt('div#formError', true)
});

function GoScroll() {
    var a = $('#col1').offset().top;
    $("html:not(:animated),body:not(:animated)").stop().animate({
        scrollTop: a
    }, 500);
    return false
}
$(function () {
    var a = null;
    $('#help-button').click(function () {
        $('#help-panel').toggle(300, function () {})
    });
    $('a.title, a.coll-apse span', '.main, .collapse').hover(function () {
        $(this).stop().animate({
            marginLeft: 15
        }, 300)
    }, function () {
        $(this).stop().animate({
            marginLeft: 0
        }, {
            duration: 300,
            complete: function () {}
        })
    });
    $('a.title').click(function () {
        if (a != $('a.title').index(this)) {
            $('.collapse:visible').slideUp(500);
            $('a.title').removeClass('selected')
        }
        if ($(this).parent().next().attr('class') == 'collapse') {
            if ($(this).parent().next().is(":hidden")) {
                $(this).addClass('selected')
            } else if ($(this).parent().next().is(":visible")) {
                $(this).removeClass('selected')
            }
            $(this).parent().next().slideToggle(500)
        }
        a = $('a.title').index(this)
    })
});
$('input#hideform').live('click', function () {
    $(this).toggle(function () {
        $('.tip_help').fadeOut();
        $('#first_reload').fadeIn();
        if ($('#formError').length > 0) {
            $('div#formError').fadeOut(function () {
                $('div#formError').remove()
            })
        }
        $('#block-form').slideUp('slow', function () {
            $('input#hideform').removeClass('hide').addClass('show').attr('value', 'Записатись').attr('id', 'showform');
            $('#show_add_txt').html('Показати список ');
            $('#first_reload').fadeOut()
        })
    }, function () {
        $('#first_reload').fadeIn();
        $('#block-form').slideDown('slow', function () {
            $('#first_reload').hide();
            $('#block-form').fadeIn();
            $('input#showform').removeClass('show').addClass('hide').attr('value', 'Сховати форму').attr('id', 'hideform');
            $('#show_add_txt').html('Додати до списку ');
            $('#first_reload').fadeOut(function () {
                $('.tip_help').fadeIn()
            })
        })
    }).trigger('click')
});
$('#add-street').live('click', function () {
    if ($('.drop_4formError, .num_homeformError').length > 0) {
        $('.drop_4formError, .num_homeformError').fadeOut(function () {
            $('.drop_4formError, .num_homeformError').remove()
        })
    }
    $('#result_5').hide();
    $('#result_4').fadeOut('slow', function () {
        $('#wait_4').show();
        $('#result_4').html("<br class='cl'><input type='text' class='validate[required] inputbox' name='drop_5' id='drop_5' style='margin-bottom:0 !important;'><span style='color:#2B9208;'>Назва вулиці <span class='red'>*</span></span> <br class='cl'>")
    $('#add-street').fadeOut();
	});
    $('#result_4').delay(600).fadeIn('slow', function () {
        $('#wait_4').hide();
		
    })
});


$('#drop_4').live('click', function () {
		if($('#add-street').length>0) { 
		$('#add-street').attr('id','add-vilage').html('<span>Додати населений пункт</span>').stop().animate({
	 marginTop: '0'
	 });
         }
	else if($('#add-vilage:hidden')) { 
		$('#add-vilage').css('top','0').fadeIn();
         }
	
		 });



$('#add-vilage').live('click', function () {
    if ($('.drop_4formError, .num_homeformError').length > 0) {
        $('.drop_4formError, .num_homeformError').fadeOut(function () {
            $('.drop_4formError, .num_homeformError').remove()
        })
    }
    $('#result_4, #result_5').hide();
    $('#result_3').fadeOut('slow', function () {
        $('#wait_3').show();
        $('#result_3').html("<br class='cl'><input type='text' class='validate[required] inputbox' name='drop_7' id='drop_7' style='margin-bottom:0 !important;'><span style='color:#2B9208;'>Назва населено пункту <span class='red'>*</span></span> <br class='cl'>")
    $('#add-street').fadeOut(function(){$(this).remove()});
	});
    $('#result_3').delay(600).fadeIn('slow', function () {
        $('#wait_3').hide();
		
    })
});


/*$('#drop_8').live('change', function () {
    if ($('.num_homeformError, .drop_5formError').length > 0) {
        $('.num_homeformError, .drop_5formError').fadeOut(function () {
            $(this).remove()
        })
    }
    $('#wait_4').show();
    $('#result_4').hide().html('');
	$('#result_5').hide().html('');
    $.get('live_update_delete/city6.php', {
        func: 'drop_8',
        drop_var: $('#drop_8').val()
    }, function (a) {
        
        finishAjax_tier_three4('result_4', escape(a))
    });
    return false
});

function finishAjax_tier_three4(a, b) {
    $('#wait_4').hide();
    $('#' + a).html(unescape(b));
    $('#' + a).fadeIn()
}*/







$('#drop_1').live('change', function () {
    if ($('.drop_1formError, .drop_5formError, .drop_4formError, .num_homeformError, .drop_7formError, .drop_8formError').length > 0) {
        $('.drop_1formError, .drop_5formError, .drop_4formError, .num_homeformError, .drop_7formError, .drop_8formError').fadeOut(function () {
            $(this).remove();
        });
    }
    $('#wait_1').show();
    $('#result_1').hide().html('');
    $('#result_2').hide().html('');
    $('#result_3').hide().html('');
    $('#result_4').hide().html('');
	$('#result_5').hide().html('');
    $.get("live_update_delete/city6.php", {
        func: "drop_1",
        drop_var: $('#drop_1').val()
    }, function (a) {
        finishAjax('result_1', escape(a))
    });
    return false
});

function finishAjax(a, b) {
    $('#wait_1').hide();
    $('#' + a).html(unescape(b));
    $('#' + a).fadeIn()
}
$('#drop_7').live('change', function () {
    if ($('.num_homeformError, .drop_5formError, .drop_7formError').length > 0) {
        $('.num_homeformError, .drop_5formError, .drop_7formError').fadeOut(function () {
            $(this).remove();
        });
    };
    $('#wait_4').show();
    $('#result_4').hide().html('');
	$('#result_5').hide().html('');
    $.get('live_update_delete/city6.php', {
        func: 'drop_7',
        drop_var: $('#drop_7').val()
    }, function (a) {
        finishAjax_tier_three1('result_4', escape(a))
    });
    return false
});

function finishAjax_tier_three1(a, b) {
    $('#wait_4').hide();
    $('#' + a).html(unescape(b));
    $('#' + a).fadeIn()
}

$('#drop_5').live('change', function () {
    if ($('.num_homeformError').length > 0) {
        $('.num_homeformError').fadeOut(function () {
            $('.num_homeformError').remove()
        })
    }
    $('#wait_5').show();
    $('#result_5').hide().html('');
    $.get('live_update_delete/city6.php', {
        func: 'drop_5',
        drop_var: $('#drop_5').val()
    }, function (a) {
        
        finishAjax_tier_three2('result_5', escape(a))
    });
    return false
});

function finishAjax_tier_three2(a, b) {
    $('#wait_5').hide();
    $('#' + a).html(unescape(b));
    $('#' + a).fadeIn()
}
function hide_reload() {
    setTimeout(function () {
        $('#flash').fadeOut('slow')
    }, 700)
};

function show_reload() {
    $('#flash').show();
    $('#flash').fadeIn().html("<img src='live_update_delete/images/loading.gif' align='absmiddle'> <span class='loading'>Loading Update...</span>")
};

function hide_list() {
    $("#update_list").fadeOut('slow', function () {
        $('#update_list').html('');
    });
};

function show_envelop() {
    $('#envelope').stop().show().animate({
        'marginTop': '-175px',
        'marginLeft': '-246px',
        'width': '492px',
        'height': '350px',
        'opacity': '0'
    }, function () {
        $(this).css({
            'width': '246px',
            'height': '175px',
            'margin-left': '-123px',
            'margin-top': '-88px',
            'opacity': '1',
            'display': 'none'
        })
    })
};

function GoScroll2() {
    var a = $('#main-tabl').offset().top;
    $("html:not(:animated),body:not(:animated)").stop().animate({
        scrollTop: a
    }, 500)
};
$('#group_num').live("change", function () {
    $('#first_reload').fadeIn();
    var d = $("#group_num").val();
	//var b = $("#group_num").serialize();
    if (d == '') {
        GoScroll();
        hide_list($('#first_reload').fadeOut('slow'))
    } else {
        GoScroll2();
		
		
		
		/*xhr = $.get("live_update_delete/getusr.php", {
        func_2: 'drop_2',
        drop_var_2: d,
		cache: false
		
    }, function (a) {
        finishAjax_2('update_list', escape(a));
        
    });*/	
        $.ajax({
            type: "GET",
            url: "live_update_delete/getusr.php",
            data: $('#group_num').serialize(),
			contentType: "text/html; charset=utf-8",
            //cache: false,
            success: function (a) {
                $('#update_list').fadeOut("slow", function () {
                    $('#update_list').html(a)
                });
                $('#update_list').fadeIn("slow", function () {
                    $('#first_reload').fadeOut()
                })
            }
        });
        //return false
    }
});
$('.delete_update').live("click", function () {
    var b = $(this).attr("id");
    var c = 'msg_id=' + b;
    jConfirm('Ви впевнені, що хочете видалити цей запис?!', 'Видалити зі списку', function (r) {
        if (r == true) {
            $.ajax({
                type: "POST",
                url: "live_update_delete/delete_data.php",
                data: c,
                cache: false,
                success: function (a) {
                    $(".bar" + b).slideUp('slow', function () {
                        $(this).remove();
                        $('#res-suc').fadeOut(300, function () {
                            $('#res-suc').html('Вас було видалено зі списку учнів Автошколи "ПЕРСЕЙ"').removeClass('result-success').addClass('result-error')
                        }).fadeIn('slow', check_count_plus())
                    })
                }
            })
        }
    });
    return false
});

function check_count_plus() {
    var a = 1;
    var b = $('.numb').attr('value');
    var c = parseInt(b);
    var d = eval(c + a);
    if (d < 0) {
        var d = 0
    } else if (d == 30) {
        var e = '<p id="alert_emty" class="result-success" style="display:none;">В цій групі немає зареєстрованих учнів</p>';
        $('ol#update').html(e);
        $('#alert_emty').fadeIn('slow')
    } else {
        var d = d
    }
    if (d == 1 || d == 21) {
        var f = 'місце'
    } else if (d == 2 || d == 3 || d == 4 || d == 22 || d == 23 || d == 24) {
        var f = 'місця'
    } else {
        var f = 'місць'
    };
    $('span.numb').attr('value', d);
    $('span.numb').html(d);
    $('span.places').html(f)
}
$('#refresh').live('click', function () {
    $('#captcha').attr('src', 'live_update_delete/code/my_codegen.php?' + Math.round(Math.random(0) * 1000000))
});

});
