 /*
 * jQuery UI selectmenu
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */

(function($) {

$.widget("ui.selectmenu", {
	getter: "value",
	version: "1.8",
	eventPrefix: "selectmenu",
	options: {
		transferClasses: true,
		style: 'dropdown',
		positionOptions: {
			my: "left top",
			at: "left bottom",
			offset: null
		},
		width: null, 
		menuWidth: null, 
		handleWidth: 26,
		maxHeight: null,
		icons: null, 
		format: null,
		bgImage: function() {},
		wrapperElement: ""
	},	
	
	_create: function() {
		var self = this, o = this.options;
		
		// set a default id value
		var selectmenuId = this.element.attr('id') || 'ui-selectmenu-' +  Math.random().toString(16).slice(2, 10);
				
		//quick array of button and menu id's
		this.ids = [selectmenuId + '-' + 'button', selectmenuId + '-' + 'menu'];
				
		//define safe mouseup for future toggling
		this._safemouseup = true;
		
		//create menu button wrapper
		this.newelement = $('<a class="'+ this.widgetBaseClass +' ui-widget ui-state-default ui-corner-all" id="'+this.ids[0]+'" role="button" href="#" tabindex="0" aria-haspopup="true" aria-owns="'+this.ids[1]+'"></a>')
			.insertAfter(this.element);
		this.newelement.wrap(o.wrapperElement);
		
		//transfer tabindex
		var tabindex = this.element.attr('tabindex');
		if (tabindex){ this.newelement.attr('tabindex', tabindex); }
		
		//save reference to select in data for ease in calling methods
		this.newelement.data('selectelement', this.element);
		
		//menu icon
		this.selectmenuIcon = $('<span class="'+ this.widgetBaseClass +'-icon ui-icon"></span>')
			.prependTo(this.newelement);
			
		//append status span to button
		this.newelement.prepend('<span class="'+self.widgetBaseClass+'-status" />');
			
		//make associated form label trigger focus
		$('label[for='+this.element.attr('id')+']')
			.attr('for', this.ids[0])
			.bind('click', function(){
				self.newelement[0].focus();
				return false;
			});	
			
		//click toggle for menu visibility
		this.newelement
			.bind('mousedown', function(event){
				self._toggle(event, true);
				// make sure a click won't open/close instantly
				if (o.style == "popup"){
					self._safemouseup = false;
					setTimeout(function(){self._safemouseup = true;}, 300);
				}	
				return false;
			})
			.bind('click',function(){
				return false;
			})
			.keydown(function(event){
				var ret = false;
				switch (event.keyCode) {
					case $.ui.keyCode.ENTER:
						ret = true;
						break;
					case $.ui.keyCode.SPACE:
						self._toggle(event);	
						break;
					case $.ui.keyCode.UP:
						if (event.altKey) {
							self.open(event);
						} else {
							self._moveSelection(-1);
						}
						break;
					case $.ui.keyCode.DOWN:
						if (event.altKey) {
							self.open(event);
						} else {
							self._moveSelection(1);
						}
						break;
					case $.ui.keyCode.LEFT:
						self._moveSelection(-1);
						break;
					case $.ui.keyCode.RIGHT:
						self._moveSelection(1);
						break;
					case $.ui.keyCode.TAB:
						ret = true;
						break;
					default:
						ret = true;
						self._typeAhead(event.keyCode, 'mouseup');
						break;	
				}
				return ret;
			})
			.bind('mouseover focus', function(){ 
				if (!o.disabled) $(this).addClass(self.widgetBaseClass+'-focus ui-state-hover'); 
			})
			.bind('mouseout blur', function(){  
				if (!o.disabled) $(this).removeClass(self.widgetBaseClass+'-focus ui-state-hover'); 
			});
		
		//document click closes menu
		$(document).mousedown(function(event){
			self.close(event);
		});

		//change event on original selectmenu
		this.element
			.click(function(){ self._refreshValue(); })
            // newelement can be null under unclear circumstances in IE8 
			.focus(function () { if (this.newelement) { this.newelement[0].focus(); } });
		
		//original selectmenu width
		var selectWidth = this.element.width();		
		//set menu button width
		this.newelement.width( (o.width) ? o.width : selectWidth);
				
		//hide original selectmenu element
		this.element.hide();		
				
		//create menu portion, append to body
		this.list = $('<ul class="' + self.widgetBaseClass + '-menu ui-widget ui-widget-content" aria-hidden="true" role="listbox" aria-labelledby="'+this.ids[0]+'" id="'+this.ids[1]+'"></ul>').appendTo('body');				
		this.list.wrap(o.wrapperElement);				
				
		//transfer menu click to menu button
		this.list
			.keydown(function(event){
				var ret = false;
				switch (event.keyCode) {
					case $.ui.keyCode.UP:
						if (event.altKey) {
							self.close(event, true);
						} else {
							self._moveFocus(-1);
						}
						break;
					case $.ui.keyCode.DOWN:
						if (event.altKey) {
							self.close(event, true);
						} else {
							self._moveFocus(1);
						}
						break;	
					case $.ui.keyCode.LEFT:
						self._moveFocus(-1);
						break;
					case $.ui.keyCode.RIGHT:
						self._moveFocus(1);
						break;	
					case $.ui.keyCode.HOME:
						self._moveFocus(':first');
						break;		
					case $.ui.keyCode.PAGE_UP:
						self._scrollPage('up');
						break;	
					case $.ui.keyCode.PAGE_DOWN:
						self._scrollPage('down');
						break;
					case $.ui.keyCode.END:
						self._moveFocus(':last');
						break;		
					case $.ui.keyCode.ENTER:
					case $.ui.keyCode.SPACE:
						self.close(event,true);
						$(event.target).parents('li:eq(0)').trigger('mouseup');
						break;		
					case $.ui.keyCode.TAB:
						ret = true;
						self.close(event,true);
						break;	
					case $.ui.keyCode.ESCAPE:
						self.close(event,true);
						break;
					default:
						ret = true;
						break;	
				}
				return ret;
			});			
		
		// needed when window is resized
		$(window).resize(
			$.proxy(self._refreshPosition, this)
		);
	},
	_init: function() {
		var self = this, o = this.options;
		
		//serialize selectmenu element options	
		var selectOptionData = [];
		this.element
			.find('option')
			.each(function(){
				selectOptionData.push({
					value: $(this).attr('value'),
					text: self._formatText($(this).text()),
					selected: $(this).attr('selected'),
					classes: $(this).attr('class'),
					parentOptGroup: $(this).parent('optgroup').attr('label'),
					bgImage: o.bgImage.call($(this))
				});
			});		
				
		//active state class is only used in popup style
		var activeClass = (self.options.style == "popup") ? " ui-state-active" : "";
		
		// empty list so we can refresh the selectmenu via selectmenu()
		this.list.html("");
		
		//write li's
		for (var i = 0; i < selectOptionData.length; i++) {
			var thisLi = $('<li role="presentation"><a href="#" tabindex="-1" role="option" aria-selected="false">'+ selectOptionData[i].text +'</a></li>')
				.data('index',i)
				.addClass(selectOptionData[i].classes)
				.data('optionClasses', selectOptionData[i].classes|| '')
				.mouseup(function(event){
						if (self._safemouseup){
							var changed = $(this).data('index') != self._selectedIndex();
							self.index($(this).data('index'));
							self.select(event);
							if (changed){ self.change(event); }
							self.close(event,true);
						}
					return false;
				})
				.click(function(){
					return false;
				})
				.bind('mouseover focus', function(){ 
					self._selectedOptionLi().addClass(activeClass); 
					self._focusedOptionLi().removeClass(self.widgetBaseClass+'-item-focus ui-state-hover'); 
					$(this).removeClass('ui-state-active').addClass(self.widgetBaseClass + '-item-focus ui-state-hover'); 
				})
				.bind('mouseout blur', function(){ 
					if ($(this).is( self._selectedOptionLi().selector )){ $(this).addClass(activeClass); }
					$(this).removeClass(self.widgetBaseClass + '-item-focus ui-state-hover'); 
				});
				
			//optgroup or not...
			if (selectOptionData[i].parentOptGroup){
				// whitespace in the optgroupname must be replaced, otherwise the li of existing optgroups are never found
				var optGroupName = self.widgetBaseClass + '-group-' + selectOptionData[i].parentOptGroup.replace(/[^a-zA-Z0-9]/g, "");
				if(this.list.find('li.' + optGroupName).size()){
					this.list.find('li.' + optGroupName + ':last ul').append(thisLi);
				} else {
					$('<li role="presentation" class="'+self.widgetBaseClass+'-group '+optGroupName+'"><span class="'+self.widgetBaseClass+'-group-label">'+selectOptionData[i].parentOptGroup+'</span><ul></ul></li>')
						.appendTo(this.list)
						.find('ul')
						.append(thisLi);
				}
			} else {
				thisLi.appendTo(this.list);
			}
			
			//this allows for using the scrollbar in an overflowed list
			this.list.bind('mousedown mouseup', function(){ return false; });
			
			//append icon if option is specified
			if (o.icons){
				for (var j in o.icons){
					if (thisLi.is(o.icons[j].find)){
						thisLi
							.data('optionClasses', selectOptionData[i].classes + ' ' + self.widgetBaseClass + '-hasIcon')
							.addClass(self.widgetBaseClass + '-hasIcon');
						var iconClass = o.icons[j].icon || "";						
						thisLi
							.find('a:eq(0)')
							.prepend('<span class="'+self.widgetBaseClass+'-item-icon ui-icon ' +iconClass + '"></span>');
						if (selectOptionData[i].bgImage) {
							thisLi.find('span').css('background-image', selectOptionData[i].bgImage);
						}
					}
				}
			}
		}	
				
		// we need to set and unset the CSS classes for dropdown and popup style
		var isDropDown = (o.style == 'dropdown') ? true : false;
		this.newelement
			.toggleClass(self.widgetBaseClass+"-dropdown", isDropDown)
			.toggleClass(self.widgetBaseClass+"-popup", !isDropDown);
		this.list
			.toggleClass(self.widgetBaseClass+"-menu-dropdown ui-corner-bottom", isDropDown)
			.toggleClass(self.widgetBaseClass+"-menu-popup ui-corner-all", !isDropDown)
		// add corners to top and bottom menu items
		.find('li:first')
			.toggleClass("ui-corner-top", !isDropDown)
		.end().find('li:last')
			.addClass("ui-corner-bottom");
		this.selectmenuIcon
			.toggleClass('ui-icon-triangle-1-s', isDropDown)
			.toggleClass('ui-icon-triangle-2-n-s', !isDropDown);
					
		//transfer classes to selectmenu and list
		if (o.transferClasses){
			var transferClasses = this.element.attr('class') || ''; 
			this.newelement.add(this.list).addClass(transferClasses);
		}
		
		//original selectmenu width
		var selectWidth = this.element.width();
		
		//set menu width to either menuWidth option value, width option value, or select width 
		if (o.style == 'dropdown') { 
			this.list.width( (o.menuWidth) ? o.menuWidth : ((o.width) ? o.width : selectWidth)); 
		} else { 
			this.list.width( (o.menuWidth) ? o.menuWidth : ((o.width) ? o.width - o.handleWidth : selectWidth - o.handleWidth)); 
		}	
		
		// calculate default max height
		if (o.maxHeight) {
			//set max height from option 
			 if (o.maxHeight < this.list.height()){ this.list.height(o.maxHeight); }
		} else {
			if (!o.format && ($(window).height() / 3) < this.list.height()) {
				o.maxHeight = $(window).height() / 3;
				this.list.height(o.maxHeight);
			}
		}
		//save reference to actionable li's (not group label li's)
		this._optionLis = this.list.find('li:not(.'+ self.widgetBaseClass +'-group)');
						
		//transfer disabled state
		if (this.element.attr('disabled') == true){ this.disable(); }
		
		//update value
		this.index(this._selectedIndex());		
		
		// needed when selectmenu is placed at the very bottom / top of the page
        window.setTimeout(function() {
            self._refreshPosition();
        }, 200);
	},
	destroy: function() {
		this.element.removeData(this.widgetName)
			.removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
			.removeAttr('aria-disabled')
			.unbind("click");
	
		//unbind click on label, reset its for attr
		$('label[for='+this.newelement.attr('id')+']')
			.attr('for',this.element.attr('id'))
			.unbind('click');
		this.newelement.remove();
		// FIXME option.wrapper needs
		this.list.remove();
		this.element.show();	
		
		// call widget destroy function
		$.Widget.prototype.destroy.apply(this, arguments);
	},
	_typeAhead: function(code, eventType){
		var self = this;
		//define self._prevChar if needed
		if (!self._prevChar){ self._prevChar = ['',0]; }
		var C = String.fromCharCode(code);
		c = C.toLowerCase();
		var focusFound = false;
		function focusOpt(elem, ind){
			focusFound = true;
			$(elem).trigger(eventType);
			self._prevChar[1] = ind;
		}
		this.list.find('li a').each(function(i){	
			if(!focusFound){
				var thisText = $(this).text();
				if( thisText.indexOf(C) == 0 || thisText.indexOf(c) == 0){
						if(self._prevChar[0] == C){
							if(self._prevChar[1] < i){ focusOpt(this,i); }	
						}
						else{ focusOpt(this,i); }	
				}
			}
		});
		this._prevChar[0] = C;
	},
	// returns some usefull information, called by callbacks only
	_uiHash: function(){
		var index = this.index();
		return {
			index: index,
			option: $("option", this.element).get(index),
			value: this.element[0].value
		};
	},
	open: function(event){
		var self = this;
		var disabledStatus = this.newelement.attr("aria-disabled");
		if(disabledStatus != 'true'){
			this._refreshPosition();
			this._closeOthers(event);
			this.newelement
				.addClass('ui-state-active');
			if (self.options.wrapperElement) {
				this.list.parent().appendTo('body');
			} else {
				this.list.appendTo('body');
			}
			this.list.addClass(self.widgetBaseClass + '-open')
				.attr('aria-hidden', false)
				.find('li:not(.'+ self.widgetBaseClass +'-group):eq('+ this._selectedIndex() +') a')[0].focus();	
			if (this.options.style == "dropdown"){ this.newelement.removeClass('ui-corner-all').addClass('ui-corner-top'); }	
			this._refreshPosition();
			this._trigger("open", event, this._uiHash());
		}
	},
	close: function(event, retainFocus){
		if(this.newelement.is('.ui-state-active')){
			this.newelement
				.removeClass('ui-state-active');
			this.list
				.attr('aria-hidden', true)
				.removeClass(this.widgetBaseClass+'-open');
			if (this.options.style == "dropdown"){ this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all'); }
			if (retainFocus){this.newelement.focus();}	
			this._trigger("close", event, this._uiHash());
		}
	},
	change: function(event) {
		this.element.trigger('change');
		this._trigger("change", event, this._uiHash());
	},
	select: function(event) {
		this._trigger("select", event, this._uiHash());
	},
	_closeOthers: function(event){
		$('.'+ this.widgetBaseClass +'.ui-state-active').not(this.newelement).each(function(){
			$(this).data('selectelement').selectmenu('close',event);
		});
		$('.'+ this.widgetBaseClass +'.ui-state-hover').trigger('mouseout');
	},
	_toggle: function(event,retainFocus){
		if(this.list.is('.'+ this.widgetBaseClass +'-open')){ this.close(event,retainFocus); }
		else { this.open(event); }
	},
	_formatText: function(text){
		return this.options.format ? this.options.format(text) : text;
	},
	_selectedIndex: function(){
		return this.element[0].selectedIndex;
	},
	_selectedOptionLi: function(){
		return this._optionLis.eq(this._selectedIndex());
	},
	_focusedOptionLi: function(){
		return this.list.find('.'+ this.widgetBaseClass +'-item-focus');
	},
	_moveSelection: function(amt){
		var currIndex = parseInt(this._selectedOptionLi().data('index'), 10);
		var newIndex = currIndex + amt;
		return this._optionLis.eq(newIndex).trigger('mouseup');
	},
	_moveFocus: function(amt){
		if(!isNaN(amt)){
			var currIndex = parseInt(this._focusedOptionLi().data('index') || 0, 10);
			var newIndex = currIndex + amt;
		}
		else { var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10); }
		
		if(newIndex < 0){ newIndex = 0; }
		if(newIndex > this._optionLis.size()-1){
			newIndex =  this._optionLis.size()-1;
		}
		var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
		
		this._focusedOptionLi().find('a:eq(0)').attr('id','');
		this._optionLis.eq(newIndex).find('a:eq(0)').attr('id',activeID).focus();
		this.list.attr('aria-activedescendant', activeID);
	},
	_scrollPage: function(direction){
		var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight());
		numPerPage = (direction == 'up') ? -numPerPage : numPerPage;
		this._moveFocus(numPerPage);
	},
	_setOption: function(key, value) {
		this.options[key] = value;
		if (key == 'disabled') {
			this.close();
			this.element
				.add(this.newelement)
				.add(this.list)
					[value ? 'addClass' : 'removeClass'](
						this.widgetBaseClass + '-disabled' + ' ' +
						this.namespace + '-state-disabled')
					.attr("aria-disabled", value);
		}
	},
	index: function(newValue) {
		if (arguments.length) {
			this.element[0].selectedIndex = newValue;
			this._refreshValue();
		} else {
			return this._selectedIndex();
		}
	},
	value: function(newValue) {
		if (arguments.length) {
			// FIXME test for number is a kind of legacy support, could be removed at any time (Dez. 2010)
			// see this post for more info: https://github.com/fnagel/jquery-ui/issues#issue/33
			if (typeof newValue == "number") {
					this.index(newValue);
			} else if (typeof newValue == "string") {
				this.element[0].value = newValue;
				this._refreshValue();
			}
		} else {
			return this.element[0].value;
		}
	},
	_refreshValue: function() {
		var activeClass = (this.options.style == "popup") ? " ui-state-active" : "";
		var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
		//deselect previous
		this.list
			.find('.'+ this.widgetBaseClass +'-item-selected')
			.removeClass(this.widgetBaseClass + "-item-selected" + activeClass)
			.find('a')
			.attr('aria-selected', 'false')
			.attr('id', '');
		//select new
		this._selectedOptionLi()
			.addClass(this.widgetBaseClass + "-item-selected" + activeClass)
			.find('a')
			.attr('aria-selected', 'true')
			.attr('id', activeID);
			
		//toggle any class brought in from option
		var currentOptionClasses = this.newelement.data('optionClasses') ? this.newelement.data('optionClasses') : "";
		var newOptionClasses = this._selectedOptionLi().data('optionClasses') ? this._selectedOptionLi().data('optionClasses') : "";
		this.newelement
			.removeClass(currentOptionClasses)
			.data('optionClasses', newOptionClasses)
			.addClass( newOptionClasses )
			.find('.'+this.widgetBaseClass+'-status')
			.html( 
				this._selectedOptionLi()
					.find('a:eq(0)')
					.html() 
			);
			
		this.list.attr('aria-activedescendant', activeID);
	},
	_refreshPosition: function(){	
		var o = this.options;				
		// if its a native pop-up we need to calculate the position of the selected li
		if (o.style == "popup" && !o.positionOptions.offset) {
			var selected = this._selectedOptionLi();
			var _offset = "0 -" + (selected.outerHeight() + selected.offset().top - this.list.offset().top);
		}
		this.list
			.css({
				zIndex: this.element.zIndex()
			})
			.position({
				// set options for position plugin
				of: o.positionOptions.of || this.newelement,
				my: o.positionOptions.my,
				at: o.positionOptions.at,
				offset: o.positionOptions.offset || _offset
			});
	}
});
})(jQuery);

//------------------------------
//------------------------------


//jQuery Translate plugin and related components


/* 
 * jQuery nodesContainingText plugin 
 * Version: 1.1.2
 * http://code.google.com/p/jquery-translate/
 * Copyright (c) 2009 Balazs Endresz (balazs.endresz@gmail.com)
 * Dual licensed under the MIT and GPL licenses.
 */
(function(b){function a(){}a.prototype={init:function(e,d){this.textArray=[];this.elements=[];this.options=d;this.jquery=e;this.n=-1;if(d.async===true){d.async=2}if(d.not){e=e.not(d.not);e=e.add(e.find("*").not(d.not)).not(b(d.not).find("*"))}else{e=e.add(e.find("*"))}this.jq=e;this.jql=this.jq.length;return this.process()},process:function(){this.n++;var i=this,d=this.options,p="",h=false,g=false,f=this.jq[this.n],k,m,j;if(this.n===this.jql){j=this.jquery.pushStack(this.elements,"nodesContainingText");d.complete.call(j,j,this.textArray);if(d.returnAll===false&&d.walk===false){return this.jquery}return j}if(!f){return this.process()}k=b(f);var n=f.nodeName.toUpperCase(),l=n==="INPUT"&&b.attr(f,"type").toLowerCase();if(({SCRIPT:1,NOSCRIPT:1,STYLE:1,OBJECT:1,IFRAME:1})[n]){return this.process()
}if(typeof d.subject==="string"){p=k.attr(d.subject)}else{if(d.altAndVal&&(n==="IMG"||l==="image")){p=k.attr("alt")}else{if(d.altAndVal&&({text:1,button:1,submit:1})[l]){p=k.val()}else{if(n==="TEXTAREA"){p=k.val()}else{m=f.firstChild;if(d.walk!==true){g=true}else{while(m){if(m.nodeType==1){g=true;break}m=m.nextSibling}}if(!g){p=k.text()}else{if(d.walk!==true){h=true}m=f.firstChild;while(m){if(m.nodeType==3&&m.nodeValue.match(/\S/)!==null){if(m.nodeValue.match(/<![ \r\n\t]*(--([^\-]|[\r\n]|-[^\-])*--[ \r\n\t]*)>/)!==null){if(m.nodeValue.match(/(\S+(?=.*<))|(>(?=.*\S+))/)!==null){h=true;break}}else{h=true;break}}m=m.nextSibling}if(h){p=k.html();p=d.stripScripts?p.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,""):p;this.jq=this.jq.not(k.find("*"))}}}}}}if(!p){return this.process()}this.elements.push(f);this.textArray.push(p);d.each.call(f,this.elements.length-1,f,p);if(d.async){setTimeout(function(){i.process()},d.async);return this.jquery}else{return this.process()}}};var c={not:"",async:false,each:function(){},complete:function(){},comments:false,returnAll:true,walk:true,altAndVal:false,subject:true,stripScripts:true};
b.fn.nodesContainingText=function(d){d=b.extend({},c,b.fn.nodesContainingText.defaults,d);return new a().init(this,d)};b.fn.nodesContainingText.defaults=c})(jQuery);
/*
 * Textnode Translator
 * Ariel Flesler - http://flesler.blogspot.com/2008/05/textnode-translator-for-javascript.html
 */

/* 
 * jQuery Translate plugin 
 * Version: 1.4.3
 * http://code.google.com/p/jquery-translate/
 * Copyright (c) 2009 Balazs Endresz (balazs.endresz@gmail.com)
 * Dual licensed under the MIT and GPL licenses.
 * This plugin uses the 'Google AJAX Language API' (http://code.google.com/apis/ajaxlanguage/)
 * You can read the terms of use at http://code.google.com/apis/ajaxlanguage/terms.html
 */
(function(c){function p(){}var d=true,g=false,e,u="".replace,v=String,k=Function,t=Object,n,l,f,q={},b,j=[],h={from:"",to:"",start:p,error:p,each:p,complete:p,onTimeout:p,timeout:0,stripComments:d,stripWhitespace:d,stripScripts:d,separators:/\.\?\!;:/,limit:1750,walk:d,returnAll:g,replace:d,rebind:d,data:d,setLangAttr:g,subject:d,not:"",altAndVal:d,async:g,toggle:g,fromOriginal:d,parallel:false,delay:0};function s(){c.translate.GL=n=google.language;c.translate.GLL=l=n.Languages;f=c.translate.toLanguageCode;c.each(l,function(y,z){q[z.toUpperCase()]=y});c.translate.isReady=d;
var x;while((x=j.shift())){x()}}function i(z,y){var x={};c.each(z,function(A,B){if(y(B,A)===d){x[A]=B}});return x}function w(y,z,x){return function(){return y.apply(z===d?arguments[0]:z,x||arguments)}}function r(x){return x!==e}function o(y,B,A){var x,C={},z=c.grep(y,r);c.each(B,function(D,E){var F=c.grep(E[0],function(H,G){return r(z[G])&&z[G].constructor===H}).length;if(F===z.length&&F===E[0].length&&(x=d)){c.each(E[1],function(G,H){C[H]=z[G]});return g}});if(!x){throw A}return C}function m(A,z){var x=o(A,c.translate.overload,"jQuery.translate: Invalid arguments"),y=x.options||{};delete x.options;y=c.extend({},h,z,c.extend(y,x));if(y.fromOriginal){y.toggle=d}if(y.toggle){y.data=d}if(y.async===d){y.async=2}return y}function a(){this.extend(c.translate);delete this.defaults;delete this.fn}a.prototype={version:"1.4.3",_init:function(z,C){var B=C.separators.source||C.separators,y=this.isString=typeof z==="string",x=0,A;c.each(["stripComments","stripScripts","stripWhitespace"],function(E,D){var F=c.translate[D];
if(C[D]){z=y?F(z):c.map(z,F)}});this.rawSource="<div>"+(y?z:z.join("</div><div>"))+"</div>";this._m3=new RegExp("["+B+"](?![^"+B+"]*["+B+"])");this.options=C;this.from=C.from=f(C.from)||"";this.to=C.to=f(C.to)||"";this.source=z;this.rawTranslation="";this.translation=[];this.i=0;this.stopped=g;this.elements=C.nodes;this._i=-1;this.rawSources=[];while(d){A=this.truncate(this.rawSource.substr(x),C.limit);if(!A){break}this.rawSources.push(A);x+=A.length}this.queue=new Array(this.rawSources.length);this.done=0;C.start.call(this,z,C.from,C.to,C);if(C.timeout){this.timeout=setTimeout(w(C.onTimeout,this,[z,C.from,C.to,C]),C.timeout)}(C.toggle&&C.nodes)?(C.textNodes?this._toggleTextNodes():this._toggle()):this._process()},_process:function(){if(this.stopped){return}var x=this.options,E=this.rawTranslation.length,I,J,G,F;var H=this;while((I=this.rawTranslation.lastIndexOf("</div>",E))>-1){E=I-1;J=this.rawTranslation.substr(0,E+1);G=J.match(/<div[> ]/gi);F=J.match(/<\/div>/gi);G=G?G.length:0;F=F?F.length:0;
if(G!==F+1){continue}var A=c(this.rawTranslation.substr(0,E+7)),C=A.length,B=this.i;if(B===C){break}A.slice(B,C).each(w(function(L,O){if(this.stopped){return g}var N=c.trim(c(O).html()),M=B+L,P=this.source,Q=!this.from&&this.detectedSourceLanguage||this.from;this.translation[M]=N;this.isString?this.translation=N:P=this.source[M];x.each.call(this,M,N,P,Q,this.to,x);this.i++},this));break}if(this.rawSources.length-1==this._i){this._complete()}var z=w(this._translate,this);if(x.parallel){if(this._i<0){if(!x.delay){c.each(this.rawSources,z)}else{var D=0,y=this.rawSources.length;(function K(){z();if(D<y){setTimeout(K,x.delay)}})()}}}else{z()}},_translate:function(){this._i++;var x=this._i,y=this.rawSourceSub=this.rawSources[x];if(!y){return}n.translate(y,this.from,this.to,w(function(z){if(z.error){return this.options.error.call(this,z.error,this.rawSourceSub,this.from,this.to,this.options)}this.queue[x]=z.translation||this.rawSourceSub;this.detectedSourceLanguage=z.detectedSourceLanguage;this._check()
},this))},_check:function(){if(!this.options.parallel){this.rawTranslation+=this.queue[this._i];this._process();return}var x=0;jQuery.each(this.queue,function(z,A){if(A!=e){x=z}else{return false}});if((x>this.done)||(x===this.queue.length-1)){for(var y=0;y<=x;y++){this.rawTranslation+=this.queue[y]}this._process()}this.done=x},_complete:function(){clearTimeout(this.timeout);this.options.complete.call(this,this.translation,this.source,!this.from&&this.detectedSourceLanguage||this.from,this.to,this.options)},stop:function(){if(this.stopped){return this}this.stopped=d;this.options.error.call(this,{message:"stopped"});return this}};c.translate=function(z,x){if(z==e){return new a()}if(c.isFunction(z)){return c.translate.ready(z,x)}var A=new a();var y=[].slice.call(arguments,0);y.shift();return c.translate.ready(w(A._init,A,[z,m(y,c.translate.defaults)]),g,A)};c.translate.fn=c.translate.prototype=a.prototype;c.translate.fn.extend=c.translate.extend=c.extend;c.translate.extend({_bind:w,_filter:i,_validate:o,_getOpt:m,_defaults:h,defaults:c.extend({},h),capitalize:function(x){return x.charAt(0).toUpperCase()+x.substr(1).toLowerCase()
},truncate:function(D,y){var z,G,E,C,B,F,x=encodeURIComponent(D);for(z=0;z<10;z++){try{F=decodeURIComponent(x.substr(0,y-z))}catch(A){continue}if(F){break}}return(!(G=/<(?![^<]*>)/.exec(F)))?((!(E=/>\s*$/.exec(F)))?((C=this._m3.exec(F))?((B=/>(?![^>]*<)/.exec(F))?(C.index>B.index?F.substring(0,C.index+1):F.substring(0,B.index+1)):F.substring(0,C.index+1)):F):F):F.substring(0,G.index)},getLanguages:function(E,D){if(E==e||(D==e&&!E)){return l}var B={},A=typeof E,z=D?c.translate.getLanguages(E):l,F=(A==="object"||A==="function")?E:D;if(F){if(F.call){B=i(z,F)}else{for(var C=0,y=F.length,x;C<y;C++){x=c.translate.toLanguage(F[C]);if(z[x]!=e){B[x]=z[x]}}}}else{B=i(l,n.isTranslatable)}return B},toLanguage:function(y,A){var z=y.toUpperCase();var x=q[z]||(l[z]?z:e)||q[(c.translate.languageCodeMap[y.toLowerCase()]||"").toUpperCase()];return x==e?e:A==="lowercase"?x.toLowerCase():A==="capitalize"?c.translate.capitalize(x):x},toLanguageCode:function(x){return l[x]||l[c.translate.toLanguage(x)]||c.translate.languageCodeMap[x.toLowerCase()]
},same:function(y,x){return y===x||f(y)===f(x)},isTranslatable:function(x){return n.isTranslatable(f(x))},languageCodeMap:{pt:"pt-PT",he:"iw",zlm:"ms","zh-hans":"zh-CN","zh-hant":"zh-TW"},isRtl:{ar:d,iw:d,fa:d,ur:d,yi:d},getBranding:function(){return c(n.getBranding.apply(n,arguments))},load:function(y,x){b=d;function z(){google.load("language",x||"1",{callback:s})}if(typeof google!=="undefined"&&google.load){z()}else{c.getScript("http://www.google.com/jsapi?"+(y?"key="+y:""),z)}return c.translate},ready:function(x,z,y){c.translate.isReady?x():j.push(x);if(!b&&!z){c.translate.load()}return y||c.translate},isReady:g,overload:[[[],[]],[[v,v,t],["from","to","options"]],[[v,t],["to","options"]],[[t],["options"]],[[v,v],["from","to"]],[[v],["to"]],[[v,v,k],["from","to","complete"]],[[v,k],["to","complete"]]],stripScripts:w(u,d,[/<script[^>]*>([\s\S]*?)<\/script>/gi,""]),stripWhitespace:w(u,d,[/\s\s+/g," "]),stripComments:w(u,d,[/<![ \r\n\t]*(--([^\-]|[\r\n]|-[^\-])*--[ \r\n\t]*)>/g,""])})})(jQuery);

(function(f){var e=true,a={text:e,button:e,submit:e},b={SCRIPT:e,NOSCRIPT:e,STYLE:e,OBJECT:e,IFRAME:e},d=f([]);d.length=1;function c(i,h){var j=i.css("text-align");i.css("direction",h);if(j==="right"){i.css("text-align","left")}if(j==="left"){i.css("text-align","right")}}function g(i,j){var k=i.nodeName.toUpperCase(),h=k==="INPUT"&&f.attr(i,"type").toLowerCase();j=j||{altAndVal:e,subject:e};return typeof j.subject==="string"?j.subject:j.altAndVal&&(k==="IMG"||h==="image")?"alt":j.altAndVal&&a[h]?"$val":k==="TEXTAREA"?"$val":"$html"}f.translate.fn._toggle=function(){var i=this.options,j=i.to,h;this.elements.each(f.translate._bind(function(k,l){this.i=k;var n=f(l),m=f.translate.getData(n,j,i);if(!m){return !(h=e)}this.translation.push(m);i.each.call(this,k,l,m,this.source[k],this.from,j,i)},this));!h?this._complete():this._process()};f.translate.extend({_getType:g,each:function(j,l,h,k,p,n,m){d[0]=l;
f.translate.setData(d,n,h,p,k,m);f.translate.replace(d,h,n,m);f.translate.setLangAttr(d,n,m)},getData:function(j,l,k){var h=j[0]||j,i=f.data(h,"translation");return i&&i[l]&&i[l][g(h,k)]},setData:function(k,m,p,n,q,h){if(h&&!h.data){return}var i=k[0]||k,l=g(i,h),j=f.data(i,"translation");j=j||f.data(i,"translation",{});(j[n]=j[n]||{})[l]=q;(j[m]=j[m]||{})[l]=p},replace:function(l,s,r,j){if(j&&!j.replace){return}if(j&&typeof j.subject==="string"){return l.attr(j.subject,s)}var k=l[0]||l,p=k.nodeName.toUpperCase(),n=p==="INPUT"&&f.attr(k,"type").toLowerCase(),m=f.translate.isRtl,i=f.data(k,"lang");if(i===r){return}if(m[r]!==m[i||j&&j.from]){if(m[r]){c(l,"rtl")}else{if(l.css("direction")==="rtl"){c(l,"ltr")}}}if((!j||j.altAndVal)&&(p==="IMG"||n==="image")){l.attr("alt",s)}else{if(p==="TEXTAREA"||(!j||j.altAndVal)&&a[n]){l.val(s)}else{if(!j||j.rebind){var h=l.find("*").not("script"),q=f("<div/>").html(s);f.translate.copyEvents(h,q.find("*"));l.html(q.contents())}else{l.html(s)}}}f.data(k,"lang",r)
},setLangAttr:function(h,j,i){if(!i||i.setLangAttr){h.attr((!i||i.setLangAttr===e)?"lang":i.setLangAttr,j)}},copyEvents:function(i,h){h.each(function(k,n){var o=i[k];if(!n||!o){return false}if(b[o.nodeName.toUpperCase()]){return e}var j=f.data(o,"events");if(!j){return e}for(var m in j){for(var l in j[m]){f.event.add(n,m,j[m][l],j[m][l].data)}}})}});f.fn.translate=function(i,h,l){var j=f.translate._getOpt(arguments,f.fn.translate.defaults),k=f.extend({},f.translate._defaults,f.fn.translate.defaults,j,{complete:function(n,m){f.translate(function(){var q=f.translate.toLanguageCode(j.from);if(j.fromOriginal){n.each(function(r,s){d[0]=s;var t=f.translate.getData(d,q,j);if(!t){return true}m[r]=t})}var p=j.each;function o(r){return function(){[].unshift.call(arguments,this.elements);r.apply(this,arguments)}}j.nodes=n;j.start=o(j.start);j.onTimeout=o(j.onTimeout);j.complete=o(j.complete);j.each=function(s){var r=arguments;if(arguments.length!==7){[].splice.call(r,1,0,this.elements[s])}this.each.apply(this,r);
p.apply(this,r)};f.translate(m,j)})},each:function(){}});if(this.nodesContainingText){return this.nodesContainingText(k)}j.nodes=this;f.translate(f.map(this,function(m){return f(m).html()||f(m).val()}),j);return this};f.fn.translate.defaults=f.extend({},f.translate._defaults)})(jQuery);

(function(h){function c(i,o){var j=[],m={SCRIPT:1,NOSCRIPT:1,STYLE:1,IFRAME:1},n=typeof o,k=n==="string"?function(p){return !h(p).is(o)}:n==="function"?o:null;function l(r,q){var t=0,s=q.childNodes,p=s.length,u;for(;t<p;t++){u=s[t];if(u.nodeType==3&&/\S/.test(u.nodeValue)){j.push(u)}else{if(u.nodeType==1&&!m[u.nodeName.toUpperCase()]&&(!k||k(u))){l(null,u)}}}}h.each((i.length&&!i.nodeName)?i:[i],l);return j}function g(j,i){var k=j.css("text-align");j.css("direction",i);if(k==="right"){j.css("text-align","left")}if(k==="left"){j.css("text-align","right")}}function f(i,k,j){if(!j||j.setLangAttr){h(i).attr((!j||j.setLangAttr===true)?"lang":j.setLangAttr,k)}}function d(k,l,p,q,n){if(!n.replace){return}var i=h.translate.isRtl,m=h.data(k,"lang");if(i[q]!==i[m||n&&n.from]){if(i[q]){g(k,"rtl")}else{if(k.css("direction")==="rtl"){g(k,"ltr")}}}h.data(k,"lang",q);if(p!=l.nodeValue){var j=document.createTextNode(p);
k.replaceChild(j,l);return j}return l}function b(j,l,k,i){if(l.data){if(!h.data(j,"translation")){h.data(j,"translation",{})}if(!h.data(j,"translation")[l.from]){h.data(j,"translation")[l.from]=[]}[].push.call(h.data(j,"translation")[l.from],k);if(!h.data(j,"translation")[l.to]){h.data(j,"translation")[l.to]=[]}[].push.call(h.data(j,"translation")[l.to],i)}}function a(i,l,j){j._childIndex=j._prevParent===i?j._childIndex+1:0;var k=h.data(i,"translation");j._prevParent=i;return k&&k[l]&&k[l][j._childIndex]}function e(m,k,r,u,n,p,j){var q=k.parentNode;b(q,j,u,r);var l=d(q,k,r,p,j);f(q,j.to,j);return l}h.translateTextNodes=function(i){var j=[].slice.call(arguments,0);j.shift();h.translate(function(){var q=h.translate._getOpt(j,h.translateTextNodes.defaults),n=q.each,l=c(i,q.not),m=h.map(l,function(o){return o.nodeValue}),r=h.translate.toLanguageCode(q.from),p={};q.nodes=l;q.textNodes=true;if(q.fromOriginal){h.each(l,function(o,t){var s=a(t.parentNode,r,p);if(!s){return true}m[o]=s})}function k(o){return function(){[].unshift.call(arguments,this.elements);
o.apply(this,arguments)}}q.start=k(q.start);q.onTimeout=k(q.onTimeout);q.complete=k(q.complete);q.each=function(s){var o=arguments;if(arguments.length!==7){[].splice.call(o,1,0,this.elements[s])}this.elements[s]=o[1]=e.apply(this,o);n.apply(this,o)};h.translate(m,q)})};h.translate.fn._toggleTextNodes=function(){var j=this.options,k=j.to,i;h.each(this.elements,h.translate._bind(function(l,o){this.i=l;var m=o.parentNode,n=a(m,k,this);if(!n){return !(i=true)}this.translation.push(n);j.each.call(this,l,o,n,this.source[l],this.from,k,j)},this));!i?this._complete():this._process()};h.fn.translateTextNodes=function(j,i,k){[].unshift.call(arguments,this);h.translateTextNodes.apply(null,arguments);return this};h.translateTextNodes.defaults=h.fn.translateTextNodes.defaults=h.extend({},h.translate._defaults)})(jQuery);

(function(a){var b={tags:["select","option"],filter:a.translate.isTranslatable,label:a.translate.toNativeLanguage||function(d,c){return a.translate.capitalize(c)},includeUnknown:false};a.translate.ui=function(){var g={},f="",d="",c="";if(typeof arguments[0]==="string"){g.tags=a.makeArray(arguments)}else{g=arguments[0]}g=a.extend({},b,a.translate.ui.defaults,g);if(g.tags[2]){d="<"+g.tags[2]+">";c="</"+g.tags[2]+">"}var e=a.translate.getLanguages(g.filter);if(!g.includeUnknown){delete e.UNKNOWN}a.each(e,function(h,i){f+=("<"+g.tags[1]+" value="+i+">"+d+g.label(i,h)+c+"</"+g.tags[1]+">")});return a("<"+g.tags[0]+' class="jq-translate-ui">'+f+"</"+g.tags[0]+">")};a.translate.ui.defaults=a.extend({},b)})(jQuery);

jQuery.translate.fn.progress=function(a,c){if(!this.i){this._pr=0}this._pr+=this.source[this.i].length;var b=100*this._pr/(this.rawSource.length-(11*(this.i+1)));if(a){var d=jQuery(a);if(!this.i&&!d.hasClass("ui-progressbar")){d.progressbar(c)}d.progressbar("option","value",b)}return b};

/*
 *   ANALYTICS
 */
 
 var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-15738853-1']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();


