$(document).ready(function(){
	//top menu
	/*
	$(".top_menu_a").hover(
		function(){
			$(this).find('.hover_mask').stop().animate({marginTop:'-35px'},'fast');
		},
		function(){
			$(this).find('.hover_mask').stop().animate({marginTop:'0'},'fast');
		}
	);*/
	//index page button buy now
	$(".item_section").hover(
		function(){
//			$(this).find('.btn_buy_now').attr("src","images/buttons/english/button_buy_now_light.png");
			$(this).css('border','1px solid #333');
		},
		function(){
//			$(this).find('.btn_buy_now').attr("src","images/buttons/english/button_buy_now.png")  ;
			$(this).css('border','1px solid #DBDEDC');
		}
	);
	//top shopping cart
	/*
	$("#img_shopping_cart").hover(
		function(){
			$(this).attr("src","images/headers/english/cart_light.gif");
		},
		function(){
			$(this).attr("src","images/headers/english/cart.gif")  ;
		}
	);*/
	//top button login
	/*
	$("#btn_login").hover(
		function(){
			$(this).attr("src","images/headers/english/button_login_light.png");
		},
		function(){
			$(this).attr("src","images/headers/english/button_login.png")  ;
		}
	);*/
	/*
	$("#btn_register").hover(
		function(){
			$(this).attr("src","images/headers/english/button_register_light.png");
		},
		function(){
			$(this).attr("src","images/headers/english/button_register.png")  ;
		}
	);*/
	/*
	$("#btn_logoff").hover(
		function(){
			$(this).attr("src","images/headers/english/button_logoff_light.png");
		},
		function(){
			$(this).attr("src","images/headers/english/button_logoff.png")  ;
		}
	);*/
	$(".hot_search a").click(function(){
		window.location.href="http://"+window.location.host+"/search/"+$(this).text(); 
	});
	$(".manufacturers_list_td").hover(
		function(){
			$(this).find('.manufacturers_list_mask').stop().animate({opacity:'0.8'},'slow');
		},
		function(){
			$(this).find('.manufacturers_list_mask').stop().animate({opacity:'0'},'fast');
		}
	);
});

function see_more_click(){
	$(".product_thumbnaildescription").hide();
	$(".product_thumbnaildescription_full").show();
}

/*
function show_float_cart(){
	$("#custom_product_float_price").stop();
	$("#custom_product_float_price").fadeIn();
}

function hide_float_cart(){
	$("#custom_product_float_price").stop();
	$("#custom_product_float_price").fadeOut();
}*/


//v: 用户输入的筛选值
//type: 筛选类型：laptop_model or partnumber
//c: 排版要显示的列数
function search_onkeyup(v,type,c){
	v = $.trim(v);
	var div_id,div_filter_id;
	if (v==""){
		//如果用户未输入筛选条件，就去掉原先的筛选列表
		//并且显示原来所有的model和partnumber列表
		if(type=="laptop_model"){
			$("#brand_models_list_filter").hide();
			$("#brand_models_list").show();			
		}else{
			$("#brand_partnumber_list_filter").hide();
			$("#brand_partnumber_list").show();
		}
		return;
	}else{
//		if(v.length==1) return;
		//隐藏原来的列表
		if(type=="laptop_model"){
			$("#brand_models_list").hide();
			div_id = "brand_models_list";
			div_filter_id = "brand_models_list_filter";
		}else{
			$("#brand_partnumber_list").hide();
			div_id = "brand_partnumber_list";
			div_filter_id = "brand_partnumber_list_filter";
		}
	}
	
	//构造筛选结果html
	var html_row="";
	$.each( $("#"+div_id+" a:Contains('"+v+"')"), function(i, n){
		if(i%c==0){
			html_row += '<div class="column three">';
		}
		html_row += '<div class="section">•&nbsp;<a href="'+$(n).attr("href")+'">'+$(n).text()+'</a></div>'
		if(i%c==2){
			html_row += '</div>';
		}
	});
	if(html_row.length>0){
		html_row += '</div>';
	}

	$("#"+div_filter_id).html(html_row);
	$("#"+div_filter_id).show();
}
