<!-- 
    function szukaj(){
	   var slowo;
	   slowo = document.getElementById("search").value;
	   parent.location.href = "page.php?page=szukaj&s="+slowo;
	  return true;
	}

   function go2url(l) {
      parent.location.href = "index.php?page="+l;
	   return true;
   }
   
   function go2urln(l) {
      parent.location.href = l;
	   return true;
   }
   
   function right(e) {
      if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
   	  	 return false;
      else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
   	     alert("W tym programie prawy przycisk myszki nie działa");
   		 return false;
      }
      return true;
   } 
   
   function NewWindow(mypage, myname, w, h, scroll) {
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=0,toolbar=0,location=0,directories=0,menubar=0,'
		win = window.open(mypage, myname, winprops)
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
  }  
  
  function selecturl(s) {
	 var gourl = s.options[s.selectedIndex].value;	
	 window.top.location.href = gourl;
  }

  function status_text() {
  	   window.status="Status Text";
	   setTimeout("status_text()",1);
  }
  
  function plus(ile) {
      document.prdList.ile.value++;
  }
  function minus(ile) {
      document.prdList.ile.value--;
  }
  
  // -----------------------------------------------------
  
  function checkAll( n ) {
	var f = document.adminForm;
	var c = f.toggle.checked;
	var n2 = 0;
	for (i=0; i < n; i++) {
		cb = eval( 'f.cb' + i );
		if (cb) {
			cb.checked = c;
			n2++;
		}
	}
	if (c) {
		document.adminForm.boxchecked.value = n2;
	} else {
		document.adminForm.boxchecked.value = 0;
	}
}

function isChecked(isitchecked){
	if (isitchecked == true){
		document.adminForm.boxchecked.value++;
	}
	else {
		document.adminForm.boxchecked.value--;
	}
}

/**
*/

function submitbutton(pressbutton) {
	submitform(pressbutton);
}

function submitform(pressbutton){
	document.prdList.task.value=pressbutton;
	try {
		document.prdList.onsubmit();
		}
	catch(e){}
	document.prdList.submit();
}

function submitformc(pressbutton){
	document.adminForm.catid.value=pressbutton;
	try {
		document.adminForm.onsubmit();
		}
	catch(e){}
	document.adminForm.submit();
}

function listItemTask( id, task ) {
	var f = document.adminForm;
	cb = eval( 'f.' + id );
	//document.write(cb);
	if (cb) {
		cb.checked = true;
		submitbutton(task);
	}
	return false;
}

// ==========================================
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 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];}}
}

// JS Calendar
var calendar = null; // remember the calendar object so that we reuse
// it and avoid creating another

// This function gets called when an end-user clicks on some date
function selected(cal, date) {
	cal.sel.value = date; // just update the value of the input field
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks the "Close" (X) button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
	cal.hide();			// hide the calendar

	// don't check mousedown on document anymore (used to be able to hide the
	// calendar when someone clicks outside it, see the showCalendar function).
	Calendar.removeEvent(document, "mousedown", checkCalendar);
}

// This gets called when the user presses a mouse button anywhere in the
// document, if the calendar is shown.  If the click was outside the open
// calendar this function closes it.
function checkCalendar(ev) {
	var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
	for (; el != null; el = el.parentNode)
	// FIXME: allow end-user to click some link without closing the
	// calendar.  Good to see real-time stylesheet change :)
	if (el == calendar.element || el.tagName == "A") break;
	if (el == null) {
		// calls closeHandler which should hide the calendar.
		calendar.callCloseHandler(); Calendar.stopEvent(ev);
	}
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id) {
	var el = document.getElementById(id);
	if (calendar != null) {
		// we already have one created, so just update it.
		calendar.hide();		// hide the existing calendar
		calendar.parseDate(el.value); // set it to a new date
	} else {
		// first-time call, create the calendar
		var cal = new Calendar(true, null, selected, closeHandler);
		calendar = cal;		// remember the calendar in the global
		cal.setRange(1900, 2070);	// min/max year allowed
		calendar.create();		// create a popup calendar
	}
	calendar.sel = el;		// inform it about the input field in use
	calendar.showAtElement(el);	// show the calendar next to the input field

	// catch mousedown on the document
	Calendar.addEvent(document, "mousedown", checkCalendar);
	return false;
}

// ===================================================================
var refer=true;

var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);

function getRef(id) {
   if (isDOM) return document.getElementById(id);
   if (isIE4) return document.all[id];
   if (isNS4) return document.layers[id];
}

function getSty(id) {
    return (isNS4 ? getRef(id) : getRef(id).style);
}

function combo() {
if (refer) {  
  getSty("contents").visibility="visible";
  refer=false;
} else {
  getSty("contents").visibility="hidden";
  refer=true;
}
}


function test_all() {
    if (document.getElementById) {
    		document.getElementById(mmForm).submit();
    } else if (document.all) {
    		document.all[emailForm].submit();
    } else {
    		document.layers[emailForm].submit
    }
}

  function round(number,x) {	
var x = (!x ? 2 : x);
	return Math.round(number*Math.pow(10,x)) / Math.pow(10,x);
}

function UpdateCost() {
  var sum = 0;
    sum = document.getElementById('shippingselect').value;
	 sum = sum * 1 ;
  document.getElementById('shippingcost').value = sum;
  cb = cb * 1 ;	
  if (cb < 60 ) {
 	
	document.getElementById('totalcost').value = round(sum + cb + 12.50);
	} else {
	document.getElementById('totalcost').value =round(sum + cb);
	}	
} 

function checkrequired(which) {
  var pass=true;
  for (i=0;i<which.length;i++) {
    var tempobj=which.elements[i];
    if (tempobj.name.substring(0,8)=="required") {
      if (((tempobj.type=="text"||tempobj.type=="textarea")&&
          tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
          tempobj.selectedIndex==0)) {
        pass=false;
        break;
      }
    }
  }
  if (!pass) {
    shortFieldName=tempobj.name.substring(8,30).toUpperCase();
    alert("Wybierz / wypełnij "+shortFieldName+" .");
    return false;
  } else {
  return true;
  }
}



// -->
