function css() {
	/**
	 * IE6, IE7
	 */
	if($.browser.msie){
		if($.browser.version <= 6) {
			$('input[type="password"], input[type="text"], textarea, a').focus(function(){ $(this).addClass('focus'); });
			$('input[type="password"], input[type="text"], textarea, a').blur(function(){ $(this).removeClass('focus'); });
			$('input#btn-prod-koszyk, input#btn-negocjuj, #this-print, #list-prod-comp .image, #nav-studio li, #sub-nav-studio li, .checkout-btn-div input, .prods-filter .view').hover(function(){
				$(this).addClass('hover');
			}, function(){
				$(this).removeClass('hover');		
			});
		} // 6

		$('#nav-studio>li').mouseover(function(){
			$ul = $(this).children('ul');
			w = $(this).width();
			w_ul = w+125+'px';
			w_a = w+70+'px';
			$ul.css({width: w_ul});
			$ul.children('li').children('a').css({width: w_a});
			//alert(w_ul);
		});
		
		//$('.lista-kategori a.title strong').append('<span>');	
		
	} // msie

	var ar_no = $('#aranzacje li').size();	
	for(ar_val = 0; ar_val < ar_no; ar_val++){
		if (ar_val % 2 == 0) {
			$('#aranzacje li').eq(ar_val).addClass('item-1');
		}
		else {
			$('#aranzacje li').eq(ar_val).addClass('item-2');
		}
	}


	$('ul.thumbs').find('a.thickbox').each(function(i){
  		var ah = $('a.thickbox img').eq(i).height();
		var ph = $('a.thickbox img').eq(i).parent().height();
		var mh = (ph - ah) / 2;
		$('ul.thumbs li a.thickbox img').eq(i).css('padding-top', mh);
	});
	
	
	/* dymki */
	$('.call-attr-info, .call-attr-zoom').click(function(event){ event.preventDefault(); });
		$('.call-attr-info').hover(function(){
			var $dymek = $(this).next('.info').children('.attr-info');
			$dymek.css({ display: 'block'});
		}, 
		function(){
			var $dymek = $(this).next('.info').children('.attr-info');
			$dymek.css({ display: 'none'});
			return false;
		}); 	
		

	
	/**
	 * Zakładkowe menu pomocy
	 */
	$('#faq-pomoc a').click(function(event){
		event.preventDefault();
		var faq_menu_href = $(this).attr('href');
		var faq_menu_id = faq_menu_href.split('#')[1];
		$('.'+faq_menu_id).siblings().hide();
		$('.'+faq_menu_id).show();
	});


	/**
	 * kontynuuj zakupy
	 */
	
	// koszyk - atrybut cenowy
	$("input.price").focus(function() {
		if ($(this).val() == '?' ) $(this).val(''); 
	});
	
	$("input.price").blur(function() {
		if ($(this).val() == '' ) $(this).val('?');
	});
	
	$(".lsa").click(function(){
		alert('click');
		   var id = $(this).attr('id');
		   var attrID = id.split('_')[1];
		   $('.chkattr' + attrID).attr("checked", "checked");
	});
	
	/**
	 * STRONA PRODUKTU
	 */
	//if($('div').is('#prod-details') == true){
	if($('li').is('#dane-techniczne') == true){
		/* Środkowanie głównego zdjęcia produktu */
		//var sciezkaIMG = $('#prod-image .image-main img').attr('src');
		//var fotoIMG = new Image();
		//fotoIMG.src = $('#prod-image .image-main img').attr('src');
		/* opcje atrybutów: cena */
		//$("#probki_menu li a div").children("em").show(function(){
		//	$(this).wrap("<table><tr><td></td></tr></table>");
		//});
		$('#attr-cena').change(function(){
			var attr, attrC, attrG;
			attr = $(this).attr('value');
			attrC = attr.split('#')[1];
			attrG = attr.split('#')[0];
			attrG = attrG.split(' ')[0];
			attrG = attrG.replace(/\./g, '_');
			klik_probka_grupa(document.forms['item_detail'].item.value,attrG);
		});

		/* środki konserwacji */
		var prods_no = $('.ekspozycja li').size();
		for(prods_val = 0; prods_val < prods_no; prods_val++){
			if (prods_val % 4 == 0) {
				$('.ekspozycja li').eq(prods_val).addClass('item-first');
			}
		}		
	
		/* Zakładki pod opisem */
		$('.rel-tab').hide();
		$('.dane-techniczne').addClass('active');
		$('#dane-techniczne').show();
		
		$('#product-menu li a').click(function(event){
				event.preventDefault();
				var schowaj = $('#product-menu li.active').removeClass('active').attr('class');				
				var pokaz = $(this).parent('li').attr('class');
	
				$(this).parent('li').addClass('active');
				$('#'+schowaj).hide();	
				$('#'+pokaz).show();	
		});	
	
	
		/* dymki */
	
		
		$('.call-attr-zoom').hover(function(){
			var pr_src = $(this).attr('href');
			var pr_alt = $(this).attr('title');
			$(this).parent('.probki-img').parent('li').parent('ul').parent('div').next('.probka-bg').children('.info').remove();
			$(this).parent('.probki-img').parent('li').parent('ul').parent('div').next('.probka-bg').append('<div class="info"><div class="attr-info-img"><img src="'+pr_src+'" alt="'+pr_alt+'" class="attr-info2" /></div></div>');
			$(this).parent('.probki-img').parent('li').parent('ul').parent('div').next('.probka-bg').children('.info').children('.attr-info-img').css({ display: 'block'});
			$(this).parent('.probki-img').parent('li').parent('ul').parent('div').next('.probka-bg').children('strong').hide();
		}, 
		function(){
			//$(this).parent('.probki-img').parent('li').parent('ul').parent('div').next('.probka-bg').children('.info').remove();
			//$(this).parent('.probki-img').parent('li').parent('ul').parent('div').next('.probka-bg').children('strong').show();
			return false;
		});
			
		
	}
	
	/* lista aranżacji na stronie kategorii */
	
	var li_ara_no = $('#lista-aranazacji li').size();	
	
	for(li_ara_val = 0; li_ara_val < li_ara_no; li_ara_val++){
		
		if (li_ara_val % 5 == 0) {
			$('#lista-aranazacji li').eq(li_ara_val).addClass('item-last');
		}
	
	}	
	
	
	
	$('.prods-filter select').change(function(){ $('.prods-filter').submit(); });
	
	
	
	
	/* raty */
	
	/**
		funkcja ratalna wywoływana w sposób:
		@@ raty(id, firma, procent, widelki, procent_widelki, prog)
		np.:
		@@ raty('aig', '#Aig',1.2, 3000, 2, 0);
		
		gdzie:
		@ firma - identyfikator (HTML) dla danego banku
		@ procent - oprocentowanie jednej raty
		@ widelki - zasięg cenowy dla definiowania innego oprocentowania
		@ procent_widelki - oprocentowanie dla wartości cenowych widełek
		@ prog - minimalna wartość towaru na jaką mozna skorzystać z rat
	
	*/

	var procent, wartosc;
	
	function raty(id, firma, procent, widelki, procent_widelki, prog){
		var cena, cena_produktu, raty, Rata, wplata, prowizja;
		empty_id = id;
		id = '#'+id;
		cena = $('.cena strong span').text();
		cena_produktu = cena.replace(/\s+/,"");
		$(id+'-wartosc').attr('value',cena_produktu);
	
		wartosc = parseInt(wartosc);	// wartość produktu
		raty = parseInt(raty);			// ilość rat
		Rata = parseInt(Rata);			// ilość rat
		wplata = parseInt(wplata);		// wpłata własna
		prowizja = parseInt(prowizja);	// prowizja od całej wartości
		widelki = parseInt(widelki);	// zasięg cenowy dla definiowania innego oprocentowania
		prog = parseInt(prog);			// wartość progu ratalnego
	
		wartosc =+ $(id+'-wolumen').attr('value');
		raty =+ $(id+'-raty').attr('value');
		wplata =+ $(id+'-kwota-bazowa').attr('value');
		wartosc_koncowa =+ (wartosc-wplata);		
	
		if (wartosc_koncowa <= 500)
		{
			if (raty <= 10) { procent = 30.75; }
			else if (raty == 15) { procent = 43.6; }
			else if (raty == 20) { procent = 57.2; }
			else if (raty == 25) { procent = 71.1; }
			else if (raty == 30) { procent = 85.2; }
			else { procent = 102.7; }
		}
		else if (wartosc_koncowa > 500 & wartosc_koncowa <= 1000)
		{
			if (raty <= 10) { procent = 26.55; }
			else if (raty == 15) { procent = 37.24; }
			else if (raty == 20) { procent = 48.34; }
			else if (raty == 25) { procent = 59.85; }
			else if (raty == 30) { procent = 71.8; }
			else { procent = 86.75; }
		}
		else if (wartosc_koncowa > 1000 & wartosc_koncowa <= 2000)
		{
			if (raty <= 10) { procent = 24.15; }
			else if (raty == 15) { procent = 33.76; }
			else if (raty == 20) { procent = 43.79; }
			else if (raty == 25) { procent = 54.25; }
			else if (raty == 30) { procent = 65.13; }
			else { procent = 78.8; }
		}
		else if (wartosc_koncowa > 2000 & wartosc_koncowa <= 3000)
		{
			if (raty <= 10) { procent = 23.35; }
			else if (raty == 15) { procent = 65.22; }
			else if (raty == 20) { procent = 42.28; }
			else if (raty == 25) { procent = 52.38; }
			else if (raty == 30) { procent = 62.91; }
			else { procent = 76.13; }
		}
		else if (wartosc_koncowa > 3000 & wartosc_koncowa <= 4000)
		{
			if (raty <= 10) { procent = 22.95; }
			else if (raty == 15) { procent = 32.03; }
			else if (raty == 20) { procent = 41.52; }
			else if (raty == 25) { procent = 51.44; }
			else if (raty == 30) { procent = 61.8; }
			else { procent = 74.81; }
		}
		else if (wartosc_koncowa > 4000 & wartosc_koncowa <= 5000)
		{
			if (raty <= 10) { procent = 22.72; }
			else if (raty == 15) { procent = 31.66; }
			else if (raty == 20) { procent = 41.07; }
			else if (raty == 25) { procent = 50.88; }
			else if (raty == 30) { procent = 61.13; }
			else { procent = 74.01; }
		}
		else if (wartosc_koncowa > 5000 & wartosc_koncowa <= 6000)
		{
			if (raty <= 10) { procent = 22.55; }
			else if (raty == 15) { procent = 31.45; }
			else if (raty == 20) { procent = 40.77; }
			else if (raty == 25) { procent = 50.51; }
			else if (raty == 30) { procent = 60.69; }
			else { procent = 73.48; }
		}
		else if (wartosc_koncowa > 6000 & wartosc_koncowa <= 7000)
		{
			if (raty <= 10) { procent = 21.73; }
			else if (raty == 15) { procent = 31.29; }
			else if (raty == 20) { procent = 40.55; }
			else if (raty == 25) { procent = 50.24; }
			else if (raty == 30) { procent = 60.36; }
			else { procent = 73.1; }
		}
		else if (wartosc_koncowa > 7000 & wartosc_koncowa <= 8000)
		{
			if (raty <= 10) { procent = 22.35; }
			else if (raty == 15) { procent = 31.16; }
			else if (raty == 20) { procent = 40.39; }
			else if (raty == 25) { procent = 50.04; }
			else if (raty == 30) { procent = 60.12; }
			else { procent = 72.82; }
		}
		else 
		{
			if (raty <= 10) { procent = 22.28; }
			else if (raty == 15) { procent = 31.07; }
			else if (raty == 20) { procent = 40.26; }
			else if (raty == 25) { procent = 49.88; }
			else if (raty == 30) { procent = 59.94; }
			else { procent = 72.59; }
		}
		

		prowizja = (wartosc_koncowa/raty)/100*procent; // prowizja dla jednej raty
		prowizja =+ prowizja.toFixed(2);
		
		//alert('prowizja: '+prowizja);
		
		//alert('rata: '+wartosc + prowizja + wplata + raty);
		
		Rata =+ (wartosc_koncowa)/raty+prowizja; // kwota raty
		//alert('rata: '+Rata);
		Rata =+ Rata.toFixed(2);
		//alert('rata: '+Rata);
		
		/* usun podstawowe anomalia */
		if(wartosc == wplata) { Rata = 0; }		
				
		if(!(isNaN(raty) || raty == 0)) {  	
		
			/* pokaż raty jeżeli wartość towaru jest większa od wymaganego progu ratalnego */
			if(wartosc > prog){
				$(id+' .rata strong').remove();		
				$(id+' .rata strong span').remove();		
				$(id+' .rata').append('<strong> zł*</strong>');
				$(id+' .rata strong').prepend('<span> '+Rata+'</span>');
				$(id+' input').attr('disabled','');
				if($('#kalkulator form>div>p').is(id+'-error') == true) $('#kalkulator form>div '+id+'-error').remove();
			}
			else {
				$(id+' .rata strong').remove();		
				$(id+' .rata').append('<strong>Niedostępna</strong>');
				$(id+' input').attr('disabled','disabled');
				if($('#kalkulator form>div>p').is('.error') == false) $('#kalkulator form>div').prepend('<p id="'+empty_id+'-error" class="error">Żeby móc skorzystać z rat w systemie '+firma+' minimalna wartość towaru musi wynosić '+prog+'zł</p>');
			}
		}
	
	}
	
	
	function ratyzagiel(id, firma, procent, widelki, procent_widelki, prog){
		var cena, cena_produktu, raty, Rata, wplata, prowizja;
		empty_id = id;
		id = '#'+id;
		cena = $('.cena strong span').text();
		cena_produktu = cena.replace(/\s+/,"");
		$(id+'-wartosc').attr('value',cena_produktu);
	
		wartosc = parseInt(wartosc);	// wartość produktu
		raty = parseInt(raty);			// ilość rat
		Rata = parseInt(Rata);			// ilość rat
		wplata = parseInt(wplata);		// wpłata własna
		prowizja = parseInt(prowizja);	// prowizja od całej wartości
		widelki = parseInt(widelki);	// zasięg cenowy dla definiowania innego oprocentowania
		prog = parseInt(prog);			// wartość progu ratalnego
	
		wartosc =+ $(id+'-wolumen').attr('value');
		raty =+ $(id+'-raty').attr('value');
		wplata =+ $(id+'-kwota-bazowa').attr('value');
		if(wartosc < widelki) procent = procent_widelki;
		
		prowizja = (wartosc/raty)/100*procent; // prowizja dla jednej raty
		prowizja =+ prowizja.toFixed(2);
		
		//alert('prowizja: '+prowizja);
		
		//alert('rata: '+wartosc + prowizja + wplata + raty);
		
		Rata =+ (wartosc-wplata)/raty+prowizja; // kwota raty
		//alert('rata: '+Rata);
		Rata =+ Rata.toFixed(2);
		//alert('rata: '+Rata);
		
		/* usun podstawowe anomalia */
		if(wartosc == wplata) { Rata = 0; }		
				
		if(!(isNaN(raty) || raty == 0)) {  	
		
			/* pokaż raty jeżeli wartość towaru jest większa od wymaganego progu ratalnego */
			if(wartosc > prog){
				$(id+' .rata strong').remove();		
				$(id+' .rata strong span').remove();		
				$(id+' .rata').append('<strong> zł*</strong>');
				$(id+' .rata strong').prepend('<span> '+Rata+'</span>');
				$(id+' input').attr('disabled','');
				if($('#kalkulator form>div>p').is(id+'-error') == true) $('#kalkulator form>div '+id+'-error').remove();
			}
			else {
				$(id+' .rata strong').remove();		
				$(id+' .rata').append('<strong>Niedostępna</strong>');
				$(id+' input').attr('disabled','disabled');
				if($('#kalkulator form>div>p').is('.error') == false) $('#kalkulator form>div').prepend('<p id="'+empty_id+'-error" class="error">Żeby móc skorzystać z rat w systemie '+firma+' minimalna wartość towaru musi wynosić '+prog+'zł</p>');
			}
		}
	
	}
		
	
		
		$('#kalkulator, #probki_menu li a').bind('click', function(){ raty('aig','AIG',procent, wartosc, 0, 100); ratyzagiel('zagiel','Żagiel',27, 0, 0, 100); return false; });
		$('#attr-cena').bind('change', function(){ raty('aig','AIG',procent, wartosc, 0, 100); ratyzagiel('zagiel','Żagiel',27, 0, 0, 100); return false; });
		
		/* prog jest ustawiony na zero, żeby klient mogł swobodnie dokonywać obliczeń cena/rata */
		$('#aig .text').bind('keyup', function(){ raty('aig','AIG',procent, wartosc, 0, 0); return false; });
		$('#aig .text-sel').bind('change', function(){ raty('aig','AIG',procent, wartosc, 0, 0); return false; });
		$('#zagiel .text').bind('keyup', function(){ ratyzagiel('zagiel','Żagiel',27, 0, 0, 0); return false; });
	
	
	
	
	
	/* FAQ */
	for(f = 0; f < $('ol.faq p.pos, ul.faq p.pos').size(); f++){
	
		f_id = $('ol.faq p.pos, ul.faq p.pos').eq(f).attr('id');
		f_pos = f_id.slice(3);
		f_y = f_pos.split('_')[0];
		f_x = f_pos.split('_')[1];
		
		$('ol.faq p.pos, ul.faq p.pos').eq(f).css({top: f_y+'px', left: f_x+'px' });
		
	}
		/* NEGOCJOWANA CENA W KOSZYKY */
	$('form#cart-form').submit(function(event){
		// [test] // $('input.price').mouseover(function(event){
		var cena, wartosc_ceny, cena_stara, cena_nowa, warunek, licitowany_produkt;
		warunek = new Array()
		
		for(c = 0; c < $('td.negotiate').size(); c++){
			
			
			cena = $('td.unit-price').eq(c).children('.text span').text();	
			wartosc_ceny = cena.replace(/\s+/,"");
			
			cena_stara = wartosc_ceny.split(',')[0];			
			cena_nowa = $('td.negotiate').eq(c).children().children('input.price').val();
			// 15%
			warunek[c] = cena_stara/100*85; 
			licitowany_produkt = $('.cart-item-title').eq(c).text();
			if((cena_nowa == null) || (cena_nowa == '?'));
			else{
				if(cena_nowa < warunek[c] || (isNaN(cena_nowa))){
					alert('Proponowana cena za "'+licitowany_produkt+'" jest zbyt niska');
					event.preventDefault();
					$('td.negotiate').eq(c).children('input.price').addClass('error');				
				}
			}
		}
		
		
	});
	
	/* galeria statyczna */
		//$('.popbox').parent('li').prepend('<div class="popupbox"><img src="js/loadingAnimation.gif" id="img-loader" /></div>');
	
	$('.popbox').click(function(e){ e.preventDefault(); });
	
	$('.popbox').mouseover(function(){
		var g_holder = $(this).parent().parent().parent('.gal-item').children('.item-image');
		var g_loader = $(this).prev('.popupbox');
		//var g_loader = $(this).parent('li').children('.popupbox');
		
		$(g_loader).show();		
		g_img = new Image();
		g_img.src = $(this).attr('href');	
		/*
			$(g_holder).load(g_img, function(){ 
				$(g_loader).hide();
				$(g_holder).children('img:not(#img-loader)').remove(); 
				$(g_holder).prepend("<img src='"+g_img.src+"' alt='"+g_img.src+"' />");
			});	
		*/
		
		g_img.onload = function(){
		//	$(g_loader).hide();
			$(g_holder).children('img:not(#img-loader)').remove(); 
			$(g_holder).prepend("<img src='"+g_img.src+"' alt='"+g_img.src+"' />");
	
		}
			
	
	});
	
	
	
	/* strefy kuchni */
	
	$('#strefy_Map area').mouseover(function(){
		$('#a').remove();
		a = $(this).attr('title');
		$('#strefy-preview h4').append('<span id="a">: '+a+'</span>');
	});
	
	$('#strefy_Map area').mouseout(function(){ $('#a').remove(); });


	/* Galerie w Detale w studio kuchni */
	
	if($('#content-studio #galeria li li').is('.rys') || $('#content-studio #galeria li li').is('.img')) { $('#content-studio #galeria li').not($('#content-studio #galeria li li')).addClass('parent'); }
	
	$('.popup').click(function(e){ e.preventDefault(); });
	$('.popup').mouseover(function(e){
		var dymek, loader, x, y, ox, oy, pop_title, h, w, pop_height;
		pop_title = $(this).attr('title');
		$('body').append('<div class="popupbox"><img src="js/loadingAnimation.gif" id="img-loader" /></div>');
		dymek = $('.popupbox');
		loader = $('.popupbox #img-loader');
		
		try { x = e.pageX; y = e.pageY; } // FF
		catch(e) { x = event.clientX; y = event.clientY; } // IE
	
		var de = document.documentElement;
		w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
		h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
		oy = y-200+'px';

		$(dymek).show();
		if(x > w/2) { ox = w-x+10+'px'; $(dymek).css({top: oy, right: ox}); }
		else { ox = x+10+'px'; $(dymek).css({top: oy, left: ox}); }

		$(loader).show();		
		url = $(this).attr('href');
		pop_img = new Image();
		pop_img.src = url;	
		
		
		pop_img.onload = function(){
			$(dymek).children('img').remove(); 
			$(dymek).prepend("<img src='"+pop_img.src+"' alt='"+pop_img.src+"' />");
			$(dymek).append('<strong>'+pop_title+'</strong>');
		}
		
		/*
		$(dymek).load(pop_img, function(){ 
			$(dymek).children('img').remove(); 
			$(dymek).prepend("<img src='"+pop_img.src+"' alt='"+pop_img.src+"' />");
			$(dymek).append('<strong>'+pop_title+'</strong>');
			
		});	
		*/
		
		
	});	
	$('.popup').mouseout(function(){ $('.popupbox').remove(); });
	
	/* galerie kolumnowe w poradach projektanta */

	$('#img-zoom').prepend('<img src="/js/loadingAnimation.gif" id="f_img-loader" />');
	$('#img-zoom').css({opacity: 0.4});
	
	$('.flashbox').click(function(e){ e.preventDefault(); });
	$('.flashbox').mouseout(function(){ $('#img-zoom').css({opacity: 0.4}); });
	
	$('.flashbox').mouseover(function(){
		$('#img-zoom').css({opacity: 1});		
		$('#f_img-loader').show();		
		f_url = $(this).attr('href');
		f_alt = $(this).children('img').attr('alt');
		f_img = new Image();
		f_img.src = f_url;	
		f_img.onload = function(){
			$('#f_img-loader').hide();
			$('#img-zoom').children('img:not(#img-loader)').remove(); 
			$('#img-zoom').prepend("<img src='"+f_img.src+"' alt='"+f_alt+"' />");
		
		}
		/*
		$('#img-zoom').load(f_img, function(){ 
			$('#f_img-loader').hide();
			$('#img-zoom').children('img:not(#img-loader)').remove(); 
			$('#img-zoom').prepend("<img src='"+f_img.src+"' alt='"+f_alt+"' />");
		});	
		*/
	});
	
	$('.flash-item div').hide();

	$('.flash-item img').mouseover(function(){
		$(this).next('div').fadeIn('slow');
		//w = $(this).next('div').children('img').width();
		$(this).parent().css({zIndex: '100'});
		//$(this).next('div').css({paddingLeft: w+10+'px'});
		//$(this).next('div').children('img').css({marginLeft: -w-8+'px'});
	});
	$('.flash-item img').mouseout(function(){
		$('.flash-item div').fadeOut('slow'); $(this).parent().css({zIndex: '10'});
	});
	
	/* Środkowanie miniaturek zdjęć produktów */
	$('.prods-thumb .prod-img img, .prods-thumb .item-image img').poziomuj(0,100,2);
	$('li.polecane a').bind('click', function(){ $('#polecane .prod-img img').poziomuj(1,100,3); });
	$('#galeria .prods-thumb .item-gal img').poziomuj(0,100,2);
	$('#galeria-columns li a img').poziomuj(0,134,3);
	$('#prod-aranazacja  img, #lista-aranzacji img').poziomuj(0,110,3);
}


$(document).ready(css);

jQuery.fn.extend({
	poziomuj: function(wczytany, rozmiar, margin) {
		var prod_thumb, prod_parent , prod_img, h, pT, pB, margin;
		var VA, tbl_class;
		if(margin == 1) VA = 'top'
		if(margin == 2) VA = 'middle'
		if(margin == 3) VA = 'bottom'
		$(this).parent('a').attr('class');
		$(this).parent('a').wrap('<div class="prod-img"><table class="prod-img"><tr><td></td></tr></table></div>');
		$('table.prod-img a, table.prod-img img').css({display: 'inline'});
		$(this).parent('a').parent('td').css({verticalAlign: VA, height: rozmiar+'px'});
		/**
		 * wczytany == 0 - operuje na obrazkach, które dopiero się wczytują, dlatego czeka na ich załadowanie
		 * wczytany == 1 - operuje na obrazkach, które zostały wczytane, ale nie zostały pokazane, np. zostały celowo ukryte
		 * rozmiar - to rozmiar nominalny jaki powinien przyjmować obszar ochronny odnośnika ze zdjęciem
		 */
	}
});

function easy_search_validate(f){
	if(f.elements['s[keyword]'].value.length<2){alert('Proszę wpisać przynajmniej dwa znaki');f.elements['s[keyword]'].focus();return false}
	return true;
}

var odczytywanie_probek=false;
function _$(id){var D=document;return D.getElementById?D.getElementById(id):D.all?D.all[id]:null;}
function klik_probka_grupa(id,group){
	if (!odczytywanie_probek) {
		var args=arguments.length;
		$.ajax({
			type: 'GET',
			url: './',
			data: 'a=sklep.probkiProduktuGrupa&item='+id+'&group='+escape(group),
			dataType: 'html',
			cache: false,
			beforeSend: function(){_$('probki_grupa').innerHTML='<p class="probki-note"><br />Ładowanie danych. Proszę czekać ...</p>';odczytywanie_probek=true;},
			error: function(){_$('probki_grupa').innerHTML='Błąd przy odczycie danych z serwera';odczytywanie_probek=false;},
			success: function (response){
				odczytywanie_probek=false;
				if(response){
					_$('probki_grupa').innerHTML=response;
					$('.call-attr-zoom').click(function(event){event.preventDefault();});
					$('.call-attr-zoom').hover(function(){
						var pr_src = $(this).attr('href');
						var pr_alt = $(this).attr('title');
						$(this).parent('.probki-img').parent('li').parent('ul').parent('div').parent('div').next('.probka-bg').children('.info').remove();
						$(this).parent('.probki-img').parent('li').parent('ul').parent('div').parent('div').next('.probka-bg').append('<div class="info"><div class="attr-info-img"><img src="'+pr_src+'" alt="'+pr_alt+'" class="attr-info2" /></div></div>');
						$(this).parent('.probki-img').parent('li').parent('ul').parent('div').parent('div').next('.probka-bg').children('.info').children('.attr-info-img').css({ display: 'block'});
						$(this).parent('.probki-img').parent('li').parent('ul').parent('div').parent('div').next('.probka-bg').children('strong').hide();
					}, 
					function(){
						//$(this).parent('.probki-img').parent('li').parent('ul').parent('div').parent('div').next('.probka-bg').children('.info').remove();
						//$(this).parent('.probki-img').parent('li').parent('ul').parent('div').parent('div').next('.probka-bg').children('strong').show();
						return false;
					});
				}
			}
		});
	}
}

function klik_monitoruj_cene(id){
	$.ajax({
		type: 'GET',
		url: './',
		data: 'a=sklep.monitorujCene&item='+id,
		cache: false,
		error: function(){alert('Błąd przy odczycie danych z serwera')},
		success: function (response){
			var odp=response.getElementsByTagName('odp'),s='';
			if(odp){
				s=odp[0].childNodes[0].nodeValue;
				if(s){
					alert(s);
				}
			}
		}
	});
	return false;
}

function click_price_attr(id){
	var a,v,grupa,f=document.forms['item_detail'],e=f.elements;
	if (typeof(e['attr['+id+']']) != 'undefined'){
		v = e['attr['+id+']'].value;
		a = v.split('#');
		grupa = a[0].split(' ')[0];
		grupa = grupa.replace(/\./g, '_');
		klik_probka_grupa(f.item.value,grupa);
		tb_show('','#TB_inline?height=500&width=900&inlineId=probki', null);
	}
	return false;
}

function click_attr(id){
	var a,v,grupa,e=document.forms['item_detail'].elements;
	if (_$('probki'+id)){
		tb_show('','#TB_inline?height=500&width=900&inlineId=probki'+id, null);
	}
	return false;
}

function click_material_sample(id,name,img){
	var e=document.forms['item_detail'].elements;
	if (typeof(e['attr['+id+']']) != 'undefined'){
		e['attr['+id+']'].value=name;
		if(_$('attribute_value'+id)){
			_$('attribute_value'+id).innerHTML='<strong>'+name+'</strong> <span>zmień &raquo;</span>';
		}
		if(_$('attribute_img'+id) && img){
			_$('attribute_img'+id).innerHTML='<img src="http://www.kelman.pl/foto/dictionaries_micro/'+img+'" alt="" />';
		}
	}
	tb_remove();
	return false;
}

function click_material_price(id,name,img){
	var a,i,n,g,e=document.forms['item_detail'].elements,pe=document.forms['choice_price_attr'].elements,attr_id=pe['attr_id'].value;
	$("div[class*='GR_']").hide();
	if(typeof(price_attributes_ids)!='undefined'){
		for(i=0,n=price_attributes_ids.length;i<n;++i){
			if((id!=price_attributes_ids[i])&&(typeof(e['attr['+price_attributes_ids[i]+']'])!='undefined')){e['attr['+price_attributes_ids[i]+']'].value=''}
		}
	}
	v=pe['attr'].options[pe['attr'].selectedIndex].value;
	e['attr['+attr_id+']'].value=v;
	a=v.split('#');
	_$('item_price').innerHTML=a[1];
	a=a[0].split(' ');
	g=a[0].replace(/\./g, '_');
//	a.shift()
//	_$('attribute_value'+attr_id).innerHTML=a.join(' ');
	if (typeof(e['attr['+id+']'])!='undefined'){
		e['attr['+id+']'].value=name;
		if(_$('attribute_value'+id)){
			_$('attribute_value'+id).innerHTML='<strong>'+a.join(' ')+': '+name+'</strong> <span>zmień &raquo;</span>';
		}
		if(_$('attribute_img'+id) && img){
			_$('attribute_img'+id).innerHTML='<img src="http://www.kelman.pl/foto/dictionaries_micro/'+img+'" alt="" />';
		}
	}
	$('.'+g).show();
	tb_remove();
	return false;
}

function change_attr_price(e,id){
	var a=e.value.split('#');
	if(a.length==2){
		_$('item_price').innerHTML=a[1];
	}
}


/* skrypty z script.js */

function getElement(el) {
	return document.all ? document.all[el] : document.getElementById (el);
}

function triggerError (errorId, msg) {
	errorId += 'Error';
	if (msg != '') {
		getElement(errorId).innerHTML = msg;
	}
	getElement(errorId).style.display = 'block';
}
function hideError (errorId) {
	errorId += 'Error';
	getElement(errorId).style.display = 'none';
}

// Email Validation Javascript
// copyright 23rd March 2003, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.

function validateEmail(addr,man,db) {
	if (addr == '' && man) {
   		if (db) alert('email address is mandatory');
   		return false;
	}
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
   		if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
      		if (db) alert('email address contains invalid characters');
      			return false;
   		}
	}
	for (i=0; i<addr.length; i++) {
   		if (addr.charCodeAt(i)>127) {
      		if (db) alert("email address contains non ascii characters.");
      		return false;
   		}
	}
	
	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('email address must contain an @');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('email address must not start with @');
	   return false;
	}
	if (addr.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('email address must contain only one @');
	   return false;
	}
	if (addr.indexOf('.', atPos) == -1) {
	   if (db) alert('email address must contain a period in the domain name');
	   return false;
	}
	if (addr.indexOf('@.',0) != -1) {
	   if (db) alert('period must not immediately follow @ in email address');
	   return false;
	}
	if (addr.indexOf('.@',0) != -1){
	   if (db) alert('period must not immediately precede @ in email address');
	   return false;
	}
	if (addr.indexOf('..',0) != -1) {
	   if (db) alert('two periods must not be adjacent in email address');
	   return false;
	}
	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	   if (db) alert('invalid primary domain in email address');
	   return false;
	}
	return true;
}

function autoVerifyForm(f) {
	// sprawdzam, czy DOM jest dostepny
	if(!document.getElementById || !document.createTextNode){ return false; }
	
	var result=true; // poprawnosc formularza  
	
	// czyszczenie komunikatow
    for (i=0; i<f.length; i++) {
		if ( f.elements[i].className == "required" ) {
			var message=f.elements[i].nextSibling; // nastepnik
			message.nextSibling.className="error-hide"; // wlasciwy obiekt i zmiana klasy 	
		}
    }
	
	// pobranie elementow formularza i przetwarzanie tych z class="required" 	
	for (i=0; i<f.length; i++) {
		if ( f.elements[i].className == "required" ) {
			switch( f.elements[i].type.toLowerCase() ) {
				case 'text':
					if(f.elements[i].value=='' && f.elements[i].disabled==false) {
						var message=f.elements[i].nextSibling; /* nastepnik */
						message.nextSibling.className="error-show"; /* wlasciwy obiekt i zmiana klasy */
						result=false;
					}
				break;
				case 'textarea':
					if(f.elements[i].value=='' && f.elements[i].disabled==false) {
						var message=f.elements[i].nextSibling; /* nastepnik */
						message.nextSibling.className="error-show"; /* wlasciwy obiekt i zmiana klasy */
						result=false;	
					}
				break;
				case 'checkbox':
				    if(!f.elements[i].checked && f.elements[i].disabled==false) {
				    	
				    }
				break;
				case 'select-one':
				    if(!f.elements[i].selectedIndex && f.elements[i].selectedIndex==0 && f.elements[i].disabled==false) {
				    			    	
				    }
				break;
			} // end switch 			
		}
	} // end for
	
	return result;
}

/* ponizsze do sprawdzenia nie sa moje


UWAGA ta pierwsza może przyda się do autoVerifyForm

function isFilled(field) 
72 if (field.value.length < 1 || field.value == field.defaultValue) {
73 return false;
74 } else {
75 return true;
76 }
77}
78
79function isEmail(field)
80{
81 // you could add a test to see if the brower support regular expression or not here
82 if (RegExp) {
83 return checkEmail(field.value);
84 } else {
85 if (field.value.indexOf("@") == -1 || field.value.indexOf(".") == -1) {
86 return false;
87 } else {
88 return true;
89 }
90 }
91}
92
93function checkEmail(addr)
94{
95 var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,9}(?:\.[a-z]{2})?)$/i
96 return filter.test(addr);
97}

*/