function addToUrl(thisElement) {
	var regNum = /\d+/;
	if (regNum.exec(thisElement.value)) {
		var aTags = thisElement.parentNode.getElementsByTagName('a');
		var url = aTags[0].href;
		if (url.match(/count=\d+/)) {
			aTags[0].href = url.replace(/count=\d+/,"count="+thisElement.value);		
		} else {
			if (url.match(/\?/)) 
				aTags[0].href += "&";
			else			
				aTags[0].href += "?";
			aTags[0].href += "count=" + thisElement.value;			
		}
	}
}

function showRecountButton() {
	var button = document.getElementById('recountButton');
	button.style.display = 'block';	
}

var myTWin = window.myTWin;

function showImage(link,winName,_w,_h)
{
  if (_w == null){_w = 350;}
  if (_h == null){_h = 350;}
  var retValue=true;
  if (myTWin!=null && !myTWin.closed)
  {
    myTWin.focus();
    myTWin.location.href=link.href;
  }
  else
  {
    myTWin=window.open(link.href,winName, 'toolbar=no, menubar=no, location=no, directories=no, scrollbars=yes, resizable=yes, status=no, width='+_w+', height='+_h+', top=200, left=100');
    if (myTWin==null || typeof(myTWin)=="undefined")
      retValue=false;
    else
    {
      link.target=winName;
      myTWin.focus();
    }
  }
  return retValue;
} 

function cbAction(thisElement)
{
    if (thisElement.checked) 
	thisElement.value = 1; 
    else 
	thisElement.value = 0;
}

function confirmDelProd(thisLink,language)
{
    var  prefix = 'Do you want to delete an item called - ';
    if (language == 'cz') 
	prefix = 'Opravu si přejete smazat přípravek s názvem - ';
    var nameTag = thisLink.parentNode.parentNode.getElementsByTagName("td");
    var message = prefix + nameTag[0].innerHTML + '?';
    return confirm(message);
}

function confirmDelLnk(thisLink,language)
{
    var  prefix = 'Do you want to delete that link called - ';
    if (language == 'cz') 
	prefix = 'Opravu si přejete smazat odkaz s názvem - ';
    var nameTag = thisLink.parentNode.parentNode.getElementsByTagName("td");
    var message = prefix + nameTag[0].innerHTML + '?';
    return confirm(message);
}