/* generated javascript */
if (!window.skin) {
	var skin = 'monaco';
	var stylepath = 'http://images.wikia.com/common/releases_200911.3/skins';
}

/* MediaWiki:Common.js */
/* Any JavaScript here will be loaded for all users on every page load. */

/*<pre><nowiki>*/

//collapsible tables
importScriptPage('ShowHide/code.js', 'dev');

// ************************************************************************************************
// Edit page tool selector
//  -> modified from http://commons.wikimedia.org/wiki/MediaWiki:Edittools.js

if( wgAction == 'edit'|| wgAction == 'submit' ) {
 addOnloadHook(customCharInsert);

function customCharInsert() {
  if(!window.wgCustomCharInsert||!wgUserName) return;
  var spec = document.getElementById('specialchars');
  var userp = document.createElement('p');
  userp.className = 'specialbasic';
  userp.id = 'Custom_Edittools'
  userp.style.display='none';

  for (var i=0;i<wgCustomCharInsert.length;i++) {
    var a = document.createElement('a');
    a.href='#';
    a.setAttribute('onclick', 'insertTags("' + wgCustomCharInsert[i].tagOpen + '","' + wgCustomCharInsert[i].tagClose + '","' + wgCustomCharInsert[i].sampleText + '"); return false;');
    a.appendChild(document.createTextNode(wgCustomCharInsert[i].tagOpen + wgCustomCharInsert[i].tagClose));
    userp.appendChild(a);
    if(i!=wgCustomCharInsert.length-1) userp.appendChild(document.createTextNode(' · '));
  }
  spec.appendChild(userp);
}

addOnloadHook(edittoolsTabs);

function edittoolsTabs() {
  var spec = document.getElementById('specialchars');
  if(!spec) return;
  var sb = getElementsByClassName(spec,'p','specialbasic');
  if(sb.length<=1) return;

  var sel = document.createElement('select');
  sel.style.display = 'inline';
  sel.setAttribute('onchange','chooseCharSubset(selectedIndex)');

  for(var i=0;i<sb.length;i++) {
    var o = document.createElement('option');
    o.appendChild(document.createTextNode(sb[i].id.replace(/_/g,' ')));
    sel.appendChild(o);
  }
  spec.insertBefore(sel,spec.firstChild.nextSibling);
}

function chooseCharSubset(seld) {
 var spec = document.getElementById('specialchars');
 var sb = getElementsByClassName(spec,'p','specialbasic');
 for (var i = 0; i < sb.length ; i++) {
  sb[i].style.display = i == seld ? 'inline' : 'none';
 }
}

}

function queryString(p) {
  var re = RegExp('[&?]' + p + '=([^&]*)');
  var matches;
  if (matches = re.exec(document.location)) {
    try { 
      return decodeURI(matches[1]);
    } catch (e) {
    }
  }
  return null;
}

/* </pre> */

/*<pre>*/

/**
 * Easy Copy Input
 * Author: Dantman
 */

function initCPinput() {
	$('span.cpinput').each(function() {
		$('<input class=cpinput title="right-click and choose Copy" readonly="readonly" />' )
			.val($(this).html())
			.click(cpInputOnClick).focus(cpInputOnFocus).blur(cpInputOnBlur)
			.insertBefore(this);
		$(this).remove();
	});
}
addOnloadHook(initCPinput);

function cpInputOnClick() {
	this.focus();
}
function cpInputOnFocus() {
	this.select();
	this.style.backgroundColor = '#0000FF';
}
function cpInputOnBlur() {
	this.style.backgroundColor = '#FFFFFF';
}

// </nowiki></pre>

if (mwCustomEditButtons) {

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images1.wikia.nocookie.net/central/images/7/70/Button_disambig.png?1",
     "speedTip": "mark as disambiguation page",
     "tagOpen": "\{\{disambig\}\}",
     "tagClose": "",
     "sampleText": ""};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images2.wikia.nocookie.net/central/images/8/8c/Button_RedX.png?1",
     "speedTip": "request delete",
     "tagOpen": "\{\{delete|",
     "tagClose": "\}\}",
     "sampleText": "your reason here"};
}

/* MediaWiki:Monaco.js */
