var w=1
var h=1

if (document.getElementById || document.all) document.write('<div id="trailimageid" style="position:absolute;visibility:hidden;left:-10px;top:-10px;width:1px;height:1px;border:1px solid #ccc;padding:1px;background:#f2f2f2;z-index:1000;"><img id="ttimg" src="./img/x.gif" /></div>')

function gettrailobj()
{
	if (document.getElementById) return document.getElementById("trailimageid").style
	else if (document.all) return document.all.trailimageid.style
}

function truebody()
{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function hidetrail()
{
	document.onmousemove=""
	document.getElementById('ttimg').src='./img/x.gif'
	gettrailobj().visibility="hidden"
	gettrailobj().left=-1000
	gettrailobj().top=-1000
}


function showtrail(width,height,file)
{
	if(navigator.userAgent.toLowerCase().indexOf('opera') == -1)
	{
		w=width
		h=height


		gettrailobj().visibility="visible"
		gettrailobj().width=w+"px"
		gettrailobj().height=h+"px"
		document.getElementById('ttimg').src=file
		document.onmousemove=followmouse
	}
}


function followmouse(e)
{

	if(navigator.userAgent.toLowerCase().indexOf('opera') == -1)
	{

		var xcoord=20
		var ycoord=20
		
		if (typeof e != "undefined")
		{
			xcoord+=e.pageX
			ycoord+=e.pageY
		}
		else if (typeof window.event !="undefined")
		{
			xcoord+=truebody().scrollLeft+event.clientX
			ycoord+=truebody().scrollTop+event.clientY
		}

		var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
		var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)

		if (xcoord+w+5>(docwidth-980)/2+280+600)
		xcoord=xcoord-w-(40*2)

		if (ycoord-truebody().scrollTop+h>truebody().clientHeight)
		ycoord=ycoord-h-20;

		gettrailobj().left=xcoord+"px"
		gettrailobj().top=ycoord+"px"

	

	}

}



function get_m(str) { 
return escape(str);
}


var xmlhttp

function showHint(str,str_2,str_3)
{
if (str.length==0)
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support XMLHTTP!");
  return;
  }
  
  // Shajaa funkcijaa pietruukst paarbaudes un uzstaadijumi
  // te var salikt jau gatavus kverijus, kas vareetu buut kaa pamats
  
  
var url="/search/gethint.php";
str=str.replace("Ā", "A");
str=str.replace("ā", "a");
str=str.replace("Č", "C");
str=str.replace("č", "c");
str=str.replace("Ē", "E");
str=str.replace("ē", "e");
str=str.replace("Ģ", "G");
str=str.replace("ģ", "g");
str=str.replace("Ī", "I");
str=str.replace("ī", "i");
str=str.replace("Ķ", "K");
str=str.replace("ķ", "k");
str=str.replace("Ļ", "L");
str=str.replace("ļ", "l");
str=str.replace("Ņ", "N");
str=str.replace("ņ", "n");
str=str.replace("Š", "S");
str=str.replace("š", "s");
str=str.replace("Ū", "U");
str=str.replace("ū", "u");
str=str.replace("Ž", "ž");
str=str.replace("ž", "z");
str=str.replace("-", ".");
url=url+"?q="+escape(str);
url=url+"&m="+str_2;
url=url+"&c="+encodeURI(str_3);
url=url+"&sid="+escape(Math.random());
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
  {
  document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
  }
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}



function show()
{
	if (document.getElementById("blink1")) {
	document.getElementById("blink1").style.visibility = "visible";
	document.getElementById("blink2").style.visibility = "visible";
	} else { return false; }
}

function hide()
{
	if (document.getElementById("blink1")) {
	document.getElementById("blink1").style.visibility = "hidden";
	document.getElementById("blink2").style.visibility = "hidden";
	} else { return false; }
}

for(var i=900; i < 5000; i=i+900)
{
	setTimeout("hide()",i);
	setTimeout("show()",i+450);
}


