var lista = new Array();

for(var i=1;i<5;i++)
{
	var img = new Image;
	lista.push(img.src = base+"images/header_"+i+"_hover.png");
}




//top
var flashvars = {};
var params = {
	menu: "false",
	scale: "default",
	wmode: "transparent",
	scale: 'noscale'
};
swfobject.embedSWF(base+"flash/"+flash_file, "top-flash", "719", "199", "9.0.0", false, flashvars, params);

var flashvars = {
	img:base+"flash/images/top_img_"+top_img+".png"
};
var params = {
	menu: "false",
	scale: "noscale"
};
swfobject.embedSWF(base+"flash/"+flash_file, "top-flash-subpage", "719", "199", "9.0.0", false, flashvars, params);

//logotypy
var flashvars = {
	xmlData:site+"/pl/loga_xml",baseUrl:base
};
var params = {
	menu: "false",
	scale: "default",
	wmode: "transparent"
};
swfobject.embedSWF(base+"flash/logo_slide.swf", "logotype-flash", "698", "65", "9.0.0", false, flashvars, params);

//mapa
var flashvars = {
	baseURL: mapBase,
	active: wojew
};
var params = {
	menu: "false",
	scale: "default",
	wmode: "transparent"
};
swfobject.embedSWF(base+"flash/mapa.swf", "map-flash", "285", "257", "9.0.0", false, flashvars, params);

$.fn.equalHeights = function(px) {
	$(this).each(function(){
		var currentTallest = 0;
		$(this).children().each(function(i){
			if ($(this).height() > currentTallest) { currentTallest = $(this).height(); }
		});
		// for ie6, set height since min-height isn't supported
		if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest}); }
		$(this).children(':not(.clear)').css({'min-height': currentTallest}); 
	});
	return this;
};


$(function(){
	$('.openThat').prev().addClass('open')

	$('#main-navbar ul li .link_1').css({'padding-top':'3px','border-top':'none','background-position':'6px 8px'})
	$('.box-info').hover(function(){
		if($(this).find('.header_img img').attr("src").indexOf("_hover") == -1) {
			var newSrc = $(this).find('.header_img img').attr("src").replace(".png","_hover.png#hover");
			$(this).find('.header_img img').attr("src",newSrc);
		}
		$(this).css('background','#fcb511').end();
		$(this).find('p').css('color','#fff');
		
		
	
	},function(){
		$(this).css('background','none').end();
		$(this).find('p').css('color','#898989');
		
		if($(this).find('.header_img img').attr("src").indexOf("_hover.png#hover") != -1) {
			var oldSrc = $(this).find('.header_img img').attr("src").replace("_hover.png#hover",".png");
			$(this).find('.header_img img').attr("src",oldSrc);
	
	}})
	
	$('.main-navbar ul a').collapsor();
	$('.lightbox').lightBox();
	var contact_boxes = $('.column-list .contact-box-sh');
	
	for(i=2;i<contact_boxes.length;i=i+2)
	{
		$(contact_boxes[i]).css('clear','both');
	}
	$('#accordion').accordion({"active": false,autoHeight: false,collapsible: true});
	$('#accordion table tr th:eq(0)').addClass('th-1');
	
	$('#accordion table tr').find('td:eq(0)').addClass('th-1');
	$('#accordion table tr').find('td:eq(2)').addClass('th-center');
	$('#accordion table tr').find('th:eq(2)').addClass('th-center');
	$('#accordion table tr').find('td:eq(3)').addClass('th-center');
	$('#accordion table tr').find('th:eq(3)').addClass('th-center');
	
	var tabele = $('#accordion table');
	
	for(var i = 0;i<tabele.length;i++)
	{
		$(tabele[i]).find('tr:even').addClass('th-odd').end();
	}
	
	
	var inputy = new Array();
	
	$('#top-search input[type="text"]').each(function(){
		inputy.push($(this).val());
	});
	
	$('#top-search input[type="text"]').blur(function(){
		var index_ = $('#top-search input[type="text"]').index(this);
		var obecny_input = inputy[index_];
		chkName(this, obecny_input);
	})
	
	$('#top-search input[type="text"]').focus(function(){
		var index_ = $('#top-search input[type="text"]').index(this);
		var obecny_input = inputy[index_];
		remName(this, obecny_input);
	});

	var inputy_ = new Array();
	
	$('#newsletter-box input[type="text"]').each(function(){
		inputy_.push($(this).val());
	});
	
	$('#newsletter-box input[type="text"]').blur(function(){
		var index_ = $('#newsletter-box input[type="text"]').index(this);
		var obecny_input = inputy_[index_];
		chkName(this, obecny_input);
	})
	
	$('#newsletter-box input[type="text"]').focus(function(){
		var index_ = $('#newsletter-box input[type="text"]').index(this);
		var obecny_input = inputy_[index_];
		remName(this, obecny_input);
	});
	
	$('a.zoom').fancybox();

})

function onload_this(){
	$('#center_text').equalHeights();
	$('#center').equalHeights();
}

window.onload=onload_this;

function remName(a, b){

if(a.value==b){
a.value='';
}else if(a.value==''){
a.value=b;
}else{
a.value=a.value;
}
}
 
function chkName(a, b){
if(a.value==''){
a.value=b;
}else{
a.value=a.value;
}
}


