//v1.0

//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function ShowHideDivAllPay(stan)
  {
    if(document.getElementById)
    {
      var div = document.getElementById('allpaytable');
  
      if (stan == 0)
      {
      div.style.display = "none";
      }
      
	  if (stan == 1)
      {
      div.style.display = "block";
      }
    }
  }


function ShowHide2(stan)
  {
    if(document.getElementById)
    {
      var el1 = document.getElementById('o1');
      var el2 = document.getElementById('o2');
      var le1 = document.getElementById('p1');
      var le2 = document.getElementById('p2');
  
      if (stan == 0)
      {
      le1.style.display = "none";
      le2.style.display = "block";
      }
      if (stan == 1)
      {
  
      le1.style.display = "block";
      le2.style.display = "none";
      }
    }
  }

function ShowHideOpis(stan)
{
    if(document.getElementById)
    {
      var le1 = document.getElementById('opis1');
      var le2 = document.getElementById('opis2');
	  var le3 = document.getElementById('opis3');
  
      if (stan == 0)
      {
      le1.style.display = "block";
      le2.style.display = "none";
	  le3.style.display = "none";
      }
      if (stan == 1)
      {
      le1.style.display = "none";
      le2.style.display = "block";
	  le3.style.display = "none";
      }
	  if (stan == 2)
      {
      le1.style.display = "none";
      le2.style.display = "none";
	  le3.style.display = "block";
      }
    }
}


function walidacja_kontakt()
{

        reg = /^[a-zA-Z0-9šćęłńóżĽĆĘŁŃÓŻ]{1,30}@[a-zA-Z0-9šćęłńóżĽĆĘŁŃÓŻ]+(\.[a-zA-Z0-9šćęłńóżĽĆĘŁŃÓŻ]+)+$/;
        wyn = document.dane_kontakt.mail.value.match(reg);
        if (wyn == null)
                {
                alert("Proszę podać prawidłowy adres e-mail!");
                return false;
                }
        spra=true;
        if (document.dane_kontakt.imie.value == "") spra = false
        if (document.dane_kontakt.nazwaisko.value == "") spra = false
        if (document.dane_kontakt.mail.value == "") spra = false
        if (document.dane_kontakt.tresc.value == "") spra = false
		if (document.dane_kontakt.akceptuje.value == "") spra = false
        if (spra==false) alert('Proszę wypełnić wszystkie pola!');
                return spra;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function zoom(act,fot,wid,heg)
{
	if (act!="") { act="&f="+act; }
	window.open('pokaz.php?id='+fot+act,'','width='+wid+',height='+heg);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + 'resizable=no,scrollbars=no,menubar=no' );
}

function addToBookmarks( sTitle, sHref ) {
if( window.sidebar && window.sidebar.addPanel ) {
//Gecko (Netscape 6 etc.) - add to Sidebar
window.addPanel( sTitle, sHref, '' );
} else if( window.external && ( navigator.platform == 'Win32' || ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
//IE Win32 or iCab - checking for AddFavorite produces errors for no
//good reason, so I use a platform and browser detect.
//adds the current page page as a favourite; if this is unwanted,
//simply write the desired page in here instead of 'location.href'
window.external.AddFavorite( window.location.href, document.title );
} else if( window.opera && window.print ) {
//Opera 6+ - add as sidebar panel to Hotlist
return true;
} else if( document.layers ) {
//NS4 & Escape - tell them how to add a bookmark quickly (adds current page,
//not target page)
window.alert( 'Proszę kilknąć OK a pu&#65533;niej Ctrl+D aby dodać strone do ulubionych' );
} else {
//other browsers - tell them to add a bookmark (adds current page, not target page)
window.alert( 'Proszę użyć manu przeglądarki by utworzyć dodać strone do ulubionych' );
}
return false;
}

function checkRadios() {
  alert("SPR opcji!");

 var el = document.forms[0].elements;
 for(var i = 0 ; i < el.length ; ++i) {
  if(el[i].type == "radio") {
   var radiogroup = el[el[i].name];
   var itemchecked = false;
   for(var j = 0 ; j < radiogroup.length ; ++j) {
    if(radiogroup[j].checked) {
         itemchecked = true;
         break;
        }
   }
   if(!itemchecked) { 
    alert("Aby dodać ten produkt do koszyka, konieczne jest wybranie jednej z dostępnych opcji tego produktu!");
    if(el[i].focus)
     el[i].focus();
        return false;
   }
  }
 }
 return true;
}

function ShowHideDiv(id,stan)
{
  if(document.getElementById)
  {
	warstwa = 'div' + id;
	var div = document.getElementById(warstwa);

    if (stan == 1)
    {
     div.style.display = "block";
    }
    if (stan == 0)
    {
     div.style.display = "none";	
    }
  }
}
