﻿var g_main_search_form = null;

$(document).ready(function () {
    //$(document).pngFix();
    g_main_search_form = $("#main_search_form");

    $('#search_tabs a').click(function (event) {
        event.preventDefault();
        class_name = $(this).attr('class');
        id = $(this).attr('data-id');

        $('.tab').css('z-index', '-1');
        $('#' + class_name).css('z-index', '10');

        if (id == 10) {
            g_main_search_form.attr("action", "livestate_base.shtml");
        }
        else if (id == 11) {
            $('.second_form').attr("action", "zag_base.shtml");
        }
        else if (id == 12) {
            g_main_search_form.attr("action", "arenda_base.shtml");
        }
        else if (id == 13) {
            g_main_search_form.attr("action", "new_estate_base.shtml");
        }

        if ( id == 12) {
			$('#mille').css('display', 'none'); 
            $('.tab_content').css('display', 'none');
            $('#content_first_tab').css('display', 'block');
            $('input[name=type_search]').val(id);
        } else if (id == 11 || id == 10||id == 13) {
			$('#mille').css('display', '');
            $('.tab_content').css('display', 'none');
            $('#content_' + class_name).css('display', 'block');
            $('input[name=type_search]').val(id);
        }
    })

})



	


	
            $(document).ready(function(){

                
                var styles=[];
                               
                styles =[
               
                   	new Array('65px', '12px','46px', '63px'),
               	 	new Array('46px','110px','67px', '93px'),
                	new Array('5px' ,'217px','115px','145px'),
                	new Array('46px','382px','67px','93px'),
                	new Array('65px','506px','46px','63px')
                ];
                
               
                var ar_l=styles.length;
                var img = $('#slider_images img');
                var img_l=img.length;
                
                
                var first=0;
                slide(first,0);
                
             
                
                $('a.arrow_right').click(function(event){
                
                event.preventDefault;
                
                	newfirst=first+1; 
                	slide(newfirst,0);
           
                	$('#slider_images li>img').not($('#slider_images li:eq(1)')).removeAttr('style');                	
                	$('#slider_images li:eq('+(first)+')').appendTo($('#slider_images'));

                  //  showInfo(first);      	 

                })
                
                $('a.arrow_left').click(function(event){
                
               event.preventDefault;
               
                   	$('#slider_images li>img:eq('+(first+4)+')').removeAttr('style');                	
                	$('#slider_images li:eq('+(ar_l+2)+')').prependTo($('#slider_images'));
                
                	newfirst=first-1; 
                	slide(newfirst,0);
                	
                
                })
                
                function slide(first,i){

            	    if(first<0){first=0;}
                		for(k=first;k<first+5;k++){
                                                           	 			
							$('#slider_images li>img:eq('+k+')').animate({
              					height: styles[i][2],
              					width: styles[i][3],
              					top: styles[i][0],
              					left: styles[i][1]
              
             	 		},200);
             	 		
             	 		i=i+1;
             	 		
              		}
              		showInfo(first);
              	}
              	function showInfo(act_num){
             
        	
                	var address=$('#slider_images img:eq('+(act_num+2)+')').attr('data-address');
                	var metro=$('#slider_images img:eq('+(act_num+2)+')').attr('data-metro');
                	var price=$('#slider_images img:eq('+(act_num+2)+')').attr('data-price');

    	            $('#address').empty().append('<b>Адрес: </b>'+address)
	                $('#metro').empty().append(metro)
        	        $('#price').empty().append('<b>Цена: </b>'+price)
            	}
            	
     });


