﻿jQuery(function(){ 
 //加入收藏
jQuery.fn.addCollect = function(l, h){
		return this.click(function(){
			var t = jQuery(this);
			  if(jQuery.browser.msie) {
				window.external.addFavorite(h, l);
				} else if(jQuery.browser.mozilla || jQuery.browser.opera){
						t.attr("rel", "sidebar");
						t.attr("title", l);
						t.attr("href", h);
				} else{
					alert("请使用Ctrl+D将本页加入收藏夹");				
					}				
				});
			}
jQuery(function(){
	 var pageTitle=jQuery("title").html();
		jQuery(".collect-mark").addCollect(pageTitle, window.location.href);
}); 
//百科时间轴
	jQuery(".weekly-time li a").mouseenter(function(){
		jQuery(this).children(".weekly-tips").show();
	}).mouseleave(function(){
		jQuery(this).children(".weekly-tips").hide();
	});	 
//搜索下拉
jQuery(".search-sel").hover(
  function () {
    jQuery(this).find("#slected-body").show();
  },
  function () {
   jQuery(this).find("#slected-body").hide();
  }
);

//搜索下拉值参数传递
jQuery("#slected-body li a").click(function(){
		var searchTxt=jQuery(this).html();
	    var searchTitle=jQuery(this).attr("title");
		jQuery("#search-value").attr('value',searchTitle);
		jQuery(".search-sel strong").html(searchTxt);
		return false;									   
		});

//文本域获得和失去焦点
jQuery(".input-value").css("color","#aaa")
jQuery(".input-value").focus(function(){
var inputValue=jQuery(this).val();
if(inputValue==this.defaultValue){
	jQuery(this).val("");}
	jQuery(this).css("color","#333")
});
jQuery(".input-value").blur(function(){
var inputValue=jQuery(this).val();
if(inputValue==""){
	jQuery(this).val(this.defaultValue);
	jQuery(this).css("color","#aaa")
	}
});

//店铺和百科导航
jQuery(".shopNav-list li,.baikeNav-list li,.aboutNav-list li").hover(
  function () {
    jQuery(this).addClass("active")
  },
  function () {
  jQuery(this).removeClass("active")
  }
);
jQuery(".baikeNav-list dd a.active").parents("li").addClass("active");
jQuery(".baikeNav-list dl:last").css("border","none");
//百宝箱套色
jQuery(".toolBox .n-list a:lt(4)").addClass("eye2");
//专题
jQuery(".hot-top .n-list li:nth-child(1) a,.hot-top .n-list li:nth-child(2) a,.hot-top .n-list li:nth-child(3) a").addClass("eye2");
//店铺筛选选择
jQuery(".filter a.active").click(function(){return false;});
//店铺列表
jQuery(".service-list .service-item").hover(
  function () {
    jQuery(this).addClass("active");
  },
  function () {
    jQuery(this).removeClass("active");
	}
);
//封装的公用选项卡
    function tabs(tabTit,on,tabCon){
     // jQuery(tabCon).each(function(){
     // jQuery(this).children().eq(0).show();
     // });
     jQuery(tabTit).children().hover(function(){
       jQuery(this).addClass(on).siblings().removeClass(on);
       var index = jQuery(tabTit).children().index(this);
     jQuery(tabCon).children().eq(index).show().siblings().hide();
     });
     }
   tabs(".tab-hd","active",".tab-bd");
//首页百科隔行换色
jQuery(".baike-nav dd:odd").css("background-color","#f4f4f4");
jQuery(".baike-nav dd:last").css("border","none");
//复制视频地址
jQuery(".animation-adress").hover(function(){
	jQuery(this).select()});
jQuery("#copy").click(function(){
var animationAdress = jQuery(this).parent().prev(".animation-adress").val();
if (document.all){ //判断Ie
window.clipboardData.setData('text',animationAdress);
alert("复制成功，发给好朋友吧！");
}else{
alert("您的浏览器不支持剪贴板操作，请自行复制。"); 
   }
   });

//医院百科简介
jQuery(".info-t-less .all-btn").click(function(){
	jQuery(".info-t-less").hide();
	jQuery(".info-t-all").show();
}); 
jQuery(".info-t-all .less-btn").click(function(){
	jQuery(".info-t-all").hide();
	jQuery(".info-t-less").show();
}); 

});





