var Container,ShowList;
ShowList = 0;
function GetTickets(Obj,SL,Path)
{
	if(!Obj){Obj=Container;}else{Container=Obj}//容器
	if(!SL){SL=ShowList;}else{ShowList=SL}//显示列数
	//拼写景点ID
	var SID = '';
	$(Obj).each(function(){
		SID +=','+$(this).attr('sid');
	});
	if(SID=='')return;
	if(SID!='')SID=SID.substring(1);
	var ajaxpath = Path + 'sys/ajax/GetTickets.aspx?sid=' + SID;
	$.ajax({
	    type: 'GET', cache: false,
	    url: ajaxpath,
	    dataType: 'xml',
	    success: function (xml) {
	        $(Obj).each(function () {
	            var thisSID = $(this).attr('sid');
	            var temp = '';
	            var children;
	            $(xml).find('ticketss>tickets[t_sceneryid="' + thisSID + '"]').each(function () {
	                temp += '<tr class="sHotTabText">';
	                temp += '<td>' +$(this).attr('t_name').substring(0,20) + '</td>';
	                temp += '<td width="80"><span class="marketPrice">¥' + $(this).attr('t_rackrate') + '</span></td>';
	                temp += '<td width="80"><span class="offerPrice">¥' + $(this).attr('t_price') + '</span></td>';
	                temp += '<td width="80"><span class="offerPrice">¥' + $(this).attr('t_discountprice') + '</span></td>';
	                temp += '<td width="80"><span class="offerPrice">¥' + $(this).attr('t_bonus') + '</span></td>';
	                temp += '<td width="80"><input type="button" onclick="SceneryBooking(' + $(this).attr('t_id') + ');" class="form_sk5" /></td>';
	                temp += '</tr>';
	            });
	            if (temp != '') {
	                $(this).html(temp);
	                //children = $(this).children().children();//获取所有景点门票
	                children = $(this).find('.sHotTabText');
	                if (SL > 0 && children.length > SL + 1) {
	                    $(children).filter(':gt(' + (SL - 1) + ')').hide(); //隐藏多余景点门票
	                    $(this).after('<div class="sExpand"><a href="javascript:void(0);" id="OpenTickets_' + thisSID + '" sid="' + thisSID + '">查看全部景点门票(' + children.length + ')</a> <img src="' + Path + 'Images/icoMoresE.gif" /></div>'); //显示所有景点门票链接
	                    $('#OpenTickets_' + thisSID).click(function () { //显示所有景点门票事件
	                        if ($(this).attr('open') != 'true') {
	                            $(Obj).filter('[sid="' + $(this).attr('sid') + '"]').find('.sHotTabText').show();
	                            $(this).attr('open', 'true');
	                            $(this).next('img').attr('src', Path + 'Images/icoMoresT.gif');
	                        } else {
	                            $(Obj).filter('[sid="' + $(this).attr('sid') + '"]').find('tr:gt(' + ((ShowList - 1) * 2) + ')').hide();
	                            $(this).attr('open', 'false');
	                            $(this).next('img').attr('src', Path + 'Images/icoMoresE.gif');
	                        }
	                    });
	                }
	            } else {
	                $(this).html('<tr class="sHotTabText"><td>暂无景点门票</td></tr>');
	            }
	        });
	    }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(XMLHttpRequest.responseText); }
	});
}