/* main.js */
var skin = 'jewage8';
var stylepath = '/w/skins';

var enableHeartbeat = true;

var fbPageOptions = {
	doAnimations: false,
	infoPos: 'tl',
	controlPos: 'tr',
	caption2Pos: 'bl',
	graphicsType: 'international',
	language: wgUserLanguage,
	theme: 'yellow',
	roundCorners: 'all',
	padding: 0,
	shadowType: 'halo',
	disableScroll: true,
	shadowSize: 8,
	titleAsCaption: true,
	licenseKey: "HRLfHwSYFx2:",
	showIE6EndOfLife: true
};

$( function() {
	$(".jqbutton").button(); 
});

var addthis_language = wgUserLanguage; 

String.prototype.trim = function () {
  return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};

String.prototype.fixForSelector = function() {
	return this.replace( ' ', '\\ ' ).replace( ':', '\\:' ).replace( '.', '\\.' );
}

Array.prototype.find = function(searchStr) {
  var returnArray = false;
  for (i=0; i<this.length; i++) {
    if (typeof(searchStr) == 'function') {
      if (searchStr.test(this[i])) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    } else {
      if (this[i]===searchStr) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    }
  }
  return returnArray;
}

function formRemoveListItem( el )
{
	var page = el.rel;
	var prefix = el.rev;
	
	// remove item from list
	el.parentNode.parentNode.removeChild( el.parentNode );
	
	// remove item from hidden field
	var hidden = $('#' + prefix + '_profile');
	hidden.val( removeStringValue( hidden.val(), page, '/' ) );
	
	if( hidden[0].onchange )
		hidden[0].onchange( hidden );
	
	// show editor
	$('#' + prefix + '_edit_div').css( 'display', 'block' );
	
	return false;
}

function formRemovePicture()
{
	$('#picture_id').attr( 'value', '' );
	$('#picture_img').attr( 'src', '' );
	$('#picture_img').addClass( 'hidden' );
	$('#picture_remove').addClass( 'hidden' );
	return false;
}

function removeStringValue( str, value, separator )
{
	var tokens = str.split( separator );
	var tokens2 = [];
	for( var i = 0; i < tokens.length; i++ )
		if( tokens[i] != value )
			tokens2.push( tokens[i] );
			
	return tokens2.join( separator );
}

function doLogout() 
{
	sajax_do_call( "ajaxJLogout", [], logoutCompleted );
	setTimeout( 'startProgress()', 500 );
	return false;
}

function logoutCompleted( resp )
{
	var location = window.location.toString();
	if( location.match( /^.*#$/ ) )
		location = location.substring( 0, location.length - 1 );
	window.location = location;
}

function switchLanguage( lang )
{
	window.location = window.location.href.replace( '/' + wgUserLanguage + '/', '/' + lang + '/' );
}

function startProgress()
{
	endProgress();
	$.blockUI( { message: '<img src="/w/skins/jewage8/ajax-loader.gif" />', css: { width: '250px' } } );
}

function endProgress()
{
	$.unblockUI();
}

// cookie functions
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


function addProgressBar( el )
{
	while( el.childNodes.length > 0 )
		el.removeChild( el.childNodes[0] );
	
	var img = document.createElement( 'img' );
	img.src = wgScriptPath + '/skins/jewage8/ajax-loader.gif';
	
	if( el.nodeType == 'UL' )
	{
		var li = document.createElement( 'li' );
		li.appendChild( img );
		el.appendChild( li );
	}
	else
		el.appendChild( img );
}


 
var loadedScripts = []; // included-scripts tracker


/* Scripts specific to Internet Explorer */
 
if (navigator.appName == "Microsoft Internet Explorer")
{
    /** Internet Explorer bug fix **************************************************
     *
     *  Description: Fixes IE horizontal scrollbar bug
     *  Maintainers: [[User:Tom-]]?
     */
 
    var oldWidth;
    var docEl = document.documentElement;
 
    function fixIEScroll()
    {
        if (!oldWidth || docEl.clientWidth > oldWidth)
            doFixIEScroll();
        else
            setTimeout(doFixIEScroll, 1);
 
        oldWidth = docEl.clientWidth;
    }
 
    function doFixIEScroll() {
        docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
    }
 
    document.attachEvent("onreadystatechange", fixIEScroll);
    document.attachEvent("onresize", fixIEScroll);
 
 
    /**
     * Remove need for CSS hacks regarding MSIE and IPA.
     */
 
    if (document.createStyleSheet) {
        document.createStyleSheet().addRule('.IPA', 'font-family: "Doulos SIL", "Charis SIL", Gentium, "DejaVu Sans", Code2000, "TITUS Cyberbit Basic", "Arial Unicode MS", "Lucida Sans Unicode", "Chrysanthi Unicode";');
    }
}
 
 
/** Table sorting fixes ************************************************
  *
  *  Description: Disables code in table sorting routine to set classes on even/odd rows
  *  Maintainers: [[User:Random832]]
  */
 
ts_alternate_row_colors = false;

/* wikibits.js */
// MediaWiki JavaScript support functions

var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var is_gecko = /gecko/.test( clientPC ) &&
	!/khtml|spoofer|netscape\/7\.0/.test(clientPC);
var webkit_match = clientPC.match(/applewebkit\/(\d+)/);
if (webkit_match) {
	var is_safari = clientPC.indexOf('applewebkit') != -1 &&
		clientPC.indexOf('spoofer') == -1;
	var is_safari_win = is_safari && clientPC.indexOf('windows') != -1;
	var webkit_version = parseInt(webkit_match[1]);
}
var is_khtml = navigator.vendor == 'KDE' ||
	( document.childNodes && !document.all && !navigator.taintEnabled );
// For accesskeys; note that FF3+ is included here!
var is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC );
// These aren't used here, but some custom scripts rely on them
var is_ff2_win = is_ff2 && clientPC.indexOf('windows') != -1;
var is_ff2_x11 = is_ff2 && clientPC.indexOf('x11') != -1;
if (clientPC.indexOf('opera') != -1) {
	var is_opera = true;
	var is_opera_preseven = window.opera && !document.childNodes;
	var is_opera_seven = window.opera && document.childNodes;
	var is_opera_95 = /opera\/(9.[5-9]|[1-9][0-9])/.test( clientPC );
}

// add any onload functions in this hook (please don't hard-code any events in the xhtml source)
var doneOnloadHook;

if (!window.onloadFuncts) {
	var onloadFuncts = [];
}

function addOnloadHook(hookFunct) {
	// Allows add-on scripts to add onload functions
	if(!doneOnloadHook) {
		onloadFuncts[onloadFuncts.length] = hookFunct;
	} else {
		hookFunct();  // bug in MSIE script loading
	}
}

function hookEvent(hookName, hookFunct) {
	if (window.addEventListener) {
		window.addEventListener(hookName, hookFunct, false);
	} else if (window.attachEvent) {
		window.attachEvent("on" + hookName, hookFunct);
	}
}

function importScript(page) {
	return importScriptURI(wgScript + '?action=raw&ctype=text/javascript&title=' + encodeURIComponent(page.replace(/ /g,'_')));
}
 
function importScriptURI(url) {
	if (loadedScripts[url]) {
		return null;
	}
	loadedScripts[url] = true;
	var s = document.createElement('script');
	s.setAttribute('src',url);
	s.setAttribute('type','text/javascript');
	document.getElementsByTagName('head')[0].appendChild(s);
	return s;
}
 
function importStylesheet(page) {
	return importStylesheetURI(wgScript + '?action=raw&ctype=text/css&title=' + encodeURIComponent(page.replace(/ /g,'_')));
}
 
function importStylesheetURI(url) {
	return document.createStyleSheet ? document.createStyleSheet(url) : appendCSS('@import "' + url + '";');
}
 
function appendCSS(text) {
	var s = document.createElement('style');
	s.type = 'text/css';
	s.rel = 'stylesheet';
	if (s.styleSheet) s.styleSheet.cssText = text //IE
	else s.appendChild(document.createTextNode(text + '')) //Safari sometimes borks on null
	document.getElementsByTagName('head')[0].appendChild(s);
	return s;
}

// for enhanced RecentChanges
function toggleVisibility(_levelId, _otherId, _linkId) {
	var thisLevel = document.getElementById(_levelId);
	var otherLevel = document.getElementById(_otherId);
	var linkLevel = document.getElementById(_linkId);
	if (thisLevel.style.display == 'none') {
		thisLevel.style.display = 'block';
		otherLevel.style.display = 'none';
		linkLevel.style.display = 'inline';
	} else {
		thisLevel.style.display = 'none';
		otherLevel.style.display = 'inline';
		linkLevel.style.display = 'none';
	}
}

function changeText(el, newText) {
	// Safari work around
	if (el.innerText) {
		el.innerText = newText;
	} else if (el.firstChild && el.firstChild.nodeValue) {
		el.firstChild.nodeValue = newText;
	}
}

var mwEditButtons = [];
var mwCustomEditButtons = []; // eg to add in MediaWiki:Common.js

function toggle_element_activation(ida,idb) {
	if (!document.getElementById) {
		return;
	}
	document.getElementById(ida).disabled=true;
	document.getElementById(idb).disabled=false;
}

function toggle_element_check(ida,idb) {
	if (!document.getElementById) {
		return;
	}
	document.getElementById(ida).checked=true;
	document.getElementById(idb).checked=false;
}


function runOnloadHook() {
	// don't run anything below this for non-dom browsers
	if (doneOnloadHook || !(document.getElementById && document.getElementsByTagName)) {
		return;
	}
	
	// set this before running any hooks, since any errors below
	// might cause the function to terminate prematurely
	doneOnloadHook = true;

	// Run any added-on functions
	for (var i = 0; i < onloadFuncts.length; i++) {
		onloadFuncts[i]();
	}
}

/**
 * Add an event handler to an element
 *
 * @param Element element Element to add handler to
 * @param String attach Event to attach to
 * @param callable handler Event handler callback
 */
function addHandler( element, attach, handler ) {
	if( window.addEventListener ) {
		element.addEventListener( attach, handler, false );
	} else if( window.attachEvent ) {
		element.attachEvent( 'on' + attach, handler );
	}
}

/**
 * Add a click event handler to an element
 *
 * @param Element element Element to add handler to
 * @param callable handler Event handler callback
 */
function addClickHandler( element, handler ) {
	addHandler( element, 'click', handler );
}
//note: all skins should call runOnloadHook() at the end of html output,
//      so the below should be redundant. It's there just in case.
hookEvent("load", runOnloadHook);

/* ajax.js */
// remote scripting library
// (c) copyright 2005 modernmethod, inc
var sajax_debug_mode = false;
var sajax_request_type = "GET";

/**
* if sajax_debug_mode is true, this function outputs given the message into 
* the element with id = sajax_debug; if no such element exists in the document, 
* it is injected.
*/
function sajax_debug(text) {
	if (!sajax_debug_mode) return false;

	var e= document.getElementById('sajax_debug');

	if (!e) {
		e= document.createElement("p");
		e.className= 'sajax_debug';
		e.id= 'sajax_debug';

		var b= document.getElementsByTagName("body")[0];

		if (b.firstChild) b.insertBefore(e, b.firstChild);
		else b.appendChild(e);
	}

	var m= document.createElement("div");
	m.appendChild( document.createTextNode( text ) );

	e.appendChild( m );

	return true;
}

/**
* compatibility wrapper for creating a new XMLHttpRequest object.
*/
function sajax_init_object() {
	sajax_debug("sajax_init_object() called..")
	var A;
	try {
		// Try the new style before ActiveX so we don't
		// unnecessarily trigger warnings in IE 7 when
		// set to prompt about ActiveX usage
		A = new XMLHttpRequest();
	} catch (e) {
		try {
			A=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				A=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (oc) {
				A=null;
			}
		}
	}
	if (!A)
		sajax_debug("Could not create connection object.");

	return A;
}

/**
* Perform an ajax call to mediawiki. Calls are handeled by AjaxDispatcher.php
*   func_name - the name of the function to call. Must be registered in $wgAjaxExportList
*   args - an array of arguments to that function
*   target - the target that will handle the result of the call. If this is a function,
*            if will be called with the XMLHttpRequest as a parameter; if it's an input
*            element, its value will be set to the resultText; if it's another type of
*            element, its innerHTML will be set to the resultText.
*
* Example:
*    sajax_do_call('doFoo', [1, 2, 3], document.getElementById("showFoo"));
*
* This will call the doFoo function via MediaWiki's AjaxDispatcher, with
* (1, 2, 3) as the parameter list, and will show the result in the element
* with id = showFoo
*/
function sajax_do_call(func_name, args, target) {
	var i, x, n;
	var uri;
	var post_data;
	uri = wgServer +
		((wgScript == null) ? (wgScriptPath + "/index.php") : wgScript) +
		"?action=ajax";
	if (sajax_request_type == "GET") {
		if (uri.indexOf("?") == -1)
			uri = uri + "?rs=" + encodeURIComponent(func_name);
		else
			uri = uri + "&rs=" + encodeURIComponent(func_name);
		for (i = 0; i < args.length; i++)
			uri = uri + "&rsargs[]=" + encodeURIComponent(args[i]);
		//uri = uri + "&rsrnd=" + new Date().getTime();
		post_data = null;
	} else {
		post_data = "rs=" + encodeURIComponent(func_name);
		for (i = 0; i < args.length; i++)
			post_data = post_data + "&rsargs[]=" + encodeURIComponent(args[i]);
	}
	x = sajax_init_object();
	if (!x) {
		alert("AJAX not supported");
		return false;
	}

	try {
		x.open(sajax_request_type, uri, true);
	} catch (e) {
		if (window.location.hostname == "localhost") {
			alert("Your browser blocks XMLHttpRequest to 'localhost', try using a real hostname for development/testing.");
		}
		throw e;
	}
	if (sajax_request_type == "POST") {
		x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1");
		x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	}
	x.setRequestHeader("Pragma", "cache=yes");
	x.setRequestHeader("Cache-Control", "no-transform");
	x.onreadystatechange = function() {
		if (x.readyState != 4)
			return;

		sajax_debug("received (" + x.status + " " + x.statusText + ") " + x.responseText);

		//if (x.status != 200)
		//	alert("Error: " + x.status + " " + x.statusText + ": " + x.responseText);
		//else

		if ( typeof( target ) == 'function' ) {
			target( x );
		}
		else if ( typeof( target ) == 'object' ) {
			if ( target.tagName == 'INPUT' ) {
				if (x.status == 200) target.value= x.responseText;
				//else alert("Error: " + x.status + " " + x.statusText + " (" + x.responseText + ")");
			}
			else {
				if (x.status == 200) target.innerHTML = x.responseText;
				else target.innerHTML= "<div class='error'>Error: " + x.status + " " + x.statusText + " (" + x.responseText + ")</div>";
			}
		}
		else {
			alert("bad target for sajax_do_call: not a function or object: " + target);
		}

		return;
	}

	sajax_debug(func_name + " uri = " + uri + " / post = " + post_data);
	x.send(post_data);
	sajax_debug(func_name + " waiting..");
	//delete x;
	
	return x;

	return true;
}


function heartbeat()
{
	if( sajax_init_object() && enableHeartbeat )
	{
		sajax_do_call( "wfHeartbeat", [], function( result ) {} );
		setTimeout( 'heartbeat()', 60000 );
	}
}

if( wgUserName )
	setTimeout( 'heartbeat()', 60000 );


function faviconizeDivClass() { 
	$('.faviconize a').each( function() {
		var jqt = $(this); 
		if( !jqt.attr('faviconized') )
		{
			var hoststring = /^http:/;
			var hrefvalue = jqt.attr("href");
			if (hrefvalue.search(hoststring) != -1) {
				var domain = hrefvalue.match(/(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)/);
				domain = RegExp.$2;
				var cue = document.createElement("img");
				cue.className = "faviconimg";
				var cuesrc = "http://"+domain+"/favicon.ico";
				cue.setAttribute("src",cuesrc);
				cue.onerror = function () {
					this.src = stylepath + "/common/images/link_icon.gif";
					}
				jqt.before(cue);
				jqt.attr('faviconized', '1');
			}
		}
	});
}

addOnloadHook( faviconizeDivClass );


if( !wgUserName )
	addOnloadHook( function() { 
		$("#top_login_password_2").focus( function() {
			$(this).addClass( "hidden" );
			$("#top_login_password").removeClass( "hidden" );
			$('#top_login_password').focus();
		});
		
		$("#top_login_name").focus( function() {
			var jqt = $(this);
			if( jqt.attr( 'title' ) == jqt.attr( 'value' ) )
				jqt.attr( 'value', '' );
		});
	
		$("#top_login_name").blur( function() {
			var jqt = $(this);
			if( jqt.attr( 'value' ) == '' )
				jqt.attr( 'value', jqt.attr( 'title' ) );
		});
	
		$("#top_login_name").attr( "value", $("#top_login_name").attr( "title" ) );
		$("#top_login_password_2").attr( 'value', $( "#top_login_password_2" ).attr( "title" ) );
	} );



/*
  popupmenu.js - simple JavaScript popup menu library.

  Copyright (C) 2008 Jiro Nishiguchi <jiro@cpan.org> All rights reserved.
  This is free software with ABSOLUTELY NO WARRANTY.

  You can redistribute it and/or modify it under the modified BSD license.

  Usage:
    var popup = new PopupMenu();
    popup.add(menuText, function(target){ ... });
    popup.addSeparator();
    popup.bind('targetElement');
    popup.bind(); // target is document;
*/
var PopupMenu=function(a){this.init(a)};PopupMenu.MODE_CONTEXT=1;PopupMenu.MODE_BUTTON=2;PopupMenu.SEPARATOR="PopupMenu.SEPARATOR";PopupMenu.current=null;PopupMenu.addEventListener=function(d,c,b,a){if(typeof d=="string"){d=document.getElementById(d)}if(d.addEventListener){d.addEventListener(c,b,a)}else{if(d.attachEvent){d.attachEvent("on"+c,b)}}};PopupMenu.prototype={init:function(a){this.items=[];this.width=0;this.height=0;this.mode=a},setSize:function(width,height){this.width=width;this.height=height;if(this.element){var self=this;with(this.element.style){if(self.width){width=self.width+"px"}if(self.height){height=self.height+"px"}}}},bind:function(b){var a=this;if(!b){b=document}else{if(typeof b=="string"){b=document.getElementById(b)}}this.target=b;if(this.mode==PopupMenu.MODE_CONTEXT){this.target.oncontextmenu=function(d){a.show.call(a,d);return false}}else{if(navigator.userAgent.indexOf("MSIE")!=-1){this.target.onmouseover=function(d){a.show.call(a,d);return false}}else{this.target.onclick=function(d){a.show.call(a,d);return false}}}var c=function(){a.hide.call(a)};PopupMenu.addEventListener(document,"click",c,true)},add:function(a,b){this.items.push({text:a,callback:b})},addSeparator:function(){this.items.push(PopupMenu.SEPARATOR)},setPos:function(b){if(!this.element){return}if(!b){b=window.event}var a,c;if(window.opera){a=b.clientX;c=b.clientY}else{if(document.all){a=document.documentElement.scrollLeft+event.clientX;c=document.documentElement.scrollTop+event.clientY}else{if(document.layers||document.getElementById){a=b.pageX;c=b.pageY}}}this.element.style.top=c+"px";this.element.style.left=a+"px"},show:function(a){if(PopupMenu.current&&PopupMenu.current!=this){PopupMenu.current.hide()}PopupMenu.current=this;if(this.element){this.setPos(a);this.element.style.display="block"}else{this.element=this.createMenu(this.items);this.setPos(a);document.body.appendChild(this.element)}},hide:function(){PopupMenu.current=null;if(this.element){this.element.style.display="none"}},createMenu:function(items){var self=this;var menu=document.createElement("div");with(menu.style){if(self.width){width=self.width+"px"}if(self.height){height=self.height+"px"}border="1px solid gray";background="#FFFFFF";color="#000000";position="absolute";display="block";padding="2px";cursor="default";zIndex="100"}for(var i=0;i<items.length;i++){var item;if(items[i]==PopupMenu.SEPARATOR){item=this.createSeparator()}else{item=this.createItem(items[i])}menu.appendChild(item)}return menu},createItem:function(c){var a=this;var b=document.createElement("div");b.style.padding="4px";var d=c.callback;PopupMenu.addEventListener(b,"click",function(e){return function(){a.hide();e(a.target)}}(d),true);PopupMenu.addEventListener(b,"mouseover",function(f){b.style.background="#B6BDD2"},true);PopupMenu.addEventListener(b,"mouseout",function(f){b.style.background="#FFFFFF"},true);b.appendChild(document.createTextNode(c.text));return b},createSeparator:function(){var sep=document.createElement("div");with(sep.style){borderTop="1px dotted #CCCCCC";fontSize="0px";height="0px"}return sep}};



// pixlr
var pixlr=function(){function windowSize(){var w=0,h=0;if(!(document.documentElement.clientWidth==0)){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight;}
else{w=document.body.clientWidth;h=document.body.clientHeight;}
return{width:w,height:h};}
function extend(settings,options){var mashup={};for(var attribute in settings){mashup[attribute]=settings[attribute];}
for(var attribute in options){mashup[attribute]=options[attribute];}
return mashup;}
function buildUrl(opt){var url='';for(var attribute in opt){if(attribute!='service')url+=((url!='')?"&":"?")+attribute+"="+escape(opt[attribute]);}
return'http://pixlr.com/'+opt.service+'/'+url;}
var bo={ie:window.ActiveXObject,ie6:window.ActiveXObject&&(document.implementation!=null)&&(document.implementation.hasFeature!=null)&&(window.XMLHttpRequest==null),quirks:document.compatMode==='BackCompat'}
return{settings:{'service':'editor'},overlay:{show:function(options){var opt=extend(pixlr.settings,options||{});var iframe=document.createElement('iframe'),div=pixlr.overlay.div=document.createElement('div'),idiv=pixlr.overlay.idiv=document.createElement('div');div.style.background='#696969';div.style.opacity=0.8;div.style.filter='alpha(opacity=80)';if((bo.ie&&bo.quirks)||bo.ie6){var size=windowSize();div.style.position='absolute';div.style.width=size.width+'px';div.style.height=size.height+'px';div.style.setExpression('top',"(t=document.documentElement.scrollTop||document.body.scrollTop)+'px'");div.style.setExpression('left',"(l=document.documentElement.scrollLeft||document.body.scrollLeft)+'px'");}
else{div.style.width='100%';div.style.height='100%';div.style.top='0';div.style.left='0';div.style.position='fixed';}
div.style.zIndex=99998;idiv.style.border='1px solid #2c2c2c';if((bo.ie&&bo.quirks)||bo.ie6){idiv.style.position='absolute';idiv.style.setExpression('top',"25+((t=document.documentElement.scrollTop||document.body.scrollTop))+'px'");idiv.style.setExpression('left',"35+((l=document.documentElement.scrollLeft||document.body.scrollLeft))+'px'");}
else{idiv.style.position='fixed';idiv.style.top='25px';idiv.style.left='35px';}
idiv.style.zIndex=99999;document.body.appendChild(div);document.body.appendChild(idiv);iframe.style.width=(div.offsetWidth-70)+'px';iframe.style.height=(div.offsetHeight-50)+'px';iframe.style.border='1px solid #b1b1b1';iframe.style.backgroundColor='#606060';iframe.style.display='block';iframe.frameBorder=0;iframe.src=buildUrl(opt);idiv.appendChild(iframe);},hide:function(callback){if(pixlr.overlay.idiv&&pixlr.overlay.div){document.body.removeChild(pixlr.overlay.idiv);document.body.removeChild(pixlr.overlay.div);}
if(callback){eval(callback);}}},window:function(options){var opt=extend(pixlr.settings,options||{});if(!window.open(buildUrl(opt),"pixlr","location=0,status=0,scrollbars=0")){alert("The editor window was blocked by your browser, please add pixlr.com to your pop-up blocker.");}},open:function(options){var opt=extend(pixlr.settings,options||{});location.href=buildUrl(opt);}}}();

pixlr.settings.target = "http://" + window.location.hostname + "/w/extensions/JATools/images/save_post_modal.php";
pixlr.settings.exit = "http://" + window.location.hostname + "/w/extensions/JATools/images/exit_modal.php";
pixlr.settings.credentials = true;
pixlr.settings.method = 'post';
pixlr.settings.locktitle = true;
pixlr.settings.locktype = true;
pixlr.settings.referrer = 'JewAge';
pixlr.settings.loc = wgUserLanguage; 
pixlr.settings.service = 'express'; 



/*!
 * jQuery blockUI plugin
 * Version 2.33 (29-MAR-2010)
 * @requires jQuery v1.2.3 or later
 *
 * Examples at: http://malsup.com/jquery/block/
 * Copyright (c) 2007-2008 M. Alsup
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Thanks to Amir-Hossein Sobhi for some excellent contributions!
 */
(function(i){if(/1\.(0|1|2)\.(0|1|2)/.test(i.fn.jquery)||/^1.1/.test(i.fn.jquery)){alert("blockUI requires jQuery v1.2.3 or later!  You are using v"+i.fn.jquery);return}i.fn._fadeIn=i.fn.fadeIn;var c=function(){};var j=document.documentMode||0;var e=i.browser.msie&&((i.browser.version<8&&!j)||j<8);var f=i.browser.msie&&/MSIE 6.0/.test(navigator.userAgent)&&!j;i.blockUI=function(p){d(window,p)};i.unblockUI=function(p){h(window,p)};i.growlUI=function(t,r,s,p){var q=i('<div class="growlUI"></div>');if(t){q.append("<h1>"+t+"</h1>")}if(r){q.append("<h2>"+r+"</h2>")}if(s==undefined){s=3000}i.blockUI({message:q,fadeIn:700,fadeOut:1000,centerY:false,timeout:s,showOverlay:false,onUnblock:p,css:i.blockUI.defaults.growlCSS})};i.fn.block=function(p){return this.unblock({fadeOut:0}).each(function(){if(i.css(this,"position")=="static"){this.style.position="relative"}if(i.browser.msie){this.style.zoom=1}d(this,p)})};i.fn.unblock=function(p){return this.each(function(){h(this,p)})};i.blockUI.version=2.33;i.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:true,theme:false,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:0.6,cursor:"wait"},growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:0.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:false,baseZ:1000,centerX:true,centerY:true,allowBodyStretch:true,bindEvents:true,constrainTabKey:true,fadeIn:200,fadeOut:400,timeout:0,showOverlay:true,focusInput:true,applyPlatformOpacityRules:true,onBlock:null,onUnblock:null,quirksmodeOffsetHack:4};var b=null;var g=[];function d(r,F){var A=(r==window);var w=F&&F.message!==undefined?F.message:undefined;F=i.extend({},i.blockUI.defaults,F||{});F.overlayCSS=i.extend({},i.blockUI.defaults.overlayCSS,F.overlayCSS||{});var C=i.extend({},i.blockUI.defaults.css,F.css||{});var N=i.extend({},i.blockUI.defaults.themedCSS,F.themedCSS||{});w=w===undefined?F.message:w;if(A&&b){h(window,{fadeOut:0})}if(w&&typeof w!="string"&&(w.parentNode||w.jquery)){var I=w.jquery?w[0]:w;var P={};i(r).data("blockUI.history",P);P.el=I;P.parent=I.parentNode;P.display=I.style.display;P.position=I.style.position;if(P.parent){P.parent.removeChild(I)}}var B=F.baseZ;var M=(i.browser.msie||F.forceIframe)?i('<iframe class="blockUI" style="z-index:'+(B++)+';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+F.iframeSrc+'"></iframe>'):i('<div class="blockUI" style="display:none"></div>');var L=i('<div class="blockUI blockOverlay" style="z-index:'+(B++)+';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');var K,G;if(F.theme&&A){G='<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+B+';display:none;position:fixed"><div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(F.title||"&nbsp;")+'</div><div class="ui-widget-content ui-dialog-content"></div></div>'}else{if(F.theme){G='<div class="blockUI blockMsg blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+B+';display:none;position:absolute"><div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(F.title||"&nbsp;")+'</div><div class="ui-widget-content ui-dialog-content"></div></div>'}else{if(A){G='<div class="blockUI blockMsg blockPage" style="z-index:'+B+';display:none;position:fixed"></div>'}else{G='<div class="blockUI blockMsg blockElement" style="z-index:'+B+';display:none;position:absolute"></div>'}}}K=i(G);if(w){if(F.theme){K.css(N);K.addClass("ui-widget-content")}else{K.css(C)}}if(!F.applyPlatformOpacityRules||!(i.browser.mozilla&&/Linux/.test(navigator.platform))){L.css(F.overlayCSS)}L.css("position",A?"fixed":"absolute");if(i.browser.msie||F.forceIframe){M.css("opacity",0)}var y=[M,L,K],O=A?i("body"):i(r);i.each(y,function(){this.appendTo(O)});if(F.theme&&F.draggable&&i.fn.draggable){K.draggable({handle:".ui-dialog-titlebar",cancel:"li"})}var v=e&&(!i.boxModel||i("object,embed",A?null:r).length>0);if(f||v){if(A&&F.allowBodyStretch&&i.boxModel){i("html,body").css("height","100%")}if((f||!i.boxModel)&&!A){var E=m(r,"borderTopWidth"),J=m(r,"borderLeftWidth");var x=E?"(0 - "+E+")":0;var D=J?"(0 - "+J+")":0}i.each([M,L,K],function(t,S){var z=S[0].style;z.position="absolute";if(t<2){A?z.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+F.quirksmodeOffsetHack+') + "px"'):z.setExpression("height",'this.parentNode.offsetHeight + "px"');A?z.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):z.setExpression("width",'this.parentNode.offsetWidth + "px"');if(D){z.setExpression("left",D)}if(x){z.setExpression("top",x)}}else{if(F.centerY){if(A){z.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')}z.marginTop=0}else{if(!F.centerY&&A){var Q=(F.css&&F.css.top)?parseInt(F.css.top):0;var R="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+Q+') + "px"';z.setExpression("top",R)}}}})}if(w){if(F.theme){K.find(".ui-widget-content").append(w)}else{K.append(w)}if(w.jquery||w.nodeType){i(w).show()}}if((i.browser.msie||F.forceIframe)&&F.showOverlay){M.show()}if(F.fadeIn){var H=F.onBlock?F.onBlock:c;var q=(F.showOverlay&&!w)?H:c;var p=w?H:c;if(F.showOverlay){L._fadeIn(F.fadeIn,q)}if(w){K._fadeIn(F.fadeIn,p)}}else{if(F.showOverlay){L.show()}if(w){K.show()}if(F.onBlock){F.onBlock()}}l(1,r,F);if(A){b=K[0];g=i(":input:enabled:visible",b);if(F.focusInput){setTimeout(o,20)}}else{a(K[0],F.centerX,F.centerY)}if(F.timeout){var u=setTimeout(function(){A?i.unblockUI(F):i(r).unblock(F)},F.timeout);i(r).data("blockUI.timeout",u)}}function h(s,t){var r=(s==window);var q=i(s);var u=q.data("blockUI.history");var v=q.data("blockUI.timeout");if(v){clearTimeout(v);q.removeData("blockUI.timeout")}t=i.extend({},i.blockUI.defaults,t||{});l(0,s,t);var p;if(r){p=i("body").children().filter(".blockUI").add("body > .blockUI")}else{p=i(".blockUI",s)}if(r){b=g=null}if(t.fadeOut){p.fadeOut(t.fadeOut);setTimeout(function(){k(p,u,t,s)},t.fadeOut)}else{k(p,u,t,s)}}function k(p,s,r,q){p.each(function(t,u){if(this.parentNode){this.parentNode.removeChild(this)}});if(s&&s.el){s.el.style.display=s.display;s.el.style.position=s.position;if(s.parent){s.parent.appendChild(s.el)}i(q).removeData("blockUI.history")}if(typeof r.onUnblock=="function"){r.onUnblock(q,r)}}function l(p,t,u){var s=t==window,r=i(t);if(!p&&(s&&!b||!s&&!r.data("blockUI.isBlocked"))){return}if(!s){r.data("blockUI.isBlocked",p)}if(!u.bindEvents||(p&&!u.showOverlay)){return}var q="mousedown mouseup keydown keypress";p?i(document).bind(q,u,n):i(document).unbind(q,n)}function n(s){if(s.keyCode&&s.keyCode==9){if(b&&s.data.constrainTabKey){var r=g;var q=!s.shiftKey&&s.target==r[r.length-1];var p=s.shiftKey&&s.target==r[0];if(q||p){setTimeout(function(){o(p)},10);return false}}}if(i(s.target).parents("div.blockMsg").length>0){return true}return i(s.target).parents().children().filter("div.blockUI").length==0}function o(p){if(!g){return}var q=g[p===true?g.length-1:0];if(q){q.focus()}}function a(w,q,A){var z=w.parentNode,v=w.style;var r=((z.offsetWidth-w.offsetWidth)/2)-m(z,"borderLeftWidth");var u=((z.offsetHeight-w.offsetHeight)/2)-m(z,"borderTopWidth");if(q){v.left=r>0?(r+"px"):"0"}if(A){v.top=u>0?(u+"px"):"0"}}function m(q,r){return parseInt(i.css(q,r))||0}})(jQuery);

/* Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * Version: 3.0.2
 * 
 * Requires: 1.2.2+
 */
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);

/* ezCookie */
(function($){cOptions={expires:365,domain:'',secure:false,path:'/'}
$.cookie=function(cookieName){var value=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,cookieName.length+1)==(cookieName+'=')){value=decodeURIComponent(cookie.substring(cookieName.length+1));break;}}}
try{return JSON.parse(value);}catch(e){return value;}}
$.subCookie=function(cookie,key){var cookie=$.cookie(cookie);if(!cookie||typeof cookie!='object'){return null;}
return cookie[key];}
$.setCookie=function(cookieName,cookieValue,options){var options=typeof options!='undefined'?$.extend(cOptions,options):cOptions;var path='; path='+(options.path);var domain='; domain='+(options.domain);var secure=options.secure?'; secure':'';if(cookieValue&&(typeof cookieValue=='function'||typeof cookieValue=='object')){cookieValue=JSON.stringify(cookieValue);}
cookieValue=encodeURIComponent(cookieValue);var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
var expires='; expires='+date.toUTCString();document.cookie=[cookieName,'=',cookieValue,expires,path,domain,secure].join('');}
$.setSubCookie=function(cookie,key,value,options){var options=typeof options!='undefined'?$.extend(cOptions,options):cOptions;var existingCookie=$.cookie(cookie);var cookieObject=existingCookie&&typeof existingCookie=='object'?existingCookie:{};cookieObject[key]=value;$.setCookie(cookie,cookieObject,options);}
$.removeSubCookie=function(cookie,key){var cookieObject=$.cookie(cookie);if(cookieObject&&typeof cookieObject=='object'&&typeof cookieObject[key]!='undefined'){delete cookieObject[key];$.setCookie(cookie,cookieObject);}}
$.removeCookie=function(cookie){$.setCookie(cookie,'',{expires:-1});}
$.clearCookie=function(cookie){$.setCookie(cookie,'');}})(jQuery);if(!this.JSON){this.JSON={};}
(function(){function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());