function startMainSite(){
	var main_obj = $('#centered');
	var w = $(window).width();
	var h = $(window).height();
	main_obj.css({'width':tvar_centered_width+'px','height':tvar_centered_height+'px'});
	var margin_top = parseInt((h-tvar_centered_height)/2);
	main_obj.css({'margin-top':margin_top+'px','margin-left':'auto','margin-right':'auto'});
	$('.col_1').css({'height':tvar_centered_height+'px'});
	$('.col_2').css({'height':tvar_centered_height+'px'});
	$('.col_3').css({'height':tvar_centered_height+'px'});
	//ustawianie boków tła
	var sides_width = parseInt((w-tvar_centered_width)/2)+52;
	$('.side_left').css({'width':sides_width+'px'});
	$('.side_right').css({'width':sides_width+'px'});
	var tb_height = parseInt((h-tvar_centered_height)/2)+71;
	$('.side_top').css({'height':tb_height+'px'});//-185
	$('.side_bottom').css({'height':tb_height+'px'});
	
	$('#bottom_belt_data').css({'bottom':(tb_height-119)+'px','left':(sides_width-60)+'px'});
}

$(document).ready(function($) {
	if ($.browser.msie && $.browser.version == 8) {
		//$('.menu_1_inner_top').css({'opacity':'1'})
		$('.menu_1_inner_top').css({'background-position':'0 240px'});
		$('.menu_2_inner_top').css({'background-position':'-320px 240px'});
		$('.menu_3_inner_top').css({'background-position':'-639px 240px'});
		$('#btn_col_1').hover(function() {
			$('.menu_1_inner').stop().animate({
				backgroundPosition: "0 -554px"//-534px
			}, tvar_menu_anim_time);		
			$('.menu_1_inner_top').stop().animate({
				backgroundPosition: "0 40px",
				//opacity: 1
			}, tvar_menu_anim_time);			
			$('.img_1_active img').stop().animate({//width:374px; height:760px;
				width: "374px",
				height: "760px",
				top: "-55px",
				left: "-27px",
				opacity: 1
			}, tvar_image_anim_time);
		} , function() { //On hover out...
			$('.menu_1_inner').stop().animate({
				backgroundPosition: "0 -634px"//-634px
			}, tvar_menu_anim_time);	
			$('.menu_1_inner_top').stop().animate({
				backgroundPosition: "0 240px",
				//opacity: 0
			}, tvar_menu_anim_time);	
			$('.img_1_active img').stop().animate({//width:320px; height:650px; 
				width: "320px",
				height: "650px",
				top: "0px",
				left: "0px",
				opacity: 0
			}, tvar_image_anim_time);
		});
		
		
		$('#btn_col_2').hover(function() {
			$('.menu_2_inner').stop().animate({
				backgroundPosition: "-320px -654px"//-534px
			}, tvar_menu_anim_time);		
			$('.menu_2_inner_top').stop().animate({
				backgroundPosition: "-320px 40px",
				//opacity: 1
			}, tvar_menu_anim_time);		
			$('.img_2_active img').stop().animate({//width:374px; height:760px;
				width: "374px",
				height: "760px",
				top: "-55px",
				left: "-27px",
				opacity: 1
			}, tvar_image_anim_time);
		} , function() { //On hover out...
			$('.menu_2_inner').stop().animate({
				backgroundPosition: "-320px -634px"//-634px
			}, tvar_menu_anim_time);	
			$('.menu_2_inner_top').stop().animate({
				backgroundPosition: "-320px 240px",
				//opacity: 0
			}, tvar_menu_anim_time);		
			$('.img_2_active img').stop().animate({//width:320px; height:650px; 
				width: "320px",
				height: "650px",
				top: "0px",
				left: "0px",
				opacity: 0
			}, tvar_image_anim_time);
		});
		
		$('#btn_col_3').hover(function() {
			$('.menu_3_inner').stop().animate({
				backgroundPosition: "-639px -654px"//-534px
			}, tvar_menu_anim_time);		
			$('.menu_3_inner_top').stop().animate({
				backgroundPosition: "-639px 40px",
				//opacity: 1
			}, tvar_menu_anim_time);		
			$('.img_3_active img').stop().animate({//width:374px; height:760px;
				width: "374px",
				height: "760px",
				top: "-55px",
				left: "-27px",
				opacity: 1
			}, tvar_image_anim_time);
		} , function() { //On hover out...
			$('.menu_3_inner').stop().animate({
				backgroundPosition: "-639px -634px"//-634px
			}, tvar_menu_anim_time);	
			$('.menu_3_inner_top').stop().animate({
				backgroundPosition: "-639px 240px",
				//opacity: 0
			}, tvar_menu_anim_time);		
			$('.img_3_active img').stop().animate({//width:320px; height:650px; 
				width: "320px",
				height: "650px",
				top: "0px",
				left: "0px",
				opacity: 0
			}, tvar_image_anim_time);
		});		
	} else {
		$('#btn_col_1').hover(function() {
			$('.menu_1_inner').stop().animate({
				backgroundPosition: "0 -654px"//-534px
			}, tvar_menu_anim_time);		
			$('.menu_1_inner_top').stop().animate({
				backgroundPosition: "0 40px",
				opacity: 1
			}, tvar_menu_anim_time);			
			$('.img_1_active img').stop().animate({//width:374px; height:760px;
				width: "374px",
				height: "760px",
				top: "-55px",
				left: "-27px",
				opacity: 1
			}, tvar_image_anim_time);
		} , function() { //On hover out...
			$('.menu_1_inner').stop().animate({
				backgroundPosition: "0 -634px"//-634px
			}, tvar_menu_anim_time);	
			$('.menu_1_inner_top').stop().animate({
				backgroundPosition: "0 86px",
				opacity: 0
			}, tvar_menu_anim_time);	
			$('.img_1_active img').stop().animate({//width:320px; height:650px; 
				width: "320px",
				height: "650px",
				top: "0px",
				left: "0px",
				opacity: 0
			}, tvar_image_anim_time);
		});
		
		$('#btn_col_2').hover(function() {
			$('.menu_2_inner').stop().animate({
				backgroundPosition: "-320px -654px"//-534px
			}, tvar_menu_anim_time);		
			$('.menu_2_inner_top').stop().animate({
				backgroundPosition: "-320px 40px",
				opacity: 1
			}, tvar_menu_anim_time);		
			$('.img_2_active img').stop().animate({//width:374px; height:760px;
				width: "374px",
				height: "760px",
				top: "-55px",
				left: "-27px",
				opacity: 1
			}, tvar_image_anim_time);
		} , function() { //On hover out...
			$('.menu_2_inner').stop().animate({
				backgroundPosition: "-320px -634px"//-634px
			}, tvar_menu_anim_time);	
			$('.menu_2_inner_top').stop().animate({
				backgroundPosition: "-320px 86px",
				opacity: 0
			}, tvar_menu_anim_time);		
			$('.img_2_active img').stop().animate({//width:320px; height:650px; 
				width: "320px",
				height: "650px",
				top: "0px",
				left: "0px",
				opacity: 0
			}, tvar_image_anim_time);
		});
		
		$('#btn_col_3').hover(function() {
			$('.menu_3_inner').stop().animate({
				backgroundPosition: "-639px -654px"//-534px
			}, tvar_menu_anim_time);		
			$('.menu_3_inner_top').stop().animate({
				backgroundPosition: "-639px 40px",
				opacity: 1
			}, tvar_menu_anim_time);		
			$('.img_3_active img').stop().animate({//width:374px; height:760px;
				width: "374px",
				height: "760px",
				top: "-55px",
				left: "-27px",
				opacity: 1
			}, tvar_image_anim_time);
		} , function() { //On hover out...
			$('.menu_3_inner').stop().animate({
				backgroundPosition: "-639px -634px"//-634px
			}, tvar_menu_anim_time);	
			$('.menu_3_inner_top').stop().animate({
				backgroundPosition: "-639px 86px",
				opacity: 0
			}, tvar_menu_anim_time);		
			$('.img_3_active img').stop().animate({//width:320px; height:650px; 
				width: "320px",
				height: "650px",
				top: "0px",
				left: "0px",
				opacity: 0
			}, tvar_image_anim_time);
		});
	}
});

$(function () {
	//if ($.browser.msie && $.browser.version < 7) return;
	if ( $.browser.msie ){
		$('#menu_lang_id li a.pl').addClass('active');
	} else {
		$('ul#menu_lang_id li').find('a span').each(function () {
			if ($(this).parent().hasClass('active') == false){
				var jQspan = $(this).css('opacity', 0);
				// when the user hovers in and out of the anchor
				$(this).hover(function () {// on hover
					jQspan.stop().fadeTo(350, 1);
				}, function () {// off hover
					jQspan.stop().fadeTo(350, 0);
				});
			}//edn if
		});
		$('#menu_lang_id li a.pl').addClass('active');
	}
});


/* CHANGE STYLES CSS */
function getActiveStyleSheet_start() {
	var i, a;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
	  if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
	}
	return null;
}

function getActiveStyleSheet() {
	var i, a;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
	  if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) {
	  }
	}
}

window.onunload = function(e) {
	var title = getActiveStyleSheet_start();
	var styleCookieOptions = {path: '/', duration: 1};
	Cookie.set('style', title, styleCookieOptions);
}

function setActiveStyleSheet(title) {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			a.disabled = true;
			if(a.getAttribute("title") == title) a.disabled = false;
		}
	}
}

function changeLang(lang,obj){
	$('#menu_lang_id li a').each( function(){
		$(this).removeClass('active');	
	});	
	$(obj).addClass('active');
	switch(lang){
		case 'pl':
			$('#bottom_belt_data').html(tvar_footer_pl);
			$('#btn_col_1').attr("href", tvar_links_array_pl[0]);
			$('#btn_col_2').attr("href", tvar_links_array_pl[1]);
			$('#btn_col_3').attr("href", tvar_links_array_pl[2]);
		break;	
		case 'en':
			$('#bottom_belt_data').html(tvar_footer_en);
			$('#btn_col_1').attr("href", tvar_links_array_en[0]);
			$('#btn_col_2').attr("href", tvar_links_array_en[1]);
			$('#btn_col_3').attr("href", tvar_links_array_en[2]);
		break;
		case 'de':
			$('#bottom_belt_data').html(tvar_footer_de);
			$('#btn_col_1').attr("href", tvar_links_array_de[0]);
			$('#btn_col_2').attr("href", tvar_links_array_de[1]);
			$('#btn_col_3').attr("href", tvar_links_array_de[2]);
		break;	
		case 'sk':
			$('#bottom_belt_data').html(tvar_footer_sk);
			$('#btn_col_1').attr("href", tvar_links_array_sk[0]);
			$('#btn_col_2').attr("href", tvar_links_array_sk[1]);
			$('#btn_col_3').attr("href", tvar_links_array_sk[2]);
		break;
	}
	setActiveStyleSheet(lang);
}


//dodaje możliwość animowania tła
/**
 * @author Alexander Farkas
 * v. 1.21
 */
(function($) {
	if(!document.defaultView || !document.defaultView.getComputedStyle){ // IE6-IE8
		var oldCurCSS = jQuery.curCSS;
		jQuery.curCSS = function(elem, name, force){
			if(name === 'background-position'){
				name = 'backgroundPosition';
			}
			if(name !== 'backgroundPosition' || !elem.currentStyle || elem.currentStyle[ name ]){
				return oldCurCSS.apply(this, arguments);
			}
			var style = elem.style;
			if ( !force && style && style[ name ] ){
				return style[ name ];
			}
			return oldCurCSS(elem, 'backgroundPositionX', force) +' '+ oldCurCSS(elem, 'backgroundPositionY', force);
		};
	}
	
	var oldAnim = $.fn.animate;
	$.fn.animate = function(prop){
		if('background-position' in prop){
			prop.backgroundPosition = prop['background-position'];
			delete prop['background-position'];
		}
		if('backgroundPosition' in prop){
			prop.backgroundPosition = '('+ prop.backgroundPosition;
		}
		return oldAnim.apply(this, arguments);
	};
	
	function toArray(strg){
		strg = strg.replace(/left|top/g,'0px');
		strg = strg.replace(/right|bottom/g,'100%');
		strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
		var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
		return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
	}
	
	$.fx.step. backgroundPosition = function(fx) {
		if (!fx.bgPosReady) {
			var start = $.curCSS(fx.elem,'backgroundPosition');
			
			if(!start){//FF2 no inline-style fallback
				start = '0px 0px';
			}
			
			start = toArray(start);
			
			fx.start = [start[0],start[2]];
			
			var end = toArray(fx.options.curAnim.backgroundPosition);
			fx.end = [end[0],end[2]];
			
			fx.unit = [end[1],end[3]];
			fx.bgPosReady = true;
		}
		//return;
		var nowPosX = [];
		nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
		nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
		fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

	};
})(jQuery);
