function initialize() {
if($("#contactmap").length) {
	var latlng = new google.maps.LatLng(50.280021336762076, 18.931760787963867);
	var myOptions = {
	  zoom: 13,
	  center: latlng,
	  mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	var map = new google.maps.Map(document.getElementById("contactmap"), myOptions);
	var marker = new google.maps.Marker({
      position: latlng, 
      map: map, 
      title:"Jowix Triomet"
  }); 
	
  $("#contactinfo>h2").next().css({"display" : "none"});
	$("#contactinfo>h2").click(function(){ $(this).next().slideToggle(); });
}
}


$(document).ready(function(){
						   
initialize(); // google maps

if ($("#active_item").length) {
	$("#active_item").parent().parent().css({"display" : "block"});
}
/*
$("a.zoom").fancybox({
	'overlayOpacity'	:	0.6,
	'overlayColor'		:	'#000',
	'titleShow'			:	'false',
	'transitionIn'	:	'elastic',
	'transitionOut'	:	'elastic',
	'speedIn'		:	400, 
	'speedOut'		:	300 
});
*/

if($("#sliderbox").width()) {
		var flashvars = {};
		var params = {};
		params.wmode = "transparent";
		var attributes = {};
		swfobject.embedSWF("index.swf", 
						   "sliderdiv2", 
						   "670", "250", 
						   "9.0.0", false, flashvars, params, attributes);
}

if($("#jowix_gallery").width()) {
		var flashvars = {};
		var params = {};
		var attributes = {};
		swfobject.embedSWF("../jowix_gallery.swf", 
						   "jowix_gallery_inside", 
						   "642", "249", 
						   "9.0.0", false, flashvars, params, attributes);
	
}

if($("#out_gallery").width()) {
		var flashvars = {};
		var params = {};
		var attributes = {};
		swfobject.embedSWF("../out_gallery.swf", 
						   "out_gallery_inside", 
						   "642", "249", 
						   "9.0.0", false, flashvars, params, attributes);
	
}
$('.prev').mouseover(function(event){
	$(this).find(".prev_top").stop().animate({
		"backgroundPosition": "0px 0px"
	  }, 300);	
	$(".third_menu").slideUp();
});
$('.prev').mouseout(function(event){
	$(this).find(".prev_top").stop().animate({
		"backgroundPosition": "0px -60px"
	  }, 500);	
	
});



$('.newsmenu>a').mouseover(function(event){
	$(this).stop().animate({
		"padding-left": "40px",
		"backgroundPosition": "0px 6px"
	  }, 300);	
	$(".third_menu").slideUp();
});
$('.newsmenu>a').mouseout(function(event){
	$(this).stop().animate({
	"padding-left": "20px",
		"backgroundPosition": "0px 32px"
	  }, 500);	
	
});

$('.submenu>ul>li>a').mouseover(function(event){
	$(this).stop().animate({
		"padding-left": "40px",
		"backgroundPosition": "0px 6px"
	  }, 300);	
});
$('.submenu>ul>li>a').mouseout(function(event){
	$(this).stop().animate({
	"padding-left": "20px",
		"backgroundPosition": "0px 32px"
	  }, 500);	
	
});

$('.submenu>ul>li>ul>li>a').mouseover(function(event){
	$(this).stop().animate({
		"padding-left": "60px",
		"backgroundPosition": "0px 6px"
	  }, 300);	
});
$('.submenu>ul>li>ul>li>a').mouseout(function(event){
	$(this).stop().animate({
	"padding-left": "40px",
		"backgroundPosition": "0px 32px"
	  }, 500);	
	
});

$('.submenu>ul>li>a').click(function(event){
	$(".third_menu").slideUp();
	if ($(this).next().children().length > 1) {
		event.preventDefault();
		$(this).next().slideToggle();
	}
 });

var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
if (badBrowser) {
   alert("Uwaga ! Używasz przestarzałej wersji przeglądarki. Ta strona nie może być wyświetlona poprawnie. ");
 $('img[src$=.png]').each(function() {
$(document).pngFix();
 });
}

if($("#contactform").length) {
	$("#send").click(function()
	{	
		$("#contactform").animate({"opacity" : 0}, 300, function()
		{
			$("#contactform form").empty().text("Dziękujemy za wysłanie wiadomości. Nasz pracownik skontaktuje się z państwem najszybciej jak to będzie możliwe.");
			
			$("#contactform").animate({"opacity" : 1}, 300);
		});
	});   
}
if ($("#spgallery").length) {
$('#spgallery').spacegallery();
}

});

