
function toggleNotice() {
	var notice = document.getElementById('centralNotice');
	if (!wgNoticeToggleState) {
		notice.className = notice.className.replace('collapsed', 'expanded');
		toggleNoticeCookie('0');
	} else {
		notice.className = notice.className.replace('expanded', 'collapsed');
		toggleNoticeCookie('1');
	}
	wgNoticeToggleState = !wgNoticeToggleState;
}
function toggleNoticeStyle(elems, display) {
	if(elems)
		for(var i=0;i<elems.length;i++)
			elems[i].style.display = display;
}
function toggleNoticeCookie(state) {
	var e = new Date();
	e.setTime( e.getTime() + (7*24*60*60*1000) ); // one week
	var work='hidesnmessage='+state+'; expires=' + e.toGMTString() + '; path=/';
	document.cookie = work;
}
function pickTemplate(templates, weights) {
	var weightedTemplates = new Array();
	var currentTemplate = 0;
	var totalWeight = 0;

	if (templates.length == 0)
		return '';

	while (currentTemplate < templates.length) {
		totalWeight += weights[currentTemplate];
		for (i=0; i<weights[currentTemplate]; i++) {
			weightedTemplates[weightedTemplates.length] = templates[currentTemplate];
		}
		currentTemplate++;
	}
	
	if (totalWeight == 0)
		return '';

	var randomnumber=Math.floor(Math.random()*totalWeight);
	return weightedTemplates[randomnumber];
}


var wgNoticeToggleState = (document.cookie.indexOf('hidesnmessage=1')==-1);
document.writeln("\x3cstyle type=\"text/css\"\x3e\n#centralNotice .siteNoticeSmall{display:none;}\n#centralNotice .siteNoticeSmallAnon{display:none;}\n#centralNotice .siteNoticeSmallUser{display:none;}\n#centralNotice.collapsed .siteNoticeBig{display:none;}\n#centralNotice.collapsed .siteNoticeSmall{display:block;}\n#centralNotice.collapsed .siteNoticeSmallUser{display:block;}\n#centralNotice.collapsed .siteNoticeSmallAnon{display:block;}\n#centralNotice.anonnotice .siteNoticeSmallUser{display:none !important;}\n#centralNotice.usernotice .siteNoticeSmallAnon{display:none !important;}\n\x3c/style\x3e");

wgNotice=pickTemplate(["\x3c!-- empty --\x3e", "\x3cscript type=\"text/javascript\"\x3e\n/* BEGIN CUSTOM ETHNIO SCRIPT */\nvar wgThrottle = 0;\nif ( \'undefined\' == typeof( Ethnio ) ) {\n  Ethnio = {};\n}\nEthnio.get_cookie = function( cookie_name ) {\n  var results = document.cookie.match ( \'(^|;) ?\' + cookie_name + \'=([^;]*)(;|$)\' );\n  if ( results ) {\n    return ( unescape ( results[2] ) );\n  } else {\n    return null;\n  }\n}\nEthnio.set_cookie = function() {\n  var domain = document.domain;\n  var domainString = ( domain == \'localhost\' ? \'\' : \'domain=\' + domain + \';\' );\n  var today = new Date();\n  var cookieexpiration = new Date( today.getTime() + 30 * 24 * 60 * 60 * 1000 );\n  document.cookie = \"ethnio_displayed=yes; expires=\" + cookieexpiration.toGMTString() + \";path=/;\" + domainString;\n}\nEthnio.currently_displayed = function() {\n   return( document.getElementById( \'ethnio-screener\' ) != null );\n};\nEthnio.previously_displayed = function() {\n   return ( Ethnio.get_cookie( \'ethnio_displayed\' ) == \'yes\' );\n};\nEthnio.should_display = function() {\n  return ( ( Math.floor( Math.random() * wgThrottle ) == 0 ) \x26\x26 !Ethnio.currently_displayed() \x26\x26 !Ethnio.previously_displayed() );\n}\nEthnio.show = function() {\n  if ( Ethnio.should_display() ) {\n    var link = document.createElement( \'link\' );\n    link.href = \"http://upload.wikimedia.org/centralnotice/enwiki/ethnio/style.css\";\n    link.rel  = \'stylesheet\';\n    link.type = \'text/css\';\n    document.getElementsByTagName( \'head\' )[0].appendChild( link );\n    Ethnio.screener = document.createElement( \'div\' );\n    Ethnio.screener.setAttribute( \'id\', \'ethnio-screener\' );\n    Ethnio.screener.innerHTML = \'\x3cdiv id=\"screener-heading\" style=\"background-image:url(http://upload.wikimedia.org/centralnotice/enwiki/ethnio/header.png);\"\x3e\x3cdiv id=\"screener-heading-label\"\x3eOnline Survey\x3c/div\x3e\x3cimg id=\"screener-close-button\" src=\"http://upload.wikimedia.org/centralnotice/enwiki/ethnio/close-button.png\" alt=\"Close\" title=\"Close\" border=\"0\" onclick=\"Ethnio.close()\" /\x3e\x3c/div\x3e\x3ciframe src=\"https://ethnio.com/remotes/56171/edit?\" id=\"ethnio-screener-id-\' + Math.random() + \'\" border=\"0\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"yes\"\x3e\x3c/iframe\x3e\';\n    document.body.appendChild( Ethnio.screener );\n    Ethnio.set_cookie();\n  }\n}\nEthnio.close = function() {\n  document.body.removeChild( Ethnio.screener );\n  document.getElementById(\'ethnio_pitch\').style.display=\'none\';\n}\n/* END CUSTOM ETHNIO SCRIPT */\n/* BEGIN CUSTOM SITE NOTICE SCRIPT */\naddHandler(window,\'load\',function(){if(wgThrottle\x3e0\x26\x26Ethnio.should_display()\x26\x26document.getElementById\x26\x26wgUserName===null){document.getElementById(\'ethnio_pitch\').style.display=\'block\'}});document.write(\'\x3cdiv id=\"ethnio_pitch\" style=\"display:none;margin:0;padding:0;\" align=\"center\"\x3e\x3ctable cellpadding=\"0\" cellspacing=\"0\" border=\"0\" summary=\"Live near San Francisco and have an hour to help Wikipedia?\"\x3e\x3ctr\x3e\x3ctd align=\"left\" nowrap=\"nowrap\" style=\"background-image:url(http://upload.wikimedia.org/centralnotice/enwiki/ethnio/ask-base.png);height:30px;padding-left:14px;padding-right:14px;border:solid 1px #5bb66f;border-right-width:0px;font-size:13px;font-family:sans-serif;font-weight:bold;color:black\"\x3eLive near San Francisco and have an hour to help Wikipedia?\x3c/td\x3e\x3ctd width=\"6\" style=\"background-image:url(http://upload.wikimedia.org/centralnotice/enwiki/ethnio/go-start.png);background-position:left center;width:6px;height:32px;\"\x3e \x3c/td\x3e\x3ctd align=\"center\" nowrap=\"nowrap\" style=\"text-align:center;background-image:url(http://upload.wikimedia.org/centralnotice/enwiki/ethnio/go-base.png);height:32px;\"\x3e\x3cdiv style=\"margin:0;padding:0;padding-left:14px;padding-right:14px;\"\x3e\x3ca href=\"javascript:void( Ethnio.show() );\" style=\"font-size:13px;font-family:sans-serif;font-style:oblique;color:white;text-decoration:none\"\x3eLet\\\'s do it!\x3c/a\x3e\x3c/div\x3e\x3c/td\x3e\x3ctd width=\"6\" style=\"background-image:url(http://upload.wikimedia.org/centralnotice/enwiki/ethnio/go-end.png);background-position:left center;width:6px;height:32px;\"\x3e \x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3c/div\x3e\');\n/* END CUSTOM SITE NOTICE SCRIPT */\n\x3c/script\x3e\n\x3cscript type=\"text/javascript\" src=\"http://upload.wikimedia.org/centralnotice/enwiki/ethnio/throttle.js\" \x3e\x3c/script\x3e"],[60, 40]);
if (wgNotice != '')
wgNotice='<div id="centralNotice" class="' + (wgNoticeToggleState ? 'expanded' : 'collapsed') + ' ' + (wgUserName ? 'usernotice' : 'anonnotice' ) + '">' + wgNotice+'</div>';

