$(document).ready(function() {
	
	$('#inputDate').DatePicker({
		format:'d.m.Y',
		date: $('#inputDate').val(),
		current: $('#inputDate').val(),
		starts: 1,
		position: 'r',
		onBeforeShow: function(){
			$('#inputDate').DatePickerSetDate($('#inputDate').val(), true);
		},
		onChange: function(formated, dates){
			$('#inputDate').val(formated);
			$('#inputDate').DatePickerHide();

		}
	});
	
	$('#banner').flash({
	src: '1.swf',
	width: 800,
	height: 146
	}, { expressInstall: true });

	setInterval(function() { $('#fillright').show().css('width', ($(window).width()-1599)/2+'px'); },50);

	exts = ['.jpg', '.gif', '.png'];
	
	$('#topmenu ul li.current > .topmenu_fill').show();
	
	$('#topmenu ul li').hover(function() {
		$(this).css('background', 'url(images/top_hover_full.png) left no-repeat');
		$(this).children('.topmenu_fill').show();
	}, function() {
		if(!$(this).hasClass('current')) {
			
			$(this).css('background', 'none');
			$(this).children('.topmenu_fill').hide();
			
		}
	});
	
	$('#partners ul li img.a').hover(function() {
		$(this).stop().animate({"opacity": "0"}, "slow");
	}, function() { 
		$(this).stop().animate({"opacity": "1"}, "slow");
	});

	$('#partners a').css('cursor', 'text');
	$('#partners a[href!=""]').css('cursor', 'pointer');

	if(screen.width < 1280) {

		$('#topmenu').css('width', screen.width+'px');
		$('ul.pl').css({ 'float': 'left', 'margin' : ' 17px 0 0 50px'});
		var cfacebook = $('#flike').html();
		$('#full').css('margin', '0 auto');
		$('#partners, #full, #full .wrapper:first, #footer, #footer_content, .wrapper').css('width', screen.width+'px');
		$('#flike').remove();

		if(screen.width <= 1024) {

			$('#logo a').css({ 'height' : 'auto', 'width' : 'auto', 'background' : 'none' });
			$('#logo a').html($('<img />').attr('src', 'images/logo1stclass.png').css({ 'padding' : '8px 0 0 10px', 'width' : '150px' }));
			$('#flags').css('left', '-35px');
			$('ul.pl, ul.ua').css('margin', '17px 17px 0 0');
			$('ul.ua li').css('margin-left', '10px');


		}

	}

	$.each($('#partners img.a'), function() {

		var img = new Image();
		
		var partner = $(this);

		img.onload = function() {
			partner.parent().parent().css('width', (this.width+5)+'px');
			//partner.parent().parent().css('width', (this.width+5)+'px !important');
		}

		img.src = $('base').attr('href')+partner.attr('src');
		d = null;

	});
	
});

(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {return;}
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/pl_PL/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);

}(document, 'script', 'facebook-jssdk'));

