Chú ý: Sau khi lưu thay đổi trang, bạn phải xóa bộ nhớ đệm của trình duyệt để nhìn thấy các thay đổi. Google Chrome, Firefox, Internet ExplorerSafari: Giữ phím ⇧ Shift và nhấn nút Reload/Tải lại trên thanh công cụ của trình duyệt. Để biết chi tiết và hướng dẫn cho các trình duyệt khác, xem Trợ giúp:Xóa bộ nhớ đệm.

/*
 <nowiki>
*/
//************************* wikiEd editor ****************************************
//install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
        + 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
        + '&action=raw&ctype=text/javascript"></' + 'script>');

//install the Vietnamese translation for [[:en:User:Cacycle/wikEd]]
importScript('User:Vinhtantran/wikEd_international_vi.js');
//***********************************************************************************



//******************** [[:en:User:Voice of All]] skin *******************************
//First loads
importScript('User:Vinhtantran/Addtabs/monobook.js');
importScript('User:Vinhtantran/UTCclock.js');
importScript('User:Vinhtantran/replacetxt.js');

//mass tools
importScript('User:Vinhtantran/Adminwarnings/monobook.js');
importScript('User:Vinhtantran/Protection/monobook.js');
importScript('User:Vinhtantran/Specialadmin/monobook.js');
importScript('User:Vinhtantran/History/monobook.js')

//crat stuff
//importScript('User:Vinhtantran/Bureaucrat/monobook.js');

//CU stuff
//importScript('User:Vinhtantran/CheckUser/monobook.js');

//BAG stuff
importScript('User:Vinhtantran/Approvals.js');

//rollback
importScript('User:Vinhtantran/Revert.js');

//New pages tools
importScript('User:Vinhtantran/Sleeper/monobook.js');
importScript('User:Vinhtantran/Deletion/monobook.js');
importScript('User:Vinhtantran/Google/monobook.js');


//Toolbox links
function changelinks()
{
    if(!document.getElementById) return;
    var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
    var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;
    if (document.title.indexOf('Thành viên:' + user_name + '/xml') != -1 || document.title.indexOf('Thành viên:' + user_name + '/XML') != -1)
    {addlilink(toplinks, 'javascript:XMLrequestprompt()', 'Request XML', 'Request XML');}
    if(document.getElementById('ca-delete'))
    {document.getElementById('ca-delete').firstChild.innerHTML = '<strong><span style="color:darkred;">delete</span></strong>';} 
}

function navigationlinks()
{
    addnavbox_link('/wiki/Wikipedia:Tin nhắn cho bảo quản viên','Tin nhắn BQV','AN-ln');
    addnavbox_link('/wiki/Wikipedia:Yêu cầu khóa hay mở khóa trang','Yêu cầu khóa','rfpp-ln');
    addnavbox_link('/wiki/Thể loại:Hình thiếu thông tin về bản quyền','Hình thiếu BQ','aiv-ln');
    addnavbox_link('/wiki/Thể loại:Chờ xoá','Chờ xóa','speedy-ln');    
}


function addtoolboxlinks()
{
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlilink(tb, '/wiki/Đặc biệt:Newpages', 'Các trang mới nhất', '');
    addlilink(tb, '/wiki/Đặc biệt:Log/newusers', 'Các thành viên mới nhất', '');
    addlilink(tb, '/wiki/Đặc biệt:Protectedpages', 'Các trang bị khóa', '');
}


$(Mainfast)
function Mainfast() 
{
userlogs();
changelinks();
navigationlinks();
addtoolboxlinks();
}


window.onload = Main;
function Main() 
{
    watchlist_tab();
    block_check();
    lastdiff();
    addtoplink();
}
//END
//************

//USER TABS
function userlogs()
{
//    no subpages or history
    if (document.title.search("/") != -1 || location.href.search(/%C4%90%E1%BA%B7c_bi%E1%BB%87t:|&action=[^p]|&diff=/) !=-1)
    {return;}
    if (document.title.indexOf("Thành viên:") == 0 || document.title.indexOf("Thảo luận Thành viên:") == 0) 
    {
        username_a = document.URL.match(/:.*:(.*)/);
        username=username_a[1];
        addTab("http://vi.wikipedia.org/w/index.php?title=%C4%90%E1%BA%B7c_bi%E1%BB%87t%3ALog&type=block&user=&page=Th%C3%A0nh_vi%C3%AAn:" + username, "log", "ca-blog", "Nhật trình khóa", "");
        addTab("http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=" + username + "&site=vi.wikipedia.org", "info", "ca-kate", "Thông tin thành viên", "");
    }
}

//LAST DIFF TAB
function lastdiff() 
{
    if (document.title.indexOf("Sửa đổi ") != -1 || !document.getElementById('ca-history') || location.href.search(/&action=history/) !=-1) return;
    var pname=wgPageName.replace(/&/g,'%26').replace(/\\+/g, '%2B');
    addTab(wgServer + "/w/index.php?title=" + pname + "&diff=cur&oldid=prev", "cuối", "ca-diff", "Thay đổi gần nhất", "");
}

//This will add an [edit top] link at the top of all pages except preview pages
function addtoplink()
{
    var edittop = '<span style="color:black;">[</span>sửa đầu<span style="color:black;">]</span>';
    // if this is preview page or generated page, stop
    if(document.getElementById("wikiPreview") || wgNamespaceNumber ==-1)
        return;
    if(document.title.indexOf("Trang Chính") != -1) return;

    // get the page title
    var pageTitle = document.title.split(" – ")[0].replace(" ", "_"); 

    // create div and set innerHTML to link
    var divContainer = document.createElement("div");
    divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:130px;margin-top:3px;"><a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" – ")[0]+'">' + edittop + '</a></div>';

    // insert divContainer into the DOM before the h1
    if (document.getElementById("content") !=undefined) {
        document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);}
}


function watchlist_tab()
{
    if (location.href.indexOf('Đặc biệt:Watchlist/edit') !=-1)
    {addTab("javascript:watchlist_clean()", "xem trang đã xóa", "ca-clean", "kiểm tra tất cả trang đã xóa", "");}
}

function watchlist_clean()
{
//    monobook
    if (document.getElementById('bodyContent'))
    {
        var body = document.getElementById('bodyContent');
    }
//    cologneblue
    else if (document.getElementById('quickbar'))
    {
        if (!document.getElementById('content')){return;}
        var body = document.getElementById('content');
    }
    var l = body.getElementsByTagName('li');
    for (var i=0; i<l.length; i++)
    {
        if (l[i].getElementsByTagName('a')[0].href.indexOf('&action=') !=-1)
        {l[i].getElementsByTagName('input')[0].checked=true;}
    }
}

function block_check()
{
    if (document.title.indexOf('Cấm thành viên') !=0){return;}
    //monobook
    if (document.getElementById('pt-userpage'))
    {var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;}
    //cologneblue
    else if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0])
    {
        var toplinks = document.getElementById('quickbar');
        var user_name = toplinks.innerHTML.split('<h6>Trang của tôi</h6>')[1].split('title="Thành viên:')[1].split('"')[0];
    }
    if (document.getElementsByTagName('input')[0].value == user_name)
    {alert('Bạn có chắc là bạn muốn cấm chính mình?');}
    else if (document.getElementsByTagName('input')[0].value == user_name.replace(/ /g,'_'))
    {alert('Bạn có chắc là bạn muốn cấm chính mình?');}
}



$(Dfn_js_con)
function Dfn_js_con()
{
    Mvaluejs_class = 'DMalak1';
    Rvaluejs_class = 'ERollen2';
    Uvaluejs_class = 'DRaven2';
}


//*******************Interiot's javascript edit counter******************************************************
if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
    document.write('<script type="text/javascript" src="' 
            + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' 
            + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); }
//****************************************************************************************************


function XMLrequestprompt()
{
    var parameters = '';
    var type = 'GET';
    var url = location.href;
    url = prompt('Gõ vào URL:');
    parse_js_value_cache = 0;
    parse_js_value_cache = prompt('Trích rút dữ liệu?' + '\n' + '0 - không (mặc định)' + '\n' + '1 - có (không script/SRC/hình)' + '\n' + '2 - có (không script/SRC)' + '\n' + '3 - có (cho phép script/hình)');
    if (parse_js_value_cache != 0 && parse_js_value_cache != 1 && parse_js_value_cache != 2 && parse_js_value_cache != 3){return;}
    if (!url || url == ''){return;}
    makeRequestXML(url, parameters,type);
}

function alertContents()
{
    if (http_request.readyState != 4)
        return;
    body = document.getElementById('bodyContent');
    if (body && parse_js_value_cache == 3)
    {
        document.getElementsByTagName('title')[0].innerHTML = "Yêu cầu XML:"; 
        body.innerHTML = '<strong>Mã XML trả về:</strong><br>' + http_request.responseText;
    }
    else if (body && parse_js_value_cache == 2)
    {
        document.getElementsByTagName('title')[0].innerHTML = "Yêu cầu XML:"; 
        var xml = http_request.responseText.replace(/<.script>/gi,'`</script>');
        body.innerHTML = '<strong>Mã XML trả về:</strong><br>' + xml.replace(/<script [^`]+`<.script>/gi,'').replace(/(<\w* onload=["'][^<]+["']>)/gi,'').replace(/(\src=["'][^<]+["']>)/gi,' src="">');
    }
    else if (body && parse_js_value_cache == 1)
    {
        document.getElementsByTagName('title')[0].innerHTML = "Yêu cầu XML:"; 
        var xml = http_request.responseText.replace(/<.script>/gi,'`</script>');
        body.innerHTML = '<strong>Mã XML trả về:</strong><br>' + xml.replace(/<script [^`]+`<.script>/gi,'').replace(/(<\w* onload=["'][^<]+["']>)/gi,'').replace(/(<img [^<]+>)/gi,'').replace(/(\src=["'][^<]+["']>)/gi,' src="">');
    }
    else if (body && parse_js_value_cache == 0)
    {
        document.getElementsByTagName('title')[0].innerHTML = "Yêu cầu XML:";
        var xml = http_request.responseText.replace(/<.script>/gi,'`</script>');
        xml = xml.replace(/(<a href=["'][^<]+<.a>)/gi,'%parenST|span style="background-color: yellow"|%parenEN$1%parenST|/span|%parenEN').replace(/(<img [^<]+>)/gi,'%parenST|span style="background-color: lightgreen"|%parenEN$1%parenST|/span|%parenEN').replace(/(<iframe [^<]+<.iframe>)/gi,'%parenST|span style="background-color: lightgreen"|%parenEN$1%parenST|/span|%parenEN').replace(/(<script [^`]+)`<.script>/gi,'%parenST|span style="background-color: #FF9900"|%parenEN$1</script>%parenST|/span|%parenEN').replace(/(<\w* onload=["'][^<]+["']>)/gi,'%parenST|span style="background-color: #FF9900"|%parenEN$1%parenST|/span|%parenEN').replace(/\s(src=["'][^<]+["'])>/gi,'%parenST|span style="background-color: #FF3300"|%parenEN $1>%parenST|/span|%parenEN');
        body.innerHTML = '<strong>Mã XML trả về:</strong><br>' + xml.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/%parenST\|/g,'<').replace(/\|%parenEN/g,'>');
    }
}

//security override HTTP request
//ALSO, reduce IE security settings
//For FF/NS, go enable, see "http://esw.w3.org/topic/SparqlCalendarDemoUsage#FAQ"
//Basically, enable "signed.applets.codebase_principal_support" in about:config 
function makeRequestXML(url, parameters,type,parse) 
{ 
    if(window.XMLHttpRequest)
    {
        try {netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } 
        catch (e) {alert("Xin phép UniversalBrowserRead bị từ chối."); } 
        http_request = false;
        http_request = new XMLHttpRequest(); 
        if (http_request.overrideMimeType) 
        {http_request.overrideMimeType('text/xml'); }
        if (!http_request) 
        {alert('Không thể tạo thực thể XMLHTTP'); return false; } 
        http_request.onreadystatechange = alertContents;
        http_request.open(type, url + parameters, true); 
        http_request.send(null); 
    }
    else if (window.ActiveXObject)
    {
        try
        {http_request = new ActiveXObject("Msxml2.XMLHTTP");} 
        catch (e)
        {
            try
            {http_request = new ActiveXObject("Microsoft.XMLHTTP");} 
            catch (e){}
        }
        if (!http_request) {showError(ERROR_XML);}
        http_request.onreadystatechange = alertContents;
        http_request.open(type, url + parameters, true); 
        http_request.send(null); 
    }
}



//addPurge
$(function () {
    var hist; var url;
    if (!(hist = document.getElementById('ca-history') )) return;
    if (!(url = hist.getElementsByTagName('a')[0] )) return;
    if (!(url = url.href )) return;
    mw.util.addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
            'purge', 'ca-purge', 'Tẩy bộ nhớ đệm', '0');
});

//******************************[[User:Lupin/popupsdev.js]] - please include this line 
document.write('<script type="text/javascript" src="' 
        + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popupsdev.js' 
        + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

popupShortcutKeys=true; // optional: enable keyboard shortcuts
popupAdminLinks=true;   // optional: enable admin links [[Category:VoA scripted admins]]
popupSubpopups=false;
popupOnEditSelection=false;
popupStructure='shortmenus';
popupFixRedirs=true;
popupRedlinkRemoval=true;
popupFixDabs=true;
popupAllDabsStubs=true;
imagePopupsForImages=false;


//Tiếng Việt
importScript('User:Vinhtantran/strings-vi.js');

//********************************************************************
// Live Preview 
wpShowImages = true;
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js&action=raw&ctype=text/javascript');
window.onload = Main;
function Main()
{
 LivePreviewInstall();
}

// Vietnamese Input Method
//document.write('<script type="text/javascript" src="http://rhos.sourceforge.net/pro/him.js"></script>');
//document.write('<script type="text/javascript" //src="http://vi.wikipedia.org/w/index.php?title=User:Tttrung/ahim.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//function Main()
//{
 method = 1;
 on_off = 1;
 dockspell = 0;
 dauCu = 0;
// HIM();
//}
//window.onload = Main;

var mpTitle = "Wikipedia:WikiProject Usability/Main Page/Draft";
var isMainPage = (document.title.substr(0, mpTitle.length) == mpTitle)

if (isMainPage) 
{
document.write('<style type="text/css"> #siteSub, #contentSub { display: none!important; } #content, #content div.thumb, #p-cactions li a, #p-cactions li a:hover, #p-cactions li.selected a { background: #fff!important; } </style>');

var mpSmallEnabled;
var mpMinWidth = 700;

function mainPageTransform()
{
        var mpContentEl = document.getElementById("bodyContent");
        var mpBrowseEl = document.getElementById("EnWpMpBrowse");
        var mpContainEl = document.getElementById("EnWpMpBrowseContainer");
        var mpMarginEl = document.getElementById("EnWpMpMargin");
        var mpEl = document.getElementById("EnWpMainPage");

        if (!mpContentEl || !mpBrowseEl || !mpContainEl || !mpMarginEl || !mpEl)
                return;

        if (!mpSmallEnabled && mpContentEl.offsetWidth < mpMinWidth)
        {
                mpContainEl.insertBefore(mpBrowseEl, mpContainEl.firstChild);
                mpBrowseEl.className = "EnWpMpBrowseBottom";
                mpMarginEl.style.marginRight = 0;
                mpSmallEnabled = true;
        }
        else if (mpSmallEnabled && mpContentEl.offsetWidth > mpMinWidth)
        {
                mpEl.insertBefore(mpBrowseEl, mpEl.firstChild);
                mpBrowseEl.className = "EnWpMpBrowseRight";
                mpMarginEl.style.marginRight = "13.8em";
                mpSmallEnabled = false;
        }
}

var onloadFuncts = [ mainPageTransform ];

if (window.addEventListener) 
  window.addEventListener("resize", mainPageTransform, false);
else if (window.attachEvent) 
  window.attachEvent("onresize", mainPageTransform);

}

/* Bottom tabs */
/* function morelinks() {
	var tabs = document.getElementById('p-cactions').cloneNode(true);
	tabs.id = 'mytabs';
	var listitems = tabs.getElementsByTagName('LI');
	for (i=0;i<listitems.length;i++) {
		if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
	}
	document.getElementById('column-content').appendChild(tabs);
}
addLoadEvent(morelinks); */

/* [[:en:Wikipedia:WikiProject User scripts/Scripts/Fix diff width|Fix diff width]] */
function FixDiffWidth() {
    var diffSigns = new Array();
    var fixDiffWidth = function () {
        var tables = document.getElementsByTagName('table');

        for (var i = 0; i < tables.length; i++) if (tables[i].className == 'diff') {
            var rows = tables[i].getElementsByTagName('tr');

            var diffDiv = document.createElement('div');
            diffDiv.style.backgroundColor = 'white';
            diffDiv.className = 'xdiff';

            for (var j = 0; j < rows.length; j++) {
                var rowDiv = document.createElement('div');
                rowDiv.style.width = '100%';
                rowDiv.style.margin = '0 0 3px 0';
                rowDiv.style.overflow = 'hidden';  // trick, makes it expand vertically to contain floats
                rowDiv.className = 'xdiff-row';

                var colDiv = null;
                var cols = rows[j].getElementsByTagName('td');
                for (var k = 0; k < cols.length; k++) { 
                    if (!colDiv) {
                        colDiv = document.createElement('div');
                        colDiv.style.cssFloat = 'left';
                        colDiv.style.clear = 'none';
                        colDiv.style.position = 'relative';
                        colDiv.style.width = '49%';
                        colDiv.className = 'xdiff-col';
                        rowDiv.appendChild(colDiv);
                    }
                    var innerDiv = document.createElement('div');

                    if (cols[k].getAttribute('colspan') == 2 || cols[k].className.substring(0,5) == 'diff-') {                
                        innerDiv.style.overflow = 'auto';  // scroll if necessary!
                        innerDiv.style.padding = '1px';
                        if (cols[k].getAttribute('colspan') != 2) {
                            innerDiv.style.margin = '0 0 0 2em';
                            innerDiv.style.fontSize = '85%';  // from MediaWiki:Monobook.css
                            if (cols[k].className == 'diff-addedline')   innerDiv.style.backgroundColor = '#cfc';
                            if (cols[k].className == 'diff-deletedline') innerDiv.style.backgroundColor = '#ffa';
                            if (cols[k].className == 'diff-context')     innerDiv.style.backgroundColor = '#eee';
                        }
                        innerDiv.style.textAlign = cols[k].getAttribute('align');
                        innerDiv.className = (cols[k].className ? "x"+cols[k].className : "");
                    }
                    else if (cols[k].firstChild && (cols[k].firstChild.nextSibling ||
                             cols[k].firstChild.nodeType != 3 || cols[k].firstChild.nodeValue.match(/\S/))) {
                        innerDiv.style.width = '2em';
                        innerDiv.style.textAlign = 'center';
                        innerDiv.style.position = 'absolute';
                        innerDiv.className = 'xdiff-sign';
                        diffSigns.push(innerDiv);
                    }
                    else continue; 

                    for (var node = cols[k].firstChild; node; node = node.nextSibling)
                        innerDiv.appendChild(node.cloneNode(true));
                    innerDiv.appendChild(document.createTextNode(String.fromCharCode(0xa0))); // add nbsp
                    colDiv.appendChild(innerDiv);

                    if (innerDiv.className != 'xdiff-sign')
                        colDiv = null;  // start new columns
                }
                // force rowDiv to expand, just in case position trick fails
                var clearer = document.createElement('span');
                clearer.clear = 'left';
                rowDiv.appendChild(clearer);
                diffDiv.appendChild(rowDiv);
            }
            tables[i].parentNode.replaceChild(diffDiv, tables[i]);
        }
    };
    // finally, a kluge to vertically center the +/- signs
    var centerDiffSigns = function () {
        for (var i = 0; i < diffSigns.length; i++) {
            var parentHeight;
            if (!( parentHeight = diffSigns[i].parentNode )) continue; 
            if (!( parentHeight = parentHeight.clientHeight )) continue; 
            diffSigns[i].style.top = Math.round((parentHeight - diffSigns[i].offsetHeight)/2) + "px";
        }
    };
    fixDiffWidth();
    hookEvent('resize', centerDiffSigns);
    setTimeout(centerDiffSigns, 250); 
}
if (window.addEventListener) addLoadEvent(FixDiffWidth);

/* [[:en:Wikipedia:WikiProject User scripts/Scripts/addLink|addLink]] */
function addLink(where, url, name, id, title, key, after) {
    //* where is the id of the toolbar where the button should be added;
    //   i.e. one of "p-cactions", "p-personal", or "p-navigation".
    //* url is the URL which will be called when the button is clicked.
    //   javascript: urls can be used to do more complex things.
    //* name is what will appear as the name of the button.
    //* id is the id of the button; it's best to define one.  
    //   Use a prefix to make sure its unique. Optional.
    //* title is the tooltip title that gives a longer description 
    //   of the button; if you define a accesskey, mention it here. Optional.
    //* key is the char you want for the accesskey. Optional.
    //* after is the id of the button you want to follow this one. Optional.
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
    if(after) {
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        tabs.appendChild(li);
    }
    if(id) {
        if(key && title) { ta[id] = [key, title]; }
        else if(key) { ta[id] = [key, '']; }
        else if(title) { ta[id] = ['', title];} 
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

/* [[:en:Wikipedia:WikiProject User scripts/Scripts/Add purge to tabs|addPurge]] */
function AddPurge () {
    var x = document.getElementById('ca-history');
    if(!x) return;
    if(x.children) x = x.children[0].href;
    else x = x.childNodes[0].href;
    addLink("p-cactions", x.replace(/=history/, "=purge"), 'Làm sạch', 'ca-purge', 'Làm sạch vùng nhớ đệm của trang này', 0);
}
addLoadEvent(AddPurge);

/* Chia ra [[Thành viên:Mxn/Trang Chính 3]] thành tab */
/* Dựa trên mã nguồn của [http://vi.wikipedia.org/skins-1.5/common/wikibits.js] */

// fold sections for Trang Chính
// XXX: needs testing on IE/Mac and safari
// more comments to follow
function tabbedsects() {
	var container = document.getElementById('page-sects');
	if (!container || !document.createElement) return;
	if (container.nodeName.toLowerCase() == 'a') return; // Occasional IE problem
	container.className = container.className + 'jsprefs';
	var sections = new Array();
	children = container.childNodes;
	var seci = 0;
	for (i = 0; i < children.length; i++) {
		if (children[i].nodeName.toLowerCase() == 'div') {
			children[i].id = 'prefsection-' + seci;
			children[i].className = 'prefsection';
			if (is_opera || is_khtml)
				children[i].className = 'prefsection operaprefsection';
			legends = children[i].getElementsByTagName('h2');
			sections[seci] = new Object();
			legends[0].className = 'mainLegend';
			if (legends[0] && legends[0].firstChild.nodeValue)
				sections[seci].text = legends[0].firstChild.nodeValue;
			else
				sections[seci].text = '# ' + seci;
			sections[seci].secid = children[i].id;
			seci++;
			if (sections.length != 1) children[i].style.display = 'none';
			else var selectedid = children[i].id;
		}
	}
	var toc = document.createElement('ul');
	toc.id = 'preftoc';
	toc.selectedid = selectedid;
	for (i = 0; i < sections.length; i++) {
		var li = document.createElement('li');
		if (i == 0) li.className = 'selected';
		var a = document.createElement('a');
		a.href = '#' + sections[i].secid;
		a.onmousedown = a.onclick = uncoversection;
		a.appendChild(document.createTextNode(sections[i].text));
		a.secid = sections[i].secid;
		li.appendChild(a);
		toc.appendChild(li);
	}
	container.parentNode.insertBefore(toc, container.parentNode.childNodes[0]);
//	document.getElementById('prefsubmit').id = 'prefcontrol';
}

function uncoversection() {
	oldsecid = this.parentNode.parentNode.selectedid;
	newsec = document.getElementById(this.secid);
	if (oldsecid != this.secid) {
		ul = document.getElementById('preftoc');
		document.getElementById(oldsecid).style.display = 'none';
		newsec.style.display = 'block';
		ul.selectedid = this.secid;
		lis = ul.getElementsByTagName('li');
		for (i = 0; i< lis.length; i++) lis[i].className = '';
		this.parentNode.className = 'selected';
	}
	return false;
}

addLoadEvent(tabbedsects);

/*
</nowiki>
*/