User:Doc glasgow/monobook.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.

//<nowiki>
function addlilink(tabs, url, name){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}

//////////////////////////////////////////
// Tabs by Korath
// returns <li><a href="url">name</a></li>
/////////////////////////////////////////
function addlilink(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);

  var txt = document.createTextNode(name);
  na.appendChild(txt);

  var li = document.createElement('li');
  li.appendChild(na);
  return li;
}

// appends msg to the currently-editted page, sets the summary to summ,
// and marks or unmarks the Watch this page checkbox according to watch.
function edit_summary_watch(msg, summ, watch, line)
{
  var f = document.editform, t = f.wpTextbox1;
  if ((t.value.length > 0) && (line == 1))
    t.value += '\n';
  t.value += msg;
  f.wpSummary.value += summ;
  f.wpWatchthis.checked = watch;
}

function delete_reason(process){
    if(process==1)
    {
        document.forms.deleteconfirm.wpReason.value = '[[Wikipedia:Articles for deletion/' + unescape(window.location.href.replace(/^.*\?title=([^&]+)&action=delete.*$/, '$1').replace(/_/g, ' ')).replace(/^(Talk|Wikipedia( talk)?):/, '') + ']]';
    }
    else if(process==2)
    {
        document.forms.deleteconfirm.wpReason.value = '[[Wikipedia:Proposed deletion' + '|PROD]]: \"\"';
    }
}

// adds various tabs to call the above
function add_tabs()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

  // Only add for pages with "Editing User talk:" somewhere in the title
  if (document.title.indexOf("Editing User talk:") != -1)
    {
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:welcome}} ~" + "~" + "~" + "~", "{{" + "welcome}}", false, 1)',"Welc"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:test1}} ~" + "~" + "~" + "~\n", "{{" + "test1}}", true, 0)',"T1"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:test2}} ~" + "~" + "~" + "~\n", "{{" + "test2}}", true, 0)',"T2"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:test2a}} ~" + "~" + "~" + "~\n", "{{" + "test2a}}", true, 0)',"T2a"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:test2b}} ~" + "~" + "~" + "~\n", "{{" + "test2b}}", true, 0)',"T2b"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:test3}} ~" + "~" + "~" + "~\n", "{{" + "test3}}", true, 0)',"T3"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:test4}} ~" + "~" + "~" + "~\n", "{{" + "test4}}", true, 0)',"T4"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:test5}} ~" + "~" + "~" + "~\n", "{{" + "test5}}", true, 1)',"T5"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:spam1}} ~" + "~" + "~" + "~\n", "{{" + "spam1}}", true, 0)',"S1"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:spam2}} ~" + "~" + "~" + "~\n", "{{" + "spam2}}", true, 0)',"S2"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:rvfd}} ~" + "~" + "~" + "~\n", "{{" + "rvfd}}", true, 0)',"RVFD"));
      tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:blanking}} ~" + "~" + "~" + "~\n", "{{" + "blanking}}", true, 0)',"Blank"));

    }
    if(document.title.indexOf("Confirm delete") != -1)
    {
        tabs.appendChild(addlilink('javascript:delete_reason(1)', 'AfD', ''));
        tabs.appendChild(addlilink('javascript:delete_reason(2)', 'PROD', ''));
    }
}

if (window.addEventListener)
  window.addEventListener("load", add_tabs, false);
else if (window.attachEvent)
  window.attachEvent("onload", add_tabs);

function hidevfd(){
    var divs = document.getElementsByTagName("div");
    for(var x = 0; x < divs.length; ++x)
        if(divs[x].className.indexOf("vfd") != -1)
            divs[x].style.display = "none";
    document.getElementById('footer').style.display = 'none';
}

function showvfd(){
    var divs = document.getElementsByTagName("div");
    for(var x = 0; x < divs.length; ++x)
        if(divs[x].className.indexOf("vfd") != -1)
            divs[x].style.display = "";
    document.getElementById('footer').style.display = '';
}

function vfdlinks(){
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    if(document.title.indexOf("Wikipedia:Articles for deletion") == 0){
        add_link2('javascript:hidevfd()', 'hide');
        add_link2('javascript:showvfd()', 'show');
    }
}

if (window.addEventListener) window.addEventListener("load",vfdlinks,false);
else if (window.attachEvent) window.attachEvent("onload",vfdlinks);

///////////////////////////////////////////////////////////////////
// AutoVFD by Korath
// This needs to change depending on skin used.
//////////////////////////////////////////////////////////////////
function add_link2(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);
  na.appendChild(document.createTextNode(name));

  var li = document.createElement('li');
  li.appendChild(na);

  var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
  tabs.appendChild(li);
}

function strip_namespace(target)
{
  var colon = target.indexOf(':');
  if (colon != -1)
    {
      var spaces = new Array('User', 'Wikipedia', 'Image', 'MediaWiki', 'Template', 'Help', 'Category');
      var ns = target.substring(0, colon);
      if (ns == '' || ns == 'Talk')
        return target.substring(colon + 1);
      else
        for (var i = 0; i < spaces.length; ++i)
          {
            if (ns == spaces[i]
                || ns == spaces[i] + '_talk')
              return target.substring(colon + 1);
          }
    }

  return target;
}
function copyvio()
{
  document.editform.wpTextbox1.value = '{' + '{' + 'copyvio|url=}}';
  document.editform.wpSummary.value = 'copyvio';

  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6,
                            target.lastIndexOf('&action=submit'));

  var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
  var date = new Date();
  date = months[date.getUTCMonth()] + '_' + date.getUTCDate();

  var pagename = strip_namespace(target);

  window.open('/w/index.php?title=Wikipedia:Copyright_problems&action=edit&fakeaction=copyviolist&faketarget=' + pagename,
              'status,toolbar,location,menubar,directories,resizeable,scrollbars');
}

function autocopyvio()
{
  if (document.title.indexOf('Editing ') == 0)
    {
      var action = '';
      var target = '';
      if (location.search)
        {
          var l = location.search.substring(1).split('&');
          for (var i = 0; i < l.length; ++i)
            {
              var eq = l[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
                
            }
        }

      if (action == 'copyviolist')
        {
          var index = document.editform.wpTextbox1.value.lastIndexOf("\n==Footer==");
          if (index == -1) 
          {
            window.alert("Couldn't find footer\n\n");
          }
          else
          {
            var firsthalf = document.editform.wpTextbox1.value.substr(0,index);
            var secondhalf = document.editform.wpTextbox1.value.substr(index);
            document.editform.wpTextbox1.value = firsthalf + '*' + '[[' + target + ']]' + ' from [' + '] ~' + '~~' + '~\n' + secondhalf;
//            document.editform.wpTextbox1.SelectionStart = document.editform.wpTextbox1.Text.Length;
//            document.editform.wpTextbox1.SelectionLength = 0;
//            document.editform.wpTextbox1.ScrollToCaret();
            document.editform.wpSummary.value = 'Copyvio ' + '[[' + target + ']]';
          }
        }
      //else
      //  add_link2('javascript:copyvio()', 'copyvio');
    }
}

if (window.addEventListener)
  window.addEventListener('load', autocopyvio, false);
else if (window.attachEvent)
  window.attachEvent('onload', autocopyvio);

function addpersondata()
{
  edit_summary_watch("\n{"+"{Persondata\n|NAME=\n|ALTERNATIVE NAMES=\n|SHORT DESCRIPTION=\n|DATE OF BIRTH=\n|PLACE OF BIRTH=\n|DATE OF DEATH=\n|PLACE OF DEATH=\n}"+"}", "+\[\[Wikipedia:Persondata\]\]", false, 0);
}
function vfd()
{
  document.editform.wpTextbox1.value = '{' + '{' + 'subst:afd}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'AfD';
  document.editform.wpWatchthis.checked = true;

  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6,
                            target.lastIndexOf('&action=submit'));

  var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
  var date = new Date();
  date = date.getUTCFullYear() + '_' + months[date.getUTCMonth()] + '_' + date.getUTCDate();

  var pagename = strip_namespace(target);

  window.open('/w/index.php?title=Wikipedia:Articles_for_deletion/' + pagename + '&action=edit&fakeaction=vfdsub&faketarget=' + target,
              'Vfd ' + unescape(target),
              'status,toolbar,location,menubar,directories,resizable,scrollbars');
  window.open('/w/index.php?title=Wikipedia:Articles_for_deletion/Log/' + date + '&action=edit&fakeaction=vfdlist&faketarget=' + pagename,
              'VfdLog ' + unescape(target),
              'status,toolbar,location,menubar,directories,resizable,scrollbars');
}

function closevfd(result,project)
{ 
        if (project==1)
                {subst_text = "afd";}
        else if (project==2)
                {subst_text = "tfd";}
        else if (project==3)
                {subst_text = "cfd";}
        else if (project==4)
                {subst_text = "mfd";}

	if(result == 1)
	{
	        document.editform.wpTextbox1.value = "{{" + "subst:" + subst_text + " top}} \'\'\'KEEP\'\'\'. -~" + "~" + "~" + "~\n" + document.editform.wpTextbox1.value;
		edit_summary_watch("{{" + "subst:" + subst_text + " bottom}}", "close - keep", false, 0);
	}

	else if(result == 2)
	{
	        document.editform.wpTextbox1.value = "{{" + "subst:" + subst_text + " top}} \'\'\'MERGE\'\'\' to \'\' \'\'. -~" + "~" + "~" + "~\n" + document.editform.wpTextbox1.value;
		edit_summary_watch("{{" + "subst:" + subst_text + " bottom}}", "close - merge+redir", false, 0);
	}

	else if(result == 3)
	{
	        document.editform.wpTextbox1.value = "{{" + "subst:" + subst_text + " top}} \'\'\'REDIRECT\'\'\' to \'\' \'\'. -~" + "~" + "~" + "~\n" + document.editform.wpTextbox1.value;
		edit_summary_watch("{{" + "subst:" + subst_text + " bottom}}", "close - redir", false, 0);
	}
        else if (result ==4)
	{
	        document.editform.wpTextbox1.value = "{{" + "subst:" + subst_text + " top}} \'\'\'DELETE\'\'\'. -~" + "~" + "~" + "~\n" + document.editform.wpTextbox1.value;
		edit_summary_watch("{{" + "subst:" + subst_text + " bottom}}", "close - delete", false, 0);
	}
        else if (result ==5)
	{
	        document.editform.wpTextbox1.value = "{{" + "subst:" + subst_text + " top}} \'\'\'NO CONSENSUS\'\'\'. -~" + "~" + "~" + "~\n" + document.editform.wpTextbox1.value;
		edit_summary_watch("{{" + "subst:" + subst_text + " bottom}}", "close - no consensus", false, 0);
	}
}

function vfdvote(vote)
{
	if (vote == 1)
	        edit_summary_watch("*\'\'\'Delete\'\'\' -~"+"~"+"~"+"~", document.editform.wpSummary.value + "delete", true, 0);
	else if (vote == 2)
		edit_summary_watch("*\'\'\'Keep\'\'\' -~"+"~"+"~"+"~", document.editform.wpSummary.value + "keep", true, 0);
	else if (vote == 3)
		edit_summary_watch("*\'\'\'Merge\'\'\' -~"+"~"+"~"+"~", document.editform.wpSummary.value + "merge", true, 0);
	else if (vote == 4)
		edit_summary_watch("*\'\'\'Redirect\'\'\' -~"+"~"+"~"+"~", document.editform.wpSummary.value + "redirect", true, 0);

}

function vfdtalk(result)
{
     boiler1 = "=" + "=Articles for Deletion debate=" + "=\nThis article ";
     boiler2 = " an [" + "[Wikipedia:Articles for deletion|Articles for Deletion]" + "] debate. The discussion can be found [" + "[Wikipedia:Articles for deletion/{" + "{subst" + ":PAGENAME}" + "}|here]" + "]. -~" + "~" + "~" + "~";

     if(result == 1)
         edit_summary_watch(boiler1 + "survived" + boiler2, document.editform.wpSummary.value + "link to AfD", false, 0);
     else if (result == 2)
         edit_summary_watch(boiler1 + "was merged with and redirected to \'\' \'\' as a result of" + boiler2, document.editform.wpSummary.value + "link to AfD", false, 0);
     else if (result == 3)
         edit_summary_watch(boiler1 + "was redirected to \'\' \'\' as a result of" + boiler2, document.editform.wpSummary.value + "link to AfD", false, 0);

}

function deletiontags()
{
        if (document.title.indexOf("Editing Wikipedia:Votes for deletion") != -1 || document.title.indexOf("Editing Wikipedia:Pages for deletion") != -1 || document.title.indexOf("Editing Wikipedia:Articles for deletion") != -1 || document.title.indexOf("Wikipedia:Templates for deletion/Log") != -1 || document.title.indexOf("Wikipedia:Categories for deletion/Log") != -1 || document.title.indexOf("Wikipedia:Miscellany for deletion") != -1)
        {
            if (document.title.indexOf("Articles") != -1)
                {project = 1;}
            else if (document.title.indexOf("Templates") != -1)
                {project = 2;}
            else if (document.title.indexOf("Categories") != -1)
                {project = 3;}
            else if (document.title.indexOf("Miscellany") != -1) 
                {project = 4;}
            add_link2('javascript:vfdvote(1)', 'v - d');
            add_link2('javascript:vfdvote(2)', 'v - k');
            add_link2('javascript:vfdvote(3)', 'v - m');
            add_link2('javascript:vfdvote(4)', 'v - r');
            add_link2('javascript:closevfd(1,project)', 'c - k');
            add_link2('javascript:closevfd(2,project)', 'c - m');
            add_link2('javascript:closevfd(3,project)', 'c - r');
            add_link2('javascript:closevfd(4,project)', 'c - d');
            add_link2('javascript:closevfd(5,project)', 'c - nc');
        }
        else if (document.title.indexOf("Editing Wikipedia:Votes for deletion") == -1 && document.title.indexOf("Editing Wikipedia:Pages for deletion") == -1 && document.title.indexOf("Editing Wikipedia:Articles for deletion") == -1 && document.title.indexOf("Editing Talk:") == -1 && document.title.indexOf("Editing User talk:") == -1)
        {
            add_link2('javascript:vfd()', 'vfd');
            add_link2('javascript:copyvio()', 'copyvio');
            add_link2('javascript:addpersondata()', 'person');
        }
        else if (document.title.indexOf("Editing Wikipedia:Votes for deletion") == -1 && document.title.indexOf("Editing Wikipedia:Pages for deletion") == -1 && document.title.indexOf("Editing Wikipedia:Articles for deletion") == -1 && document.title.indexOf("Editing Talk:") != -1 && document.title.indexOf("Editing User talk:") == -1)
        {
            add_link2('javascript:vfdtalk(1)','afd - k');
            add_link2('javascript:vfdtalk(2)','afd - m');
            add_link2('javascript:vfdtalk(3)','afd - r');
        }
}

function autovfd()
{
  if (document.title.indexOf('Editing ') == 0)
    {
      var action = '';
      var target = '';
      if (location.search)
        {
          var l = location.search.substring(1).split('&');
          for (var i = 0; i < l.length; ++i)
            {
              var eq = l[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
        }

      if (action == 'vfdlist')
        {
          document.editform.wpTextbox1.value += '{{' + 'subst:afd3|pg=' + target + '}}\n';
          document.editform.wpSummary.value = '[[Wikipedia:Articles for deletion/' + target + ']]';
          document.editform.wpWatchthis.checked = false;
        }
      else if (action == 'vfdsub')
        {
          if (document.editform.wpTextbox1.value.length > 0)
            {
              target = document.editform.action;
              target = unescape(target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'))).replace(/_/g, ' ');
              window.alert("There's an old vfd at the default location already.\n\n" +
                           'Please either move it out of the way (and update existing links to it), or file the Vfd by hand in another location (such as [[' + target + ' (2)]]).');
            }
          else
          {
            document.editform.wpTextbox1.value += "{{" + "subst:afd2|pg=" + target + "|text=\'\'\'Delete\'\'\'}} -~" + "~" + "~" + "~";
            document.editform.wpSummary.value = 'Nominate';
            document.editform.wpWatchthis.checked = true;
          }
        }
      else
           deletiontags();
    }
}

if (window.addEventListener)
  window.addEventListener('load', autovfd, false);
else if (window.attachEvent)
  window.attachEvent('onload', autovfd);

// Returns <li><a href="url">name</a></li>
function addlilink(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);

  var txt = document.createTextNode(name);
  na.appendChild(txt);

  var li = document.createElement('li');
  li.appendChild(na);
  return li;
}

//function do_onload()
//{
//  if (document.title.indexOf('User:') == 0
//      || document.title.indexOf('User talk:') == 0)
//    add_block_tab();
//}

// Adds a "blocklog" tab and fills in the username field on Special:Blockip, if a "&faketarget=username" is present.
function do_blockip_stuff()
{
  // focus on Reason field
  document.getElementsByName('wpBlockReason')[0].focus();

  // Look for a &faketarget= for the username/ip
  var l = location.search.substring(1).split('&');
  var target = '';
  for (var i = 0; i < l.length; ++i)
    {
      var n = l[i].indexOf('=');
      if (l[i].substring(0, n) == 'faketarget')
	{
	  target = l[i].substring(n + 1);
	  break;
	}
    }

  if (target == '')
    return;

  // put account name in "IP Address/username" field
  var addr = document.getElementsByName('wpBlockAddress')[0];
  addr.value = unescape(target);

  // add "blocklog" tab
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
  tabs.appendChild(addlilink('/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + target, 'blocklog'));
}

// Opens the block log in the current window, and Special:Blockip in a popup.
// Width, height, top, and left are chosen for a 1600x1200 display.
function blockpage_and_log(target)
{
  window.open('/w/index.php?title=Special%3ABlockip&faketarget=' + target, 'Block', 'width=1400,height=525,top=525,left=0');
  document.location.href = 'http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + target;
}

// Adds "block" and "blocklog" tabs to User: and User talk: pages.
function add_block_tab()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

  // use the "edit this page" tab to get already-tidied url
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  // cut everything up to "title=" from the start and everything past "&action=edit" from the end
  editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));
  editlk = editlk.substring(editlk.indexOf(':') + 1);
  var slloc = editlk.indexOf('/');
  if (slloc > 0)
    editlk = editlk.substring(0, slloc);

  // add "block" tab
  //tabs.appendChild(addlilink('/w/index.php?title=Special%3ABlockip&faketarget=' + editlk, 'block'));

  // To open the block page and block log simultaneously, replace the above line with:
   tabs.appendChild(addlilink('javascript:blockpage_and_log("' + editlk + '")', 'Block'));
  // and uncomment the blockpage_and_log() function above.

  // add "blocklog" tab
  tabs.appendChild(addlilink('/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + editlk, 'blocklog'));

  //add "contributions" tab
  tabs.appendChild(addlilink('/w/wiki.phtml?title=Special:Contributions&target=User%3A' + editlk, 'contributions'));

}

function do_onload()
{
  if (document.title.indexOf('User:') == 0
      || document.title.indexOf('User talk:') == 0)
    add_block_tab();
  else if (document.title.indexOf('Block user') == 0) // could stand to be more robust
    do_blockip_stuff();
}

if (window.addEventListener) 
  window.addEventListener("load", do_onload, false);
else if (window.attachEvent) 
  window.attachEvent("onload", do_onload);

if ( document.createElement && window.addEventListener )
{
	function SoFixItInit() // pre-load, (don't want to slow down loading of article's content, though)
	{

	}

	function SoFixItLoad() // post-load
	{
		UserMenu = new PortletMenu( 'p-personal'   );
		PageMenu = new PortletMenu( 'p-cactions'   );
		 NavMenu = new PortletMenu( 'p-navigation' );
		//ToolMenu = new PortletMenu( 'p-tb'         );

			//	This is inefficient and not particularly robust.
			//	This comes first, I want this link to come up as
			//	fast as possible.
			//
		function GetByClass( sElem, sClass )
		{	var i, a2 = [], a = document.getElementsByTagName( sElem );
			for ( i = 0; i < a.length; i++ )
				if ( a[ i ].className == sClass )
					a2.push( a[ i ] );
			return a2;
		}
		var a, td = GetByClass( 'td', 'diff-otitle' );
		if ( ( td = td[ 0 ] ) && ( a = td.getElementsByTagName( 'a' )[ 0 ] ) )
			a.href = a.href + '&action=edit'; // need to change text, later

		var userName = UserMenu.getText( 'pt-userpage' );

			// personal (top-most) menu
			//
			//		Splash  Talk  Prefs  Watch  List  Contribs  Kate  Logs  #IRC  Out
			//
		UserMenu.setText( 'pt-mytalk'     , 'talk'  );
		UserMenu.setText( 'pt-preferences', 'prefs' );
		UserMenu.setText( 'pt-watchlist'  , 'watch' );
		UserMenu.setText( 'pt-mycontris'  , 'contribs' );
		UserMenu.setText( 'pt-logout'     , 'out'   );
			//
		UserMenu.setHref( 'pt-mycontris',
			'http://en.wikipedia.org/w/index.php?title=Special:Contributions&target=' +
			userName + '&offset=0&limit=500' );
			//
			//
			//	it seems there is a stylesheet that makes them lowercase
			//
			//		ok, the lowercased menu items are starting to really bug me:
			//
		document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0].style.textTransform = 'none';
			//
		UserMenu.insertBefore( 'pt-mycontris', 'pt-list', 'list', '/wiki/Special:Watchlist/edit' );
		UserMenu.insertBefore( 'pt-logout'   , 'pt-logs', 'logs',
			'/w/index.php?title=Special%3ALog&user=' + userName );
		UserMenu.insertBefore( 'pt-logout'   , 'pt-irc' , '#irc', 'irc://irc.freenode.net/wikipedia' );
		UserMenu.insertBefore( 'pt-logs'     , 'pt-kate', 'count',
			'javascript:void InlineKate( "' + userName + '" )' );

			//	so I always know what time it is in UTC land:
			//
		UserMenu.append( 'pt-utc', UTCTime(), 'javascript:void UserMenu.setText("pt-utc",UTCTime())' );

			//	article-actions menu, (the "tabs")
			//
		if ( PageMenu[ 'ca-history' ] ) // theory: if it has a history tab, then it's purgable
		{
			PageMenu.insertBefore( 'ca-history', 'ca-lastdiff', 'Last Diff',
				PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'diff=0' ) );

			PageMenu.append( 'ca-purge', 'Purge',
				PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'action=purge' ) );
		}

		var x = 1;
		//NavMenu.append( 'n-' + x++, 'monobook.js', '/wiki/User:' + userName + '/monobook.js' );
		NavMenu.append( 'n-' + x++, 'Cat:Wikipedia', '/wiki/Category:Wikipedia' );
		NavMenu.append( 'n-' + x++, 'Cat:Policies', '/wiki/Category:Wikipedia_policies_and_guidelines' );
		NavMenu.append( 'n-' + x++, 'Cat:Official', '/wiki/Category:Wikipedia_official_policy' );
		NavMenu.append( 'n-' + x++, 'Templates', '/wiki/Wikipedia:Template' );
		NavMenu.append( 'n-' + x++, 'Cleanup tags', '/wiki/Wikipedia:Template_messages/Cleanup' );
                NavMenu.append( 'n-' + x++, 'Stub sorts', '/wiki/Stub_types' );


	}

	function PortletMenu( id ) // constructor
	{
		this.menu = document.getElementById( id );
		this.list = this.menu.getElementsByTagName( 'ul' )[ 0 ]; // bypass "<h5>Views</h5>", etc.

			//	sigh...as far as I can figure, there is empty whitespace being treated
			//	as TextNodes....
			//
		var LIs = this.list.getElementsByTagName( 'li' );

		for ( var i = 0; i < LIs.length; i++ )
		{
			this[ LIs[ i ].id ] = LIs[ i ];
		}

		this.newItem = function( id, txt, url )
		{	var li = document.createElement( 'li' ); li.id   = id;
			var  a = document.createElement( 'a'  );  a.href = url;

			 a.appendChild( document.createTextNode( txt ) );
			li.appendChild( a );

			this[ id ] = li; // watch this!!!

			return li;
		}

		this.append = function( id, txt, url )
		{	this.list.appendChild( this.newItem( id, txt, url ) );
		}
		
		this.insertBefore = function( old, id, txt, url )
		{	this.list.insertBefore( this.newItem( id, txt, url ), this[ old ] );
		}

			//	the ByTagName here is a bit annoying, but in Safari, I was picking
			//	up TextNodes by using this[ id ].firstChild.firstChild
			//
		this.getText = function( id      ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data }
		this.setText = function( id, txt ) {        this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data = txt }

		this.getHref = function( id      ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].href       }
		this.setHref = function( id, url ) {        this[ id ].getElementsByTagName( 'a' )[ 0 ].href = url }
		
		//	I add em as I need em....
	}

	function InlineKate( user )
	{
		var kate =
			'http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user=Splash&dbname=enwiki_p';

		var div = document.createElement( 'div' );
			div.id = 'inlineKateDiv';
			div.style.position = 'absolute';
			div.style.zIndex   = 1000;
			div.style.left     =  '20px';
			div.style.top      =  '20px';
			div.style.backgroundColor = '#FFFFFF';
			div.style.borderStyle     = 'solid';
			div.style.borderWidth     = ' medium';
			div.style.borderColor     = '#000000';

			var top = document.createElement( 'div' );
				top.id = 'inlineKateTop';
				top.style.textAlign = 'right';
				top.style.margin = '8px';
				top.style.backgroundColor = '#DDDDDD';

				var a = document.createElement( 'a' );
					a.appendChild( document.createTextNode( "Go to Interiot's" ) );
					a.href    = kate;
					a.target  = '_parent';
					a.style.margin = '8px';

				top.appendChild( a );

					a = document.createElement( 'a' );
					a.appendChild( document.createTextNode( 'Close' ) );
					a.href    = "javascript:void RemoveNode('inlineKateDiv')";
					a.style.margin = '8px';

				top.appendChild( a );

			div.appendChild( top );

			var iframe = document.createElement( 'iframe' );
				iframe.id   = 'inlineKateBot';
				iframe.style.width  = '500px';
				iframe.style.height = '600px';
				iframe.style.margin =   '8px';
				iframe.style.borderStyle = 'solid';
				iframe.style.borderWidth = 'thin';
				iframe.style.borderColor = '#000000';
				iframe.src = kate;

			div.appendChild( iframe );

		document.body.appendChild( div );
	}

	function RemoveNode( id )
	{	var node = document.getElementById( id )
		node.parentNode.removeChild( node );
	}

	function UTCTime()
	{
			//	Get a date stamp for the time in UTC-land.
			//
			//	for the future: a format arg
			//
		var s = '',
			d = new Date(),
			a = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
		return	d.getUTCDate() + ' ' +
				a[ d.getUTCMonth() ] + ' ' +
				d.getUTCFullYear() + ' ' +
				( '0' + d.getUTCHours()   ).substr( -2 ) + ':' +
				( '0' + d.getUTCMinutes() ).substr( -2 ) + ' ' + 'UTC';
	}

	SoFixItInit();
	window.addEventListener( 'load', SoFixItLoad, false );
}

//	Released into the public domain by [[User:Func]]
function NUPatrol()
{
	if ( window.location.href.indexOf( 'Special:Log/newusers'        ) < 0 &&
	     window.location.href.indexOf( '&type=newusers' ) < 0  ) return;

	var items, item, i, links, user, name, talk, contribs, insertLoc, link;

	items = document.getElementById( 'bodyContent' ).getElementsByTagName( 'ul' )[ 0 ].getElementsByTagName( 'li' );

	function NewLink( txt, url, plainlinks, linkColor )
	{	var a = document.createElement( 'a' );
			a.appendChild( document.createTextNode( txt ) );
			a.href = url;
		if ( plainlinks ) a.className = 'plainlinks';
		if ( linkColor )
		{	if ( typeof linkColor == "string" )
					a.style.color = linkColor;
			else	a.style.color = '#FF0000'; // old default behavior
		}
		return a;
	}

	for ( i = 0; i < items.length; i++ )
	{
		item = items[ i ];
		
		links = item.getElementsByTagName( 'a' );

			user = links[ 0 ]; name = user.firstChild.nodeValue;
			talk = links[ 2 ]; talk.firstChild.nodeValue = 'talk'; // lowercase 'Talk' for consistency
		contribs = links[ 3 ];

		insertLoc = user.nextSibling; // ' newusers '

		item.insertBefore( document.createTextNode( ' ( ' ), insertLoc );

		item.insertBefore( talk, insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( contribs, insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'actions', '/w/index.php?title=Special%3ALog&user=' + name, true, '#000088' ), insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'blocks', '/w/index.php?title=Special%3ALog&type=block&page=User%3A' + name, true, '#008800' ), insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'is blocked?', '/wiki/Special:Ipblocklist?action=search&ip=' + name, true, '#888800' ), insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'do block!', '/w/index.php?title=Special:Blockip&ip=' + name, true, '#880000' ), insertLoc );

		item.insertBefore( document.createTextNode( ' )' ), insertLoc );

		item.removeChild( insertLoc.nextSibling ); // should remove the span
		item.removeChild( insertLoc ); // should remove ' newusers ' text
	}
}
if ( window.addEventListener ) window.addEventListener( 'load', NUPatrol, false );
else if ( window.attachEvent ) window.attachEvent( 'onload', NUPatrol );

// This will add an [edit top] link at the top of all pages except preview pages
// by User:Pile0nades

// Add an [edit top] link to pages
function editTopLink() {
  // if this is preview page or generated page, stop
  if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -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-top:3px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">edit top</a>]</div>';

  // insert divContainer into the DOM before the h1
  if(window.location.href.indexOf("&action=edit") == -1)
    document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);

  if(window.location.href.indexOf("&action=edit&section=0") != -1)
    document.getElementById("wpSummary").value = "/* Intro */ ";
}

addOnloadHook(editTopLink);

// Like document.getElementsByTagName, but finds only direct children of a given node
function node_getElementsByTagName(node, tag)
{
  var arr = new Array;
  tag = tag.toUpperCase();
  for (node = node.firstChild; node; node = node.nextSibling)
    if (node.tagName == tag)
      arr[arr.length] = node;
  return arr;
}

addOnloadHook(function ()
{
  var node = document.getElementById('contentSub');     // monobook-like skins

  if (!node)    // classic-like skins
    {
      var h1s = document.getElementsByTagName('h1');
      for (var i = 0; i < h1s.length; ++i)
        if (h1s[i].className && h1s[i].className.indexOf('pagetitle') >= 0)
          {
            node = h1s[i].nextSibling;
            break;
          }
    }

  if (node
      && node.firstChild
      && node.firstChild.nodeType == Node.TEXT_NODE
      && node.firstChild.data.indexOf("Revision as of") >= 0)
    {
      var as = node_getElementsByTagName(node, 'a');
      if (as[0].firstChild.data == "view current revision")
        {
          var a = document.createElement('a');
          a.href = as[1].href.replace(/&direction=prev&oldid=/, '&diff=prev&oldid=');
          a.appendChild(document.createTextNode('(diff) '));
          node.insertBefore(a, as[1]);

          a = document.createElement('a');
          a.href = as[2].href.replace(/&direction=next&oldid=/, '&diff=next&oldid=');
          a.appendChild(document.createTextNode(' (diff)'));
          node.appendChild(a);
        }
    }
});
//<nowiki> ============= test-n.js ==============
function tnaddlilink(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);

  var txt = document.createTextNode(name);
  na.appendChild(txt);

  var li = document.createElement('li');
  li.appendChild(na);
  return li;
}

addOnloadHook(protection_tabs);

function protection_tabs()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

if  (document.title.indexOf("") != -1)
{
if (document.title.indexOf("Editing ") != -1)
{
  if (document.title.indexOf("Editing User talk:") != -1)
    {
      tabs.appendChild(tnaddlilink('javascript:usprotect()',"(sp)"));
      tabs.appendChild(tnaddlilink('javascript:uunprotect()',"(up)"));
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
    }
  else if (document.title.indexOf("Editing User:") != -1)
    {  
      tabs.appendChild(tnaddlilink('javascript:usprotect()',"(sp)"));
      tabs.appendChild(tnaddlilink('javascript:uunprotect()',"(up)"));
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'Protection (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'Protection (on)';
      }
    }
  else if (document.title.indexOf("Editing Wikipedia:Requests for page protection (section)") != -1)
    {
    if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }     
    }
  else if (document.title.indexOf("Editing Wikipedia:Administrators' noticeboard/3RR (section)") != -1)
    {
    if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
    if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
    }
//This line removes a minor glitch [[Category:Wikipedia administrators who use VoA script]]
 else if(document.title.indexOf("Editing Help:Contents/Editing Wikipedia") != -1)
   {
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
   }
 else if(document.title.indexOf("Help:Contents/Editing Wikipedia") != -1)
 {
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'Protection (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'Protection (on)';
      }
   }
 else if(document.title.indexOf("Editing Talk") != -1)
 {
      tabs.appendChild(tnaddlilink('javascript:oprotect()',"(fp)"));
      tabs.appendChild(tnaddlilink('javascript:osprotect()',"(sp)"));
      tabs.appendChild(tnaddlilink('javascript:ounprotect()',"(up)"));
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
      if(document.getElementById('ca-edit'))
      {
        document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';
      }
   }
 else if(document.title.indexOf("Editing Wikipedia talk") != -1)
 {
      tabs.appendChild(tnaddlilink('javascript:oprotect()',"(fp)"));
      tabs.appendChild(tnaddlilink('javascript:osprotect()',"(sp)"));
      tabs.appendChild(tnaddlilink('javascript:ounprotect()',"(up)"));
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
   }
 else if(document.title.indexOf("Editing Wikipedia") != -1)
 {
      tabs.appendChild(tnaddlilink('javascript:oprotect()',"(fp)"));
      tabs.appendChild(tnaddlilink('javascript:osprotect()',"(sp)"));
      tabs.appendChild(tnaddlilink('javascript:ounprotect()',"(up)"));
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
      if(document.getElementById('ca-edit'))
      {
        document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';
      }
   }
  else
   {  
      tabs.appendChild(tnaddlilink('javascript:protect()',"(fp)"));
      tabs.appendChild(tnaddlilink('javascript:sprotect()',"(sp)"));
      tabs.appendChild(tnaddlilink('javascript:unprotect()',"(up)"));
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
      if(document.getElementById('ca-edit'))
      {
        document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';
      }
   }
}
 else if (document.title.indexOf("User:") != -1)
 {
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'Protection (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'Protection (on)';
      }
 }
 else if (document.title.indexOf("User talk:") != -1)
 {
 if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'Protection (off)';
      }
 if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'Protection (on)';
      }
 }
 else
 {
 if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'Protection (off)';
      }
 if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'Protection (on)';
      }
}
}
}


function protect()
{
//This is for if people skrew with the WP:PP page layout
  var movesec = 7;
  var artfull = 10;
  var artsemi = 11;
  var otherpro = 13;
  var userfull = 16;  
  var usersemi = 17;
  var regtalk = 18;  
  var anontalk = 19;
//End of WP:PP constants
  var z ='';
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{tl|protected}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{tl|vprotected}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
   var z = 'notag';
  }
  else
  {
  document.editform.wpTextbox1.value = '{{protected' + '}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = '+{{protected' + '}}';
window1 = window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artfull + '&fakeaction=plist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window2 = window.open('http://en.wikipedia.org/w/index.php?title=' + target + '&action=protect',
              'targetname2',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
    return;
  }
if (z == 'notag')
  {
alert("Error: A protection tag is already on this page. If this tag is supposed to be part of the text, then add the desired protection tag manually.");
    return;
  }
}

function sprotect()
{
//This is for if people skrew with the WP:PP page layout
  var movesec = 7;
  var artfull = 10;
  var artsemi = 11;
  var otherpro = 13;
  var userfull = 16;  
  var usersemi = 17;
  var regtalk = 18;  
  var anontalk = 19;
//End of WP:PP constants
  var z ='';
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{usertalk-sprotected}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Usertalk-sprotected}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
    var z = 'notag';
  }
  else
  {
  document.editform.wpTextbox1.value = '{{sprotected' + '}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = '+{{sprotected' + '}}';
window1 = window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artsemi + '&fakeaction=plist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window2 = window.open('http://en.wikipedia.org/w/index.php?title=' + target + '&action=protect',
              'targetname2',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
    return;
  }
  if (z == 'notag')
  {
alert("Error: A protection tag is already on this page. If this tag is supposed to be part of the text, then add the desired protection tag manually.");
    return;
  }
}

function usprotect()
{
//This is for if people skrew with the WP:PP page layout
  var movesec = 7;
  var artfull = 10;
  var artsemi = 11;
  var otherpro = 13;
  var userfull = 16;  
  var usersemi = 17;
  var regtalk = 18;  
  var anontalk = 19;
//End of WP:PP constants
  var z ='';
  if (document.title.indexOf("Editing User talk") != -1)
    {
    value = 't'; 
    }
  if (document.title.indexOf("Editing User:") != -1)
    {
    value = 'u';
    }
  var reg = '';
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Sprotect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Sprotected}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vutprotected}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Vutprotected}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotect}}')[1] != undefined)
  {
   z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotected}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Vprotect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Vprotected}}')[1] != undefined)
  {
    z = 'notag';
  }
  if (z == 'notag')
    {
    alert("Error: A protection tag is already on this page. If this tag is supposed to be part of the text, then add the desired protection tag manually.");
    return;
    }
  else
  {
  if (value == 'u')
      {
      var act = 'u';
      type = 17;
      }
  else if (value == 't')
      {
      var act = 'ut';
      var reg = prompt('Is this an anon or a registered user (enter *a* or *r*)?');
         if (reg == 'a')
             {
            type = 19;
             }
         else if (reg == 'r')
             {
            type = 18;
             }
         else
             {
            alert("Error: Invalid input. Make sure you are not actually including the asterisk symbols.");
            return;
             }
      }
  else
      {
      alert("Error: Invalid input. Make sure you are not actually including the asterisk symbols.");
      return;
      }
  document.editform.wpTextbox1.value = '{{sprotected' + '}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = '+{{sprotected' + '}}';
window1 = window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + type + '&fakeaction=' + act + 'plist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window2 = window.open('http://en.wikipedia.org/w/index.php?title=' + target + '&action=protect',
              'targetname2',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
         return;
  }
}

function oprotect()
{
//This is for if people skrew with the WP:PP page layout
  var movesec = 7;
  var artfull = 10;
  var artsemi = 11;
  var otherpro = 13;
  var userfull = 16;  
  var usersemi = 17;
  var regtalk = 18;  
  var anontalk = 19;
//End of WP:PP constants
  var z ='';
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
    z = 'notag';
  }
  if (z == 'notag')
  {
    alert("Error: A protection tag is already on this page. If this tag is supposed to be part of the text, then add the desired protection tag manually.");
    return;
  }
  else
  {
  document.editform.wpTextbox1.value = '{{protected' + '}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = '+{{protected' + '}}';
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + otherpro + '&fakeaction=oplist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window.open('http://en.wikipedia.org/w/index.php?title=' + target + '&action=protect',
              'targetname2',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  }
}

function osprotect()
{
//This is for if people skrew with the WP:PP page layout
  var movesec = 7;
  var artfull = 10;
  var artsemi = 11;
  var otherpro = 13;
  var userfull = 16;  
  var usersemi = 17;
  var regtalk = 18;  
  var anontalk = 19;
//End of WP:PP constants
  var z ='';
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotected}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
    z = 'notag';
  }
 if (z == 'notag')
  {
  alert("Error: A protection tag is already on this page. If this tag is supposed to be part of the text, then add the desired protection tag manually.");
  }
  else
  {
  document.editform.wpTextbox1.value = '{{sprotected' + '}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = '+{{sprotected' + '}}';
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + otherpro + '&fakeaction=oplist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window.open('http://en.wikipedia.org/w/index.php?title=' + target + '&action=protect',
              'targetnameo',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  }
}

function unprotect()
{
//This is for if people skrew with the WP:PP page layout
  var movesec = 7;
  var artfull = 10;
  var artsemi = 11;
  var otherpro = 13;
  var userfull = 16;  
  var usersemi = 17;
  var regtalk = 18;  
  var anontalk = 19;
//End of WP:PP constants
  var undefined;
  var original = document.editform.wpTextbox1.value;
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artsemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{sprotect}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{sprotect}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artsemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotected}}')[1];
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artsemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{sprotected}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{sprotected}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artsemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{semiprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{semiprotect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{semiprotect}}')[1];
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artsemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{semiprotect}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{semiprotect}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artsemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{semiprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{semiprotected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{semiprotected}}')[1];
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artsemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{semiprotected}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{semiprotected}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artsemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
  }
else if (document.editform.wpTextbox1.value.split('{{vprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vprotect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{vprotect}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{vprotect}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vprotected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotected}}')[1];
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{vprotected}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{vprotected}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{protect}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{protect}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{protected}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{protected}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{moveprotect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{moveprotect}}')[1];
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + movesec + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     } 
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{moveprotect}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{moveprotect}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + movesec + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{moveprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + movesec + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     } 
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{moveprotected}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{moveprotected}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + movesec + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  else
  {
alert("Error: Either there is no recognized protection tag on this page or the tag is preceded by text (in which case you have to remove it manually).");
  }
if (go == 'yes')
    {
window.open('http://en.wikipedia.org/w/index.php?title=' + target + '&action=protect',
              'targetnamepro',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
    }
}

function ounprotect()
{
//This is for if people skrew with the WP:PP page layout
  var movesec = 7;
  var artfull = 10;
  var artsemi = 11;
  var otherpro = 13;
  var userfull = 16;  
  var usersemi = 17;
  var regtalk = 18;  
  var anontalk = 19;
//End of WP:PP constants
  var undefined;
  var original = document.editform.wpTextbox1.value;
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + otherpro + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{sprotect}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{sprotect}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + otherpro + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotected}}')[1];
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + otherpro + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{sprotected}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{sprotected}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + otherpro + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + otherpro + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{protect}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{protect}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + otherpro + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + otherpro + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{protected}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{protected}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + otherpro + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{moveprotect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{moveprotect}}')[1];
var go = 'yes';
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + movesec + '&fakeaction=pdelist&faketarget=' + target,
              'targetnamem',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     } 
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{moveprotect}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{moveprotect}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + movesec + '&fakeaction=pdelist&faketarget=' + target,
              'targetnamem',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{moveprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + movesec + '&fakeaction=pdelist&faketarget=' + target,
              'targetnamem',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
     } 
    else
     {
document.editform.wpSummary.value = 'Unprotected';
var before = document.editform.wpTextbox1.value.split('{{moveprotected}}')[0]; 
var after = document.editform.wpTextbox1.value.split(before + '{{moveprotected}}')[1];
document.editform.wpTextbox1.value = before + after;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + movesec + '&fakeaction=pdelist&faketarget=' + target,
              'targetnamem',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var go = 'yes';
    }
  }
  else
  {
alert("Error: Either there is no recognized protection tag on this page or the tag is preceded by text (in which case you have to remove it manually).");
  }
  if (go == 'no')
  {
alert("Error: The protection tag is preceded by text (in which case you have to remove it manually).");
  }
  if (go == 'yes')
  {
window.open('http://en.wikipedia.org/w/index.php?title=' + target + '&action=protect',
              'targetnamep',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  }
}

//USERPAGE UNPROTECT
function uunprotect()
{
//This is for if people skrew with the WP:PP page layout
  var movesec = 7;
  var artfull = 10;
  var artsemi = 11;
  var otherpro = 13;
  var userfull = 16;  
  var usersemi = 17;
  var regtalk = 18;  
  var anontalk = 19;
//End of WP:PP constants
  var undefined;
  if (document.title.indexOf("Editing User talk:") != -1)
    {
    value = 't'; 
    }
  if (document.title.indexOf("Editing User:") != -1)
    {
    value = 'u';
    }
  var original = document.editform.wpTextbox1.value;
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (value == 'u')
      {
      type = 17;
      }
  else if (value == 't')
      {
      var reg = prompt('Is this an anon or a registered user (enter *a* or *r*)?');
         if (reg == 'a')
             {
            type = 19;
             }
         else if (reg == 'r')
             {
            type = 18;
             }
         else
             {
            alert("Error: Invalid input. Make sure you are not actually including the asterisk symbols.");
            return;
             }
      }
  else
      {
      alert("Error: Invalid input. Make sure you are not actually including the asterisk symbols.");
      return;
      }
//Tag search
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotect}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + usersemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + anontalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + regtalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
  else if (document.editform.wpTextbox1.value.split('{{vprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vprotect}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + userfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + anontalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + regtalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
  else if (document.editform.wpTextbox1.value.split('{{vutprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vutprotected}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vutprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + userfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vutprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + anontalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vutprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + regtalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
else if (document.editform.wpTextbox1.value.split('{{vprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vprotected}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + userfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + anontalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + regtalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotected}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + usersemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + anontalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + regtalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
 else if (document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + usersemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + anontalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + regtalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
 else if (document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + usersemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + anontalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + regtalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
  else if (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protect}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + userfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + anontalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + regtalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
  else if (document.editform.wpTextbox1.value.split('{{protected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protected}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + userfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + anontalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + regtalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{moveprotect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{moveprotect}}')[1];
     } 
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{moveprotected}}')[1]; 
     } 
  }
//No tag found...what now?
 else
  {
  var message = "Note: Either there is no recognized protection tag on this page or it is preceded by text. Press OK to continue.";
  var return_value = confirm(message);
//If they click OK
  if (return_value == true)
    {
    if (value == 't')
      {
     if (reg == 'a')
       {
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + anontalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');   
       }
     else if (reg == 'r')
       {
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + regtalk + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');  
       }
     else
       {
     alert("An unknown error has occured. Please contact User:Voice of All for help.");
       }
     }
    if (value == 'u')
     { 
var level = prompt("Page no longer semi or fully protected (enter *s* or *f*)?");
     if (level == 's')
        {
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + usersemi + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');  
        }
     else if (level == 'f')
        {
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + userfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');   
        }
     else
        {
       alert("Invalid input."); 
       return;
        }
      }
   else if (value != 'u' && value != 't')
       {
      alert("An unknown page recognition error has occured. Please contact User:Voice of All for help."); 
       }
     }
   else 
     { 
   document.editform.wpSummary.value = "";
   return;
     } 
   }
window.open('http://en.wikipedia.org/w/index.php?title=' + target + '&action=protect',
              'targetnameu',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
         return;
 } 

addOnloadHook(autoplist);

function autoplist()
{
  if (document.title.indexOf('Editing ') == 0)
    {
      var action = '';
      var target = '';
      if (location.search)
        {
          var l = location.search.substring(1).split('&');
          for (var i = 0; i < l.length; ++i)
            {
              var eq = l[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
        }
      if (action == 'plist')
        {
  var pagename = strip_namespace(target);
  var reason = prompt("Enter an explanation for protection:")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*{{article|" + pagename + "}}. " + reason + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value = "[[" + pagename + "]] protected ";
        }
    }
}

addOnloadHook(autouplist);

function autouplist()
{
  if (document.title.indexOf('Editing ') == 0)
    {
      var action = '';
      var target = '';
      if (location.search)
        {
          var l = location.search.substring(1).split('&');
          for (var i = 0; i < l.length; ++i)
            {
              var eq = l[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
        }
      if (action == 'uplist')
        {
  var username = target.split("User:")[1];
  var pagename = strip_namespace(username);
  var reason = prompt("Enter an explanation for protection:")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*[[User:" + pagename + "]] --" + reason + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value = "[[" + pagename + "]]" + " protected ";
        }
    }
}

addOnloadHook(autoutplist);

function autoutplist()
{
  if (document.title.indexOf('Editing ') == 0)
    {
      var action = '';
      var target = '';
      if (location.search)
        {
          var l = location.search.substring(1).split('&');
          for (var i = 0; i < l.length; ++i)
            {
              var eq = l[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
        }
      if (action == 'utplist')
        {
  var username = target.split("User talk:")[1];
  var pagename = strip_namespace(username);
  var reason = prompt("Enter an explanation for protection:")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*{{vandal|" + pagename + "}} --" + reason + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value = "[[" + pagename + "]]" + " protected ";
        }
    }
}

addOnloadHook(autooplist);

function autooplist()
{
  if (document.title.indexOf('Editing ') == 0)
    {
      var action = '';
      var target = '';
      if (location.search)
        {
          var l = location.search.substring(1).split('&');
          for (var i = 0; i < l.length; ++i)
            {
              var eq = l[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
        }
      if (action == 'oplist')
        {
  var pagename = strip_namespace(target);
  var reason = prompt("Enter an explanation for protection")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*{{Non-article|Wikipedia|" + pagename + "}}. " + reason + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value = "[[" + target + "]]" + " protected ";
        }
    }
}

addOnloadHook(autopdelist);

function autopdelist()
{
  if (document.title.indexOf('Editing ') == 0)
    {
      var action = '';
      var target = '';
      if (location.search)
        {
          var l = location.search.substring(1).split('&');
          for (var i = 0; i < l.length; ++i)
            {
              var eq = l[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
         }
      if (action == 'pdelist')
        {
         var undefined;
         var splitpoint = '';
         var nada = '';
         var pagename = strip_namespace(target);
         var original = document.editform.wpTextbox1.value;
         document.editform.wpTextbox1.value = pagename;
         var username = document.editform.wpTextbox1.value.split("User:")[1];
         var usertalk = document.editform.wpTextbox1.value.split("User talk:")[1];
         var themovename = document.editform.wpTextbox1.value.split("Wikipedia:")[1];
         var themove = "*{{Non-article|Wikipedia|" + themovename + "}}";
         var thepage = "*{{article|" + target + "}}";
         var thepage2 = "* {{article|" + target + "}}";
         var lapage = "*{{la|" + target + "}}";
         var theuser = "*[[" + target + "]]";
         var vandaltalk = "*{{vandal|" + usertalk + "}}";
         document.editform.wpTextbox1.value = original;
      if (document.editform.wpTextbox1.value.split(thepage)[1] != undefined)
        {
         if (document.editform.wpTextbox1.value.split(thepage)[0] != undefined)
           {
         var firsthalf = document.editform.wpTextbox1.value.split(thepage)[0];
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(thepage)[1]; 
         splitpoint = document.editform.wpTextbox1.value.split("*{{")[0];
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 3) 
                    {
         secondhalf = original.split(thepage)[1];
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
         alert("The page has been located and de-listed. The de-listed page had no protection summary or explanation.");
                    }
              else 
                    {
                 if (splitpoint.split("* " + "{{")[1] != undefined) 
                       {
           splitpointb = splitpoint.split("* " + "{{")[0];
           secondhalf = document.editform.wpTextbox1.value.split(thepage + splitpointb)[1];
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpointb + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                       }
                 else 
                       {
           secondhalf = document.editform.wpTextbox1.value.split(thepage + splitpoint)[1];
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpoint + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                       }
           }
        }
     } 
      else if (document.editform.wpTextbox1.value.split(thepage2)[1] != undefined)
        {
         if (document.editform.wpTextbox1.value.split(thepage2)[0] != undefined)
           {
         var firsthalf = document.editform.wpTextbox1.value.split(thepage2)[0];
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(thepage2)[1]; 
         splitpoint = document.editform.wpTextbox1.value.split("*{{")[0];
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 3) 
                    {
         secondhalf = original.split(thepage2)[1];
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
         alert("The page has been located and de-listed. The de-listed page had no protection summary or explanation.");
         return;
                    }
              else 
                    {
                 if (splitpoint.split("* " + "{{")[1] != undefined) 
                       {
           splitpointb = splitpoint.split("* " + "{{")[0];
           secondhalf = document.editform.wpTextbox1.value.split(thepage2 + splitpointb)[1];
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpointb + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                       }
                 else 
                       {
           secondhalf = document.editform.wpTextbox1.value.split(thepage2 + splitpoint)[1];
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpoint + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                       }
           }
        }
     }
      else if (document.editform.wpTextbox1.value.split(themove)[1] != undefined)
        {
         if (document.editform.wpTextbox1.value.split(themove)[0] != undefined)
           {
         var firsthalf = document.editform.wpTextbox1.value.split(themove)[0];
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(themove)[1]; 
         splitpoint = document.editform.wpTextbox1.value.split("*{{")[0];
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 3) 
                    {
         secondhalf = original.split(themove)[1];
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
         alert("The page has been located and de-listed. The de-listed page had no protection summary or explanation.");
                    }
              else 
                    {
                 if (splitpoint.split("*" + "[[")[1] != undefined) 
                       {
           splitpointb = splitpoint.split("*" + "[[")[0];
           secondhalf = document.editform.wpTextbox1.value.split(themove + splitpointb)[1];
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpointb + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                       }
                 else 
                       {
           secondhalf = document.editform.wpTextbox1.value.split(themove + splitpoint)[1];
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpoint + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                       }
           }
        }
     } 
     else if (document.editform.wpTextbox1.value.split(lapage)[1] != undefined)
        {
         if (document.editform.wpTextbox1.value.split(lapage)[0] != undefined)
           {
         var firsthalf = document.editform.wpTextbox1.value.split(lapage)[0];
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(lapage)[1]; 
         splitpoint = document.editform.wpTextbox1.value.split("*{{")[0];
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 3) 
                    {
         secondhalf = original.split(lapage)[1];
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
         alert("The page has been located and de-listed. The de-listed page had no protection summary or explanation.");
 	            }
              else 
                    {
                 if (splitpoint.split("*" + "[[")[1] != undefined) 
                       {
           splitpointb = splitpoint.split("*" + "[[")[0];
           secondhalf = document.editform.wpTextbox1.value.split(lapage + splitpointb)[1];
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpointb + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                       }
                 else 
                       {
           secondhalf = document.editform.wpTextbox1.value.split(lapage + splitpoint)[1];
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpoint + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                       }
           }
        }
     } 
else if (document.editform.wpTextbox1.value.split(vandaltalk)[1] != undefined)
         {
         if (document.editform.wpTextbox1.value.split(vandaltalk)[0] != undefined)
            {
         var firsthalf = document.editform.wpTextbox1.value.split(vandaltalk)[0];
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(vandaltalk)[1]; 
         splitpoint = document.editform.wpTextbox1.value.split("*" + "{{")[0];
         document.editform.wpTextbox1.value = original.split(splitpoint)[1];
         var secondhalf = original.split(vandaltalk + splitpoint)[1];
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 3) 
                    {
         secondhalf = document.editform.wpTextbox1.value.split(vandaltalk)[1];
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
         alert("The page has been located and de-listed. The de-listed page had no protection summary or explanation.");
         return;
                    }
              else 
                    {
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
         alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpoint + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                    }
              }
         }
else if (document.editform.wpTextbox1.value.split(theuser)[1] != undefined)
         {
         if (document.editform.wpTextbox1.value.split(theuser)[0] != undefined)
            {
         var firsthalf = document.editform.wpTextbox1.value.split(theuser)[0];
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(theuser)[1]; 
         splitpoint = document.editform.wpTextbox1.value.split("*" + "[[User:")[0];
         document.editform.wpTextbox1.value = original.split(splitpoint)[1];
         var secondhalf = original.split(theuser + splitpoint)[1];
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 3) 
                    {
         secondhalf = document.editform.wpTextbox1.value.split(theuser + splitpoint)[1];
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
         alert("The user's page has been located and de-listed. The de-listed page had no protection summary or explanation."); 
         return;
                    }
              else 
                    {
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
         alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpoint + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                    }
              }
         }
     else
         {
          alert("Note: The page you unprotected was not found on the list and may never have been listed. However, check to make sure that this is not a glitch, such as the listed article being a redirect to the actual page or beind the newest entry, or inconsistant asterik usage. Move-protected articles tend to be listed inconsistantly. Also, some entries for non-articles are listed with templates that this tool does not look for.");
          alert("Debuging Information: " + "vandaltalk=" + vandaltalk + "|username=" + username + "|username2=" + usertalk + " |target=" + target + "|thepage=" + thepage + "|themove=" + themove + " |splitpoint=" + splitpoint); 
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
          return;
          document.editform.wpTextbox1.value = original;
         }
      }
   }
}

//</nowiki>

//</nowiki>

// [[User:Lupin/popups.js]]

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
popupAdminLinks=true;
popupMaxWidth=400;


//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>'); }

/**************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
********************************************* VoA SCRIPTS START HERE **********************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
***************************************************************************************************************************
**************************************************************************************************************************/

// Admin rollback tools [[Category:Wikipedia administrators who use VoA script|{{PAGENAME}}]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Specialadmin/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//
addOnloadHook(Dfn_js_con)
function Dfn_js_con()
{
//moves
Mvaluejs_class = 'm';
//edits
Rvaluejs_class = 'r';
//uploads
Uvaluejs_class = 'u';
}
//

// </nowiki></pre>