<!--
var timer = '';
var doit = '';
var tempX = 0;
var tempY = 0;
var tx = 0;
var ty = 0;

var IE = document.all ? true : false;
if (!IE) document.captureEvents(Event.MOUSEMOVE);
function checkProdukt(){
	val = -1;
	if(document.zakup.kup)
	for (i=0;i<document.zakup.kup.length;i++){
		if (document.zakup.kup[i].checked )
			val=i;
	}
	if( val == -1){
		if( document.zakup.kup.checked )
			return true;
		alert("Musisz wybrać wersje produktu");
		return false;
	}
	return true;
}


function checkCZam(){
	if( document.czam.imie_nazwisko.value == ''){
		alert('Wypełnij pole "Imię i nazwisko"');
		document.czam.imie_nazwisko.focus();
		return false;
	}
	if( document.czam.email.value == ''){
		alert('Wypełnij pole "Email"');
		document.czam.email.focus();
		return false;
	}
	if( document.czam.telefon.value == ''){
		alert('Wypełnij pole "Telefon"');
		document.czam.telefon.focus();
		return false;
	}
	return true;
}

function getMouseXY(e) {	
	if( doit != ''){
	  if (IE) { // grab the x-y pos.s if browser is IE
	  	if( (event ? event.clientY : ty) + document.getElementById(doit).offsetHeight + 20 >= (document.documentElement.offsetHeight ? document.documentElement.offsetHeight : document.body.offsetHeight) && (event ? event.clientY : ty) - document.getElementById(doit).offsetHeight + 30  >= 0){
	  		if( document.documentElement && document.documentElement.scrollTop){
		  		tempY = (event ? event.clientY : ty) + document.documentElement.scrollTop - document.getElementById(doit).offsetHeight - 20;
		  		tempX = (event ? event.clientX : tx) + document.documentElement.scrollLeft;
		  	} else if( document.body && document.body.scrollTop ){
		  		tempY = (event ? event.clientY : ty) + document.body.scrollTop - document.getElementById(doit).offsetHeight - 20;
		  		tempX = (event ? event.clientX : tx) + document.body.scrollLeft;
		  	} else {
		  		tempY = (event ? event.clientY : ty) - document.getElementById(doit).offsetHeight - 20;
		  		tempX = (event ? event.clientX : tx);
		  	}
	  	} else {
		  	if( document.documentElement && document.documentElement.scrollTop){
		  		tempY = (event ? event.clientY : ty) + document.documentElement.scrollTop + 20;
		  		tempX = (event ? event.clientX : tx) + document.documentElement.scrollLeft;
		  	} else if( document.body && document.body.scrollTop ){
		  		tempY = (event ? event.clientY : ty) + document.body.scrollTop + 20;
		  		tempX = (event ? event.clientX : tx) + document.body.scrollLeft;
		  	} else {
		  		tempY = (event ? event.clientY : ty) + 20;
		  		tempX = (event ? event.clientX : tx);
		  	}
	  }
	  	if( event ) {
	  		tx = event.clientX;
	  		ty = event.clientY;
	  	}
	  	
	} else {  // grab the x-y pos.s if browser is NS
		if( e ){
	  		tx = e.pageX;
	  		ty = e.pageY;
		}
		if( innerHeight && innerHeight > 0 && (e ? e.pageY : ty) - document.documentElement.scrollTop + document.getElementById(doit).offsetHeight + 20 >= innerHeight && (e ? e.pageY : ty) - document.documentElement.scrollTop - document.getElementById(doit).offsetHeight + 30 > 0 ){
	  		tempX = (e ? e.pageX : tx);
	  		tempY = (e ? e.pageY : ty) - document.getElementById(doit).offsetHeight - 20;
	  	} else {
		    tempX = (e ? e.pageX : tx);
		    tempY = (e ? e.pageY : ty) + 20;
	  	}
	  }
	  return true
	} else {
		tempX = 0;
		tempY = 1000
	}
}
document.onmousemove = getMouseXY;
var px = '';
if( IE )
	px = '';
else
	px = 'px';
function trail() {
	if( doit != '' ){
		t = parseFloat(tempX)-150;
		document.getElementById(doit).style.left = t + px;
		t = parseFloat(tempY);
		document.getElementById(doit).style.top= t + px;
		timer=setTimeout("trail();",30);
	}
}

function hbox(id,src_s){
	if( doit ){
		document.getElementById(doit).style.display = 'none';
	}
	if( document.getElementById(id) ){
		doit = id;
		document.getElementById(id).style.display = 'block';
		getMouseXY();
		if( document.getElementById("foto_"+doit) )
			document.getElementById("foto_"+doit).src = src_s;
		trail();
	}
}
function hhbox(id){
	if( document.getElementById(id) )
		document.getElementById(id).style.display = 'none';
	//setTimeout("document.getElementById('"+id+"').style.display = 'none';",30);
	doit = '';
}

//Menu DMS
function preSelectMenu(id) { selectMenu("menu" + id, id); }
function selectMenu(th, id) {
  th = document.getElementById(th);
  //ukrywam podmenu innych dzialow
  var Nodes = document.getElementsByTagName('div')
  var max = Nodes.length

  for (var i = 0; i < max; i++) {
    var nodeObj = Nodes.item(i);

    if (nodeObj.id.indexOf("pos") != -1) {
      nodeObj.style.display = "none";
    }
  }

  //pokazuje podmenu
  if (document.getElementById("pos" + id)) document.getElementById("pos" + id).style.display = "block";

  //zmieniam style innych butonow dzialow
  var Nodes = document.getElementsByTagName('div')
  var max = Nodes.length

  for (var i = 0; i < max; i++) {
    var nodeObj = Nodes.item(i);

    if (nodeObj.id.indexOf("menu") != -1) {
      nodeObj.className = "menupoz";
    }
  }

  //zmieniam styl wybranego buttony dzialu
  if (th) th.className = "menupoz2";
}
//Menu DMS

var def_color1 = "menupoz";
var act_color1 = "menupoz2";
var def_color = "menupoz_1";
var act_color = "menupoz_2";
var wysokosc_menu_level_1 = 39;
var przesuniecie_level_1 = 0; 

var wysokosc_submenulink = 5;
var przesuniecie_submenulink = -1;

var last;
var obji = new Array(5);
var objj = new Array(5);

var mTimer = null;

function showOpis( s ){
    var oid = 'w'+s.options[s.selectedIndex].value;
    hideall();
    if( document.getElementById(oid) )
      linkuj(oid);
}

function loadDzien(){
	s = document.wysz_cza.miesiac_od;
	val = s.options[s.selectedIndex].value - 1;
	
	var intMonth = val;//given month
	var intYear = document.wysz_cza.rok_od.value;//given year
	
	var dteMonth = new Date(intYear,intMonth);//
	var intDaysInMonth = 28;//the fewest number of days in a month
	var blnDateFound = false;//Set a variable to check on the while loop
	
	while (!blnDateFound)
	{
	dteMonth.setDate(intDaysInMonth+1);//create the next possible day
	var intNewMonth = dteMonth.getMonth();//new month date 
	
	if (intNewMonth != intMonth)//if the month has changed
	  blnDateFound = true;
	else
	  intDaysInMonth++;
	}
	removeOptions();	
	
	for(i=1;i<=intDaysInMonth;i++){
		ob = new Date(intYear,intMonth,i);
		if( ob.getDay() == 6 ){
			appendOptionLast(i);
		}
	}
	
}

var count1 = 0;
var count2 = 0;

function removeOptions()
{
  var elSel = document.getElementById('dzien_od');
  var i;
  for (i = elSel.length - 1; i>=0; i--) {
    elSel.remove(i);
  }
}

function appendOptionLast(num)
{
  var elOptNew = document.createElement('option');
  elOptNew.text = num;
  elOptNew.value = num;
  var elSel = document.getElementById('dzien_od');

  try {
    elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
  }
  catch(ex) {
    elSel.add(elOptNew); // IE only
  }
}

function setTimer(){
     clearTimeout(mTimer);
     mTimer = setTimeout("hide('clr')" , 60000 );
}

function setFastTimer(){
     clearTimeout(mTimer);
     mTimer = setTimeout("hide('clr')" , 50 );
}

function seth(objs, c, id, h){
   setTimer();
   unset(c);  
   hide(c); 
   obji[c] = objs;
   objj[c] = id;
     
   objs.className = act_color;

   show(id, h, 'sublink');     
   setTimer();
}

function unset(c){
   setFastTimer();
   if( obji[c] != null )
      obji[c].className = def_color;
}

function setp(c, id, h, mode){
  hide();
  setTimer();
  for (var i = 0;i<obji.length;i++)
  {
    if( obji[i] != null )
      obji[i].className = def_color;
  }

  show(id, h, mode);

  if( objj[c] != null ){
     document.getElementById(objj[c]).className = def_color1;
     document.getElementById('h'+objj[c]).className = def_color1;
  }
  
  document.getElementById(id).className = act_color1;
  document.getElementById('h'+id).className = act_color1;
  objj[c] = id;
}

function unsetp(id, c){
  setFastTimer();
}

function show(id, h, mode){ 
   divmenu = 'm'+id;
   obj = document.getElementById(divmenu);
   if( obj ){   
     pos = getAnchorPosition(id);
     if( mode=='sublink' ){  
     	if( document.getElementById('ma'+h) ){
     		 if( document.getElementById('ma'+h).clientWidth > 0 )
				ww = document.getElementById('ma'+h).clientWidth;
		     else if( document.getElementById('ma'+h).offsetWidth )
				ww = document.getElementById('ma'+h).clientWidth;
	     	 document.getElementById(divmenu).style.left = parseFloat(parseFloat(document.getElementById('ma'+h).style.left) + parseFloat(ww)+przesuniecie_submenulink)+'px'; 
	     	 document.getElementById(divmenu).style.top = parseFloat(parseFloat(pos.y)-parseFloat(wysokosc_submenulink))+'px';
     	}
     }else if( mode=='center' ){
     	document.getElementById(divmenu).style.display='block';
     	document.getElementById(divmenu).style.left= parseFloat(pos.x+przesuniecie_level_1-(document.getElementById(divmenu).clientWidth/2)+(document.getElementById(id).clientWidth/2)+1)+'px';
     } else if( mode=='right' ){
     	document.getElementById(divmenu).style.display='block';
     	document.getElementById(divmenu).style.left= parseFloat(pos.x+przesuniecie_level_1-document.getElementById(divmenu).clientWidth+document.getElementById(id).clientWidth+1)+'px';
     } else {
     	document.getElementById(divmenu).style.left= parseFloat(pos.x+przesuniecie_level_1)+'px';
     	document.getElementById(divmenu).style.top= parseFloat(pos.y+wysokosc_menu_level_1)+'px';
   	 }
     document.getElementById(divmenu).style.display='block';  
     setTimer();
   }
}

function hide(c) {
  if( c == "clr" ){
  	 for (var i = 0;i<objj.length;i++){
     	if( objj[i] && document.getElementById(objj[i])&& document.getElementById('h'+objj[i]) ){
          document.getElementById(objj[i]).className = def_color1;
     	  document.getElementById('h'+objj[i]).className = def_color1;
     	}
     }
  }
  if( c > 0 ){
  	 if(objj[c] && document.getElementById('m'+objj[c]) )	
  	 	document.getElementById('m'+objj[c]).style.display = 'none';
     
  } else {
     var Nodes = document.getElementsByTagName('div')
     var max = Nodes.length
     for(var i=0;i<max;i++) {
                 var nodeObj = Nodes.item(i);                                
                 if(nodeObj.id.indexOf('ma')!=-1 ) {
                    nodeObj.style.display = 'none';                                
                 }
     }
     
  }
}    

function czysc(o){
  for (var i=0; i<o.length;i++) {
      if( o[i].type!= 'hidden' && o[i].type!= 'submit' && o[i].type!= 'button'){
        o[i].value = "";
      }
  }
}

function go(url){
  document.location.href = url;
}

function go_form(f, url){
   f.action = url;
   f.submit();
}

function selecturl(s) {
	var gourl = s.options[s.selectedIndex].value;	document.location.href = gourl;
}

function otworz( host, url, tytul, szer, wys, extra_foto ){
    if (parseInt(szer) > 800 || parseInt(wys) > 800){
        NoweOkienko=window.open(url, tytul);
    } else{
		if( extra_foto )
			wys = parseInt(wys)+50;
		if( parseInt(szer) < 150 )
			szer = 350;

        config='left=100,top=100,width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';
        NoweOkienko=window.open('', tytul, config);
        NoweOkienko.document.open();
        NoweOkienko.document.write('<HTML>');
        NoweOkienko.document.write('<HEAD>');
        NoweOkienko.document.write('<TITLE>'+tytul+'</TITLE>');
        NoweOkienko.document.write('</HEAD>');
        NoweOkienko.document.write('<body style="padding: 0px; margin: 0px;" bgcolor="#ffffff">');
        if( extra_foto )
			NoweOkienko.document.write('<table height="50" cellpadding="0" cellspacing="0" width="100%"><tr><td><img src="'+host+'/logo.gif"></td><td align="right"><img src="'+host+'/'+extra_foto+'"></td></tr></table>');
        NoweOkienko.document.write('<div align="center"><A HREF=# onclick="javascript:self.close();"><IMG SRC="'+host+'/'+url+'" BORDER=0 ALT="Zamknij"></A></div>');
        NoweOkienko.document.write('</BODY>');
        NoweOkienko.document.write('</HTML>');
        NoweOkienko.document.close();
        NoweOkienko.focus();
    }
}
function otworz_url( url, szer, wys, scroll ){
	if( !scroll )
		scroll = "no";
    config='left=100,top=100,width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scroll+',resizable=yes';
    NoweOkienko=window.open(url, '', config);
}

function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
 	if (use_gebi && document.all) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_gebi) {
		var o=document.getElementById(anchorname);
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
 	else if (use_css) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_layers) {
		var found=0;
		for (var i=0; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) { found=1; break; }
			}
		if (found==0) {
			coordinates.x=0; coordinates.y=0; return coordinates;
			}
		x=document.anchors[i].x;
		y=document.anchors[i].y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// getAnchorWindowPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the window
function getAnchorWindowPosition(anchorname) {
	var coordinates=getAnchorPosition(anchorname);
	var x=0;
	var y=0;
	if (document.getElementById) {
		if (isNaN(window.screenX)) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		}
	else if (document.all) {
		x=coordinates.x-document.body.scrollLeft+window.screenLeft;
		y=coordinates.y-document.body.scrollTop+window.screenTop;
		}
	else if (document.layers) {
		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el) {
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
	}
function AnchorPosition_getWindowOffsetLeft (el) {
	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
	}	
function AnchorPosition_getPageOffsetTop (el) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
	return ot;
	}
function AnchorPosition_getWindowOffsetTop (el) {
	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
	}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function sortp(s, k, base){
    var gourl = s.options[s.selectedIndex].value;
	if( k ){
		document.location.href= base+k+"&sort="+gourl;
	} else {
    	document.location.href= base+"?sort="+gourl;	
	}
}

function getcheck(a, b){
   if( a.checked )
     hideall("block", b);
   else
     hideall("none", b);
}

function hideall(all, b) {
                        var Nodes = document.getElementsByTagName('table')
                        var max = Nodes.length
                        for(var i=0;i<max;i++) {
                                var nodeObj = Nodes.item(i);                                
                                if(nodeObj.id.indexOf(b)!=-1) {
                                   nodeObj.style.display = all;                                
                                }
                        }
}       
function hideallt(all, ids, tag) {
                        var Nodes = document.getElementsByTagName(tag)
                        var max = Nodes.length
                        for(var i=0;i<max;i++) {
                                var nodeObj = Nodes.item(i);                                
                                if(nodeObj.id.indexOf(ids)!=-1) {
                                   nodeObj.style.display = all;                                
                                }
                        }
}

function zaplataSelect(){
	document.zamow.action = location.href+"&nc=1";
	document.zamow.submit();
}

function mailer(pre, dom, c, mpre, mdom){
	document.write("<a href='mailto:"+pre+"@"+dom+"' "+c+">"+mpre+(mdom ? "@"+mdom : "")+"</a>");
}

// -->  
<!--
parchor = '';
nanchor = '';
 var myWidth = 0;
 if( typeof( window.innerWidth ) == 'number' ) {
	 //Non-IE
	 myWidth = window.innerWidth;
 } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	 //IE 6+ in 'standards compliant mode'
	 myWidth = document.documentElement.clientWidth;
 } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	 //IE 4 compatible
	 myWidth = document.body.clientWidth;
 }
 // Split the string into part [0] and part [1]
temp=navigator.appVersion.split('MSIE');

// Parse the string for the "6" in 6.0
ieVer=parseInt(temp[1]);

// Is it greater than 6?
var isIE6=(ieVer == 6)?1:0; 
var load_stan = false;	  
function DmsImageBox(){
	this.init = function (){
		if (!document.getElementsByTagName){ return; }
		var anchors = document.getElementsByTagName('a');
		for (var i=0; i<anchors.length; i++){
			var anchor = anchors[i];
			var relAttribute = String(anchor.getAttribute('rel'));
			if (anchor.getAttribute('href') && (relAttribute.match('DmsImageBox'))){
				anchor.onclick = function () {return DmsImageBox.start(this);}
			}
		}
		
		var objOverlay = document.createElement("div");
		objOverlay.setAttribute('id','overlay');
		objOverlay.style.display = 'none';
		objOverlay.setAttribute('align','center');
		objOverlay.style.left = '0px';
		objOverlay.style.top = '0px';
		objOverlay.style.filer = 'alpha(opacity=60)';
		objOverlay.style.opacity = '0.6';
		objOverlay.style.width = '100%';
		objOverlay.style.height = '500px';
		objOverlay.style.zIndex = '90';
		objOverlay.style.position = 'absolute';
		objOverlay.style.background = '#000000';
		
		objOverlay.onclick = function() { DmsImageBox.end(); return false; }
		var objInside = document.createElement("div");
		document.body.appendChild(objOverlay);
		
		objInside.setAttribute('id','inside');
		objInside.style.display = 'none';
		objInside.setAttribute('align','center');
		objInside.style.background = '#ffffff';
		objInside.style.top = '10px';
		objInside.style.marginBottom = '10px';
		objInside.style.position = 'absolute';
		objInside.style.padding = '10px';
		objInside.style.zIndex = '91';
		document.body.appendChild(objInside);
		
		pic1= new Image(24,24); 
		pic1.src="/grafika/loading.gif";
		
	}
	this.loadingInfo = function(fast_start){
		var arrayPageSize = getPageSize();
		hideSelectBoxes();
		document.getElementById('overlay').style.height = arrayPageSize[1]+'px';
		document.getElementById('inside').style.width = '250px';
		document.getElementById('inside').style.height = '150px';
		
		arrayPageScroll = getPageScroll();
		
		
		s = parseFloat(arrayPageScroll[1])+ 10;
		if( s < parseFloat(arrayPageScroll[1]) + 10 )
			s = parseFloat(arrayPageScroll[1])+10;
			
		document.getElementById('inside').style.top = s+'px';
		
		document.getElementById('inside').innerHTML = '<table cellpadding=0 cellspacing=0 width=100% height=100%><tr><td valign=middle align=center><img src="/grafika/loading.gif" border=0></td></tr></table>';
		if( fast_start != 1 )
			opacity('overlay', 0, 60, 500);
		x = Math.round(arrayPageSize[2]/2) - 75;
		document.getElementById('inside').style.left = x+'px';
		opacity('inside', 0, 100, 200);
	}
	this.start = function (obj, fast_start){
		bigImg = obj.getAttribute('href');
		title = obj.getAttribute('rel_name');
		if( !title )
			title = '';
		imgPreloader = new Image();
		this.loadingInfo(fast_start);
		load_stan = true;
		imgPreloader.onload= function() {
			clearOpacity('inside');
			changeOpac(0, 'inside');
			DmsImageBox.showImage(bigImg, this.width, this.height, title);
		}		
		imgPreloader.src = bigImg;
		return false;
	}
	this.showImage = function (src, width, height, title){
	if( load_stan == true ){
		z = 0;
		zi = -1;
		prev = '';
		panchor = '';
		nanchor = '';
		plink = '';
		nlink = '';
		
		var anchors = document.getElementsByTagName('a');
		for (var i=0; i<anchors.length; i++){
			var anchor = anchors[i];
			var relAttribute = String(anchor.getAttribute('rel'));
			if (anchor.getAttribute('href') && (relAttribute.match('DmsImageBox'))){
				if( anchor.getAttribute('href') == src){
					panchor = prev;
					if( prev )
						plink = "DmsImageBox.start(panchor, 1);";
					zi = z+1;
				}
				if( zi == z ){
					nanchor = anchor;
					nlink = "DmsImageBox.start(nanchor, 1);";
				}
				prev = anchor;
				z++;
			}
		}
		
		var arrayPageSize = getPageSize();
		if( width < 400 )	
			width = 400;
		if( height < 300 )
			height = 300;
		x = Math.round(arrayPageSize[2]/2) - Math.round(width/2);
		document.getElementById('inside').style.left = x+'px';
		height = parseFloat(height) + 30;
		document.getElementById('inside').style.width = width+'px';
		document.getElementById('inside').style.height = height+'px';
		arrayPageScroll = getPageScroll();
		
		s = parseFloat(arrayPageScroll[1])+ 10;
		
		document.getElementById('inside').style.top = s+'px';
		
		var arrayPageSize = getPageSize();
		if( parseInt(height) + s + 50 > arrayPageSize[1] ){
				tmp =  parseInt(height) + s + 50;
				document.getElementById('overlay').style.height = tmp+'px';
		}
		
		htm = '<table cellpadding=0 cellspacing=0 width=100% height=100%><tr><td bgcolor="#ffffff" colspan=3 valign=middle align=center><img onClick="DmsImageBox.end();" style="cursor: pointer;" border=0 src="'+src+'" border=0></td></tr><tr><td align=left height=20 style="padding-top: 8px;" width="250">'+
		(panchor != '' ? '<div style="cursor:hand; width: 25px; text-align: center; padding-top: 6px;padding-bottom: 5px;position: absolute; top: 100px;"><a style="color: #000000;" href="javascript:void(0)" onclick="'+plink+'"><img src="/grafika/ico_back.gif" border="0"></a></div>' : '')+
		zi+'&nbsp;/&nbsp;'+z+'</td><td width="'+(width-50)+'" style="padding-top: 8px;" align=center>'+title+'</td><td width=25>'+
		(nanchor != '' ? '<div style="cursor:hand; width: 25px; text-align: center; padding-top: 6px;padding-bottom: 5px;position: absolute; top: 100px;"><a style="color: #000000;" href="javascript:void(0)" onclick="'+nlink+'"><img src="/grafika/ico_next.gif" border="0"></a></div>' : '')+
		(isIE6 ? "<br>" : "")+'<div style="float: right"><div style="filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;cursor:hand; width: 25px; text-align: center; padding-top: 6px;padding-bottom: 5px;"><a style="color: #000000"style="filter:alpha(opacity=100);"  href="javascript: DmsImageBox.end();"><img src="/grafika/ico_close.gif" border="0"></a></div></div></td></tr></table>';
		
		document.getElementById('inside').innerHTML = htm;
		opacity('inside', 0, 100, 500);
		var arrayPageSize = getPageSize();
		document.getElementById('overlay').style.height = arrayPageSize[1]+'px';
		load_stan = false;
	}}

	this.end = function (){
		load_stan = false;
		imgPreloader.onLoad = "void();";
		changeOpac(0, 'inside');
		clearOpacity('inside');
		//opacity('inside', 100, 0, 100);
		opacity('overlay', 60, 0, 100);
		showSelectBoxes();
	}
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode
		xScroll = document.documentElement.scrollWidth;
		yScroll = document.documentElement.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth + document.body.offsetLeft;
		yScroll = document.body.offsetHeight + document.body.offsetTop;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}
var timers = Array();
timers['inside'] = Array(1000);
timers['overlay'] = Array(1000);

function clearOpacity(id){
	for(i=0;i<1000;i++){
		if( timers[id][i] )
			clearTimeout(timers[id][i]);
		timers[id][i] = "";
	}
}

function opacity(id, opacStart, opacEnd, millisec) { 
	clearOpacity(id);
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            timers[id][i] = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
	object.display = 'block';
	if( opacity == 0 )
		document.getElementById(id).style.display = 'none';
} 
function showSelectBoxes(){
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}
function hideSelectBoxes(){
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}

var DmsImageBox = new DmsImageBox();
function initDmsImageBox(){
	DmsImageBox.init();
	initDynamicOptionLists();
}
window.onload= initDmsImageBox;



var FlashDetect = new function(){
	var self = this;
	self.installed = false;
	self.raw = "";
	self.major = -1;
	self.minor = -1;
	self.revision = -1;
	self.revisionStr = "";
	var activeXDetectRules = [
		{
			"name":"ShockwaveFlash.ShockwaveFlash.7",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash.6",
			"version":function(obj){
				var version = "6,0,21";
				try{
					obj.AllowScriptAccess = "always";
					version = getActiveXVersion(obj);
				}catch(err){}
				return version;
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		}
	];
	var getActiveXVersion = function(activeXObj){
		var version = -1;
		try{
			version = activeXObj.GetVariable("$version");
		}catch(err){}
		return version;
	};
	var getActiveXObject = function(name){
		var obj = -1;
		try{
			obj = new ActiveXObject(name);
		}catch(err){}
		return obj;
	};
	var parseActiveXVersion = function(str){
		var versionArray = str.split(",");//replace with regex
		return {
			"raw":str,
			"major":parseInt(versionArray[0].split(" ")[1], 10),
			"minor":parseInt(versionArray[1], 10),
			"revision":parseInt(versionArray[2], 10),
			"revisionStr":versionArray[2]
		};
	};
	var parseStandardVersion = function(str){
		var descParts = str.split(/ +/);
		var majorMinor = descParts[2].split(/\./);
		var revisionStr = descParts[3];
		return {
			"raw":str,
			"major":parseInt(majorMinor[0], 10),
			"minor":parseInt(majorMinor[1], 10), 
			"revisionStr":revisionStr,
			"revision":parseRevisionStrToInt(revisionStr)
		};
	};
	var parseRevisionStrToInt = function(str){
		return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
	};
	self.majorAtLeast = function(version){
		return self.major >= version;
	};
	self.FlashDetect = function(){
		if(navigator.plugins && navigator.plugins.length>0){
			var type = 'application/x-shockwave-flash';
			var mimeTypes = navigator.mimeTypes;
			if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
				var version = mimeTypes[type].enabledPlugin.description;
				var versionObj = parseStandardVersion(version);
				self.raw = versionObj.raw;
				self.major = versionObj.major;
				self.minor = versionObj.minor; 
				self.revisionStr = versionObj.revisionStr;
				self.revision = versionObj.revision;
				self.installed = true;
			}
		}else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
			var version = -1;
			for(var i=0; i<activeXDetectRules.length && version==-1; i++){
				var obj = getActiveXObject(activeXDetectRules[i].name);
				if(typeof obj == "object"){
					self.installed = true;
					version = activeXDetectRules[i].version(obj);
					if(version!=-1){
						var versionObj = parseActiveXVersion(version);
						self.raw = versionObj.raw;
						self.major = versionObj.major;
						self.minor = versionObj.minor; 
						self.revision = versionObj.revision;
						self.revisionStr = versionObj.revisionStr;
					}
				}
			}
		}
	}();
};
var MM_FlashCanPlay = false;
if(FlashDetect.majorAtLeast(7))   
	MM_FlashCanPlay = true; 
 		
var ji = 1;
function insertSwf(plik, width, height, transparent, border, id_replace, im){
    rnd = width+height+ji;
    ji++;

 if( id_replace && (MM_FlashCanPlay || !im)){
 	document.getElementById(id_replace).innerHTML = (
	'<object '+(border ? 'class="tfoto"' : '')+' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + width + '" height="' + height + '"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="movie" value="' + plik + '" /><param name="quality" value="high" />'+(transparent ? '<param name="wmode" value="transparent" />' : '<param name="bgcolor" value="'+(border ? border : '#ffffff')+'">')+'<embed src="' + plik + '" '+(transparent ? 'wmode="transparent"' : '')+' quality="high" bgcolor='+(border ? border : '#ffffff')+' width="' + width + '" height="'
         + height
         + '" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></embed></object>');
 	
 } else if( MM_FlashCanPlay || !im ){
 	document.write('<div id="f'+rnd+'" style="width:'+width+';height:'+height+'px"></div>');
 	document.getElementById('f'+rnd).innerHTML = (
	'<object '+(border ? 'class="tfoto"' : '')+' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + width + '" height="' + height + '"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="quality" value="high" /><param name="movie" value="' + plik + '" />'+(transparent ? '<param name="wmode" value="transparent" />' : '<param name="bgcolor" value="'+(border ? border : '#ffffff')+'">')+'<embed src="' + plik + '" '+(transparent ? 'wmode="transparent"' : '')+' quality="high" bgcolor='+(border ? border : '#ffffff')+' width="' + width + '" height="'
         + height
         + '" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></embed></object>');
 } else if( im ) {
 		document.write('<img src="'+im+'" width="'+width+'" height="'+height+'" '+(border ? 'class=tfoto' : '')+' border=0 />');
 }
 
}
var upd_get_url = '';
function getUrl(url, upd){
		upd_get_url = upd;
		if (document.getElementById) {
			var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
			if(x){
				x.onreadystatechange = function(){
				if (x.readyState == 4){
					document.getElementById(upd_get_url).innerHTML = x.responseText;
					document.getElementById(upd_get_url+'2').style.visibility = 'visible';
				}}
				
			}
			x.open("GET", url, true);
			x.send(null);
		}
}

// Global objects to keep track of DynamicOptionList objects created on the page
var dynamicOptionListCount=0;
var dynamicOptionListObjects = new Array();

// Init call to setup lists after page load. One call to this function sets up all lists.
function initDynamicOptionLists() {
  // init each DynamicOptionList object
  for (var i=0; i<dynamicOptionListObjects.length; i++) {
    var dol = dynamicOptionListObjects[i];

    // Find the form associated with this list
    if (dol.formName!=null) { 
      dol.form = document.forms[dol.formName];
    }
    else if (dol.formIndex!=null) {
      dol.form = document.forms[dol.formIndex];
    }
    else {
      // Form wasn't set manually, so go find it!
      // Search for the first form element name in the lists
      var name = dol.fieldNames[0][0];
      for (var f=0; f<document.forms.length; f++) {
        if (typeof(document.forms[f][name])!="undefined") {
          dol.form = document.forms[f];
          break;
        }
      }
      if (dol.form==null) {
        alert("ERROR: Couldn't find form element "+name+" in any form on the page! Init aborted"); return;
      }
    }

    // Form is found, now set the onchange attributes of each dependent select box
    for (var j=0; j<dol.fieldNames.length; j++) {
      // For each set of field names...
      for (var k=0; k<dol.fieldNames[j].length-1; k++) {
        // For each field in the set...
        var selObj = dol.form[dol.fieldNames[j][k]];
        if (typeof(selObj)=="undefined") { alert("Select box named "+dol.fieldNames[j][k]+" could not be found in the form. Init aborted"); return; }
        // Map the HTML options in the first select into the options we created
        if (k==0) {
          if (selObj.options!=null) {
            for (l=0; l<selObj.options.length; l++) {
              var sopt = selObj.options[l];
              var m = dol.findMatchingOptionInArray(dol.options,sopt.text,sopt.value,false);
              if (m!=null) {
                var reselectForNN6 = sopt.selected;
                var m2 = new Option(sopt.text, sopt.value, sopt.defaultSelected, sopt.selected);
                m2.selected = sopt.selected; // For some reason I need to do this to make NN4 happy
                m2.defaultSelected = sopt.defaultSelected;
                m2.DOLOption = m;
                selObj.options[l] = m2;
                selObj.options[l].selected = reselectForNN6; // Reselect this option for NN6 to be happy. Yuck.
              }
            }
          }
        }
        if (selObj.onchange==null) {
          // We only modify the onChange attribute if it's empty! Otherwise do it yourself in your source!
          selObj.onchange = new Function("dynamicOptionListObjects["+dol.index+"].change(this)");
        }
      }
    }
  }
  // Set the preselectd options on page load 
  resetDynamicOptionLists();
}

// This function populates lists with the preselected values. 
// It's pulled out into a separate function so it can be hooked into a 'reset' button on a form
// Optionally passed a form object which should be the only form reset
function resetDynamicOptionLists(theform) {
  // reset each DynamicOptionList object
  for (var i=0; i<dynamicOptionListObjects.length; i++) {
    var dol = dynamicOptionListObjects[i];
    if (typeof(theform)=="undefined" || theform==null || theform==dol.form) {
      for (var j=0; j<dol.fieldNames.length; j++) {
        dol.change(dol.form[dol.fieldNames[j][0]],true); // Second argument says to use preselected values rather than default values
      }
    }
  }
}

// An object to represent an Option() but just for data-holding
function DOLOption(text,value,defaultSelected,selected) {
  this.text = text;
  this.value = value;
  this.defaultSelected = defaultSelected;
  this.selected = selected;
  this.options = new Array(); // To hold sub-options
  return this;
}

// DynamicOptionList CONSTRUCTOR
function DynamicOptionList() {
  this.form = null;// The form this list belongs to
  this.options = new Array();// Holds the options of dependent lists
  this.longestString = new Array();// Longest string that is currently a potential option (for Netscape)
  this.numberOfOptions = new Array();// The total number of options that might be displayed, to build dummy options (for Netscape)
  this.currentNode = null;// The current node that has been selected with forValue() or forText()
  this.currentField = null;// The current field that is selected to be used for setValue()
  this.currentNodeDepth = 0;// How far down the tree the currentNode is
  this.fieldNames = new Array();// Lists of dependent fields which use this object
  this.formIndex = null;// The index of the form to associate with this list
  this.formName = null;// The name of the form to associate with this list
  this.fieldListIndexes = new Object();// Hold the field lists index where fields exist
  this.fieldIndexes = new Object();// Hold the index within the list where fields exist
  this.selectFirstOption = true;// Whether or not to select the first option by default if no options are default or preselected, otherwise set the selectedIndex = -1
  this.numberOfOptions = new Array();// Store the max number of options for a given option list
  this.longestString = new Array();// Store the longest possible string 
  this.values = new Object(); // Will hold the preselected values for fields, by field name
  
  // Method mappings
  this.forValue = DOL_forValue;
  this.forText = DOL_forText;
  this.forField = DOL_forField;
  this.forX = DOL_forX;
  this.addOptions = DOL_addOptions;
  this.addOptionsTextValue = DOL_addOptionsTextValue;
  this.setDefaultOptions = DOL_setDefaultOptions;
  this.setValues = DOL_setValues;
  this.setValue = DOL_setValues;
  this.setFormIndex = DOL_setFormIndex;
  this.setFormName = DOL_setFormName;
  this.printOptions = DOL_printOptions;
  this.addDependentFields = DOL_addDependentFields;
  this.change = DOL_change;
  this.child = DOL_child;
  this.selectChildOptions = DOL_selectChildOptions;
  this.populateChild = DOL_populateChild;
  this.change = DOL_change;
  this.addNewOptionToList = DOL_addNewOptionToList;
  this.findMatchingOptionInArray = DOL_findMatchingOptionInArray;

  // Optionally pass in the dependent field names
  if (arguments.length > 0) {
    // Process arguments and add dependency groups
    for (var i=0; i<arguments.length; i++) {
      this.fieldListIndexes[arguments[i].toString()] = this.fieldNames.length;
      this.fieldIndexes[arguments[i].toString()] = i;
    }
    this.fieldNames[this.fieldNames.length] = arguments;
  }
  
  // Add this object to the global array of dynamicoptionlist objects
  this.index = window.dynamicOptionListCount++;
  window["dynamicOptionListObjects"][this.index] = this;
}

// Given an array of Option objects, search for an existing option that matches value, text, or both
function DOL_findMatchingOptionInArray(a,text,value,exactMatchRequired) {
  if (a==null || typeof(a)=="undefined") { return null; }
  var value_match = null; // Whether or not a value has been matched
  var text_match = null; // Whether or not a text has been matched
  for (var i=0; i<a.length; i++) {
    var opt = a[i];
    // If both value and text match, return it right away
    if (opt.value==value && opt.text==text) { return opt; }
    if (!exactMatchRequired) {
      // If value matches, store it until we complete scanning the list
      if (value_match==null && value!=null && opt.value==value) {
        value_match = opt;
      }
      // If text matches, store it for later
      if (text_match==null && text!=null && opt.text==text) {
        text_match = opt;
      }
    }
  }
  return (value_match!=null)?value_match:text_match;
}

// Util function used by forValue and forText
function DOL_forX(s,type) {
  if (this.currentNode==null) { this.currentNodeDepth=0; }
  var useNode = (this.currentNode==null)?this:this.currentNode;
  var o = this.findMatchingOptionInArray(useNode["options"],(type=="text")?s:null,(type=="value")?s:null,false);
  if (o==null) {
    o = new DOLOption(null,null,false,false);
    o[type] = s;
    useNode.options[useNode.options.length] = o;
  }
  this.currentNode = o;
  this.currentNodeDepth++;
  return this;
}

// Set the portion of the list structure that is to be used by a later operation like addOptions
function DOL_forValue(s) { return this.forX(s,"value"); }

// Set the portion of the list structure that is to be used by a later operation like addOptions
function DOL_forText(s) { return this.forX(s,"text"); }

// Set the field to be used for setValue() calls
function DOL_forField(f) { this.currentField = f; return this; }

// Create and add an option to a list, avoiding duplicates
function DOL_addNewOptionToList(a, text, value, defaultSelected) {
  var o = new DOLOption(text,value,defaultSelected,false);
  // Add the option to the array
  if (a==null) { a = new Array(); }
  for (var i=0; i<a.length; i++) {
    if (a[i].text==o.text && a[i].value==o.value) {
      if (o.selected) { 
        a[i].selected=true;
      }
      if (o.defaultSelected) {
        a[i].defaultSelected = true;
      }
      return a;
    }
  }
  a[a.length] = o;
}

// Add sub-options to the currently-selected node, with the same text and value for each option
function DOL_addOptions() {
  if (this.currentNode==null) { this.currentNode = this; }
  if (this.currentNode["options"] == null) { this.currentNode["options"] = new Array(); }
  for (var i=0; i<arguments.length; i++) {
    var text = arguments[i];
    this.addNewOptionToList(this.currentNode.options,text,text,false);
    if (typeof(this.numberOfOptions[this.currentNodeDepth])=="undefined") {
      this.numberOfOptions[this.currentNodeDepth]=0;
    }
    if (this.currentNode.options.length > this.numberOfOptions[this.currentNodeDepth]) {
      this.numberOfOptions[this.currentNodeDepth] = this.currentNode.options.length;
    }
    if (typeof(this.longestString[this.currentNodeDepth])=="undefined" || (text.length > this.longestString[this.currentNodeDepth].length)) {
      this.longestString[this.currentNodeDepth] = text;
    }
  }
  this.currentNode = null;
  this.currentNodeDepth = 0;
}

// Add sub-options to the currently-selected node, specifying separate text and values for each option
function DOL_addOptionsTextValue() {
  if (this.currentNode==null) { this.currentNode = this; }
  if (this.currentNode["options"] == null) { this.currentNode["options"] = new Array(); }
  for (var i=0; i<arguments.length; i++) {
    var text = arguments[i++];
    var value = arguments[i];
    this.addNewOptionToList(this.currentNode.options,text,value,false);
    if (typeof(this.numberOfOptions[this.currentNodeDepth])=="undefined") {
      this.numberOfOptions[this.currentNodeDepth]=0;
    }
    if (this.currentNode.options.length > this.numberOfOptions[this.currentNodeDepth]) {
      this.numberOfOptions[this.currentNodeDepth] = this.currentNode.options.length;
    }
    if (typeof(this.longestString[this.currentNodeDepth])=="undefined" || (text.length > this.longestString[this.currentNodeDepth].length)) {
      this.longestString[this.currentNodeDepth] = text;
    }
  }
  this.currentNode = null;
  this.currentNodeDepth = 0;
}

// Find the first dependent list of a select box
// If it's the last list in a chain, return null because there are no children
function DOL_child(obj) {
  var listIndex = this.fieldListIndexes[obj.name];
  var index = this.fieldIndexes[obj.name];
  if (index < (this.fieldNames[listIndex].length-1)) {
    return this.form[this.fieldNames[listIndex][index+1]];
  }
  return null;
}

// Set the options which should be selected by default for a certain value in the parent
function DOL_setDefaultOptions() {
  if (this.currentNode==null) { this.currentNode = this; }
  for (var i=0; i<arguments.length; i++) {
    var o = this.findMatchingOptionInArray(this.currentNode.options,null,arguments[i],false);
    if (o!=null) {
      o.defaultSelected = true;
    }
  }
  this.currentNode = null;
}

// Set the options which should be selected when the page loads. This is different than the default value and ONLY applies when the page LOADS
function DOL_setValues() {
  if (this.currentField==null) { 
    alert("Can't call setValues() without using forField() first!");
    return;
  }
  if (typeof(this.values[this.currentField])=="undefined") {
    this.values[this.currentField] = new Object();
  }
  for (var i=0; i<arguments.length; i++) {
    this.values[this.currentField][arguments[i]] = true;
  }
  this.currentField = null;
}

// Manually set the form for the object using an index
function DOL_setFormIndex(i) {
  this.formIndex = i;
}

// Manually set the form for the object using a form name
function DOL_setFormName(n) {
  this.formName = n;
}

// Print blank <option> objects for Netscape4, since it refuses to grow or shrink select boxes for new options
function DOL_printOptions(name) {
  // Only need to write out "dummy" options for Netscape4
    if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) <= 4)){
    var index = this.fieldIndexes[name];
    var ret = "";
    if (typeof(this.numberOfOptions[index])!="undefined") {
      for (var i=0; i<this.numberOfOptions[index]; i++) { 
        ret += "<OPTION>";
      }
    }
    ret += "<OPTION>";
    if (typeof(this.longestString[index])!="undefined") {
      for (var i=0; i<this.longestString[index].length; i++) {
        ret += "_";
      }
    }
    document.writeln(ret);
  }
}

// Add a list of field names which use this option-mapping object.
// A single mapping object may be used by multiple sets of fields
function DOL_addDependentFields() {
  for (var i=0; i<arguments.length; i++) {
    this.fieldListIndexes[arguments[i].toString()] = this.fieldNames.length;
    this.fieldIndexes[arguments[i].toString()] = i;
  }
  this.fieldNames[this.fieldNames.length] = arguments;
}

// Called when a parent select box is changed. It populates its direct child, then calls change on the child object to continue the population.
function DOL_change(obj, usePreselected) {
  if (usePreselected==null || typeof(usePreselected)=="undefined") { usePreselected = false; }
  var changedListIndex = this.fieldListIndexes[obj.name];
  var changedIndex = this.fieldIndexes[obj.name];
  var child = this.child(obj);
  if (child == null) { return; } // No child, no need to continue
  if (obj.type == "select-one") {
    // Treat single-select differently so we don't have to scan the entire select list, which could potentially speed things up
    if (child.options!=null) {
      child.options.length=0; // Erase all the options from the child so we can re-populate
    }
    if (obj.options!=null && obj.options.length>0 && obj.selectedIndex>=0) {
      var o = obj.options[obj.selectedIndex];
      this.populateChild(o.DOLOption,child,usePreselected);
      this.selectChildOptions(child,usePreselected);
    }
  }
  else if (obj.type == "select-multiple") {
    // For each selected value in the parent, find the options to fill in for this list
    // Loop through the child list and keep track of options that are currently selected
    var currentlySelectedOptions = new Array();
    if (!usePreselected) {
      for (var i=0; i<child.options.length; i++) {
        var co = child.options[i];
        if (co.selected) {
          this.addNewOptionToList(currentlySelectedOptions, co.text, co.value, co.defaultSelected);
        }
      }
    }
    child.options.length=0;
    if (obj.options!=null) {
      var obj_o = obj.options;
      // For each selected option in the parent...
      for (var i=0; i<obj_o.length; i++) {
        if (obj_o[i].selected) {
          // if option is selected, add its children to the list
           this.populateChild(obj_o[i].DOLOption,child,usePreselected);
        }
      }
      // Now go through and re-select any options which were selected before
      var atLeastOneSelected = false;
      if (!usePreselected) {
        for (var i=0; i<child.options.length; i++) {
          var m = this.findMatchingOptionInArray(currentlySelectedOptions,child.options[i].text,child.options[i].value,true);
          if (m!=null) {
            child.options[i].selected = true;
            atLeastOneSelected = true;
          }
        }
      }
      if (!atLeastOneSelected) {  
        this.selectChildOptions(child,usePreselected);
      }
    }
  }
  // Change all the way down the chain
  this.change(child,usePreselected);
}
function DOL_populateChild(dolOption,childSelectObj,usePreselected) {
  // If this opton has sub-options, populate the child list with them
  if (dolOption!=null && dolOption.options!=null) {
    for (var j=0; j<dolOption.options.length; j++) {
      var srcOpt = dolOption.options[j];
      if (childSelectObj.options==null) { childSelectObj.options = new Array(); }
      // Put option into select list
      var duplicate = false;
      var preSelectedExists = false;
      for (var k=0; k<childSelectObj.options.length; k++) {
        var csi = childSelectObj.options[k];
        if (csi.text==srcOpt.text && csi.value==srcOpt.value) {
          duplicate = true;
          break;
        }
      }
      if (!duplicate) {
        var newopt = new Option(srcOpt.text, srcOpt.value, false, false);
        newopt.selected = false; // Again, we have to do these two statements for NN4 to work
        newopt.defaultSelected = false;
        newopt.DOLOption = srcOpt;
        childSelectObj.options[childSelectObj.options.length] = newopt;
      }
    }
  }
}

// Once a child select is populated, go back over it to select options which should be selected
function DOL_selectChildOptions(obj,usePreselected) {
  // Look to see if any options are preselected=true. If so, then set then selected if usePreselected=true, otherwise set defaults
  var values = this.values[obj.name];
  var preselectedExists = false;
  if (usePreselected && values!=null && typeof(values)!="undefined") {
    for (var i=0; i<obj.options.length; i++) {
      var v = obj.options[i].value;
      if (v!=null && values[v]!=null && typeof(values[v])!="undefined") {
        preselectedExists = true;
        break;
      }
    }
  }
  // Go back over all the options to do the selection
  var atLeastOneSelected = false;
  for (var i=0; i<obj.options.length; i++) {
    var o = obj.options[i];
    if (preselectedExists && o.value!=null && values[o.value]!=null && typeof(values[o.value])!="undefined") {
      o.selected = true;
      atLeastOneSelected = true;
    }
    else if (!preselectedExists && o.DOLOption!=null && o.DOLOption.defaultSelected) {
      o.selected = true;
      atLeastOneSelected = true;
    }
    else {
      o.selected = false;
    }
  }
  // If nothing else was selected, select the first one by default
  if (this.selectFirstOption && !atLeastOneSelected && obj.options.length>0) {
    obj.options[0].selected = true;
  }
  else if (!atLeastOneSelected &&  obj.type=="select-one") {
    obj.selectedIndex = -1;
  }
}

//-->