		var zeropicPaths = new Array();
		
		var zeroAds = new Array();
		
		var zeroSwitchImgPathStartNum = 1;
		
		var zeroFlashTime = 3000;
		
		var zeroPage = null;
	
		var goTime = null;
		
		var zeroCurrentPage = 0;
		
		var zeroPageSize = 21;
		
		$(function(){
			
			$.getJSON("/help/clientgetAd.do?adPostion=0&data="+new Date(),function(date){
				var p = $(date).length;
				
				$(date).each(function(i){
					
					if((p-1)==i){
						
						zeroPage = date[i];
						
						zeroCurrentPage = zeroPage.currentPage;
						zeroPageSize = zeroPage.pageSize;
					}else{
						
						zeroAds[i]=date[i];
						
						zeropicPaths[i]=date[i].adPicture;
					}
				});
				$("#num0").css({backgroundImage:"url("+zeropicPaths[0]+")"});/********************************************/
				
				$("<input type='hidden' id='mySelfAllNumber' value='0'></input>").appendTo($("#zeroAdContent"));
				
				for(var i=0;i<zeropicPaths.length;i++){
					$("<div class='zeroDivs' onmouseout='zeromouseout(this);' onmouseover='zerogetThisAdByNumber(this);'>"+(i+1)+"</div>").appendTo($("#zeroAdPage"));
				}
				
				$($("#zeroAdPage>div")[0]).css('background-color','#cccccc');
			});
			
			goTime=setInterval("numberZeroSwitchImgPath()",zeroFlashTime);
		});
		
		
		function zerogetThisAdByNumber(obj){
			
				clearInterval(goTime);
				var myNum = $(obj).text();
				if(myNum>=(zeroPageSize+1)){
					myNum = myNum%zeroPageSize;
				}
				$(obj).css('background-color','#ffff00');
				$("#num0").css({backgroundImage:"url("+zeropicPaths[myNum-1]+")"});/*********************************/
				$("#mySelfAllNumber").val(myNum-1);
		}
		
		
		function zeroContentMouseout(){
			goTime=setInterval("numberZeroSwitchImgPath()",zeroFlashTime);
		}
		
		function zeromouseout(obj){
			$(obj).css('background-color','gray');
			goTime=setInterval("numberZeroSwitchImgPath()",zeroFlashTime);
		}
		
		function zeromouseover(){
			clearInterval(goTime);
		}
		
		function zeroClick(){
			var number = $("#mySelfAllNumber").val();
			if(zeroAds[number].isNotOpenWeb==1){
				window.open(zeroAds[number].httpAddress);
			}else{
				var name = encodeURI(zeroAds[number].companyName);
				var url = "/help/showShopInfo.do?method=toShop&company_name="+name;
				window.open(url);
			}
		}
		
		
	
		function numberZeroSwitchImgPath(){
			
			if(zeroSwitchImgPathStartNum>=(zeroAds.length)){//-1
				zeroSwitchImgPathStartNum=1;
				
				if(zeroPage==null||zeroPage.totalPages==null){
					zeroGetNewDateFirstPage();
					return null
				};
				if(zeroCurrentPage==zeroPage.totalPages){
					zeroGetNewDateFirstPage();
				}else{
					zeroGetNewDateNextPage();
				}
			}else{
				
				$("#num0").css({backgroundImage:"url("+zeropicPaths[zeroSwitchImgPathStartNum]+")"});
				var pages = $("#zeroAdPage div");
				
				$(pages).each(function(i){
					var myNum = $(pages[i]).text();//%10
					if(myNum>=(zeroPageSize+1)){
						myNum= myNum%zeroPageSize;
					}
					if(myNum==zeroSwitchImgPathStartNum+1){
						$(pages[i]).css('background-color','#cccccc');
					}else{
						$(pages[i]).css('background-color','gray');
					}
				});
				$("#mySelfAllNumber").val(zeroSwitchImgPathStartNum);
				zeroSwitchImgPathStartNum++;
			}
		}
		
		
		function zeroGetNewDateNextPage(){
			
			$.getJSON("/help/clientgetAd.do?adPostion=0&pageMethod=next&currentPage="+zeroCurrentPage,function(date){
				zeropicPaths = new Array();
				zeroAds = new Array();
				zeroSwitchImgPathStartNum = 1;
				$("#zeroAdPage").text("");
				var p = $(date).length;
				$(date).each(function(i){
					if((p-1)==i){
						zeroPage = date[i];
						zeroCurrentPage = zeroPage.currentPage;
						zeroPageSize = zeroPage.pageSize;
						
					}else{
						zeroAds[i]=date[i];
						zeropicPaths[i]=date[i].adPicture;
					}
				});
				$("#num0").css({backgroundImage:"url("+zeropicPaths[0]+")"});/**********************************/
				for(var i=0;i<zeropicPaths.length;i++){
					$("<div class='zeroDivs' onmouseout='zeromouseout(this);' onmouseover='zerogetThisAdByNumber(this);'>"+((zeroCurrentPage-1)*zeroPageSize+(i+1))+"</div>").appendTo($("#zeroAdPage"));
				}
				$($("#zeroAdPage div")[0]).css('background-color','#cccccc');
			});
		}
		
		
		function zeroGetNewDatePreviousPage(){
			
			$.getJSON("/help/clientgetAd.do?adPostion=0&pageMethod=previous&currentPage="+zeroCurrentPage,function(date){
				zeropicPaths = new Array();
				zeroAds = new Array();
				zeroSwitchImgPathStartNum = 0;
				$("#zeroAdPage").text("");
				var p = $(date).length;
				$(date).each(function(i){
					if((p-1)==i){
						zeroPage = date[i];
						zeroCurrentPage = zeroPage.currentPage;
						
						zeroPageSize = zeroPage.pageSize;
						
					}else{
						/*save Ad Object*/
						zeroAds[i]=date[i];
						zeropicPaths[i]=date[i].adPicture;
					}
				});
				$("#num0").css({backgroundImage:"url("+zeropicPaths[0]+")"});/*******************************/
				for(var i=0;i<zeropicPaths.length;i++){
					$("<div class='zeroDivs' onmouseout='zeromouseout(this);' onmouseover='zerogetThisAdByNumber(this);'>"+((zeroCurrentPage-1)*zeroPageSize+(i+1))+"</div>").appendTo($("#zeroAdPage"));
				}
				$($("#zeroAdPage div")[0]).css('background-color','#cccccc');
			});
		}
		
		function zeroGetNewDateFirstPage(){
			$.getJSON("/help/clientgetAd.do?adPostion=0&pageMethod=first&currentPage="+zeroCurrentPage,function(date){
				zeropicPaths = new Array();
				zeroAds = new Array();
				
				$("#zeroAdPage").text("");
				var p = $(date).length;
				$(date).each(function(i){
					if((p-1)==i){
						zeroPage = date[i];
						zeroCurrentPage = zeroPage.currentPage;
						zeroPageSize = zeroPage.pageSize;
						
					}else{
						zeroAds[i]=date[i];
						zeropicPaths[i]=date[i].adPicture;
					}
				});
				$("#num0").css({backgroundImage:"url("+zeropicPaths[0]+")"});/******************************/
				for(var i=0;i<zeropicPaths.length;i++){
					$("<div class='zeroDivs' onmouseout='zeromouseout(this);' onmouseover='zerogetThisAdByNumber(this);'>"+((zeroCurrentPage-1)*zeroPageSize+(i+1))+"</div>").appendTo($("#zeroAdPage"));
				}
				$($("#zeroAdPage div")[0]).css('background-color','#cccccc');
			});
		}
		
		
		/**------------------------------1-------------------------------***/
		
		$(function(){
			$.getJSON("/help/clientgetLocationAd.do?adPostion=1&data="+new Date(),function(data){
				if($(data)!=null||$(data)!=undifind){
					if($(data).length!=0){
						
						$("#tuijianImg").attr("src",$(data)[0].adPicture);
						var openflag = $(data)[0].isNotOpenWeb;
						var openname = $(data)[0].companyName;
						var companyurl = $(data)[0].httpAddress;
						$("#tuijianImg").click(function (){
							if(openflag==1){
								window.open(companyurl);
							}else{
								var name = encodeURI(openname);
								var url = "/help/showShopInfo.do?method=toShop&company_name="+name;
								window.open(url);
						}
						});
						var adShow = $(data)[0].adShow;
						if(adShow==null){
							return false;
						}
						$("#showAdShowInformation").css("opacity",0.7)
						$("#AdShowInforContent").css("opacity",1)
						
						$("#promotionPoints").css("cursor"," pointer");
						
						if(adShow.split("dis:")[1].split("showsellone:")[0].length>=25){
							$("#promotionPoints").text(adShow.split("dis:")[1].split("showsellone:")[0].substring(0,25)+"......");
							$("#showAdInforBodyContent").text(adShow.split("dis:")[1].split("showsellone:")[0]);
							$("#promotionPoints").click(function(){
								/*<div id="showAdInforBodyContent" style="width: 100%;height: 93%;color: #000000;"></div>*/
								$("#showAdShowInformation").fadeIn(1000);
							});
						}else{
							$("#promotionPoints").text(adShow.split("dis:")[1].split("showsellone:")[0]);
						}
						
						$("#showAdInforTopClose").click(function(){
							$("#showAdShowInformation").fadeOut(1000);
						});
						
						/*oneSellPointsOne*/
						//showsellone
						
						if(adShow.split("showsellone:")[1].split("showselltwo:")[0].length>=25){
							$("#oneSellPointsOne").css("cursor"," pointer");
							$("#oneSellPointsOne").text(adShow.split("showsellone:")[1].split("showselltwo:")[0].substring(0,25)+"......")
							
							$("#showAdInforBodyContent").text(adShow.split("showsellone:")[1].split("showselltwo:")[0]);
							$("#oneSellPointsOne").click(function(){
								$("#showAdShowInformation").fadeIn(1000);
							});
						}else{
							$("#oneSellPointsOne").text(adShow.split("showsellone:")[1].split("showselltwo:")[0]);
						}
						
						/*oneSellPointsTow*/
						//showselltwo:
						if(adShow.split("showselltwo:")[1].split("showsellthree:")[0].length>=25){
							$("#oneSellPointsTow").css("cursor"," pointer");
							
							$("#oneSellPointsTow").text(adShow.split("showselltwo:")[1].split("showsellthree:")[0].substring(0,25)+"......")
							
							$("#showAdInforBodyContent").text(adShow.split("showselltwo:")[1].split("showsellthree:")[0]);
							$("#oneSellPointsTow").click(function(){
								$("#showAdShowInformation").fadeIn(1000);
							});
							
						}else{
							$("#oneSellPointsTow").text(adShow.split("showselltwo:")[1].split("showsellthree:")[0]);
						}
						
						
						/*oneSellPointsThree*/
						//showsellthree:
						if(adShow.split("showsellthree:")[1].length>=25){
							
							$("#oneSellPointsThree").css("cursor"," pointer");
							
							$("#oneSellPointsThree").text(adShow.split("showsellthree:")[1].substring(0,25)+"......")
							
							$("#showAdInforBodyContent").text(adShow.split("showsellthree:")[1]);
							$("#oneSellPointsThree").click(function(){
								$("#showAdShowInformation").fadeIn(1000);
							});
							
						}else{
							$("#oneSellPointsThree").text(adShow.split("showsellthree:")[1]);
						}
						
					}
				}
				
			});
		});
		/*<div style="float:right;width: 100%;height: 15px;background-color: #cccccc;cursor: pointer;text-align: right" onclick="">Close</div>*/
		function closeBigDiv(){
			
		}
		
		
		
		
		
		/*****************------------------2-----------------------**************/
		var TwoAds = null;
	$(function(){
		//$(".numOne").corner();
		$.getJSON("/help/clientgetLocationAd.do?adPostion=2&data="+new Date(),function(data){
			TwoAds = $(data);
			TwoAds.each(function(i){
				$($("#num2>img")[i]).attr({src:TwoAds[i].adPicture});
				$("<input type='hidden' value='"+i+"'></input>").appendTo($($("#num2>div")[i]));
			});
		});
	});
	
	function twoClick(num){
		if(TwoAds[num].isNotOpenWeb==1){
				window.open(TwoAds[num].httpAddress);
			}else{
				var name = encodeURI(TwoAds[num].companyName);
				
				var url = "/help/showShopInfo.do?method=toShop&company_name="+name;
				window.open(url);
			}
	}
	
	/*******************---------------------3----------------*******************************/
	var threeAd = null;
	
	$(function(){
		//$(".numOne").corner();
		$.getJSON("/help//clientgetLocationAd.do?adPostion=3&data="+new Date(),function(data){
			threeAd = $(data);
			threeAd.each(function(i){
				$("#num3").attr({src:threeAd[i].adPicture});
				$("<input type='hidden' value='"+i+"'></input>").appendTo($("#num3"));
			});
		});
	});
	
	function threeClick(num){
		if(threeAd[num].isNotOpenWeb==1){
				window.open(threeAd[num].httpAddress);
			}else{
				var name = encodeURI(threeAd[num].companyName);
				
				var url = "/help/showShopInfo.do?method=toShop&company_name="+name;
				window.open(url);
			}
	}
	