/**
 * create date: 2009-11-27
 * @requires jQuery v1.3+
 */
$(function(){
         
	// * 03-15 change the first 	
	var a = $("#c-1-l-t li a"), dd = $("#c-1-l-t dd");
	var count = 0;
	var process = setInterval(start, 2000);
	$("#c-1-l-t li a").hover(function(){
		count = $("#c-1-l-t li a").index(this);
		a.removeClass("selected").eq(count).addClass("selected");
		dd.hide().eq(count).show();
		clearInterval(process);
	}, function(){
		process = setInterval(start, 2000)
	});
	$("#c-1-l-t dd a").hover(function(){
		clearInterval(process);
	}, function(){
		process = setInterval(start, 2000)
	});
	function start(){
		count++;
		if (count >= a.size()) count = 0;
		a.removeClass("selected").eq(count).addClass("selected");
		dd.hide().eq(count).show();
	}
	
	//dl dt dd切换效果
	$("#home #c-4-r-t dl").showDD();

	//幻灯效果
        	
	$("#c-3 .carousel .images").each(function(i){
		$(this).jCarouselLite({
			btnPrev: $("#c-3 .prev").eq(i),
			btnNext: $("#c-3 .next").eq(i),
			visible: 4
		});
	});
	$("#c-4-r-b .carousel .images").jCarouselLite({
		btnPrev: "#c-4-r-b .prev",
		btnNext: "#c-4-r-b .next",
		visible: 2
	});

	$("#home-product-line-sel").change(function(){
		$.ajax({
                        type: "POST",
	                url: "/ztryout/ajax_search_brands/"+$(this).val(),
	                success: function( responseText ){
	                       $("#home-brand-sel").empty();
	                       $("#home-brand-sel").html( responseText );
	                }
	       });
	});

	$("#home-brand-sel").change(function(){
		window.location.href = $(this).val();
	});

	$("#c-5-l-b .submit").click(function(){
		var brand_txt = $("#c-5-l-b .text").val();
		if( brand_txt != '' && brand_txt != '关键字搜索' ){
			window.location.href = "/brand/(brand_title)/" + brand_txt;
		}	
		else{
			alert("请输入关键字！");
			return false;
		}
	});

	//2010-9-1 change for 9977
	/*
	$("#h-m").css('cursor','pointer');
	$("#h-m").click(function(){
	    window.open("http://www.ambers.cc/redirect/?r=11240","_blank");
        });
	*/
});
