// JavaScript Document
$(document).ready(function(){
	
	//fix png
	$.ifixpng('img/pixel.gif'); 
	$('div#menu, div#menu, div#sklep_link').ifixpng();
	$('div.box_lb, div.box_pas_gora, div.box_lgr, div.box_lgr, div.box_pgr, div.box_pas_dol, div.box_ldr, div.box_pdr').ifixpng();
	
	$('li.menu_poz').ifixpng();
	
	$('#foto').ifixpng();
	
	$('#ekangu').ifixpng();//ekangu
	$('#logo_sklepu').ifixpng();
	//$('img[@src$=.png]').ifixpng(); 
	
	
	
	//ruszenie kartki z linkiem do sklepu
	$("#sklep_link").hover(
	  function () {
		$(this).animate({"top": "0px"}, "slow"); 

	  },
	  function () {
		$(this).animate({"top": "-6px"}, "fast"); 
	  }
	);
            //ruszenie kartki z linkiem do sklepu
	$("#sklep_link2").hover(
	  function () {
		$(this).animate({"top": "0px"}, "slow"); 

	  },
	  function () {
		$(this).animate({"top": "-6px"}, "fast"); 
	  }
	);
	
	
	//podmiana grafig flag
	$.fn.canvasSwap.defaults.suffix = '_on';
    $.fn.canvasSwap.defaults.ie6_support = true;
    $('img.flaga').canvasSwap();
    
    //jakby co menu
    $(".menu_poz").hover(
		function () {
			var $id= $(this)
			$id.find("ul").show(); 
		  },
		function () {
			  var $id= $(this)
			$id.find("ul").hide(); 
		  }
		);
    		
    
    
	/* formularz kontaktowy*/
	$('#wyslijKontakt').click(function(){
		$('#tekst').text(' ');

		var dane = {
			'imie': $('#imie').val(),
			'email': $('#email').val(),
			'tel': $('#tel').val(),
			'tresc': $('#tresc').val()
		};

		$.post(ROOT+"kontakt/wyslij", dane, function(data) {
			$('#kontakt .tresc, #kontakt .komunikat, #kontakt .email, #kontakt .tel, #kontakt .imie, .ok').hide();
			$('#tresc, #imie, #email, #tel').css({
				'color': '#6A6100'
			});

			if(!data.ok) {
				for(x in data.bledy) {
					$('#' + x).css({
						'color': 'red'
					});
					$('#kontakt .' + x).text(data.bledy[x]);
					$('#kontakt .' + x).show();
				
				}
			} else {
				
				$('.ok').text(data.info.dziekujemy);
				$('.ok').show();
				
				$('#imie').val(data.info.imie);
				$('#email').val('mail@mail.eu');
				$('#tel').val('123123');
				$('#tresc').val(data.info.tresc);

				data.ok=0;

				
			}
		}, 'json');

		return false;
	});
	
    		
});


var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-19333503-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
