//语言下拉菜单
$(document).ready(function(){
	
	$("ul.topnav li a#language").hover(function() { //When trigger is clicked...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
	$("ul.subnav").hover(function(){
		$("#language").addClass("subhover");
		},function(){
		$("#language").removeClass("subhover");							  
	});
	
	//搜索界面
	$("#site_search").submit(function(){
			///alert($(this).attr("id"));
			val	=	$("#site_search input[name='str']").val();
			/**if(val.length < 3){
				alert('Please enter at least 3 characters!');
				return false;
			}**/
	});
});
//加入收藏夹
function AddToFavorite()  
{  
    if (document.all){
       window.external.addFavorite(document.URL,document.title);  
    }else if (window.sidebar){ 
       window.sidebar.addPanel(document.title, document.URL, "");  
    }  
	else{
		alert("Refused to join this browser favorites, please manually add!" );
	}
}

function addwishlist(_this){	
	  var dom=$(_this);
	  var $url	=	dom.attr("href");
	  $.post($url,function(data){
		  if(data.code=="success"){
			  $(".WishlistNum").text(data.num);
		  }
		  else if(data.code=="faile")
			  alert(data.text);
	  },"json");
	  return false;
}
