$.DLOT = {
	hover_tag : function(control, show, class1) {
		$(control + "> a").hover(function() {
			var c = $(control + "> a").index($(this));
/*			if (c == i || $(this).hasClass("more")) {
				return false;
			}*/
			$(this).addClass(class1).siblings().removeClass(class1);
			$(show + "> div").eq(c).show().siblings().hide();
		})
	},
	click_tag : function(control, show, class1) {
		$(control + "> a").click(function() {
			var c = $(control + "> a").index($(this));
/*			if (c == i || $(this).hasClass("more")) {
				return false;
			}*/
			$(this).addClass(class1).siblings().removeClass(class1);
			$(show + "> div").eq(c).show().siblings().hide();
		})
	},
	hover_tag_li : function(control, show, class1) {
		var time = null;
		$(control + " li").hover(function() {
			if($(this).hasClass('more')){
				clearTimeout(time);
				var c = $(control + " li").index($(this));
				$(this).addClass(class1).siblings().removeClass(class1);
				$(show).show();
				$(show + " .hide_box").eq(c).show().siblings().hide();
			}
		},function(){
			if($(this).hasClass('more')){
				time = setTimeout(function(){
			        $(control + " li").removeClass(class1);
					$(show + " .hide_box").hide();
		    		$(show).hide();
		    	},200);
	    	}
		});
		$(show).hover(function(){
		    clearTimeout(time);
		    $(this).show();
		    },function(){
		    time = setTimeout(function(){
		        $(show + " .hide_box").hide();
		        $(control + " li").removeClass(class1);
	    		$(show).hide();
		    },200);
		});

	},
	hover_show : function(control, hideBox) {
		$(control).hover(function() {
			$(this).find(hideBox).show();
		}, function() {
			$(this).find(hideBox).hide();
		})
	},
	hover_class : function(control, class1) {
		$(control).hover(function() {
			$(this).addClass(class1)
		}, function() {
			$(this).removeClass(class1)
		})
	},
	hover_class_show : function(control, hoverBox, class1, hideBox) {
		$(control).hover(function() {
			$(this).find(hoverBox).addClass(class1);
			$(this).find(hideBox).show();
		}, function() {
			$(this).find(hoverBox).removelass(class1);
			$(this).find(hideBox).hide();
		})
	},
	hover_load : function(control, hover, class1) {
		$(control).on("mouseenter", hover, function() {
			$(this).addClass(class1);
		})
		$(control).on("mouseleave", hover, function() {
			$(this).removeClass(class1);
		})
	}
}


// 输入框焦点事件
$.fn.focusEffect = function() {
	var $input = this;
	$input.focus(function() {
		if ($input.val() == '' || $input.val() == this.defaultValue) {
			$input.val('');
			$input.css({
				color : '#333'
			})
		}
	});
	$input.blur(function() {
		if ($input.val() == '') {
			$input.val(this.defaultValue);
			$input.css({
				color : '#aaa'
			})
		}
	})
}

if ($(window).width() < 1180) {
	$('body').addClass('warp1000')
}
$(window).resize(function() {
	if ($(window).width() < 1180 && $(window).width() > 0) {
		$('body').addClass('warp1000')
	} else {
		$('body').removeClass('warp1000')
	}
});

//add by jeffy.woo
function nav_on(num){
	$('#nav_'+num).addClass('on');
}

$.DLOT.hover_class(".site_nav .my_order", "hover");
$.DLOT.hover_class(".site_nav .web_nav", "hover");
$.DLOT.hover_class(".nav_tag_con dl", "hover");
$.DLOT.hover_class(".nav_tag_con dl", "hover");


var e = null;
$('.J_more_tip').hover(function() {
	var self = $(this);
	self.addClass('hover');
	$('#' + self.data('tip_id')).show().off().hover(function() {
		if (e) {
			clearTimeout(e)
		}
	}, function() {
		if (e) {
			clearTimeout(e)
		}
		$('#' + self.data('tip_id')).hide();
		self.removeClass('hover');
	});
}, function() {
	var self = $(this);
	e = setTimeout(function() {
		$('#' + self.data('tip_id')).hide();
		self.removeClass('hover');
	}, 200);
});

// 头部搜索
var arr_txt = [ '请输入目的地名称或线路关键词', '请输入景点名称', '请输入旅行社名称', '请输入关键词', '请输入门票名称' ];
var $curtInput = $('#curtInput');
var m;
var $curtlist = $('#curtlist');
$curtInput.mouseover(function() {
	clearInterval(m);
	$curtlist.show();
	$curtInput.addClass('hover')
});
$curtInput.mouseout(function() {
	clearInterval(m);
	m = setInterval(function() {
		$curtlist.hide();
		$curtInput.removeClass('hover')
	}, 100);
})
$curtlist.find('li').hover(function() {
	$(this).css({
		background : '#f0f0f0'
	})
}, function() {
	$(this).css({
		background : '#fff'
	})
});

if($(document).find("#tn")){
	if($(".onName").text()=='门票'){
		$('#tn').val('menpiao');
	}else{
		$('#tn').val('line');
	}
}

$curtlist.find('li').click(function() {
	$curtlist.hide();
	var n = $.trim($(this).text());
	$curtInput.find('.onName').text(n);
	var ts = $('#so_input');
	var ts_val = ts.val();
	if (n == '景点') {
		$('#tn').val('jd');
		if (ts_val && $.inArray(ts_val, arr_txt) > -1) {
			ts.val(arr_txt[1]);
			ts[0].defaultValue = arr_txt[1];
			ts.css({
				color : '#aaa'
			})
		}
	} else if (n == '旅行社') {
		$('#tn').val('lxs');
		if (ts_val && $.inArray(ts_val, arr_txt) > -1) {
			ts.val(arr_txt[2]);
			ts[0].defaultValue = arr_txt[2];
			ts.css({
				color : '#aaa'
			})
		}
	} else if (n == '综合') {
		$('#tn').val('all');
		if (ts_val && $.inArray(ts_val, arr_txt) > -1) {
			ts.val(arr_txt[3]);
			ts[0].defaultValue = arr_txt[3];
			ts.css({
				color : '#aaa'
			})
			document.soform.target = "blank";
		}
	} else if (n == '门票') {
		$('#tn').val('menpiao');
		if (ts_val && $.inArray(ts_val, arr_txt) > -1) {
			ts.val(arr_txt[4]);
			ts[0].defaultValue = arr_txt[4];
			ts.css({
				color : '#aaa'
			})
		}
	} else {
		$('#tn').val('line');
		if (ts_val && $.inArray(ts_val, arr_txt) > -1) {
			ts.val(arr_txt[0]);
			ts[0].defaultValue = arr_txt[0];
			ts.css({
				color : '#aaa'
			})
		}
	}
});
$("#xianlu_so").bind(
		"submit",
		function() {
			if ($("#so_input").val() == '请输入目的地名称或线路关键词'
					|| $("#so_input").val() == '请输入景点名称'
					|| $("#so_input").val() == '请输入旅行社名称'
					|| $("#so_input").val() == '请输入关键词') {
				$("#so_input").parent(".search_top");
				return false;
			}
		});

$.DLOT.click_tag(".city_tag_top", ".city_tag_con", "on");
$.DLOT.hover_tag(".tjxl_tag_top", ".tjxl_tag_con", "on");

if (!$(".side_menu").hasClass("hide")) {
	$.DLOT.hover_class(".side_menu", "hover");
	$(".side_menu").mouseover(function(){
		{
		$.DLOT.hover_tag_li("#tag_top_nav", "#tag_con_nav", "hover");
		}
	})	
	
}else{
	$.DLOT.hover_tag_li("#tag_top_nav", "#tag_con_nav", "hover");
}

$('.side_menu').hover(function() {
    $(this).addClass('hover');
    $("#tag_top_nav").css({
        "display": "block"
    });
},
function() {
    $(this).removeClass('hover');
    $("#tag_top_nav").css({
        "display": "none"
    });
});




$.DLOT.hover_show(".site_nav_con .weixin", ".weixin_tip");
$.DLOT.hover_show(".site_nav_con .mendian", ".mendian_tip");
$.DLOT.hover_show(".site_nav_con .web_nav", ".web_nav_con");

$(function () {
//鼠标放上去状态
$(".fn-browseTitle li").hover(function () {
$(this).addClass("on");
}, function () {
$(this).removeClass("on");
});
$("div.fn-browseTop a").click(function () {
parentHide();
return false;
});
//tabs切换
$("li.fn-browseLi").click(function () {
$(this).addClass("on");
$(".fn-browseOne").show();
$(this).blur();
});
//返回顶部
$(window).scroll(function () {
var ScrollTop = $(window).scrollTop();
if (ScrollTop > 100) {
$(".J_ScrollTop").show();
} else {
$(".J_ScrollTop").hide();
}
scrollFix();
});
$(".J_ScrollTop").click(function () {
parentHide();
$('body,html').animate({ scrollTop: 0 }, 800);
});
//IE6下的定位
function scrollFix() {
if (!window.XMLHttpRequest) { $(".fn-browse").css("top", $(document).scrollTop() + $(window).height() - $(".fn-browse").height() + 65);}
}
});

//伸缩广告
if ($("#js_ads_banner_top_slide").length==0){
	setTimeout(function(){$("#js_ads_banner_top").slideUp(1000);$("#js_ads_banner_top_slide").slideDown(1000);},2500);
	setTimeout(function(){$("#js_ads_banner_top_slide").slideUp(1000,function (){$("#js_ads_banner_top").slideDown(1000);});},8500);
}
$(function () {//左侧导航
var aslideShow;
var aslideHide;
$(".subMenu-li").hover(function () {
var that = $(this);
if (aslideHide) {
window.clearTimeout(aslideHide);
}
if (that.find(".subMenu-list dt i").is(":visible")) {
aslideShow = window.setTimeout(function () {
that.siblings("li").removeClass("cur").children(".subMenu-gty2").hide();
that.addClass("cur").children(".subMenu-gty2").show()
}, 200);
} else {
that.siblings("li").removeClass("cur").children(".subMenu-gty2").hide();
}
}, function () {
if (aslideShow) {
window.clearTimeout(aslideShow);
}
var that = $(this);
aslideHide = window.setTimeout(function () {
$(".subMenu-ul li.cur").removeClass("cur").children(".subMenu-gty2").hide()
}, 200);
});
});
//导航
(function(window){
    var arr=["dlzb","dlts","dlmore"];
    for(var i=0,j=arr.length;i<j;i++){
        showNavMain(document.getElementById(arr[i]));
    }
    function showNavMain(el){
        var subnav_wrap_bg = document.getElementById("subnav_wrap_bg");
        if(el){
                el.onmouseover = function() {
                    el.className = "top_has cui_nav_o";
                    subnav_wrap_bg.style.display="block"; 

                },
                el.onmouseout = function() {
                    el.className = "top_has";
                    subnav_wrap_bg.style.display="none"; 
                }
            };

    }
    })(window);