var addthis_pub				= 'eupractices.eu'; 
var addthis_logo			= '';
var addthis_logo_background	= '10d6f9';
var addthis_logo_color		= '000';
var addthis_brand			= 'eupractices.eu';
var addthis_options			= 'favorites, email, delicious, google, digg, reddit, facebook, live, more';




var Flags = (function(){
	var flags = {
		'all languages':	'country-all',
		'germany':		'country-german',
		'bulgaria':		'country-bulgarian',
		'lithuania':		'country-lithuania',
		'romania':		'country-romania',
		'estonia':		'country-estonia',
		'slovakia':		'country-slovakia',
		'poland':		'country-polish',
		'greece':		'country-greece',
		'turkey':		'country-turkish'
		
	};
	
	function addFlag(element){
		var text = element.innerHTML.toLowerCase();
		if (flags[text]){
			element.addClassName(flags[text]);
		}
	}

	return {
		add: function(select){
			addFlag(select.linkspan)
			select.ul.select('a').each(function(a){
				addFlag(a);
			});
		},
		onChange: function(value){
			this.linkspan.className = '';
			addFlag(this.linkspan);
		}
	};
})();


$$('select').each(function(select){
	if (select.name == 'country'){
		Flags.add(new CD3.Select(select, { onChange: Flags.onChange }));
	} else {
		new CD3.Select(select);
	}
});

//text resizer
if ($('sizer')) {
$('big').observe('click', function(){
	var mar =  parseInt( $('sizer').getStyle('font-size') );
		if (mar < 18){ 
			$('sizer').style.fontSize = mar + 2 + 'px' ;
			
			$$('#sizer p, #sizer h1 , #sizer a , #sizer table td, #sizer h2 ,#sizer h3, #sizer h4').each( function(sd){
				var dol = parseInt(  sd.getStyle('font-size') ) + 2 + 'px'; 
				sd.style.fontSize = dol ;
				});
		};
	});
				
$('small').observe('click', function(){
	var mar =  parseInt( $('sizer').getStyle('font-size') );
		if (mar > 13){ 
			$('sizer').setStyle({fontSize: mar - 2 + 'px'})
			
			$$('#sizer p, #sizer h1, #sizer a , #sizer table td , #sizer h2,#sizer h3, #sizer h4').each( function(sd){
					var dol = parseInt(  sd.getStyle('font-size') ) - 2 + 'px'; 
					sd.style.fontSize = dol ;
				});
		}; 
	});
$('normal').observe('click', function(){
		$('sizer').setStyle({fontSize: 12 + 'px'}); 
		$$(' #sizer h1').each( function(sd){ sd.style.fontSize = '16px' });
		$$(' #sizer h1').each( function(sd){ sd.style.fontSize = '18px'});
		$$(' #sizer h2').each( function(sd){ sd.style.fontSize = '12px'});
		$$(' #sizer h3').each( function(sd){ sd.style.fontSize = '12px'});
		$$(' #sizer h4').each( function(sd){ sd.style.fontSize = '12px'});
		$$(' #sizer a').each( function(sd){ sd.style.fontSize = '12px'});
		$$('#sizer p, #sizer table td').each( function(sd){ sd.style.fontSize = '12px'});
	});
};

CD3.Behaviors.assign({
	'input[type=text],input[type=password]': {
		focus: function(){
			if (this.getAttribute('value') == this.getAttribute('title'))
				this.setAttribute('value', '');
				
			this.up('div').style.backgroundPosition = 'left bottom';
		},
		blur: function(){
			if (!this.getAttribute('value'))
				this.setAttribute('value', this.getAttribute('title'));
			
			this.up('div').style.backgroundPosition = 'left top';
		}	
	},
	'input[type=submit]': {
		mouseover: function(){
			this.style.backgroundPosition = 'left bottom';
		},
		mouseout: function(){
			this.style.backgroundPosition = 'left top';
		}
	},
	'#gadgets-bookmark': {
		mouseover:	function(){ addthis_open(this, '', location.href, 'eupractices.eu');},
		mouseout:	function(){ addthis_close(); },
		click:		function(){ addthis_sendto(); }
	}
	
});


function changeTable(){
	var tables = $$('#sizer table');
	
	if($('registercho')){
		
	}else{
		tables.each(function(all){
		all.down('tr').addClassName('firsta');
	})
	}
	
	
};
changeTable();

