
//首页JS

function bindTopCity()
{
	var cityId=$("#cityId").val();
	var showTypeId=$("#showTypeId").val();
	var html='';
		$.getJSON(server+'/index/getTopCity.do?cityId='+cityId,function(data){
			$.each(data.agenInfo,function(entryIndex,entry){
				//	alert(entry.agencyTel);
					$('#agenTelDiv').append('订票热线：'+entry.agencyTel);
//					alert(entry.rebate);
					var temp=entry.rebate;
					var arr=temp.split('\r\n');
					var htmlTemp='';
					var htmlStr='';
					for(var i=0;i<arr.length;i++){
						if(arr[i]!=''){
							htmlTemp+=arr[i]+'</br>';
						}
					}
					if(htmlTemp!=''){
						htmlStr+=' <div id="default_right_discount">';
				          
							
						htmlStr+='<div class="de_ri_dis_title">';
						htmlStr+='<span>优惠</span>信息';
							htmlStr+='<img src="'+server+'/public/front/img/de_ri_dis_icon.gif" height="15px" width="15px" />';
								htmlStr+='</div>';
									htmlStr+='<div class="de_ri_dis_content">';
										htmlStr+='<img src="'+server+'/public/front/img/de_ri_dis_img.gif" height="54px" width="54px" />';
											htmlStr+='<div style="float:left; width:205px;" >'+htmlTemp+'</div>';
						htmlStr+='<br style="clear:both;" />';
							htmlStr+='</div>';
							htmlStr+=' </div>';
					}
					
					$('#default_right_discountDIV').append(htmlStr);
					
					var footerDivHtml=' <div class="footer_intro_1">'+entry.agency_service_time+'</div>';
					footerDivHtml+='<div class="footer_intro_2">'+entry.is_free_deliver+'</div>';
					footerDivHtml+='<div class="footer_intro_3">'+entry.is_self_ticket+'</div>';
					footerDivHtml+=' <div class="footer_intro_4">'+entry.agencyTel+'</div>';
					footerDivHtml+=' <br style="clear:both;" />';
				    
					$('#footerDiv').append(footerDivHtml);
				});
			
			$.each(data.results,function(entryIndex,entry){
					if(entryIndex==0){
						  html +=' <div hid="'+entry.cityId+'">'+entry.cityName+'</div>';
						  document.getElementById("cityId").value=entry.cityId;
						  html +=' <ul style="display:none;">';
					}else{
						 html +='  <li hid="'+entry.cityId+'">'+entry.cityName+'</li>';
					}
			});
			 html +=' </ul>';
			 html +='<script language="javascript">';
			 //window.location.href="init.do?cityId="+this.hid;
			 html +=' new myMemu("menu1",function(){window.location.href="'+server+'/index/init.do?showTypeId=&cityId="+this.hid});';
			 html +='</script>';
			$('#menu1').append(html); 
			var html1='';
			if(showTypeId=='0'){
				html1='<a  href="'+server+'/index/init.do?showTypeId=&cityId='+cityId+'" class="on">首页</a>';
			}else{
				html1='<a  href="'+server+'/index/init.do?showTypeId=&cityId='+cityId+'">首页</a>';
			}
			$.each(data.typeList,function(entryIndex,entry){
				if(entry.showTypeID==showTypeId){
					html1+='<a href="#" onclick="searchByType(\''+entry.showTypeID+'\')" class="on">'+entry.showTypeName+'</a>';
				}else{
					html1+='<a href="#" onclick="searchByType(\''+entry.showTypeID+'\')">'+entry.showTypeName+'</a>';
				}
			});
			$('#showTypeList').append(html1);
			
	});
}



function bindButtom1(){
			$.getJSON(server+'/index/getBottom.do?type=6',function(data){
				var str=data.results;
		
				if(str!=""){
					$('#partnerIMGTOP').append('<img src="'+str+'" width="207px" height="48px" />'); 
					$('#partnerIMGButtom').append('<img src="'+str+'" width="207px" height="48px" />'); 
					
				}
//				
	});
}

//版权信息
function bindCopyRight(){
	$.ajax({
	     url:server+"/index/getCopyRight.do",
	     type:"get",
	     dataType:"html",
	     data:"type=7",
	     success:showCopyRight
	});
}
//回调函数(版权信息)
function showCopyRight(temp){
	 if(temp.length > 0){
		 $('#copyRight').append(temp);
	 }
}

function searchByName(){
	var showName = $("#searchName").val();
	var showTypeId=$("#showTypeId").val();
	var cityID=$("#cityId").val();
	if(showName=='请输入演出名称'){
		showName="";
	}
	showName = encodeURI(encodeURI(showName));
	window.location.href=server+"/index/listInit.do?showName="+showName+"&cityId="+cityID+"&showTypeId="+showTypeId;

}
function searchByType(showType){
	$("#showTypeId").val(showType);
	topSearch1();
}
function clean(){
//	$("#showName").val('');
}

function topSearch(){
	var showName = $("#searchName").val();
	var cityID=$("#cityId").val();
	if(showName=='请输入演出名称'){
		showName="";
	}
	showName = encodeURI(encodeURI(showName));
	var url = server+"/index/listInit.do?showName="+showName+"&cityId="+cityID+"&showTypeId=all";
	window.location.href=url;
	
}
function topSearch1(){
	var showName = $("#searchName").val();
	var showTypeId=$("#showTypeId").val();
	var cityID=$("#cityId").val();
	if(showName=='请输入演出名称'){
		showName="";
	}
	if(showTypeId!=''){
		showName="";
	}
	showName = encodeURI(encodeURI(showName));
	window.location.href=server+"/index/listInit.do?showName="+showName+"&cityId="+cityID+"&showTypeId="+showTypeId;
	
}
function getShowHistoryList(){
	$.getJSON(server+'/index/getShowHistory.do',function(data){
		$("#showHistory").empty();
		var html='';
			for(var index in data.result[0]){
				$("#rv_no_results").hide();
				var showName="";
				if(data.result[0][index].length>18){
					showName = data.result[0][index].substring(0,18)+"...";
				}else{
					showName = data.result[0][index];
				}
				html+='<li><a title="'+data.result[0][index]+'" target="_parent" class="block" href="'+server+'/index/'+index+'">'+showName+'</a></li>';
			}
			if(html==''){
				$("#rv_no_results").show();
			}else{
				$("#showHistory").append(html);
			}
	});
}
function bindNavTopPic(){
	$.getJSON(server+'/index/getNavTopRecomments.do',function(data){
		$(".ad_index1").empty();
		var html='';
		if(data.results.length>0){
			$.each(data.results,function(entryIndex,entry){
				//html+='<a href="'+entry.home_url+'"><img width="790px" height="80px" border="0" src="'+server+entry.home_img+'"/></a>';
				html+='<a href="'+entry.home_url+'"><img width="790px" height="80px" border="0" src="'+serverAddressRecomment+entry.home_img+'"/></a>';
			});
			$(".ad_index1").append(html);
		}else{
			$(".ad_index1").html("该图片暂时没有上传");
		}
	});
}
function bindNavBottomPic(){
	$.getJSON(server+'/index/getNavBottomRecomments.do',function(data){
		$(".ad_index2").empty();
		var html='';
		if(data.results.length>0){
			$.each(data.results,function(entryIndex,entry){
				//html+='<a href="'+entry.home_url+'"><img width="980px" height="80px" border="0" src="'+server+entry.home_img+'"/></a>';
				html+='<a href="'+entry.home_url+'"><img width="980px" height="80px" border="0" src="'+serverAddressRecomment+entry.home_img+'"/></a>';
			});
			$(".ad_index2").append(html);
		}else{
			$(".ad_index2").html("该图片暂时没有上传");
		}
	});
}


                                                                





