Cufon.replace('.suzuki, .index_image .image_block .numbers a, .index_news .hd b, .index_image .text_block .links a, .menu .fst_level, .model_selector .title', {fontFamily: 'suzuki'});

$(document).ready(function() {
	
	$(".index_image .text_block .links li").hover(
               function(){$(this).addClass("li_hover");},
               function(){$(this).removeClass("li_hover");});

	//$(".top_nav ul li:last-child").after("<br clear='all' />").css({borderRight:'none'});
        
        $(".top_nav ul li:last-child").not(".top_nav ul ul li").after("<br clear='all' />").css({borderRight:'none'});
	$(".top_nav ul li").not(".top_nav ul ul li").has('ul').hover(
		function(){$(this).addClass("active").children('ul').slideDown(200)},
		function(){$(this).removeClass("active").children('ul').slideUp(200)}
	);
            
	$(".top_nav .login_link").click(
		function(){
			$(".top_nav .login_box").fadeIn('fast');
			return false;
		});
	$(".top_nav .login_box .close").click(
		function(){
			$(".top_nav .login_box").fadeOut('fast');
			return false;
		});

	$(".footer .bot_nav li:last-child").css({borderRight:'none'});

	$(".index_news .column:nth-child(1)").addClass("cyan");
	$(".index_news .column:nth-child(2)").addClass("orange");
	$(".index_news .column:nth-child(3)").addClass("green");

	if ($(".trail a").length>0){$(".trail a").not(".trail ul li:last-child a").after(" /");}
	//$(".trail ul li:last-child a").css("textDecoration","none");

	$(".menu ul li").has("ul").addClass("active");

	$(".header_models .popup_filler").each(function(){
		var color=$(this).next().next().children().attr('rel');
		$(this).css("backgroundColor","#"+color);
		$(this).next().next(".popup_bg").children('.coloured').css("color","#"+color);
	});

	$(".header_models .prev").click(
		function(){
                        if (content_width<container_width){
                            return false;
                        }
                        debugger;
                        if (parseInt($(".header_models .scroller").css('margin-left'))<0){
			$(".header_models .scroller").animate({marginLeft:'+=156'});
                        }
			return false;
		});
	$(".header_models .next").click(
		function(){
                        if (content_width<container_width){
                            return false;
                        }
                        debugger;
                        if (-1*parseInt($(".header_models .scroller").css('margin-left'))<content_width-scroll_width){
                            $(".header_models .scroller").animate({marginLeft:'-=156'});
                        }
			return false;
		});
	$(".header_models li").hover(
		function(){
			$(this).addClass("popped_up");

			$(".header_models .scroller_container").css("paddingBottom",parseInt($(".header_models .scroller_container .popup_bg").height()+20)+"px");
			return false;
		},
		function(){
			$(".header_models li").removeClass("popped_up");
			$(".header_models .scroller_container").css("paddingBottom","20px");
			return false;
		});

	$(".select .selected").prepend('<span class="bullet"></span>');

	$(".manager_item:odd").css({float:"right", marginRight:"0px"});

	$(".used_tech_data tr:last-child").addClass("last");

	$(".used_item:odd").after("<br clear='all' />");

        var container_width=$(".container").width();
        var scroll_width = container_width - parseInt($(".header_models .scroller_container").css('margin-left'))*2;
        var content_width = $('.header_models .scroller ul').width();

        if (content_width<container_width){
            $(".header_models .prev").css('background-position', '-10px 0');
            $(".header_models .next").css('background-position', '-10px 20px');
        }

	$(".calculator_result:last-child").css("marginBottom","0px");

	$(".popup_title").append("<span class='bg_bot'></span><span class='bg_r'></span><span class='bg_nib'></span>");
	
	$(".positioner").hover(
		function(){
			$(this).children(".popup_title").fadeIn(200)
		},
		function(){
			$(this).children(".popup_title").fadeOut(200)
		}
	);
	
	$(".tabs a").click(function(){
		$(".tabs li").removeClass('active');
		$(this).parent().addClass('active');
		return false;
	});

	Cufon.now();

});

function LayoutBlocks(){
    var h = $('.index_news .colour_block').height();
    var nh2 = $('.index_news table td:eq(0)') .height();
    var mh2 = $('.index_news .column:eq(1) div.colour_block').next('div').height();
    var rh2 = $('.index_news .column:eq(2) div.colour_block ').next('div').height();
	var vh2 = $('.index_news .voting div.bottom_block').height();
	if(vh2<230)
		vh2 = 230;
    var max = Math.max(nh2, mh2);
    max = Math.max(max, rh2);
	max = Math.max(max, vh2);
    $('.index_news table td:eq(0)').css('height', max+'px');
    $('.index_news .column:eq(1) div.colour_block').next('div').css('height', max+'px');
    $('.index_news .column:eq(2) div.colour_block ').next('div').css('height', max+'px');
	if(vh2<=max)
		$('.index_news .voting div.bottom_block').css('height', (max+19)+'px');
}

