﻿/// <reference path="jquery.js" />
var www = {
    SetHomePage: function(obj) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                prefs.setCharPref('browser.startup.homepage', location.href.toString());
            }
            catch (e) { alert("此操作被Firefox拒绝！\r\n请在浏览器地址栏输入“about:config”并回车\r\n然后将[signed.applets.codebase_principal_support]设置为'true'"); }
        }
        else { obj.style.behavior = 'url(#default#homepage)'; obj.setHomePage(location.href.toString()); }
    },
    AddFav: function() {
        var title = document.title.toString();
        var url = window.location.href.toString();
        if (document.all)
            window.external.AddFavorite(url, title);
        else if (window.sidebar)
            window.sidebar.addPanel(title, url, "")
    }
}

var anni = 1;

function getann(_1) {
    if (anni <= 0) {
        anni = 1;
    }
    var current = anni + _1;
    anni = current;
    $.ajax(
    {
        type: 'GET',
        url: 'tools/ajax.aspx',
        data: { act: 'ann', pageindex: current },
        dataType: 'html',
        success: function(data) {
            $('.ann .detail').html(data);
        },
        error: function() { alert('请求的资源不可用，请重试！'); }
    });
}

function switchobj(eventobj, i) {
    $('.switch1 a').removeClass('current');
    $('#s11').hide();
    $('#s12').hide();
    $('#s13').hide();
    $('#s14').hide();
    eventobj.className = 'current';
    $('#s1' + i).show();
}

function switchobj2(eventobj, i) {
    $('.switch2 a').removeClass('current');
    $('#s21').hide();
    $('#s22').hide();
    eventobj.className = 'current';
    $('#s2' + i).show();
}

function mylist(onoff, id) {
    $.ajax(
    {
        type: 'GET',
        url: 'tools/ajax.aspx',
        data: { act: 'mylist', on: onoff, id: id },
        dataType: 'html',
        success: function(data) {
            $('#container_mylist').html(data);
        },
        error: function() { alert('请求的资源不可用，请重试！'); }
    });
}

function removeall() {
    $.ajax(
    {
        type: 'GET',
        url: 'tools/ajax.aspx',
        data: { act: 'removeall' },
        dataType: 'html',
        success: function(data) {
            $('#container_mylist').html(data);
        },
        error: function() { alert('请求的资源不可用，请重试！'); }
    });
}

function docheck(id, truefalse) {
    id = 'box' + id;
    if (document.getElementById(id)) {
        document.getElementById(id).checked = truefalse;
    }
}

function selectcountry(obj, act, _1) {
    $.ajax(
    {
        type: 'GET',
        url: 'tools/area.ashx',
        data: { act: act, par: obj.value, updateid: _1 },
        dataType: 'html',
        success: function(data) {
            $('#ajaxjs').html(data);
        },
        error: function() { alert('请求的资源不可用，请重试！'); }
    });
}

function initcountry(objid, c, p, city) {
    $.ajax(
    {
        type: 'GET',
        url: 'tools/area.ashx',
        data: { act: 'init', c: c, p: p, city: city, id: objid },
        dataType: 'html',
        success: function(data) {
            $('#ajaxjs').html(data);
        },
        error: function() { alert('请求的资源不可用，请重试！'); }
    });
}