function preloadImages()
{
  if(document.images)
  {
    if(!document.imageArray) document.imageArray = new Array();
    var i,j = document.imageArray.length, args = preloadImages.arguments;

    for(i=0; i<args.length; i++)
    {
      if (args[i].indexOf("#")!=0)
      {
        document.imageArray[j] = new Image;
        document.imageArray[j++].src = args[i];
      }
    }
  }
}

function replace_char(s,c,n)
{
	var re = new RegExp('^(.{'+ n +'}).(.*)$','');
	return s.replace(re,'$1'+c+'$2');
}

function mi_act(obj) 
{
	obj.src = replace_char(obj.src,'a',obj.src.lastIndexOf("/")+1) ;
}

function li_act(id) 
{
	var obj = document.getElementById(id);
	obj.src = replace_char(obj.src,'a',obj.src.lastIndexOf("/")+1) ;
}

function mi_deact(obj) 
{
	obj.src = replace_char(obj.src,'r',obj.src.lastIndexOf("/")+1) ;
}

function li_deact(id) 
{
	var obj = document.getElementById(id);
	obj.src = replace_char(obj.src,'r',obj.src.lastIndexOf("/")+1) ;
}

function procopt(obj)
{
	if (obj.value)
	{
		location.href = "f_arch.php?af="+obj.value+"&type="+obj.name;
	}	
}

function starter ()
{
  preloadImages('img/menu/r_mdiv.gif', 'img/menu/r1_archion.gif', 'img/menu/a1_archion.gif', 'img/menu/r2_mida.gif', 'img/menu/a2_mida.gif', 'img/menu/r3_iruim.gif', 'img/menu/a3_iruim.gif', 'img/menu/r4_mofaim.gif', 'img/menu/a4_mofaim.gif', 'img/menu/r5_luah.gif', 'img/menu/a5_luah.gif', 'img/menu/r6_odot.gif', 'img/menu/a6_odot.gif', 'img/menu/r7_thnx.gif', 'img/menu/a7_thnx.gif', 'img/menu/r8_grtz.gif', 'img/menu/a8_grtz.gif', 'img/a_arrleft.gif', 'img/r_arrleft.gif', 'img/a_arrght.gif', 'img/r_arrght.gif');
}

function popup(URL, w, h) 
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+"');");
}

function gi_showfull(tumb, target) 
{
	var fslot = document.getElementById(target);
	
	for (var i=0; i<fslot.childNodes.length; i++)
	{
		if (fslot.childNodes[i].nodeName == "IMG")
		{
			fslot.childNodes[i].src = replace_char(tumb.src,'f',tumb.src.lastIndexOf("/")+1) ;
		}
	}
}