
$(document).ready(function() { 

	if (window.location.hash == '#szybki_kontakt') {
		$('.btn_skontaktuj_sie').click(); 
	}

	$("#js").hide();

	if ($("ul#submenu2").length > 0) {
	
		$("ul#submenu2 li").hover(
		  function () {
		    $(this).addClass('selected');;
		  },
		  function () {
		    $(this).removeClass('selected');;
		  }
		);
	}

	if ($(".box-agent-bottom").length > 0) {
		var height = $(".box-agent-bottom img").height();
		height = (202 - height) / 2 - 15;
		if (height > 0) {
			$(".box-agent-bottom img").css({'margin-top' : height});
		}
	}

	$("#tabs li.notowania").click(function () {
		$('#kalkulatory').hide();
		$('#notowania').show();
		$('#tabs li').removeClass('kalkulatoryactive');
		$(this).addClass('notowaniaactive');
		return false;
	});

	$("#tabs li.kalkulatory").click(function () {
		$('#notowania').hide();
		$('#kalkulatory').show();
		$('#tabs li').removeClass('notowaniaactive');
		$(this).addClass('kalkulatoryactive');
		return false;
	});

	$('[class="convert"]').each(function(){
		if($(this).html().length > 1){
			var x = $(this).html().replace(/ \(w domenie\) /ig, "@");
			$(this).html('<a href="mailto:'+ x + '">'+ x + '</a>');
		}
	});
	
	$('[class="convert_white"]').each(function(){
		if($(this).html().length > 1){
			var x = $(this).html().replace(/ \(w domenie\) /ig, "@");
			$(this).html('<a href="mailto:'+ x + '" class="white">'+ x + '</a>');
		}
	});
	
	$('[class="convert_division"]').each(function(){
		if($(this).html().length > 1){
			var x = $(this).html().replace(/ \(w domenie\) /ig, "@");
			$(this).html('<a href="mailto:'+ x + '" class="white">e-mail</a>');
		}
	});

var now = new Date();
var today = "" +
now.getYear() +
now.getMonth() +
now.getDate() +
now.getHours() +
now.getMinutes() +
now.getSeconds();
ileZdjec = $("img[lang]").length;
ileLoaded = 0;

 $($("img[lang]")).each( function() {
 var x = $(this).attr("src");
 $(this).attr("src", x + "?" + today);
 $(this).load( function() {
  ileLoaded++;
 
  if (ileZdjec == ileLoaded) {
     $("img[lang]").each(function () {
       this.title = this.alt;
     })
     $('img').tooltip({
      track: true,
      extraClass: 'errorTooltip',
      position: 'mouse',
      showURL: false,
      showBody: " - ",
      delay: 0
     });
   }
 })
 })

  $('a#ofe5').click(
    function(){
    	 window.open($(this).attr('href'), 'umowa', 'width=785,height=600, menubar=yes, toolbar=yes,scrollbars=yes, resizable=yes');
      return false;
    }
  );
  $('a#ofe10').click(
		  function(){
			  window.open($(this).attr('href'), 'umowa', 'width=785,height=600, menubar=yes, toolbar=yes,scrollbars=yes, resizable=yes');
			  return false;
		  }
  );
  $('a#ofeprod5').click(
    function(){
    	 window.open($(this).attr('href'), 'umowa', 'width=785,height=600, menubar=yes, toolbar=yes,scrollbars=yes, resizable=yes');
      return false;
    }
  );
  $('a#ofeprod10').click(
		  function(){
			  window.open($(this).attr('href'), 'umowa', 'width=785,height=600, menubar=yes, toolbar=yes,scrollbars=yes, resizable=yes');
			  return false;
		  }
  );
  $('a#question').click(
    function(){
      window.open($(this).attr('href'), 'umowa', 'width=740,height=600, menubar=yes, toolbar=yes,scrollbars=yes, resizable=yes');
      return false;
    }
  );

	$('a#UbezpieczSamochod').click(
    function(){
      window.open($(this).attr('href'), 'UbezpieczSamochod', 'width=960,height=600, menubar=yes, toolbar=yes,scrollbars=yes, resizable=yes');
      return false;
    }
	); 

});