function new_wnd(links) {
	open(links,"WL","scrollbars=no,width=550,height=250");
}

//cookii lietas
function SetCookie(name, value){
 never = new Date();
 never.setTime(never.getTime() + 2000*24*60*60*1000);
 var expString = "; expires=" + never.toGMTString();
 document.cookie = name + "=" + escape(value) + expString;
}
function SetTmpCookie(name, value){
 document.cookie = name + "=" + escape(value) + "; path=/";
}
function GetCookie(name){
 var result = "";
 var myCookie = " " + document.cookie + ";";
 var searchName = " " + name + "=";
 var startOfCookie = myCookie.indexOf(searchName);
 var endOfCookie;
 if (startOfCookie != -1)
{
  startOfCookie += searchName.length; // izlaizham cookie nosaukumu
  endOfCookie = myCookie.indexOf(";", startOfCookie);
  result = unescape(myCookie.substring(startOfCookie, endOfCookie));
 }
 return result;
}
var flag1 = 0;var flag2 = 0;var onDiv1;var onDiv2;var aaa;var bbb;var layerRef;var styleRef;var showVar;var hideVar;
if (navigator.appName == "Netscape") {layerRef="document.";styleRef="";showVar="'show'";hideVar="'hide'";} else {layerRef="document.all.";styleRef=".style";showVar="'visible'";hideVar="'hidden'";}
function hide(divn){
	var d=document.getElementById(divn);
	if (d!=null)
		d.style.visibility="hidden";
}
function show(divn){
	var d=document.getElementById(divn);
	if (d!=null)
		d.style.visibility="visible";
}
function over_1(divn, pos) {
	margin1 = getWinWidth() - 773;
	if (margin1 < 0)
		margin1 = 0;
	else
		margin1 = margin1 / 2;
	document.getElementById(divn).style.left = pos+margin1+'px';
	if (aaa != null){
		clearTimeout(aaa);
		hide(onDiv1);
	}
	show(divn);
	onDiv1 = divn;
}
function out_1() {aaa = setTimeout("Out1()",500)}
function Out1() {if (flag1 == 0) {hide(onDiv1);}}

function over_2(){if (onDiv2 != null) {hide(onDiv2);}flag1 = 1;flag2 = 1;clearTimeout(aaa);clearTimeout(bbb);if (bbb != null) {clearTimeout(bbb); hide(onDiv2);}}function out_2() {flag1 = 0;aaa = setTimeout("Out1()",500);}

function over_2_drop(divn){if (onDiv2 != null) {hide(onDiv2);}if (bbb != null) {clearTimeout(bbb); hide(onDiv2);}flag1 = 1;flag2 = 1;clearTimeout(aaa);clearTimeout(bbb);show(divn);onDiv2 = divn;}function out_2_drop() {flag1 = 0;flag2 = 0;aaa = setTimeout("Out1()",500);bbb = setTimeout("Out2()",500);}
function Out2() {if (flag2 == 0) {hide(onDiv2);}}
function over_3(){flag1 = 1;flag2 = 1;clearTimeout(aaa);clearTimeout(bbb);}function out_3() {flag1 = 0;flag2 = 0;aaa = setTimeout("Out1()",500);bbb = setTimeout("Out2()",500);}
function hideallmenu(n1,n2,n3,n4){}

function getWinWidth() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
      myHeight = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
    }
  }
  return myWidth;
}
function go_to_anchor(anch_name)
{
	var lnk = document.getElementById(anch_name);
	if (lnk != null){
		// -20 as in firefox it jumed little bit too far. why?
		window.scrollTo(0, parseInt(YAHOO.util.Dom.getY(lnk)) - 10);
	}
}
function format_pk(ed){
	var l = ed.value.length;
	if (l == 6)
		ed.value += '-';
	else if (l > 6 && ed.value.charAt(6) != '-'){
		var ind = ed.value.indexOf('-');
		ed.value = ed.value.substring(0, ind) + ed.value.substring(ind + 1);
		var beg = ed.value.substring(0, 6);
		var en = ed.value.substring(6);
		ed.value = beg + '-' + en;
	}
}
function showIntroJs(pUrl, every_time){
	var coc_name = 'stop_intro';
	if (every_time)
		coc_name = 'stop_intro_ses';
	var popWidth = 550;
	var popHeight = 400;
	var popTopPosition = (window.screen.height-popHeight)/2;
	var popLeftPosition = (window.screen.width-popWidth)/2;
	sw = GetCookie(coc_name);
	if (sw == ''){
		window.open(pUrl,'popwin','toolbar=no,width='+popWidth+',height='+popHeight+',top='+popTopPosition+',left='+popLeftPosition);
		if (every_time){
			SetTmpCookie(coc_name,'yes');
			SetCookie('stop_intro','');
		}else{
			SetCookie(coc_name,'yes');
		}
	}
}

