function initSlider() {
                $('#slider').easySlider({ auto: true, continuous: true, speed: 1000});
            }
            
            function initLinks() {
                var url = $(this).attr('href');
                
                $.ajax({
                    type: 'POST',
                    url: url,
                    data: 'controller=complexAjax',
                    success: function(data) {
                        //$('#slider').unbind('easySlider');
                        $(data).each(function(){
                            if(this.nodeName == 'DIV' || this.nodeName == 'div') {
                                var element = $(this);
                                if(element.attr('id') == 'sourceAll') 
                                {
                                	
                                    elementContent.html(element.html());
                                    elementContent.find('a').not('[href^="http://"]').click(initLinks);
                                    
                                    $("a[rel=group]").fancybox({'hideOnContentClick': false}); 
                                 	$("a.shadowbox").fancybox(); 
                                    $('#game').click
       				 				(
           								function()
           								{
              								var url = $(this).attr('href');
        									//alert(url);
        									$.post(url, {
            									controller:'ajax'
        										}, function(data){
           							 				$.fancybox(data,
            						 				{
                										'width': 750,
                										'height': 550,
                										'padding':0,
                										'hideOnContentClick': false,
               	 										'showCloseButton': true
            										});
        									});
        								return false;
           								}
        							);
        							$('a#fancybox-close').unbind('click', initLinks);
        							$('#prev').click(prev);
                					$('#next').click(next);
                					list = $('#galeryList td.element');
               						size = list.length;
                					start = 0;
                					end = 2;
                					for(i = 2; i < size; i++)
                					{
                    					$(list[i]).css('display', 'none');
                					}
                					$('#send1').click(initFormRequest1);
                                }
                                if(element.attr('id') == 'sourceSidebar') {
                                  		elementSidebar.html(element.html());
                                  		elementSidebar.find('a').not('[href^="http://"]').click(initLinks);
                                    	$('#send').click(initFormRequest);
                                    	
                                    	
                                }
                                if(element.attr('id') == 'sourcePresentation') {
                                    elementPresentation.html(element.html());//.load(initSlider);
                                    elementPresentation.find('a').not('[href^="http://"]').click(initLinks);
                                    //initSlider();
                                }
                               
                            }
                        });
                    }});
                return false;
            }
            function initFormRequest() {
                var name = $('input.request[name^="name"]').val();
                var phone = $('input.request[name^="phone"]').val();
                var text = $('textarea.request[name^="text"]').val();
                var data = 'name=' + name + '&phone=' + phone + '&text=' + text + '&send=1';
                //alert(text);
                $.ajax({
                    type: 'POST',
                    url: '/',
                    data: data,
                    success: function(msg){
                        $("#response").html("Ваше сообщение отправлено!");
                        $('input.request[name^="name"]').val('');
                        $('input.request[name^="phone"]').val('');
                        $('textarea.request[name^="text"]').val('');
                    }
                });
            }
            function initFormRequest1() {
             //alert(1);
                var name = $('input.request[name^="name"]').val();
                var city = $('input.request[name^="city"]').val();
                var text = $('textarea.request[name^="text"]').val();
                var data = 'name=' + name + '&city=' + city + '&text=' + text + '&send=1';
                //alert(text);
                $.ajax
                ({
                    type: 'POST',
                    url: '/',
                    data: data,
                    success: function(msg)
                    		{
                        		$("#response").html("Ваше сообщение успешно отправлено!");
                        		$('input.request[name^="name"]').val('');
                        		$('input.request[name^="city"]').val('');
                        		$('textarea.request[name^="text"]').val('');
                    		}
                });
            }
          	
           $(document).ready(function () {
                elementContent = $('#all');
                elementSidebar = $('#sidebar');
                elementPresentation = $('#presentation');
                $('#mainMenu td').not('.separator').hover(
                function() {
                    $(this).addClass('active');
                    $(this).next('.separator').addClass('active');
                    $(this).prev('.separator').addClass('active');
                },
                function() {
                    $(this).removeClass('active');
                    $(this).next('.separator').removeClass('active');
                    $(this).prev('.separator').removeClass('active');
                });
                $('a').not('[href^="http://"]').not('[href^="javascript"]').click(initLinks);
                $('#send1').click(initFormRequest1);
                $('#send').click(initFormRequest);
                
                /*$('a[href^="http://evento"]').click(initLinks);
                $('a[href^="http://www.evento"]').click(initLinks);*/
                //console.log(window.location.host.toLowerCase());
          });
