$(document).ready(function(){
	
	// The small arrow that marks the active search icon:
	var arrow = $('<span>',{className:'arrow'}).appendTo('ul.icons');
	$('ul.icons li').click(function(){
		var el = $(this);
		
		if(el.hasClass('active')){
			// 如果已激活，退出
			return false;
		}

		el.siblings().removeClass('active');
		el.addClass('active');
		
		// 把箭头移动到当前属性
		arrow.stop().animate({
			left		: el.position().left,
			marginLeft	: (el.width()/2)-4
		});
	});
	
	
	// 默认标记搜索商铺激活:
	switch ( s_selected  )
	{
		case "s_shop":
			$('li.s_shop').click();
			s_c_shop();
			break;
		default:
			$('li.s_item').click();
			break;
	}
	// Focusing the input text box:
	$('#s').focus();

	$('li.s_shop').click(function () { s_c_shop(); });
	$('li.s_item').click(function () { s_c_item(); });
	
});

function s_c_item()
{
	$("#s_type").val("search");
	$("#s_label").html("填写淘宝商品名称或复制链接地址");
}

function s_c_shop()
{
	$("#s_type").val("search_shop");
	$("#s_label").html("填写淘宝掌柜用户名或淘宝店铺名称");
}

