$(document).ready( function () {
		
		  $('#search_area1 input').focus(function(){
				if ($(this).val() == 'Поиск по сайту')
					$(this).val('');
			});
			$('#search_area1 input').blur(function(){
				if ($(this).val() == '')
					$(this).val('Поиск по сайту');
			});
		
		   $('#search_area2 input').focus(function(){
				if ($(this).val() == 'Введите фразу для поиска...')
					$(this).val('');
			});
			$('#search_area2 input').blur(function(){
				if ($(this).val() == '')
					$(this).val('Введите фразу для поиска...');
			});
		
		  if ( $("#rubrics li ul li").hasClass('mactiv') == true)
		  	        { 
		  		$('#rubrics>li>ul').css('display','none');
		  		$("#rubrics li ul li.mactiv").parent('ul').slideDown();
		  		} else {
		  		$('#rubrics>li>ul').css('display','none');
		  		}
		  
					
					$('#rubrics>li>ul').parent('li').hover( function() {
					if ($(this).find('ul').css('display') !== 'block')
					{
					$('#rubrics li ul').slideUp();
					$(this).find('ul').slideDown(500);
					}					
					});
				
                           var urlPath = window.location.pathname
                           var arch = urlPath.indexOf("archive")
                            if (arch>0)
                           { $("#curday").css('display','none'); }

	
                  $('div.reporting_wrapper>div.reporting:odd>.img_container').hover( function () {
					 
						
						$(this).parent().attr('id','reporting_active').css('display','none').fadeIn('slow');
						$(this).attr('id','img_cont_act').find('a:first').prepend('<div id="border_l"></div>');
						$(this).next('p').css({'padding-top':'180px','margin-left':'260px'});
						$(this).next('p').find('a').addClass('inspotlight');
						$(this).nextAll('.full_info').css({'overflow':'hidden' , 'top' : '0' , 'left' : '0px'}).show();
					}, function () { 
						$(this).parent().removeAttr('id','reporting_active');
						$(this).removeAttr('id','img_cont_act');
						$("div#border_l").remove();
						$(this).next('p').css({'padding-top':'12px','margin-left':'0'});
						$(this).next('p').find('a').removeClass('inspotlight');
						$(this).nextAll('.full_info').css({'overflow':'hidden' , 'top' : '0' , 'left' : '0px'}).hide();
		});
		$('div.reporting_wrapper>div.reporting:even>.img_container').hover( function () {
					
					        $(this).parent().next('div.reporting').css('display','none');
						$(this).parent().attr('id','reporting_active').css('display','none').fadeIn('normal');
						
						$(this).css({'float':'left' }).find('a:first').prepend('<div id="border_r"></div>');;
						$(this).next('p').find('a').addClass('inspotlight').css({'display':'block', 'margin-right' : '240px', 'padding-top': '172px'});
						$(this).nextAll('.full_info').css({ 'top' : '0' , 'left' : '250px' }).show();
					}, function () { 
						$(this).parent().next('div.reporting').css('display','block');
						$(this).parent().removeAttr('id','reporting_active');
						$(this).css('float','none');
						$("div#border_r").remove();
						$(this).next('p').find('a').removeClass('inspotlight').css({'display':'inline', 'margin-right' : '0px','padding-top': '172px'});
						$(this).nextAll('.full_info').css('overflow','hidden').hide();
		});
		  
		          var urlSearch = window.location.search
                          var Ph = urlSearch.indexOf("ph=")

                           if (Ph>0){
                               $('#video_wrap').fadeOut();
   			       $('#photo_wrap').fadeIn();
   			       $('.change_img_wrap').fadeIn();
                                  }

		  if ($('#video_wrap').length ){
		         
		            
			  $('.ph_switch').click( function (){
   			 $('#video_wrap').fadeOut();
   			 $('#photo_wrap').fadeIn();
   			 $('.change_img_wrap').fadeIn();
    				return false;
				});
			 $('.vid_switch').click( function (){
			 $('#photo_wrap').fadeOut();
			 $('.change_img_wrap').fadeOut();
			 $('#video_wrap').fadeIn();
			  return false;
			 
			 });
		  
		  } else {
                 
                  $('#photo_wrap').attr('style','background: url("/i/photo_bg.png") no-repeat scroll right -71px transparent'); 
		  $('#photo_wrap').fadeIn();
		  $('.change_img_wrap').fadeIn();
                     
		  }
		

                 var firstImg = $("#photo_wrap").find("img").attr('src')
                $("a[href='"+firstImg+"']").find("img").addClass("active_thumb"); 

		$('.change_img>ul>li>a').click( function (){
				var ImgPath = $(this).attr('href');
				var ImgAlt = $(this).attr('title');
				$('.change_img>ul>li>a>img.active_thumb').removeClass('active_thumb'); 
				$('#photo_wrap>img').attr('src', ImgPath);
				$('#photo_wrap>img').attr('alt', ImgAlt);
				$('#photo_wrap>img').attr('title', ImgAlt);
				$(this).find('img').addClass('active_thumb');
				return false;
			});
		
		
     });

