		var fiveTwoAds = new Array();
		var fiveTwoSwitchImgPathStartNum = 1;
		var fiveTwoFlashTime = 2500;
		var fiveTwoPage = null;
		var towGoTime = null;
		var fiveTwoCurrentPage = 0;
		var fiveTwoPageSize = 8;

		function innitFiveTwo(addCurrentPage){
			finalCurrentPage=finalCurrentPage;
			$("#fiveTwoAdPage").text("");
			$.getJSON("/help/clientgetAdLocationFive.do?adPostion=5&pageSize=8&pageMethod=next&currentPage="+finalCurrentPage,function(date){
				var p = $(date).length;
				$(date).each(function(i){
					if((p-1)==i){
						fiveTwoPage = date[i];
						fiveTwoCurrentPage = fiveTwoPage.currentPage;
						finalCurrentPage = fiveTwoCurrentPage;
						
						innitFiveThree(finalCurrentPage);
					}else{
						fiveTwoAds[i]=date[i];
						//fiveTwopicPaths[i]=date[i].adPicture;
					}
				});
				$("#fourTwo").css({backgroundImage:"url("+fiveTwoAds[0].adPicture+")"});/********************************************/
				$("<input type='hidden' id='fiveTwoAllNumber' value='0'></input>").appendTo($("#fiveTwoAdContent"));
				for(var i=0;i<fiveTwoAds.length;i++){
					$("<div class='fiveOneDivs' onmouseout='fiveTwomouseout(this);' onmouseover='fiveTwogetThisAdByNumber(this);'>"+(fiveTwoPageSize+(i+1))+"</div>").appendTo($("#fiveTwoAdPage"));
				}
				$($("#fiveTwoAdPage>div")[0]).css('background-color','#cccccc');
			});
			towGoTime=setInterval("numberFiveTwoSwitchImgPath()",fiveTwoFlashTime);
		}
		
		
		function numberFiveTwoSwitchImgPath(){
		
			if(fiveTwoSwitchImgPathStartNum>=(fiveTwoAds.length)){//-1
			
				fiveTwoSwitchImgPathStartNum=1;
				
				if(finalCurrentPage==fiveTwoPage.totalPages){
				
					finalCurrentPage=1;
					
					fiveTwoGetNewDateFirstPage();
				}else{
					fiveTwoGetNewDateNextPage();
				}
			}else{
				$("#fourTwo").css({backgroundImage:"url("+fiveTwoAds[fiveTwoSwitchImgPathStartNum].adPicture+")"});
				var pages = $("#fiveTwoAdPage div");
				$(pages).each(function(i){
				
					var myNum = $(pages[i]).text();//%10
					
					if(myNum>=(fiveTwoPageSize+1)){
						
						myNum= myNum%fiveTwoPageSize;
						
						if(myNum==0){
							myNum=8;
						}
					}
					if(myNum==fiveTwoSwitchImgPathStartNum+1){
						$(pages[i]).css('background-color','#cccccc');
					}else{
						$(pages[i]).css('background-color','gray');
					}
				});
				$("#fiveTwoAllNumber").val(fiveTwoSwitchImgPathStartNum);
				fiveTwoSwitchImgPathStartNum++;
			}
		}
		
		
		
		function fiveTwoGetNewDateNextPage(){
			finalCurrentPage+=1;
			$.getJSON("/help/clientgetAdLocationFive.do?adPostion=5&pageSize=8&pageMethod=next&currentPage="+(finalCurrentPage-1),function(date){
				fiveTwoAds = new Array();
				$("#fiveTwoAdPage").text("");
				
				var p = $(date).length;
				$(date).each(function(i){
					if((p-1)==i){
						fiveTwoPage = date[i];
						fiveTwoCurrentPage = fiveTwoPage.currentPage;
						finalCurrentPage=fiveTwoCurrentPage;
					}else{
						fiveTwoAds[i]=date[i];
					}
				});
				$("#fourTwo").css({backgroundImage:"url("+fiveTwoAds[0].adPicture+")"});/**********************************/
				for(var i=0;i<fiveTwoAds.length;i++){
					$("<div class='fiveOneDivs' onmouseout='fiveTwomouseout(this);' onmouseover='fiveTwogetThisAdByNumber(this);'>"+((fiveTwoCurrentPage-1)*fiveTwoPageSize+(i+1))+"</div>").appendTo($("#fiveTwoAdPage"));
				}
				$($("#fiveTwoAdPage div")[0]).css('background-color','#cccccc');
			});
		}
		
		
		
		function fiveTwoGetNewDateFirstPage(){
			$.getJSON("/help/clientgetAdLocationFive.do?adPostion=5&pageSize=8&pageMethod=first&currentPage="+finalCurrentPage,function(date){
				fiveTwoAds = new Array();
				
				$("#fiveTwoAdPage").text("");
				var p = $(date).length;
				$(date).each(function(i){
					if((p-1)==i){
						fiveTwoPage = date[i];
						fiveTwoCurrentPage = fiveTwoPage.currentPage;
						finalCurrentPage=fiveTwoCurrentPage;
					}else{
						fiveTwoAds[i]=date[i];
					}
				});
				$("#fourTwo").css({backgroundImage:"url("+fiveTwoAds[0].adPicture+")"});/******************************/
				for(var i=0;i<fiveTwoAds.length;i++){
					$("<div class='fiveOneDivs' onmouseout='fiveTwomouseout(this);' onmouseover='fiveTwogetThisAdByNumber(this);'>"+((fiveTwoCurrentPage-1)*fiveTwoPageSize+(i+1))+"</div>").appendTo($("#fiveTwoAdPage"));
				}
				$($("#fiveTwoAdPage div")[0]).css('background-color','#cccccc');
			});
		}
		
		
		function fiveTwogetThisAdByNumber(obj){
			clearInterval(towGoTime);
				var myNum = $(obj).text();
				
				if(myNum>=(fiveTwoPageSize+1)){
					myNum = myNum%fiveTwoPageSize;
				}
				$(obj).css('background-color','#ffff00');
				$("#fourTwo").css({backgroundImage:"url("+fiveTwoAds[myNum-1].adPicture+")"});/*********************************/
				$("#fiveTwoAllNumber").val(myNum-1);
		}
		
		function fiveTwomouseout(obj){
			$(obj).css('background-color','gray');
			clearInterval(towGoTime);
			towGoTime=setInterval("numberFiveTwoSwitchImgPath()",fiveTwoFlashTime);
		}
		
		function fiveTwoContentMouseout(){
			towGoTime=setInterval("numberFiveTwoSwitchImgPath()",fiveTwoFlashTime);
		}
		
		function fiveTwomouseover(){
			$("#fourTwo").css("cursor","pointer");
			clearInterval(towGoTime);
		}
		
		function fiveTwoClick(inputId){
			var number = $("#"+inputId).val();
			if(fiveTwoAds[number].isNotOpenWeb==1){
				window.open(fiveTwoAds[number].httpAddress);
			}else{
				var name = encodeURI(fiveTwoAds[number].companyName);
				var url = "/help/showShopInfo.do?method=toShop&company_name="+name;
				window.open(url);
			}
		}
		