﻿// JScript 文件
function AjaxPost() { 
    $.ajax({
        type: "post",
        url: "../../UserLogin.aspx",
        data: "UserName=" + $("#UserName").val() + "&UserPwd=" + $("#UserPwd").val(),
        success: function(msg) {
            $("#sp").html(msg);
        },
        error: function() {
            alert('操作错误！');
        }
    });
}
var i=0;
function AjaxGet() { 
    i++;
    $.ajax({
        type: "get",
        url: "GetNewProduct.aspx?pager="+i,
        success: function(msg) {
            $("#imglist").html(msg);
        },
        error: function() {
            alert('操作错误！');
        }
    });
}

//上一页
function AjaxGetUp() { 
    i--;
    if(i<=0)
    {
      i=1;
    }
    $.ajax({
        type: "get",
        url: "GetNewProduct.aspx?pager="+i,
        success: function(msg) {
            $("#imglist").html(msg);
        },
        error: function() {
            alert('操作错误！');
        }
    });   
}

//下一页
function AjaxGetDown() { 
    i++;    
    $.ajax({
        type: "get",
        url: "GetNewProduct.aspx?pager="+i,
        success: function(msg) {
            if(msg=="")
            {
              i-=2;//返回到上次
              //再次调用
              AjaxGetDown();
            }
            $("#imglist").html(msg);
        },
        error: function() {
            alert('操作错误！');
        }
    });    
}

//加入收藏夹: 
function shouCang()
{        
    window.external.AddFavorite(window.document.location.href,window.document.title);        
}

//设为首页:   
function myhomepage(th) 
{
        th.style.behavior='url(#default#homepage)';
        th.setHomePage(window.document.location.href);
}
