var WindowObjectReference, strPreviousURL;
function launchDisplay(strCurrentURL, strTarget) {
  if(WindowObjectReference == null || WindowObjectReference.closed) {
    WindowObjectReference = window.open(strCurrentURL, strTarget,"width=450,height=500,resizable,scrollbars");
  } else if(strPreviousURL != strCurrentURL) {
    WindowObjectReference = window.open(strCurrentURL, strTarget,"width=450,height=500,resizable,scrollbars");
    WindowObjectReference.focus();
  } else {
    WindowObjectReference.focus();
  };
  strPreviousURL = strCurrentURL;
}

function checkFields() {
	var zgoda = document.getElementById("panel_rejestracyjny_zgoda").checked;
	var form = document.forms.panel_rejestracyjny;
	if(zgoda) {
		if(form.pass.value != "" && form.pass.value == form.pass2.value) {
			if(form.imie.value != "" && form.nazwisko.value != "" && form.nazwa.value != "" && form.adres.value != "") {
				form.submit();
			} else alert("Proszę wypełnić wymagane dane.");
		} else alert("Powtórzone hasło nie zgadza się z oryginałem.");
		return false;
	} else {
		alert("Proszę wyrazić zgodę.");
		return false;
	}
}

function biuroLogin() {
	var form = document.forms.word_press_login;
	form.submit();
}

	function selectCountry() {
		document.forms.selectCountry.submit();
	}

   function poprawPNG() {
      var divs = document.getElementsByTagName('DIV');
      for(var i=0; i<divs.length; i++) {
          var div = divs[i];
          var back = eval('div.currentStyle.backgroundImage');
          if(back.indexOf(".png") != -1) {
              div.style.backgroundImage = 'none';
              div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + back.substring(5, back.length-2) + "', sizingMethod='scale')";
          }
      }
  }
  if(window.attachEvent) window.attachEvent('onload', poprawPNG);
  

//tooltip  
$(function() {
$("#foottip a").tooltip({ 
    bodyHandler: function() { 
        return $($(this).attr("href")).html(); 
    },
    showURL: false 
});
});