if (document.layers && navigator.appVersion.indexOf('4.04') == -1) onresize = function () { history.go(0) }
var siteurl="./";

var restoreimgsrc="";

function MMon(p){
restoreimgsrc = document.images[p].src;
document.images[p].src=restoreimgsrc.substring(0,restoreimgsrc.length-4)+"_on.gif";
}
function MMof(p){
 document.images[p].src=restoreimgsrc;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

imageArray = new Array();
current = "";
function load_img(name_src)
{
if(document.images) {
var temp = imageArray[name_src];
if(! temp) {
temp = new Image();
temp.src = name_src;
imageArray[name_src] = temp;
}

return temp;
}
}
function replace_img(name, name_src)
{
if(document.images) {
if(name != current) {
document[name].src = load_img(name_src).src;
}
}
}
load_img("image/home_on.gif");
load_img("image/contactus_on.gif");
load_img("image/sitemap_on.gif");
load_img("image/atlase2_on.gif");
load_img("image/kompetence2_on.gif");
load_img("image/atalgojums2_on.gif");
load_img("image/organizacija2_on.gif");

function Pagelocation(page) {
 if (page.indexOf("/")>=0 ) document.location = page;
}

function imgchange(chimg){
  var imgobj = document.images[chimg];
  imgpath = imgobj.src;
  imgpath_base = imgpath.substring(0,imgpath.length-6);

  switch (imgobj.width){
     case 231:   // normal=>lager
       imgobj.width  = 456;
       imgobj.height = 306;
       imgobj.src=imgpath_base + '_1.jpg';
       break;
     case 456:
       imgobj.width  = 231;
       imgobj.height = 156;
       imgobj.src=imgpath_base + '_2.jpg';
       break;
     case 156:  //vertcal=>v.large
       imgobj.width  = 306;
       imgobj.height = 456;
       imgobj.src=imgpath_base + '_1.jpg';
       break;
     case 306:  //vertcal=>v.large
       imgobj.width  = 156;
       imgobj.height = 231;
       imgobj.src=imgpath_base + '_2.jpg';
       break;
  }

}

function galeryimgshow(chimg){
  var imgobj = document.images[chimg];
  imgpath = imgobj.src;
  imgpath_base = imgpath.substring(0,imgpath.length-5);
  //imgwidth  = imgobj.width;
  bgimg.src=imgpath_base + '1.jpg';
}