
function funNextB()
{
	var f1=$("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldPageIndex").val()
	var newpage1=parseInt(f1)+4;
	var newpage2=parseInt(f1)+7;
	$.get("/Api/Main/Member/GetJson.ashx?type=GetShopProductBrowse&start="+newpage1+"&end="+newpage2+"",null,function(data){
		if(data!="[object XMLDocument]" && data!="")
		{
			$("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldPageIndex").val(parseInt(f1)+4)
			funBrowseProduct(parseInt($("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldPageIndex").val()),parseInt($("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldPageIndex").val())+3);            
		}
		else
		{
			alert("已经是最后一页了！");
		}
	})
	
	
}

function funShangB()
{
	var f1=$("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldPageIndex").val()
	if(f1>=5)
	{
		$("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldPageIndex").val(parseInt(f1)-4);
		funBrowseProduct(parseInt(f1)-4,parseInt(f1)-1);
		
	}
	else
	{
		alert("已经是首页了！");
	}
}

function funBrowseProduct(val1,val2)
{
	$.get("/Api/Main/Member/GetJson.ashx?type=GetShopProductBrowse&start="+val1+"&end="+val2+"",null,function(data){
				if(data!="")
				{
					if(data!="[object XMLDocument]" && data!="")
					{
						var vdata=eval('('+data+')'); 
						var Str="";
						$.each(vdata,function(m,n)
						{
							Str+="<dl><dt><a target=\"_blank\" href=\""+n.ahref+"\"><img src=\""+n.productimage+"\" width=\"130\" height=\"130\"  onerror=\"javascript:this.src='style/images/noImg.jpg'\"  /></a></dt><dd>"+n.name+"</dd><dd style=\"padding-top:10px;\"><strong style=\"font-size:16px;\" class=\"red\">￥"+n.shopprice+"</strong></dd></dl>";    
						});
						$("#yllsp").html(Str);
					}
					else
					{
						$("#shangImage1").hide();
						$("#xiaImage1").hide();$("#menucontent3").hide();
					}
			  }  
				else
				{
					$("#shangImage1").hide();
					$("#xiaImage1").hide();$("#menucontent3").hide();
				}
		});
}

//团购
function funGroupProduct(val1,val2)
{
	$.get("/Api/Main/Member/GetJson.ashx?type=GroupProduct&start1="+val1+"&end1="+val2+"",null,function(data){
				if(data!="")
				{
					
					if(data!="[object XMLDocument]" && data!="")
					{
						var vdata=eval('('+data+')'); 
						var Str="";
						$.each(vdata,function(m,n)
						{
							Str+="<dl><dt><a target=\"_blank\" href=\""+n.ahref+"\"><img src=\""+n.groupimg+"\" width=\"130\" height=\"130\"  onerror=\"javascript:this.src='style/images/noImg.jpg'\"  /></a></dt><dd>"+n.name+"</dd><dd style=\"padding-top:10px;\"><strong style=\"font-size:16px;\" class=\"red\">￥"+n.groupprice+"</strong></dd></dl>";    
						});
						$("#zxtg").html(Str);
					}
					else
					{
						$("#shangImage2").hide();
						$("#xiaImage2").hide();$("#menucontent1").hide();
					}
				}else{   $("#shangImage2").hide();
						$("#xiaImage2").hide();$("#menucontent1").hide();}
		});
}


function funNextC()
{
	var f1=$("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldTgPageIndex").val()
	var newpage3=parseInt(f1)+4;
	var newpage4=parseInt(f1)+7;
	$.get("/Api/Main/Member/GetJson.ashx?type=GroupProduct&start1="+newpage3+"&end1="+newpage4+"",null,function(data){
		if(data!="[object XMLDocument]" && data!="")
		{
			$("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldTgPageIndex").val(parseInt(f1)+4)
			funGroupProduct(parseInt($("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldTgPageIndex").val()),parseInt($("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldTgPageIndex").val())+3);        
		}
		else
		{
			alert("已经是最后一页了");
		}
	})
	
	
}

function funShangC()
{
	var f1=$("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldTgPageIndex").val()
	if(f1>=5)
	{
		$("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldTgPageIndex").val(parseInt(f1)-4);
		funGroupProduct(parseInt(f1)-4,parseInt(f1)-1);
		
	}
	else
	{
		alert("已经是首页了！");
	}
}


//----------------------------------------------------
//抢购
function funQgProduct(val1,val2)
{
	$.get("/Api/Main/Member/GetJson.ashx?type=GetShopQgProduct&start2="+val1+"&end2="+val2+"",null,function(data){
				if(data!="")
				{
					if(data!="[object XMLDocument]" && data!="")
					{
						var vdata=eval('('+data+')'); 
						var Str="";
						$.each(vdata,function(m,n)
						{
							Str+="<dl><dt><a target=\"_blank\" href=\""+n.ahref+"\"><img src=\""+n.originalimage+"\" width=\"130\" height=\"130\"  onerror=\"javascript:this.src='style/images/noImg.jpg'\"  /></a></dt><dd>"+n.name.substring(0,22)+"</dd><dd style=\"padding-top:10px;\"><strong style=\"font-size:16px;\" class=\"red\">￥"+n.shopprice+"</strong></dd></dl>";    
						});
						$("#zxqg").html(Str);
					}
					else
					{
						$("#shangImage3").hide();
						$("#xiaImage3").hide();$("#menucontent2").hide();
					}
				}
				else
				{
					$("#shangImage3").hide();
					$("#xiaImage3").hide();$("#menucontent2").hide();
				}
		});
}


function funNextD()
{
	var f1=$("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldQgPageIndex").val()
	var newpage5=parseInt(f1)+4;
	var newpage6=parseInt(f1)+7;
	$.get("/Api/Main/Member/GetJson.ashx?type=GetShopQgProduct&start2="+newpage5+"&end2="+newpage6+"",null,function(data){
		if(data!="[object XMLDocument]" && data!="")
		{
			$("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldQgPageIndex").val(parseInt(f1)+4)
			funQgProduct(parseInt($("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldQgPageIndex").val()),parseInt($("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldQgPageIndex").val())+3);
		}
		else{
			alert("已经是最后一页了！");
		}
	})
	
	
}

function funShangD()
{
	var f1=$("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldQgPageIndex").val()
	if(f1>=5)
	{
		$("#M_Welcome_ctl00_M_WelcomeProduct_ctl00_HiddenFieldQgPageIndex").val(parseInt(f1)-4);
		funQgProduct(parseInt(f1)-4,parseInt(f1)-1);
		
	}
	else
	{
		alert("已经是首页了！");
	}
}
