// JavaScript Document
function OOO(obj,ele){
	if (obj&&!ele){return document.getElementById(obj);}
	else if (obj&&ele){return document.getElementById(obj).getElementsByTagName(ele);}
	else {return false;}
}


//提交搜索
function Search(url)
{
	if(OOO("keyword").value!="")
	{
		window.location.href=url+"?keyword="+OOO("keyword").value;
	}else{
		alert("请输入关键字");
		OOO("keyword").focus();
	}
}
//提交搜索(首页)
function Search2(url)
{
		var brand_obj=OOO("brand");
		var size_obj=OOO("size");
		var brand=brand_obj.options[brand_obj.options.selectedIndex].value;
		var size=size_obj.options[size_obj.options.selectedIndex].value;
		window.location.href=url+"?act=pro&keyword="+OOO("key").value+"&brand="+brand+"&size="+size;

}

//导航
$(function(){
	var nav_obj=$(".nav li");
	for(var i=0;i<nav_obj.length;i++){
		if(/\/product*/.test(nav_obj[i].innerHTML)){
			$(nav_obj[i]).hover(
				function(){
					$(".sub").show();					
				},
				function(){
					$(".sub").hide();					
				}
			);
		}else{
			$(nav_obj[i]).hover(
				function(){
					$(this).children("ul").show();				
				},
				function(){
					$(this).children("ul").hide();		
				}
			);
		}
	}
	var sub_nav=$(".sub dl");
	for(var i=0;i<sub_nav.length;i++){			
		$(sub_nav[i]).hover(
			function(){
			$(this).children("dd").show();
			},
			function(){
			$(this).children("dd").hide();
			}
		);		
	}
	$(".sub").hover(
		function(){
			$(this).show();
		},
		function(){
			$(this).hide();
		}
	);

});



