function displayWindow(url, width, height) {
      var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=0,menubar=no' );
}

function displayWindow2(url, width, height) {
      var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=1,menubar=no' );
}

/*
*pokaz pole wprowadzania nazwy, jesli wybrano inne - zamowienie
*/

function toggleElement(selectionField,inputShown,tagShown) {
	
	selectionField = document.getElementById(selectionField);
	inputShown = document.getElementById(inputShown);
	tagShown = document.getElementById(tagShown);

  //alert(element1.value);
  if (selectionField.value == 'Inny...') {

   inputShown.style.display = 'inline';
   tagShown.style.display = 'inline';

  }
  else {
    inputShown.value = ''; // input text will be empty
    inputShown.style.display = 'none'; // hide text element
	tagShown.style.display = 'none';
  }

  return;
}

/*
*pokaz tabele stolow w zapytaniu
*/

function toggleElement2(selectionField,inputShown,tagShown) {
	
	selectionField = document.getElementById(selectionField);
	inputShown = document.getElementById(inputShown);
	tagShown = document.getElementById(tagShown);

  //alert(element1.value);
  if (selectionField.value == '') {
	inputShown.value = ''; // input text will be empty
    inputShown.style.display = 'none'; // hide text element
	tagShown.style.display = 'none';
  }
  else {
	inputShown.style.display = 'inline';
   	tagShown.style.display = 'inline';
    
  }

  return;
}

/*
*pokaz tabele stolow w zapytaniu
*/

function toggleElementVariable(selectionField,inputShown,tagShown,inputDesired) {
	
	selectionField = document.getElementById(selectionField);
	inputShown = document.getElementById(inputShown);
	tagShown = document.getElementById(tagShown);

  //alert(element1.value);
  if (selectionField.value == 'Nie jestem zainteresowany stołem - mam inne pytanie') {
    inputShown.style.display = 'none'; // hide text element
	tagShown.style.display = 'none';
  }
  else {
	inputShown.style.display = 'inline';
   	tagShown.style.display = 'inline';
    
  }

  return;
}


/*
*pokaz info o polu wymaganym
*/

function toggleElementInfo(inputField,tagShown,limit) {
	
	inputField = document.getElementById(inputField);

  //alert(element1.value);
  if (inputField.value !== '') {
	for(n=1;n<=limit;n++){
		document.getElementById(tagShown+n).style.display = 'inline';
	}
  }
  else {
	for(n=1;n<=limit;n++){
		document.getElementById(tagShown+n).style.display = 'none';
	}
  }

  return;
}

//polska
function toggleElementInfo2(inputField,tagShown,value,limit) {
	
	inputField = document.getElementById(inputField);

  //alert(element1.value);
  if (inputField.value == value) {
	for(n=1;n<=limit;n++){
		document.getElementById(tagShown+n).style.display = 'inline';
	}
  }
  else {
	for(n=1;n<=limit;n++){
		document.getElementById(tagShown+n).style.display = 'none';
	}
  }

  return;
}

//tooltip
	
	function xstooltip_findPosX(obj) 
	{
	  var curleft = 0;
	  if (obj.offsetParent) 
	  {
		while (obj.offsetParent) 
			{
				curleft += obj.offsetLeft
				obj = obj.offsetParent;
			}
		}
		else if (obj.x)
			curleft += obj.x;
		return curleft;
	}
	
	function xstooltip_findPosY(obj) 
	{
		var curtop = 0;
		if (obj.offsetParent) 
		{
			while (obj.offsetParent) 
			{
				curtop += obj.offsetTop
				obj = obj.offsetParent;
			}
		}
		else if (obj.y)
			curtop += obj.y;
		return curtop;
	}
	
	function xstooltip_show(tooltipId, parentId, posX, posY)
	{
		it = document.getElementById(tooltipId);
		
		if ((it.style.top == '' || it.style.top == 0) 
			&& (it.style.left == '' || it.style.left == 0))
		{
			// need to fixate default size (MSIE problem)
			it.style.width = it.offsetWidth + 'px';
			it.style.height = it.offsetHeight + 'px';
			
			img = document.getElementById(parentId); 
		
			// if tooltip is too wide, shift left to be within parent 
			if (posX + it.offsetWidth > img.offsetWidth) posX = img.offsetWidth - it.offsetWidth;
			if (posX < 0 ) posX = 0; 
			
			x = xstooltip_findPosX(img) + posX;
			y = xstooltip_findPosY(img) + posY;
			
			it.style.top = y + 'px';
			it.style.left = x + 'px';
		}
		
		it.style.visibility = 'visible'; 
	}
	
	function xstooltip_hide(id)
	{
		it = document.getElementById(id); 
		it.style.visibility = 'hidden'; 
	}
	
	/*
	
	<style type="text/css">
	.xstooltip 
	{
		visibility: hidden; 
		position: absolute; 
		top: 0;  
		left: 0; 
		z-index: 2; 
	
		font: normal 8pt sans-serif; 
		padding: 3px; 
		border: solid 1px;
	}
	</style>
	
	<div id="tooltip_123" class="xstooltip">
	Time spent: 00:00:08<br/>
	Page viewed: 4<br/>
	Location: Loopback <br/>
	Browser: Mozilla - 1.7.11<br/>
	Operating system: Linux - i686 (x86_64)
	</div> 
	
	<img id="the_image"
	src="image.jpg"
	width="100"
	height="50" 
	onmouseover="xstooltip_show('tooltip_123', 'the_image', 289, 49);"
	onmouseout="xstooltip_hide('tooltip_123');" 
	/>
	
	*/

//migajacy tekst
		var b_timer = null; // blink timer
		var b_on = true; // blink state
		var blnkrs = null; // array of spans
		
		function blink() {
		var tmp = document.getElementsByTagName("span");
		if (tmp) {
		blnkrs = new Array();
		var b_count = 0;
		for (var i = 0; i < tmp.length; ++i) {
		if (tmp[i].className == "blink") {
		blnkrs[b_count] = tmp[i];
		++b_count;
		}
		}
		// time in m.secs between blinks
		// 500 = 1/2 second
		blinkTimer(500);
		}
		}
		
		function blinkTimer(ival) {
		if (b_timer) {
		window.clearTimeout(b_timer);
		b_timer = null;
		}
		blinkIt();
		b_timer = window.setTimeout('blinkTimer(' + ival + ')', ival);
		}
		
		function blinkIt() {
		for (var i = 0; i < blnkrs.length; ++i) {
		if (b_on == true) {
		blnkrs[i].style.visibility = "hidden";
		}
		else {
		blnkrs[i].style.visibility = "visible";
		}
		}
		b_on =!b_on;
		}

/* zmiana obrazkow po najechaniu kursorem na link */
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_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_findObj(n, d) { //v4.0

  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 && document.getElementById) x=document.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];}

}
