function redir(url){
location.href=url;
return true;
}

	
$(document).ready(function(e) {

	$('.nice_select').selectbox();
	


	//$('a[rel*=facebox]').facebox();
	$('a[href*=message.php?type=zayavka]').facebox();
    $('a[href*=message.php?type=quest]').facebox();
    $('a[href*=user.php?act=reg]').facebox();

	//$('.menu-first-line .first-line li').attr('id', function(arr) { return "item" + arr; });
	$('.sub-menu-line div').attr('id', function(arr) { return "sub-box" + arr; });

$(window).load(function() {
	if($('.menu-first-line .first-line li').is('.active')) {
		var curentItem = $('.menu-first-line .first-line li.active').attr('id').slice(4);
		$('.sub-menu-line').find('div#sub-box'+curentItem).show();
	}
});


$('.menu-first-line .first-line li[class!=right_bg]').mouseover(function(){
if ($(this).attr('id') != 'item6r')
if (!$(this).hasClass('active') && !$(this).hasClass('right_bg_active')){
	var curentItem = $(this).attr('id')+'r';
	//alert(curentItem);
	$('.menu-first-line .first-line').find('li#'+curentItem).addClass('act_r');
	//$('.menu-first-line .first-line').find('li#'+curentItem).css('background-position', 'right 2px').css('margin-top', '2px').css('height', '23px');
	$(this).addClass('act');
	//$(this).css('background-position', 'left 2px').css('margin-top', '2px').css('height', '23px');
	}
}).mouseout(function(){
    if ($(this).attr('id') != 'item6r')  
    {
	    var curentItem = $(this).attr('id')+'r';
	    $('.menu-first-line .first-line').find('li#'+curentItem).removeClass('act_r');
	    $(this).removeClass('act');
    }
});


                    $('#orderfortestversion').live('click', function() {
                        jQuery.facebox({ ajax: 'includes/message.php?type=zayavka&subject=11&uid=1652&caption=Заявка на получение пробной электронной версии ИАИ "ЭкоПРАВО"' });
                        return false; // <-- important!
                    });
                    
                    $('#tosendorder').live('click', function() {
                        jQuery.facebox({ ajax: 'includes/message.php?type=zayavka&subject=12&uid=1652&caption=Отправить заявку на подписку' });
                        return false; // <-- important!
                    });



});







(function($) {
	$.extend($.fx.step,{
	    backgroundPosition: function(fx) {
            if (fx.state === 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
			}
            var nowPosX = [];
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

           function toArray(strg){
               strg = strg.replace(/left|top/g,'0px');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
           }
        }
	});
})(jQuery);