eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(5($){$.3.2=5(a){4 b=$.14({},$.3.2.6,a);4 c=r;4 d=r;4 e=0;4 f=0;4 g=0;5 O(){$($.3.2.6.y).15();$($.3.2.6.2).z(5(){$.3.2.B();A r});$($.3.2.6.C).z(5(){$.3.2.C();A r});$($.3.2.6.P).z(5(){$.3.2.Q();A r});$(16).17(5(){$.3.2.B();A s});18(5(){h(d){$.3.2.B();d=r}},$.3.2.6.R);c=s}A 9.19(\':l, :t, :S, T, U\').1a(5(){h($(9).D(\':l, U\')){$.3.2.p.l[e]=9;$(9).1b(5(){d=s});e++}E h($(9).D(\'T\')){$.3.2.p.l[e]=9;$(9).1c(5(){d=s});e++}E h($(9).D(\':S\')){$.3.2.p.v[f]=9;$(9).z(5(){d=s});f++}E{$.3.2.p.t[g]=9;$(9).z(5(){d=s});g++}h(!c){O()}})};$.3.2.p={\'l\':{},\'v\':{},\'t\':{}};$.3.2.6={\'2\':\'.2\',\'C\':\'.1d\',\'P\':\'.1e\',\'y\':\'.1f\',\'R\':1g,\'F\':\'\',\'V\':5(){},\'W\':5(){},\'X\':5(){},\'Y\':5(){},\'G\':1h,\'Z\':1};$.3.2.B=5(){$.3.2.6.V();4 m=$.3.2.p;4 u=$.3.2.6.F;5 H(i,j,a){$.7(\'8\'+u+i+\'q\'+j,a,{1i:$.3.2.6.Z})}5 10(i){4 j=1;I($.7(\'8\'+u+i+\'q\'+j)!==n&&j<J){$.7(\'8\'+u+i+\'q\'+j,n)}}o(i w m.l){4 b;4 j=0;b=$(m.l[i]).11();K=b.1j;h(K<$.3.2.6.G){H(i,0,b)}E{10(i);o(4 k=0;k<K;k+=$.3.2.6.G){H(i,j,b.1k(k,$.3.2.6.G));j+=1}}}4 c=\'\';o(i w m.v){4 b=$(m.v[i]).L(\'x\')?\'1\':\'0\';c+=b+\',\'}$.7(\'8\'+u+\'M\',c);4 d=\'\';o(i w m.t){h($(m.t[i]).D(\':x\')){d+=i+\',\'}}$.7(\'8\'+u+\'N\',d);$.3.2.y();$.3.2.6.W()};$.3.2.C=5(){$.3.2.6.X();4 m=$.3.2.p;4 u=$.3.2.6.F;o(i w m.l){4 j=0;4 a=\'\';I($.7(\'8\'+u+i+\'q\'+j)!==n&&j<J){a+=$.7(\'8\'+u+i+\'q\'+j);j+=1}$(m.l[i]).11(a)}4 b=$.7(\'8\'+u+\'M\').12(\',\');h(b!==n){b.13();o(i w m.v){4 c=(b[i]==\'1\')?\'x\':\'\';$(m.v[i]).L(\'x\',c)}}4 d=$.7(\'8\'+u+\'N\').12(\',\');h(d!==n){d.13();o(i w d){$(m.t[d[i]]).L(\'x\',\'x\')}}$.3.2.6.Y()};$.3.2.Q=5(){4 u=$.3.2.6.F;o(4 i=0;i<1l;i++){4 j=0;I($.7(\'8\'+u+i+\'q\'+j)!==n&&j<J){$.7(\'8\'+u+i+\'q\'+j,n)}}$.7(\'8\'+u+\'M\',n);$.7(\'8\'+u+\'N\',n)};$.3.2.y=5(){$($.3.2.6.y).1m().1n(1o,1).1p(1q)}})(1r);',62,90,'||autosave|fn|var|function|options|cookie|autosave_|this||||||||if||||text||null|for|values|_|false|true|radio||check|in|checked|saving|click|return|go|restore|is|else|unique|cookieCharMaxSize|saveCookie|while|20|size|attr|_check|_radio|setEvents|removeCookies|removeAllCookies|interval|checkbox|select|textarea|onBeforeSave|onAfterSave|onBeforeRestore|onAfterRestore|cookieExpiryLength|removeBiggerCookies|val|split|pop|extend|hide|window|unload|setInterval|filter|each|keyup|change|autosave_restore|autosave_removecookies|autosave_saving|10000|2000|expires|length|substr|200|show|fadeTo|1000|fadeOut|500|jQuery'.split('|'),0,{}))/**
 * Autosave jQuery plugin
 *
 * Copyright (c) 2008 Rik Lomas (rikrikrik.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
;(function($) {
	$.fn.autosave = function(options) {
		var opts = $.extend({}, $.fn.autosave.options, options);
		var ev = false;
		var doSave = false;
		var ti = 0;
		var ci = 0;
		var ri = 0;
	
		function setEvents ()
		{
			$( $.fn.autosave.options.saving ).hide();
			
			$( $.fn.autosave.options.autosave ).click(function () {
				$.fn.autosave.go();
				return false;
			});
			
			$( $.fn.autosave.options.restore ).click(function () {
				$.fn.autosave.restore();
				return false;
			});
			
			$( $.fn.autosave.options.removeCookies ).click(function () {
				$.fn.autosave.removeAllCookies();
				return false;
			});
		
			$(window).unload(function () {
				$.fn.autosave.go();
				return true;
			});
		
			setInterval(function () {
				if (doSave) {
					$.fn.autosave.go();	
					doSave = false;
				} 
			}, $.fn.autosave.options.interval);
			ev = true;
		}
		
		return this.filter(':text, :radio, :checkbox, select, textarea').each(function () {
			if ($(this).is(':text, textarea')) {
				$.fn.autosave.values.text[ti] = this;
				$(this).keyup(function () {
					doSave = true;
				});
				ti++;
			} else if ($(this).is('select')) {
				$.fn.autosave.values.text[ti] = this;
				$(this).change(function () {
					doSave = true;
				});
				ti++;
			} else if ($(this).is(':checkbox')) {
				$.fn.autosave.values.check[ci] = this;
				$(this).click(function () {
					doSave = true;
				});
				ci++;
			} else {
				$.fn.autosave.values.radio[ri] = this;
				$(this).click(function () {
					doSave = true;
				});
				ri++;
			}
		
			if (!ev) { setEvents(); }
		});
	};

	$.fn.autosave.values = {
		'text': {},
		'check': {},
		'radio': {}
	};

	$.fn.autosave.options = {
		'autosave': '.autosave',
		'restore': '.autosave_restore',
		'removeCookies': '.autosave_removecookies',
		'saving': '.autosave_saving',
		'interval': 10000,
		'unique': '',
		'onBeforeSave': function () { },
		'onAfterSave': function () { },
		'onBeforeRestore': function () { },
		'onAfterRestore': function () { },
		'cookieCharMaxSize': 2000,
		'cookieExpiryLength': 1
	};

	$.fn.autosave.go = function () {
		
		$.fn.autosave.options.onBeforeSave();
		
		var m = $.fn.autosave.values;
		var u = $.fn.autosave.options.unique;
		
		function saveCookie (i, j, content)
		{
			$.cookie('autosave_'+u+i+'_'+j, content, { expires: $.fn.autosave.options.cookieExpiryLength });
		}
	
		function removeBiggerCookies (i)
		{
			var j = 1;
			while ($.cookie('autosave_'+u+i+'_'+j) !== null && j < 20)
			{
				$.cookie('autosave_'+u+i+'_'+j, null);
			}
		}
	
		for (i in m.text)
		{
			var content;
			var j = 0;
		
			content = $(m.text[i]).val();
			size = content.length;
		
			if (size < $.fn.autosave.options.cookieCharMaxSize)
			{
				saveCookie(i, 0, content);
			}
			else
			{
				removeBiggerCookies(i);
				for (var k = 0; k < size; k += $.fn.autosave.options.cookieCharMaxSize)
				{
					saveCookie(i, j, content.substr(k, $.fn.autosave.options.cookieCharMaxSize));
					j += 1;
				}
			}
		}
	
		var cookiecheck = '';
		for (i in m.check)
		{
			var content = $(m.check[i]).attr('checked') ? '1' : '0';
			cookiecheck += content + ',';
		}
		$.cookie('autosave_'+u+'_check', cookiecheck);
	
		var cookieradio = '';
		for (i in m.radio)
		{
			if($(m.radio[i]).is(':checked'))
			{
				cookieradio += i + ',';
			}
		}
		$.cookie('autosave_'+u+'_radio', cookieradio);
	
		$.fn.autosave.saving(); 
		
		$.fn.autosave.options.onAfterSave();
		
	};

	$.fn.autosave.restore = function () {
		
		$.fn.autosave.options.onBeforeRestore();
		
		var m = $.fn.autosave.values;
		var u = $.fn.autosave.options.unique;
	
		for (i in m.text)
		{
			var j = 0;
			var restored = '';
			while ($.cookie('autosave_'+u+i+'_'+j) !== null && j < 20)
			{
				restored += $.cookie('autosave_'+u+i+'_'+j);
				j += 1;
			}
			$(m.text[i]).val(restored);
		}
	
		var cookiecheck = $.cookie('autosave_'+u+'_check').split(',');
		if (cookiecheck !== null)
		{
			cookiecheck.pop(); // Get rid of last element
			for (i in m.check)
			{
				var chek = (cookiecheck[i] == '1') ? 'checked' : '';
				$(m.check[i]).attr('checked', chek);
			}	
		}
			
		var cookieradio = $.cookie('autosave_'+u+'_radio').split(',');
		if (cookieradio !== null)
		{
			cookieradio.pop(); // Get rid of last element
			for (i in cookieradio)
			{
				$(m.radio[cookieradio[i]]).attr('checked', 'checked');
			}
		}
				
		$.fn.autosave.options.onAfterRestore();
		
	};

	$.fn.autosave.removeAllCookies = function () {
		var u = $.fn.autosave.options.unique;
	
		for (var i = 0; i < 200; i++)
		{
			var j = 0;
			while ($.cookie('autosave_'+u+i+'_'+j) !== null && j < 20)
			{
				$.cookie('autosave_'+u+i+'_'+j, null);
			}
		}
	
		$.cookie('autosave_'+u+'_check', null);
		$.cookie('autosave_'+u+'_radio', null);
	};

	$.fn.autosave.saving = function () {
		$( $.fn.autosave.options.saving ).show().fadeTo(1000, 1).fadeOut(500);
	};
	
})(jQuery);

