
$(window).load(function() {
//$(document).ready(function(){




		









		
		
		email = '\u006f\u0066\u0066\u0069\u0063\u0065\u0040\u0072\u006f\u006d\u0070\u0072\u0065\u0073\u0074\u002e\u0072\u006f';
		$('.vcard .email').html('<a href="mailto:'+email+'" title="">'+email+'</a>');



		
		
		
		var gallery = $('#main-side div.gallery');
		var thumbs = $('#main-side .gallery .thumbs a');
		var bigThumb = $('#main-side .gallery div.image');
		var closer = $('#main-side .gallery .close');
		
		$('#main-side .gallery .thumbs a[rel=mg]').hide();
		
		gallery.click(function(){
				$(this).stop().animate({width:640,height:210,padding:30,marginBottom:20}, 400, 'swing', function(){
					$(this).find('.thumbs').stop().fadeIn(300);
					//alert(gallery.find('.thumbs a.current img').eq(0).attr('src'));
					bigThumb.find('a').eq(0).attr('href', gallery.find('.thumbs a.current img').eq(0).attr('src')).css({display:'block'}).lightbox();
					$('#main-side .gallery a[rel=mg]').lightbox();
				});
			});
			
		closer.click(function(e){
				e.stopPropagation();
				gallery.find('.image a').hide();
				gallery.find('.thumbs').stop().fadeOut(100, function(){
					gallery.animate({width:300,height:160,padding:5,marginBottom:5}, 600, 'swing', function(){
						
						//alert(gallery.find('.thumbs a.current img').eq(0).attr('src'));
						//bigThumb.find('a').eq(0).attr('href', gallery.find('.thumbs a.current img').eq(0).attr('src')).lightbox();
					});
				});
				
		});
		
		thumbs.click(function(e){
			e.stopPropagation();
			image = $(this).find('img').eq(0);
			bigThumb.css({backgroundImage:'url('+image.attr('src')+')'});
			bigThumb.find('a').eq(0).attr('href', image.attr('src')).lightbox();
			
			thumbs.removeClass('current');
			$(this).addClass('current');
		});

		
		
		
		
		
		
		// home tabs & hash tags
		
		$('#tabs-menu a').click(function(){
			$('#tabs-menu a').removeClass('active');
			$(this).addClass('active');
			$('#inner-content .active').removeClass('active');
			$('#inner-content .'+$(this).attr('id')).addClass('active');
			
			window.location.hash = $(this).attr('hashtag');
			
		});
			if(window.location.hash) {$('#tabs-menu a[hashtag='+window.location.hash.replace('#', '')+']').click()}
		

		
		$('#logo').css({background:'none',textIndent:0}).flash({
				src: url_base+'flash/logo.swf',
				width:'212',
				height:'210',
				wmode:'transparent'
			}).find('div.alt').css({display:'none'});

		$('#logo_en').css({background:'none',textIndent:0}).flash({
				src: url_base+'flash/logo_en.swf',
				width:'212',
				height:'210',
				wmode:'transparent'
			}).find('div.alt').css({display:'none'});
		
			
		//$('#search_form').attr('action', 'javascript:search()');






});

function subscribe(){
	form = $('#newsletter_form');
	email = form.find('#newsletter_email').val();
	
	data = 'ajax=1&nemail='+email;
			
			$.ajax({
				type: 	'post',
				url: 	url_base+'ajax/',
				data:	data,
							
				beforeSend: function() {
					
				},
				success: function (response) {
					
				},
				error: function(response) {
					error = 1;
				},
				complete:	function(response) {
					
					r = response.responseText.split('::');
					form.find('p.info').removeClass('error').removeClass('warning').removeClass('ok').addClass(r[0]).html(r[1]);
				}
			});
}

