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

var enableHeartbeat = true;

var fbPageOptions = {
	doAnimations: true,
	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_config = { 
	ui_language: wgUserLanguage, 
	data_track_clickback: true 
}

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" ) );
	} );


/* SMW_tooltips.js */

addOnloadHook(smw_tooltipInit);BubbleTT=new Object();BubbleTT.Platform=new Object();var tt=null;var all_tt=[];var imagePath=wgScriptPath+"/extensions/SemanticMediaWiki/skins/images/";var SMWTT_WIDTH_P=200;var SMWTT_HEIGHT_P=80;var SMWTT_WIDTH_I=150;var SMWTT_HEIGHT_I=50;function smw_tooltipInit(){var anchs=document.getElementsByTagName("span");for(var i=0;i<anchs.length;i++){if(anchs[i].className=="smwttpersist")smw_makePersistentTooltip(anchs[i]);if(anchs[i].className=="smwttinline")smw_makeInlineTooltip(anchs[i]);}}
function smw_makeInlineTooltip(a){var spans=a.getElementsByTagName("span");a.className="smwttactiveinline";for(var i=0;i<spans.length;i++){if(spans[i].className=="smwttcontent"){spans[i].style.display="none";}}
a.onmouseover=smw_showTooltipInline;a.onmouseout=smw_hideTooltip;}
function smw_makePersistentTooltip(a){var spans=a.getElementsByTagName("span");a.className="smwttactivepersist";for(var i=0;i<spans.length;i++){if(spans[i].className=="smwtticon"){img=document.createElement("img");img.setAttribute("src",imagePath+spans[i].innerHTML);img.className="smwttimg";a.replaceChild(img,a.firstChild);}
if(spans[i].className=="smwttcontent"){spans[i].style.display="none";}}
if(BubbleTT.Platform.browser.isIE){a.attachEvent("onclick",smw_showTooltipPersist);}else{a.addEventListener("click",smw_showTooltipPersist,false);}}
function smw_showTooltipPersist(e){var x;var y;if(BubbleTT.Platform.browser.isIE){c=BubbleTT.getElementCoordinates(window.event.srcElement);x=c.left;y=c.top;}else{x=e.pageX;y=e.pageY;}
var origin=(BubbleTT.Platform.browser.isIE)?window.event.srcElement:e.target;while(!(origin.className=="smwttactivepersist")){origin=origin.parentNode};tt=BubbleTT.createBubbleForPoint(true,origin,x,y,SMWTT_WIDTH_P,SMWTT_HEIGHT_P);all_tt.push(tt);BubbleTT.fillBubble(tt,origin);if(BubbleTT.Platform.browser.isIE){origin.detachEvent("onclick",smw_showTooltipPersist);}else{origin.removeEventListener("click",smw_showTooltipPersist,false);}}
function smw_showTooltipInline(e){if(tt!=null){return;}
var x;var y;if(BubbleTT.Platform.browser.isIE){c=BubbleTT.getElementCoordinates(window.event.srcElement);x=c.left;y=c.top;}else{x=e.pageX;y=e.pageY;}
var origin=(BubbleTT.Platform.browser.isIE)?window.event.srcElement:e.target;while(!(origin.className=="smwttactiveinline"))origin=origin.parentNode;var doc=origin.ownerDocument;tt=BubbleTT.createBubbleForPoint(false,origin,x,y,SMWTT_WIDTH_I,SMWTT_HEIGHT_I);BubbleTT.fillBubble(tt,origin);}
function smw_hideTooltip(){if(tt){tt.close();tt=null;}}
function _smw_hideAllTooltips(){for(var i=0;i<all_tt.length;i++){all_tt[i].close();}
all_tt=[];}
BubbleTT.getElementCoordinates=function(elmt){var left=0;var top=0;if(elmt.nodeType!=1){elmt=elmt.parentNode;}
while(elmt!=null){left+=elmt.offsetLeft;top+=elmt.offsetTop-(elmt.scrollTop?elmt.scrollTop:0);elmt=elmt.offsetParent;}
top+=document.documentElement.scrollTop;return{left:left,top:top};};BubbleTT._bubbleMargins={top:33,bottom:42,left:33,right:40}
BubbleTT._arrowOffsets={top:0,bottom:9,left:1,right:8}
BubbleTT._bubblePadding=15;BubbleTT._bubblePointOffset=15;BubbleTT._halfArrowWidth=18;BubbleTT.createBubbleForPoint=function(closingButton,origin,pageX,pageY,contentWidth,contentHeight){var doc=origin.ownerDocument;var bubble={_closed:false,_doc:doc,close:function(){if(!this._closed){this._doc.body.removeChild(this._div);this._doc=null;this._div=null;this._content=null;this._closed=true;if(closingButton){if(BubbleTT.Platform.browser.isIE){origin.attachEvent("onclick",smw_showTooltipPersist);}else{origin.addEventListener("click",smw_showTooltipPersist,false);}}}}};var docWidth=doc.body.offsetWidth;var docHeight=doc.body.offsetHeight;var margins=BubbleTT._bubbleMargins;var bubbleWidth=margins.left+contentWidth+margins.right;var bubbleHeight=margins.top+contentHeight+margins.bottom;var pngIsTranslucent=(!BubbleTT.Platform.browser.isIE)||(BubbleTT.Platform.browser.majorVersion>6);var setImg=function(elmt,url,width,height){elmt.style.position="absolute";elmt.style.width=width+"px";elmt.style.height=height+"px";if(pngIsTranslucent){elmt.style.background="url("+url+")";}else{elmt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"', sizingMethod='crop')";}}
var div=doc.createElement("div");div.style.width=bubbleWidth+"px";div.style.height=bubbleHeight+"px";div.style.position="absolute";div.style.zIndex=1000;bubble._div=div;var divInner=doc.createElement("div");divInner.style.width="100%";divInner.style.height="100%";divInner.style.position="relative";div.appendChild(divInner);var createImg=function(url,left,top,width,height){var divImg=doc.createElement("div");divImg.style.left=left+"px";divImg.style.top=top+"px";setImg(divImg,url,width,height);divInner.appendChild(divImg);}
createImg(imagePath+"bubble-top-left.png",0,0,margins.left,margins.top);createImg(imagePath+"bubble-top.png",margins.left,0,contentWidth,margins.top);createImg(imagePath+"bubble-top-right.png",margins.left+contentWidth,0,margins.right,margins.top);createImg(imagePath+"bubble-left.png",0,margins.top,margins.left,contentHeight);createImg(imagePath+"bubble-right.png",margins.left+contentWidth,margins.top,margins.right,contentHeight);createImg(imagePath+"bubble-bottom-left.png",0,margins.top+contentHeight,margins.left,margins.bottom);createImg(imagePath+"bubble-bottom.png",margins.left,margins.top+contentHeight,contentWidth,margins.bottom);createImg(imagePath+"bubble-bottom-right.png",margins.left+contentWidth,margins.top+contentHeight,margins.right,margins.bottom);if(closingButton){var divClose=doc.createElement("div");divClose.style.left=(bubbleWidth-margins.right+BubbleTT._bubblePadding-16-2)+"px";divClose.style.top=(margins.top-BubbleTT._bubblePadding+1)+"px";divClose.style.cursor="pointer";setImg(divClose,imagePath+"close-button.png",16,16);BubbleTT.DOM.registerEventWithObject(divClose,"click",bubble,bubble.close);divInner.appendChild(divClose);}
var divContent=doc.createElement("div");divContent.style.position="absolute";divContent.style.left=margins.left+"px";divContent.style.top=margins.top+"px";divContent.style.width=contentWidth+"px";divContent.style.height=contentHeight+"px";divContent.style.overflow="auto";divContent.style.background="white";divInner.appendChild(divContent);bubble.content=divContent;(function(){if(pageX-BubbleTT._halfArrowWidth-BubbleTT._bubblePadding>0&&pageX+BubbleTT._halfArrowWidth+BubbleTT._bubblePadding<docWidth){var left=pageX-Math.round(contentWidth/2)-margins.left;left=pageX<(docWidth/2)?Math.max(left,-(margins.left-BubbleTT._bubblePadding)):Math.min(left,docWidth+(margins.right-BubbleTT._bubblePadding)-bubbleWidth);if(pageY-BubbleTT._bubblePointOffset-bubbleHeight>0){var divImg=doc.createElement("div");divImg.style.left=(pageX-BubbleTT._halfArrowWidth-left)+"px";divImg.style.top=(margins.top+contentHeight)+"px";setImg(divImg,imagePath+"bubble-bottom-arrow.png",37,margins.bottom);divInner.appendChild(divImg);div.style.left=left+"px";div.style.top=(pageY-BubbleTT._bubblePointOffset-bubbleHeight+
BubbleTT._arrowOffsets.bottom)+"px";return;}else if(pageY+BubbleTT._bubblePointOffset+bubbleHeight<docHeight){var divImg=doc.createElement("div");divImg.style.left=(pageX-BubbleTT._halfArrowWidth-left)+"px";divImg.style.top="0px";setImg(divImg,imagePath+"bubble-top-arrow.png",37,margins.top);divInner.appendChild(divImg);div.style.left=left+"px";div.style.top=(pageY+BubbleTT._bubblePointOffset-
BubbleTT._arrowOffsets.top)+"px";return;}}
var top=pageY-Math.round(contentHeight/2)-margins.top;top=pageY<(docHeight/2)?Math.max(top,-(margins.top-BubbleTT._bubblePadding)):Math.min(top,docHeight+(margins.bottom-BubbleTT._bubblePadding)-bubbleHeight);if(pageX-BubbleTT._bubblePointOffset-bubbleWidth>0){var divImg=doc.createElement("div");divImg.style.left=(margins.left+contentWidth)+"px";divImg.style.top=(pageY-BubbleTT._halfArrowWidth-top)+"px";setImg(divImg,imagePath+"bubble-right-arrow.png",margins.right,37);divInner.appendChild(divImg);div.style.left=(pageX-BubbleTT._bubblePointOffset-bubbleWidth+
BubbleTT._arrowOffsets.right)+"px";div.style.top=top+"px";}else{var divImg=doc.createElement("div");divImg.style.left="0px";divImg.style.top=(pageY-BubbleTT._halfArrowWidth-top)+"px";setImg(divImg,imagePath+"bubble-left-arrow.png",margins.left,37);divInner.appendChild(divImg);div.style.left=(pageX+BubbleTT._bubblePointOffset-
BubbleTT._arrowOffsets.left)+"px";div.style.top=top+"px";}})();doc.body.appendChild(div);return bubble;};BubbleTT.fillBubble=function(bubble,origin){doc=bubble._doc;div=doc.createElement("div");div.className="smwtt";spans=origin.getElementsByTagName("span");for(i=0;i<spans.length;i++){if(spans[i].className=="smwttcontent"){div.innerHTML=spans[i].innerHTML.replace(/\n/g,"<br />");div.innerHTML=spans[i].innerHTML.replace(/<!--br-->/g,"<br />");}}
bubble.content.appendChild(div);}
BubbleTT.Platform.os={isMac:false,isWin:false,isWin32:false,isUnix:false};BubbleTT.Platform.browser={isIE:false,isNetscape:false,isMozilla:false,isFirefox:false,isOpera:false,isSafari:false,majorVersion:0,minorVersion:0};(function(){var an=navigator.appName.toLowerCase();var ua=navigator.userAgent.toLowerCase();BubbleTT.Platform.os.isMac=(ua.indexOf('mac')!=-1);BubbleTT.Platform.os.isWin=(ua.indexOf('win')!=-1);BubbleTT.Platform.os.isWin32=BubbleTT.Platform.isWin&&(ua.indexOf('95')!=-1||ua.indexOf('98')!=-1||ua.indexOf('nt')!=-1||ua.indexOf('win32')!=-1||ua.indexOf('32bit')!=-1);BubbleTT.Platform.os.isUnix=(ua.indexOf('x11')!=-1);BubbleTT.Platform.browser.isIE=(an.indexOf("microsoft")!=-1);BubbleTT.Platform.browser.isNetscape=(an.indexOf("netscape")!=-1);BubbleTT.Platform.browser.isMozilla=(ua.indexOf("mozilla")!=-1);BubbleTT.Platform.browser.isFirefox=(ua.indexOf("firefox")!=-1);BubbleTT.Platform.browser.isOpera=(an.indexOf("opera")!=-1);var parseVersionString=function(s){var a=s.split(".");BubbleTT.Platform.browser.majorVersion=parseInt(a[0]);BubbleTT.Platform.browser.minorVersion=parseInt(a[1]);};var indexOf=function(s,sub,start){var i=s.indexOf(sub,start);return i>=0?i:s.length;};if(BubbleTT.Platform.browser.isMozilla){var offset=ua.indexOf("mozilla/");if(offset>=0){parseVersionString(ua.substring(offset+8,indexOf(ua," ",offset)));}}
if(BubbleTT.Platform.browser.isIE){var offset=ua.indexOf("msie ");if(offset>=0){parseVersionString(ua.substring(offset+5,indexOf(ua,";",offset)));}}
if(BubbleTT.Platform.browser.isNetscape){var offset=ua.indexOf("rv:");if(offset>=0){parseVersionString(ua.substring(offset+3,indexOf(ua,")",offset)));}}
if(BubbleTT.Platform.browser.isFirefox){var offset=ua.indexOf("firefox/");if(offset>=0){parseVersionString(ua.substring(offset+8,indexOf(ua," ",offset)));}}})();BubbleTT.Platform.getDefaultLocale=function(){return BubbleTT.Platform.clientLocale;};BubbleTT.DOM=new Object();BubbleTT.DOM.registerEventWithObject=function(elmt,eventName,obj,handler){BubbleTT.DOM.registerEvent(elmt,eventName,function(elmt2,evt,target){return handler.call(obj,elmt2,evt,target);});};BubbleTT.DOM.registerEvent=function(elmt,eventName,handler){var handler2=function(evt){evt=(evt)?evt:((event)?event:null);if(evt){var target=(evt.target)?evt.target:((evt.srcElement)?evt.srcElement:null);if(target){target=(target.nodeType==1||target.nodeType==9)?target:target.parentNode;}
return handler(elmt,evt,target);}
return true;}
if(BubbleTT.Platform.browser.isIE){elmt.attachEvent("on"+eventName,handler2);}else{elmt.addEventListener(eventName,handler2,false);}};


/*
  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 = 'source';
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');};}}());


/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();