﻿$(document).ready(function(){
	// show detail line
	var showDetailLine = function(){	    
		var $this = $(this);
		var onshow = $this.attr('class');
		if(!onshow)
		{
			$this
				.siblings().removeClass('onshow')
				.end()
				.addClass('onshow');
			var imgpath = $('li.l1', this).find('img').attr('src');
			if(!imgpath)
			{
				imgpath = $('li.l1', this).text();
				$('li.l1', this).empty();
				$('<img src="" alt="" />').appendTo($('li.l1', this)).attr('src', imgpath);
			}
		}
	};
	$('div#sgLine ul').bind('mouseover', showDetailLine);
	$('div#sgLine ul:eq(0)').trigger('mouseover');
	
	$('.switchtitle li').click(function(){
		var $this = $(this);
		$this.addClass('onshow').siblings().removeClass('onshow');
		var cityname = $('#HF_CityName').val();
		var $parent = $this.parents('.part');
		var type = $.trim($this.text());
		var StrTT;
		if($parent[0].id == 'LineList')
		{
			if(type=="热门")
			{
				StrTT = Web51U.Web.Ajax.CityAjax.IndexTravelHotList(cityname).value;
			}
			else
			{
				StrTT = Web51U.Web.Ajax.CityAjax.GetCityTravelList(cityname, type).value;
			}		
			$('div#sgLine').html(StrTT);
			$('div#sgLine ul').bind('mouseover', showDetailLine);
			$('div#sgLine ul:eq(0)').trigger('mouseover');
		}
		else if($parent[0].id == 'NewsList')
		{
			StrTT = Web51U.Web.Ajax.DefaultAjax.GetTypeTagNews(type).value;
			$('#TagNewsUL').html(StrTT);
		}
	});
});
