(function($){
/***********/
/* hover */
$(document).ready(function(){


$.fn.Button=function(sel)
{
	var closed=true,
		th=this;
	$(sel).hide();
	$(this).removeClass('selected').click(function(){
		$(sel).toggle("fast");
		$(this).toggleClass("selected");
		closed=!closed;
		return false;
	});
	$(document).click(function(e){
		if(closed)
			return;
		var target=e.target||e.srcElement;
		while(target)
		{
			var ret=false;
			$(sel).each(function(){
				if(ret=target==this)
					return false;
			});
			if(ret)
				return;
			target=target.parentNode;
		}
		$(sel).hide('fast');
		$(th).removeClass('selected');
		closed=true;
	});
	return this;
}


	$('div#content-main').mouseover(function(){
	   $('div#site_info',this).stop().animate({ borderColor: "#f00" , color: 'color:#eb7800' }, 300);
	    }).mouseout(function(){
       $('div#site_info',this).stop().animate({ borderColor: "#323232" , color: 'color:#323232' }, 800);
	});

    // smart_menu
	$('dl.cats_menu dd').mouseover(function(){
	   $(this).stop().animate({ backgroundColor: '#f00' }, 200);
	    }).mouseout(function(){
       $(this).stop().animate({ backgroundColor: '#141414' }, 600);
	});
	
	$('dl.cats_menu').css('margin-left', '15px').mouseover(function(){
	   $(this).stop().animate({ marginLeft: 0 }, 300);
	   $('dt', this).stop().animate({ backgroundColor: '#f00' , color: 'color:#ffa' }, 200);
	    }).mouseout(function(){
	   $(this).stop().animate({ marginLeft: '15px' }, 600);
	   $('dt', this).stop().animate({ backgroundColor: '#141414' , color: 'color:#eb7800' }, 1000);
	});

	//img_in_news
//	$(".shortstory .story img").addClass("upload_img");
	$('.upload_img').css("opacity","0.5").mouseover(function(){
	   $(this).stop().animate({backgroundColor: '#f00' }, 100).fadeTo(200,1);
	    }).mouseout(function(){
	   $(this).stop().animate({backgroundColor: '#282828' }, 700).fadeTo(700,0.5);
	});
    

	$('#related td').mouseover(function(){
	   $(this).stop().animate({backgroundColor: '#141414' }, 200);
	   $('img', this).stop().animate({backgroundColor: '#f00' }, 100).fadeTo(200,1);
	   $('span', this).stop().animate({ color: 'color:#ffa' }, 200);
	    }).mouseout(function(){
	   $(this).stop().animate({backgroundColor: '#282828' }, 700);
	   $('img', this).stop().animate({backgroundColor: '#282828' }, 700).fadeTo(700,0.5);
	   $('span', this).stop().animate({ color: 'color:#eb7800' }, 700);
	});	
	

    $('.box_img img').css("opacity","0.5");
	$('.box_img dd').mouseover(function(){
	   $('span', this).stop().animate({ color: 'color:#ffa'}, 300);
	   $('img', this).stop().animate({backgroundColor: '#f00' }, 100).fadeTo(200,1);
	    }).mouseout(function(){
	   $('span', this).stop().animate({ color: 'color:#eb7800'}, 700);
	   $('img', this).stop().animate({backgroundColor: '#282828' }, 700).fadeTo(700,0.5);
	});
	
	$('.box_img_adv img').css("opacity","0.5").css("padding","3px").mouseover(function(){
	   $(this).stop().animate({backgroundColor: '#f00' }, 100).fadeTo(200,1);
	    }).mouseout(function(){
	   $(this).stop().animate({backgroundColor: '#000' }, 700).fadeTo(700,0.5);
	});
	
	// боксы в шторах
	$('.box, .block').mouseover(function(){
	   $('dt, li.ttl, h4', this).stop().animate({backgroundColor: '#f00' , color: 'color:#ffa'}, 300);
	   $(this).stop().animate({ backgroundColor: '#000', borderColor: "#f00" }, 200);
	    }).mouseout(function(){
	   $('dt, li.ttl, h4', this).stop().animate({backgroundColor: '#141414' , color: 'color:#eb7800'}, 800);
	   $(this).stop().animate({ backgroundColor: '#282828', borderColor: "#323232" }, 800);
	});
	
	$('fieldset').mouseover(function(){
	   $('legend', this).stop().animate({ color: 'color:#eb7800'}, 300);
	   $(this).stop().animate({ borderColor: "#f00" }, 200);
	    }).mouseout(function(){
	   $('legend', this).stop().animate({ color: 'color:#ffa'}, 800);
	   $(this).stop().animate({  borderColor: "#aaa" }, 800);
	});	
	
	// новость короткая и полная
	$(".shortstory .story img").addClass("upload_img");
	$('.shortstory, .fullstory').mouseover(function(){
	   $(this).stop().animate({ backgroundColor: '#000', borderColor: "#f00" }, 200);
	   $('dt, h3, h1', this).stop().animate({backgroundColor: '#f00' , color: 'color:#ffa'}, 300);
	   $('dt a, h3 a', this).stop().animate({ color: 'color:#ffa'}, 300);
	   $('h1 span.red, h1 span.green, h3 span.red, h3 span.green', this).stop().animate({ color: 'color:#fff'}, 300);
	    }).mouseout(function(){
	   $(this).stop().animate({ backgroundColor: '#282828', borderColor: "#323232" }, 800);
	   $('dt, h3, h1', this).stop().animate({backgroundColor: '#141414' , color: 'color:#eb7800'}, 800);
	   $('dt a, h3 a', this).stop().animate({ color: 'color:#eb7800'}, 800);
	   $('h1 span.red, h3 span.red', this).stop().animate({ color: 'color:#f00'}, 300);
	   $('h1 span.green, h3 span.green', this).stop().animate({ color: 'color:#006600'}, 300);
	});	

	$('.bottom').mouseover(function(){
	   $(this).stop().animate({ borderColor: "#f00" }, 200);
	    }).mouseout(function(){
	   $(this).stop().animate({ borderColor: "#323232" }, 800);
	});	
	
	// 
	
    $('.f_submit, .f_button').css('color', '#eb7800').css('backgroundColor', '#141414').css('borderColor', '#323232').mouseover(function(){
	   $(this).stop().animate({backgroundColor: '#f00' , color: 'color:#ffa'}, 300);
	    }).mouseout(function(){
	   $(this).stop().animate({ backgroundColor: '#141414', color: 'color:#eb7800' }, 800);
	});

	// 
    $('.tabs-section').mouseover(function(){
	   $('.tabs-ttl', this).stop().animate({color: 'color:#f00'}, 300);
	   $('.tab-box, ul.tabs', this).stop().animate({ borderColor: "#f00" }, 300);
	   $('ul.tabs li.current', this).stop().animate({ borderTopColor: "#f00", borderLeftColor: "#f00", borderRightColor: "#f00" }, 300);
	    }).mouseout(function(){
	   $('.tabs-ttl', this).stop().animate({color: 'color:#eb7800'}, 800);	
	   $('ul.tabs li.current', this).stop().animate({ borderTopColor: "#eb7800", borderLeftColor: "#eb7800", borderRightColor: "#eb7800" }, 800);	
	   $('.tab-box, ul.tabs', this).stop().animate({ borderColor: "#eb7800" }, 800);
	});
	
	//pagenav_link
	$('.navigation a').mouseover(function(){
	   $(this).stop().animate({backgroundColor: '#f00' , color: 'color:#ffa' }, 100);
	    }).mouseout(function(){
	   $(this).stop().animate({backgroundColor: '#141414' , color: 'color:#eb7800' }, 250);
	});
    //
	$('.go_top a').mouseover(function(){
	   $(this).stop().animate({backgroundColor: '#f00'  }, 100);
	    }).mouseout(function(){
	   $(this).stop().animate({backgroundColor: '#1e1e1e'  }, 250);
	});


	
	
	
	
	
});       
/*end hover*/



// show and hide for account
$(function(){
    $('.acc_span').click(function(){
        $('.acc_menu').slideToggle('slow');
        $('a.login_show').toggleClass('active');
    });
});
		
  
  /* title for input */
$(document).ready(function() {
	$('input').each(function() {							   
		if($(this).val() === '') {
			$(this).val($(this).attr('title'));	
		}
		
		$(this).focus(function() {
			if($(this).val() == $(this).attr('title')) {
				$(this).val('').addClass('focused');	
			}
		});
		$(this).blur(function() {
			if($(this).val() === '') {
				$(this).val($(this).attr('title')).removeClass('focused');	
			}
		});
	});
});
  
/**** end ****/
})(jQuery);
