  function saveStats_Outlink(strLink)
  {
    document.getElementById('imgHidden').src='http://www.mapes.lv/?outlinks=' + myUrlEncode(strLink);
    window.open(strLink, '_blank');
    return false;
  }

  function myUrlEncode(strString)
  {
    strString = escape(strString);
    strString = strString.replace('+', '%2B');
    strString = strString.replace('%20', '+');
    strString = strString.replace('*', '%2A');
    strString = strString.replace('/', '%2F');
    strString = strString.replace('@', '%40');
    return strString;
  }

  function toggleVis(object1)
  {
    object = document.getElementById(object1);
    if (object.style.display=='none')
    {
      object.style.display='';
    }
    else
    {
      object.style.display='none';
    }
  }

  var oWindow = null;
  function popUp(URL) 
  {  
    day = new Date();
    id = day.getTime();
	oWindow=window.open(URL, id, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=300,height=350,left=100,top=100')
  }
  
  function notfyPopup(i, v)
  {
    eval('oWindow.cs' + i + ' = ' + v);
  }
  
  function addCategory(id)
  {
	for(i=1; i<=2; i++)
	{
	  if(document.getElementById('intCategoryID' + i).value == id)
	  {
	    document.getElementById('intCategoryID' + i).value = 0;
		notfyPopup(i, 0);
		return true;
	  }
	}
	
	for(i=1; i<=2; i++)
	{
	  if(document.getElementById('intCategoryID' + i).value < 1)
	  {
	    document.getElementById('intCategoryID' + i).value = id;
		notfyPopup(i, id); 
		return true;
	  }
	}
	
	alert('Vairāk par 2 nozarēm pielikt nevar!');
	return false;
  }
