﻿
//获取位置广告
function LoadPositionAd(page, position, define, pnlId) {
    var rtnHtml = null;
    var mParam = 'action=getad&page=' + page + '&position=' + position + '&define=' + define;

    var opt = {
        method: 'post',
        parameters: mParam,
        onSuccess: function(t) {
            rtnHtml = t.responseText;
            document.getElementById(pnlId).innerHTML = rtnHtml;
        },
        on404: function(t) {
            alert('Error 404: location "' + t.statusText + '" was not found.');
        },

        onFailure: function(t) {

            alert('Error ' + t.status + ' -- ' + t.statusText);
        }
    }
    var strurl = '/Common/AjaxAction.aspx';
    new Ajax.Request(strurl, opt);
}

function AddFavorite(type, id) {
    var rtnHtml = null;
    var mParam = 'action=favor&type=' +type + '&id=' +id;

    var opt = {
        method: 'post',
        parameters: mParam,
        onSuccess: function(t) {
            rtnHtml = t.responseText;
            if (rtnHtml == "ok") {
                alert("已加入收藏。");
            }else if(rtnHtml == "no")
            {
                 alert("您已收藏过。");
            }else if(rtnHtml == "nologo")
            {
                 alert("对不起,您还没有登录。");
            }
            else {
                alert("操作失败。");
            }
        },
        on404: function(t) {
            alert('Error 404: location "' + t.statusText + '" was not found.');
        },

        onFailure: function(t) {

            alert('Error ' + t.status + ' -- ' + t.statusText);
        }
    }
    var strurl = '/Common/AjaxAction.aspx?'+mParam;
    new Ajax.Request(strurl, opt);
}  