//v1.0

//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function confirmLink(theLink, what)
{
    var is_confirmed = confirm(what);
    if (is_confirmed) {
        theLink.href += '&confirmed=1';
    }
    return is_confirmed;
}


function ShowHideDivKreator(divon,divoff)
{
  var div = document.getElementById(divon);
  div.style.display = "block";
  
  var div = document.getElementById(divoff);
  div.style.display = "none";
}

function ShowHideDiv(idp,allid,ilosc,ido)
{
  var  sel = ido.options[ido.selectedIndex].value;
  var i;
  var warstwa;
  var tabido = allid.split(".");
  for(i=0;i<ilosc;i+=1)
  {
	warstwa = 'p' + idp + 'o' + tabido[i];
	var div = document.getElementById(warstwa);
	div.style.display = "none";
	//alert (warstwa);
  }
  warstwa = 'p' + idp + 'o' + sel;
  var div = document.getElementById(warstwa);
  //alert ('Pokaz' + warstwa);
  div.style.display = "block";
}


var browserType;
var help_var;
if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
   browserType= "gecko"
}

function hide_and_show() {
box=document.all.category;
for(i=0;i<box.options.length;i+=1)
	{
		select_value=box.options[i].value;
		//document.write(select_value);
			if (browserType == "gecko" ){
				help_var=document.getElementById(select_value);
				document.poppedLayer = eval(help_var);
			}else if (browserType == "ie"){
				help_var=document.getElementById(select_value);
				document.poppedLayer = eval(help_var);
			}else{
				help_var=document.layers[select_value];
				document.poppedLayer = eval(help_var);
			}
		document.poppedLayer.style.visibility = "hidden";
	}
	
select_value=box.options[box.selectedIndex].value
 if (browserType == "gecko" ){
	help_var=document.getElementById(select_value);
    document.poppedLayer = eval(help_var);
  }else if (browserType == "ie"){
	help_var=document.getElementById(select_value);
     document.poppedLayer = eval(help_var);
  }else{
	help_var=document.layers[select_value];
     document.poppedLayer = eval(help_var);
  }
  document.poppedLayer.style.visibility = "visible";
}


function togg(theform, enabled) {
    for (var i = 0; i < theform.elements.length; i++) {
         if (theform.elements[i].id.indexOf('_sid') != -1) {
              theform.elements[i].disabled = (!enabled);
         }
    }
}


function Uzytogg(theform, enabled) {
    for (var i = 0; i < theform.elements.length; i++) {
         if (theform.elements[i].id.indexOf('_uzt') != -1) {
              theform.elements[i].disabled = (!enabled);
         }
    }
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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;
}
