/*
CSS Browser Selector v0.4.0 (Nov 02, 2010)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod':is('ipad')?m+' ipad':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win'+(is('windows nt 6.0')?' vista':''):is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);

/**
* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne brian(at)cherne(dot)net
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);

(function($) {
$(function() {	
	
    $(".commitet-info .description .inline-block a").each(function(index){
		    $(this).click(function(e){
					  e.preventDefault(); 
                      
                      $("#"+$(".commitet-info .description .inline-block a.current").attr("rel")).fadeOut(200);
                      $(".commitet-info .description .inline-block a").removeClass("current"); 
                      $(this).addClass("current");
                      $("#"+$(".commitet-info .description .inline-block a.current").attr("rel")).fadeIn(200, function() {checkSize();  });
				});                                                                                           
		});
        
    $(".news-scroller .news-list a").each(function(index){
            $(this).click(function(e){
                      e.preventDefault();
                      listItemLink = $(this);
                    $(".news-scroller .news-list a").removeClass("current");    
                        $(".news_pointer").animate({"top": index * 64}, 100, function(){
                               listItemLink.addClass("current");                                
                        });    
                        $(".news-image-preview img").fadeOut(100, function() { $(this).attr("src", listItemLink.attr("rel")).fadeIn(100);});
                        $(".newsHref").attr("href", listItemLink.attr("href"));         
                });
        });
		
    $("#showEnterLogIn").click(function(e) { 
        e.preventDefault();
        $("#login-div").animate({opacity: 1, width: 250},300); 
        $("#login-div .login-form").fadeIn(300);    
    });
    $("#showEnterLogInOut").click(function(e) {
        e.preventDefault(); 
        $("#login-div .login-form").fadeOut(300); 
        $("#login-div").animate({opacity: 0.2, width: 0},300);    
    });
        $("#showSearch").click(function(e) { 
        e.preventDefault();
        $("#search-div").animate({width: 751},300);
        $("#search-div").animate({height: 27},50);  
        $("#search-div .search-form").fadeIn(300); 
        $("#search-div .left-corner").fadeOut(300);  
    });
    $("#hideSearch").click(function(e) {
        e.preventDefault(); 
        $("#search-div").animate({height: 21},50);
        $("#search-div .search-form").fadeOut(300); 
        $("#search-div").animate({width: 35},300);  
        $("#search-div .left-corner").fadeIn(300);    
    });
    
    $(".logIn").hover(function(){$(this).animate({opacity : 1})},function(){$(this).animate({opacity : 0.1})});
    
    $('#login').focusout(function() {
    if(jQuery.trim(this.value) == "")
        {
            this.value = "Логин";
            this.style.color = "#777";         
        } 
    });

    $('#login').focusin(function() {
        if(this.value == "Логин")
            {
            this.value = "";  
            this.style.color = "#000";
            }  
    });
    
        $('#password').focusout(function() {
    if(jQuery.trim(this.value) == "")
        {
            this.value = "Пароль";
            this.style.color = "#777";
            this.type = "text";         
        } 
    });

    $('#password').focusin(function() {
        if(this.value == "Пароль")
            {
            this.value = "";  
            this.style.color = "#000";
            this.type = "password";
            }  
    });
    
    $("#vote .radio-group a.radio-raplace-link").each(function(index){
            $(this).click(function(e){
                      e.preventDefault(); 

                      $("#vote .radio-raplace-link").css("background-position", "0 0");  
                      $(this).parent().find(".radio").attr("checked",true);
                      $(this).css("background-position", "0 -9px");  
                });
        });
    $("#vote .radio-group label").each(function(index){
            $(this).click(function(e){	
                $("#vote .radio-raplace-link").css("background-position", "0 0");  
                $(this).parent().find("a.radio-raplace-link").css("background-position", "0 -9px");
            });
    });		
});
})(jQuery);

function checkSize() { 
    if(($(".top_bg").height()) < ($(window).height())){
            $(".top_bg").css("height","100%");
            $(".footer").css({"border-radius" : "0 0 10px 10px", "bottom" : "-8px", "box-shadow" : "0 5px 10px rgba(0,0,0,0.5)"})
            $(".bottom_bg").css("height","100%");
            
            $ischanged = true;
        } 
    else{
        $(".top_bg").css("height","auto");
        $(".footer").css({"border-radius" : "0", "bottom" : "0", "box-shadow" : "none"})
        $(".bottom_bg").css("height","auto"); 
        
    }  
}
