function externalLinks() {  
 if (!document.getElementsByTagName) return;  
 var anchors = document.getElementsByTagName("a");  
 for (var i=0; i<anchors.length; i++) {  
   var anchor = anchors[i];  
   if (anchor.getAttribute("href") &&  
       anchor.getAttribute("rel") == "external")  
     anchor.target = "_blank";  
 }  
}  
window.onload = externalLinks;

function radaBildi(link, x, y){
	try { window.prof_opened.close(); if (window.prof_opened.closed) throw 'a^€¦' }
	catch(e) { window.prof_opened = window.open(link,null,'resizable=no, scrollbars=no, location=no, width='+x+', height='+y+', left='+((self.screen.availWidth-x)/2)+', top='+((self.screen.availHeight-y)/2)) }
	return false
}

function cipariOnly(input){
    if(input.value.match(/\W+/g)){
        alert('Šeit var rakstīt tikai a-z, A-Z vai 0-9');
        input.value = input.value.replace(/[^\w]*/g,'');
        input.focus();
    }
}



var theObj="";
var theId="";


function toolTip(id,me) {
  theObj=me;
  theId=id;

  theObj.onmousemove=updatePos;
  window.onscroll=updatePos;
  theObj.onclick=hideMe;
  //document.getElementById(id).innerHTML=text;
  document.getElementById(theId).style.display="block";
  document.getElementById(theId).style.visibility="visible";
}

function updatePos() {
  var ev=arguments[0]?arguments[0]:event;
  var x=ev.clientX;
  var y=ev.clientY;
  diffX=-200;
  diffY=-200;
  document.getElementById(theId).style.top  = y - 2 + diffY + document.body.scrollTop + document.getElementById('content').scrollTop + "px";
  document.getElementById(theId).style.left = x - 2 + diffX + document.body.scrollLeft + document.getElementById('content').scrollLeft + "px";
  theObj.onmouseout=hideMe;
}
function hideMe() {
  document.getElementById(theId).style.display="none";
  document.getElementById(theId).style.visibility="hidden";
}