   $(function () {
        // 幫 #menu li 加上 hover 事件
		$('#menu li').children('ul').css('display', 'none');
		$('#menu li').hover(function () {
			// 先找到 li 中的子選單
			var _this = $(this),
			_subnav = _this.children('ul');

			// 同時顯示子選單(如果有的話)
			_subnav.css('display', 'block');
		}, function () {
			// 同時隱藏子選單(如果有的話)
			$(this).children('ul').css('display', 'none');
		});


		$(".left02 .listtop li").mouseover(function(){
			$(".left02 .prodlist").each(function(){
				$(this).hide();
				var id = $(this).attr("id");
				var classname = id.replace("prod","top");			
				var url = $(".left02 ."+classname).css("background-image");
				url = url.replace("_ovr","_std");
				$(".left02 ."+classname).css("background-image",url);
			});
			var url = $(this).css("background-image");
			url = url.replace("_std","_ovr");
			$(this).css("background-image",url);
			var classname = $(this).attr("class");
			var id = classname.replace("top","prod");
			$("#"+id).show();
		});
		$(".left02 .listtop .top01").mouseover();			//02
		$(".left02 .listtop .top01-01").mouseover();		//01

		$("#right_news .newsbj .title .nlist li").click(function () {
			$("#right_news .newsbj .list").each(function () {
				$(this).hide();
			});
			$("#right_news .newsbj .title li").each(function () {
				$(this).attr("class","");
			});
			$(this).attr("class","black");
			var id = $(this).attr("t");
			urlid = id.substr(id.length-1,1);
			$("#right_news .newsbj").css("background-image","url(images/newimg/beauty_box"+urlid+".gif)");
			$("#" + id).show();
		});
		$("#right_news .newsbj .title .nlist li").eq(0).click();
 });

function addToFav() {
	var url = "http://yahoo.mycosme.com.tw/index.aspx";
	var title = "我的美研院 - Yahoo!奇摩時尚";

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url, "");
	} else if (window.external) { // IE Favorite
		window.external.addFavorite(url, title);
	} else if (window.opera) { // Opera 7+
		return false; // do nothing
	} else {
		alert('Unfortunately, your browser does not support this action,'
	 + ' please bookmark this page manually by pressing Ctrl + D on PC or Cmd + D on Mac.');
	}
}

function publishTo(type) {
	
	var title = $(document).attr("title");
	/*if (type != 1) {
		title = "<%=content %>";
		title.replace("\n", "")
		setTitle(title);
	}*/

	setHref($(document).attr("location"));
	setHrefFB($(document).attr("location"));
	setTitle(title);
	
	switch(type) {
		case 1:
			publish('FaceBook');
			break;
		case 2:
			publish('Plurk');
			break;
		case 3:
			publish('Twitter');
			break;
	}
}

function infoor01(v){
	var prodlist = $(".infoorprod .list .prod");
	if(v<0){
		for(var i=0;i<prodlist.length;i++){
			var l = prodlist.eq(i);
			if(l.css("display")!="none"){
				l.hide();
				if(l.prev().attr("class")=="left"){
					prodlist.eq(prodlist.length-1).fadeIn("slow");
				}else{
					l.prev().fadeIn("slow");
				}
				break;
			}
		}
	}else{
		for(var i=0;i<prodlist.length;i++){
			var l = prodlist.eq(i);
			if(l.css("display")!="none"){
				l.hide();
				if(l.next().attr("class")=="right"){
					prodlist.eq(0).fadeIn("slow");
				}else{
					l.next().fadeIn("slow");
				}
				break;
			}
			
		}
	}
}
