$(document).ready(function(){
			$(".navText ul li:last").addClass("lastli");
            $(".search span").click(function(){
			   if($("#keys").val()==''){
			      alert('查询内容不能为空!');
				  $("#keys").focus();
			   }
			   else
			   parent.location='SearchLine.asp?keys='+$("#keys").val();
			});	
			//链接详细介绍效果
			var x = 10;
			var y = 20;
			$("a.tooltip").click(function(){
				return false ;
			});
			$("a.tooltip").mouseover(function(e){
				this.myTitle = this.title;
				this.title = "";	
				var imgTitle = this.myTitle? "<br/>" + this.myTitle : "";
				var tooltip = "<div id='tooltip'>"+ this.myTitle +"<\/div>"; //创建 div 元素
				$("body").append(tooltip);	//把它追加到文档中						 
				$("#tooltip")
					.css({
						"top": (e.pageY+y) + "px",
						"left":  (e.pageX+x)  + "px"
					}).show("fast");	  //设置x坐标和y坐标，并且显示
    		}).mouseout(function(){
				this.title = this.myTitle;	
				$("#tooltip").remove();	 //移除 
   		    }).mousemove(function(e){
				$("#tooltip")
					.css({
						"top": (e.pageY+y) + "px",
						"left":  (e.pageX+x)  + "px"
					});
			});
			/*换色*/
 			$(".tourPrice tr").mouseover(function(){ 
					$(this).addClass("t_over");//鼠标移到class为tourPrice的表格的tr上时，执行函数 
			}); 
		    $(".tourPrice tr").mouseout(function(){ 
					$(this).removeClass("t_over");//移除该行的class 
			 }); 
			$(".tourPrice tr:even").addClass("t_color");//even----奇数,and odd----偶数 
			/*/滚动代码
		    var $this = $(".scorllprice");
		    var scrollTimer;
		    $this.hover(function(){
			    clearInterval(scrollTimer);
		    },function(){
		        scrollTimer = setInterval(function(){
						 scrollNews( $this );
					}, 3000 );
		    }).trigger("mouseleave");
		   */
		   //一开始就执行动画
		   //限定合作单位的图片宽为200px；
		   $(".scrollNews img").each(function(){
			     if($(this).width()>200){
		            $(this).width(200);
		        }
		   });
		   $("#keys").focus(function(){
		   		$("#hotkeys_srch_tours").show('normal');
		   });
		   $(".brand dd").click(function(){
		        $("#hotkeys_srch_tours").hide('normal'); 
		   });
		   $("#hotkeys_srch_tours").click(function(){
		        $("#hotkeys_srch_tours").hide('normal'); 
		   });
 		   //首页线路切换效果
		    var $div_ulli =$("div.lineTitle li");
	        $div_ulli.hover(function(){
			$(this).addClass("hoverli")            //当前<li>元素高亮
				   .siblings().removeClass("hoverli");  //去掉其它同辈<li>元素的高亮
            var ulindex =  $div_ulli.index(this);  // 获取当前点击的<li>元素 在 全部li元素中的索引。
			$("div.mainlineText-right > ul")   	//选取子节点。不选取子节点的话，会引起错误。如果里面还有div 
					.eq(ulindex).show()   //显示 <li>元素对应的<div>元素
					.siblings().hide(); //隐藏其它几个同辈的<div>元素
		    });
		   //tab代码
		    var $div_li =$("div.Ticket li");
	        $div_li.mouseover(function(){
			$(this).addClass("TickethoverLi")            //当前<li>元素高亮
				   .siblings().removeClass("TickethoverLi");  //去掉其它同辈<li>元素的高亮
            var index =  $div_li.index(this);  // 获取当前点击的<li>元素 在 全部li元素中的索引。
			$("div.TicketList > table")   	//选取子节点。不选取子节点的话，会引起错误。如果里面还有div 
					.eq(index).show()   //显示 <li>元素对应的<div>元素
					.siblings().hide(); //隐藏其它几个同辈的<div>元素
		    });
			$("div.scorllprice input").click(function(){
				var ulindex =  $("div.scorllprice input").index(this); 
				if($("div.scorllprice > ul").eq(ulindex).is(":visible"))
				  $("div.scorllprice > ul").eq(ulindex).slideUp('normal');
				else
				  $("div.scorllprice > ul").eq(ulindex).slideDown('normal');
 				//alert(ulindex);
			});
			$(".hotelList").mouseover(function(){
			   $(this).addClass("overhotel")          
				   .siblings().removeClass("overhotel");
			});
			$(".hotelList").mouseout(function(){
			   $(this).removeClass("overhotel");
			});
			/*酒店房间*/
			$(".roomname").click(function(i){
					   var index =  $(".roomname").index(this);
  					   if($(this).find("img").attr("src")=="images/ic_u.gif"){
					 	  $(this).find("img").attr("src", "images/ic_d.gif");
						  $(".roomInfor").eq(index).fadeOut('normal');
					   }
				       else{
				          $(this).find("img").attr("src", "images/ic_u.gif");
						  $(".roomInfor").eq(index).fadeIn('normal');
					   }
					   
 			}).hover(function(){
				 $(this).css("color","#ff3300");
			},function(){
				 $(this).css("color","#444444");
			})
});
//滚动新闻函数
function scrollNews(obj){
    var $self=obj.find("ul:first");
	var lineHeight=$self.find("li:first").height();
	 $self.animate({ "marginTop" : -lineHeight +"px" },600,function(){
	       $self.css({marginTop:0}).find("li:first").appendTo($self); //每次滚动完毕需要把当前的li加载到ul 的后面然后再将ul的margin-top设置为零
	});
}
