$(document).ready(function() {
				var counts = $('div.dtcontainer').size();
				for (i=1; i <= counts ; i++) {
					var ari8m = i%6;
					$('div.dtcontainer:nth-child('+i+')').addClass('dtcontainer'+ari8m);
				}
				var counts = $('div.boxcontent').size();
				for (i=1; i <= counts ; i++) {
					var ari8m = i%3;
					$('div.boxcontent:nth-child('+i+')').addClass('boxcontent'+ari8m);
				}
				//TABS
				$('div.tab-content:gt(0)').hide();
				$('ul.tabs li:eq(0)').removeClass().addClass('tab2');
				$('ul.tabs li').click(function() {
				var index = $('ul.tabs li').index(this);
				$('div.tab-content').hide();
				$('div.tab-content:eq('+index+')').show();
				$('li.tab2').removeClass().addClass('tab');
				$(this).removeClass().addClass('tab2');
						})
				if ($('div#nav').html() != null) {
					var mhkos = $('div#nav').html().length;
					if (mhkos > 0) {
						$('div#main_img img').attr('width', '550');
						$('div#content').css('width', '584px');
					}
				}


                                $("#request-title").autocomplete({
                                        //request-title

                                         source: function( request, response ) {
                                                $.ajax({
                                                        url: "/ajax.php",
                                                        type: 'POST',
                                                        dataType:'json',
                                                       data: "ajaxAction=findRequests&request-title="+$("#request-title").val(),
                                                        success: function( data ) {
                                                               
                                                                response( $.map( data, function( item ) {
                                                                        //alert(item.title);
                                                                        return {
                                                                                label: item.title,
                                                                                value: item.title,
                                                                                url:'/'+item.section_url_symbol+'/'+item.cat_url_symbol+'/'+item.item_url_symbol+'.html'
                                                                                //label: item.label,
                                                                                //value: item.value
                                                                        }
                                                                }));
                                                        }
                                                });
                                        },

                                        minLength: 2,
                                        select: function( event, ui ) {
                                                //alert(ui.item.url);
                                                window.location =ui.item.url;
//                                                log( ui.item ?
//                                                                        "Selected: " + ui.item.value + " aka " + ui.item.id :
//                                                                        "Nothing selected, input was " + this.value );
                                        }
                                });



         

                                $('.gallery a').lightBox();

        cp=[
               "/img/header_7.jpg",
               "/img/header_6.jpg",
               "/img/header_5.jpg",
               "/img/header_4.jpg",
			"/img/header_3.jpg",
			"/img/header_2.jpg",
           "/img/header_1.jpg"
                                  ];
                                $("#im").bind("load", function (){
                                        $(this).fadeIn("slow");
                                });
                                function change_picture(){
                                        $('#im').css("display","none");
                                       photo = (Math.floor((Math.random()*100)%7));

                                       $('#im').attr('src', cp[photo]);

                                }
                                change_picture();
                                //setInterval(change_picture,5500);
$('#dep_id').change(function() {
        $.ajax({
          url: '/ajax.php',
          dataType: 'json',
          type:'POST',
          data: 'ajaxAction=loadDepartmentInfo&depId='+$('#dep_id').val(),
         success: function(data){
                 $("#_department").html(data.title||"");
                        $("#_competence").html(data.descr||"");
                        $("#_phone").html(data.phone||"");
                        $("#_fax").html(data.fax||"");
                        $("#_email").html(data.email||"");
          }

        });

});



			});




