		window.onload = function() {
			setFooter();
			preloadImages();
		}
		window.onresize = function() {
			setFooter();
		}
		
		var agt = navigator.userAgent.toLowerCase(); // get browser type
var elName = ((agt.indexOf("gecko") != -1) || (agt.indexOf("opera") != -1) || (agt.indexOf("mac") != -1)) ? 'target' : 'srcElement'; // get type of browser, well it's the same as IE/non-IE

		function gallery(e){
		var obj=eval('e.'+elName); // get click source object
//		window.status='['+obj.tagName+']';
//		while (obj.tagName != 'IMG') obj = obj.parentElement;
		
		if(obj.tagName!='IMG') return false; // h2 (Question) is only object for processing (as click source obj)			
		
			var newSrc=obj.src.replace(/t\_/gi,'');
			
			var nWin=window.open('/gallery.php?img='+newSrc+'&txt='+obj.alt,'Gallery','width=450, height=450,resizable=0,scrollbars=no');

		}
		
		function langover(lang){
			document.getElementById(lang).src='/images/spacer.gif';
			//document.getElementById(lang).attributes['src'].value='/images/spacer.gif';
		}
		
		function langout(lang){
			document.getElementById(lang).src='/images/l_'+lang+'_p.gif';
		}
		
		var Star=false;
		
		function getStars(srcObj){
			Star=true;
			var starsObj=document.getElementById('stars');
			var leftPosition=DL_GetElementLeft(srcObj)+(srcObj.offsetWidth/2)-46+'px';
			starsObj.style.left=leftPosition;
			starsObj.style.display='block';
		}
		
		function hideStars(){
			Star=false;
			setTimeout('rHideStars()',1000)
		}
		
		function rHideStars(){
			if(!Star)
			document.getElementById('stars').style.display='none';	
		}


		function getWindowHeight() {
			var windowHeight = 0;
			if (typeof(window.innerHeight) == 'number') {
				windowHeight = window.innerHeight;
			}
			else {
				if (document.documentElement && document.documentElement.clientHeight) {
					windowHeight = document.documentElement.clientHeight;
				}
				else {
					if (document.body && document.body.clientHeight) {
						windowHeight = document.body.clientHeight;
					}
				}
			}
			return windowHeight;
		}
		
		function setFooter() {
			if (document.getElementById) {
				if(document.body.className=='gal') return false;
				var windowHeight = getWindowHeight();
				if (windowHeight > 0) {
					var mainHeight0 = (document.getElementById('main').offsetHeight);
					var absHeight1 = (document.getElementById('anounces'))?document.getElementById('anounces').offsetHeight:0;		
					var absHeight2 = (document.getElementById('header'))?document.getElementById('header').offsetHeight:0;
					var articleElement = (document.getElementById('article') || false);					
					if((absHeight1+absHeight2)>mainHeight0){
						mainHeight=absHeight1+absHeight2+25;
						var useAbs=true;
					}else{
						mainHeight=mainHeight0;
						var useAbs=false;						
					}
					var footerElement = document.getElementById('footer');
					var subFooterElement = (document.getElementById('subfooter') || false);
					var buildsElement = (document.getElementById('builds') || false);
					var footerHeight  = footerElement.offsetHeight;
					if ((windowHeight - (mainHeight + footerHeight) >= 0 || useAbs)) {
						windowHeight=(useAbs)?mainHeight:windowHeight;
						footerElement.style.position = 'absolute';
						footerElement.style.top = (windowHeight - footerHeight) + 'px';
						if(subFooterElement){
							subFooterElement.style.position = 'absolute';
							subFooterElement.style.top = (windowHeight - footerHeight-43) + 'px';
						}
						if(buildsElement){
							buildsElement.style.position = 'absolute';
							buildsElement.style.top = (windowHeight - footerHeight - 275) + 'px';
							buildsElement.style.zIndex=0;
						}
						if(articleElement){
							articleElement.style.height=(windowHeight - footerHeight - 209) + 'px';
						}							
					}
					else {
						footerElement.style.position = 'static';
						if(subFooterElement){
							subFooterElement.style.position = 'static';
						}
						if(buildsElement){
							buildsElement.style.position = 'static';
						}
					}
				}
				footerElement.style.visibility='visible';
			}
		}
		
function DL_GetElementLeft(eElement)
{
   if (!eElement && this)                    // if argument is invalid
   {                                         // (not specified, is null or is 0)
      eElement = this;                       // and function is a method
   }                                         // identify the element as the method owner

   var DL_bIE = document.all ? true : false; // initialize var to identify IE

   var nLeftPos = eElement.offsetLeft;       // initialize var to store calculations
   var eParElement = eElement.offsetParent;  // identify first offset parent element

   while (eParElement != null)
   {                                         // move up through element hierarchy
      if(DL_bIE)                             // if browser is IE, then...
      {
         if(eParElement.tagName == "TD")     // if parent a table cell, then...
         {
            nLeftPos += eParElement.clientLeft; // append cell border width to calcs
         }
      }
      else                                   // if browser is Gecko, then...
      {
         if(eParElement.tagName == "TABLE")  // if parent is a table, then...
         {                                   // get its border as a number
            var nParBorder = parseInt(eParElement.border);
            if(isNaN(nParBorder))            // if no valid border attribute, then...
            {                                // check the table's frame attribute
               var nParFrame = eParElement.getAttribute('frame');
               if(nParFrame != null)         // if frame has ANY value, then...
               {
                  nLeftPos += 1;             // append one pixel to counter
               }
            }
            else if(nParBorder > 0)          // if a border width is specified, then...
            {
               nLeftPos += nParBorder;       // append the border width to counter
            }
         }
      }

      nLeftPos += eParElement.offsetLeft;    // append left offset of parent
      eParElement = eParElement.offsetParent; // and move up the element hierarchy
   }                                         // until no more offset parents exist
   return nLeftPos;                          // return the number calculated
}

function DL_GetElementTop(eElement)
{
   if (!eElement && this)                    // if argument is invalid
   {                                         // (not specified, is null or is 0)
      eElement = this;                       // and function is a method
   }                                         // identify the element as the method owner
   var DL_bIE = document.all ? true : false; // initialize var to identify IE

   var nTopPos = eElement.offsetTop;         // initialize var to store calculations
   var eParElement = eElement.offsetParent;  // identify first offset parent element

   while (eParElement != null)
   {                                         // move up through element hierarchy
      if(DL_bIE)                             // if browser is IE, then...
      {
         if(eParElement.tagName == "TD")     // if parent a table cell, then...
         {
            nTopPos += eParElement.clientTop; // append cell border width to calcs
         }
      }
      else                                   // if browser is Gecko, then...
      {
         if(eParElement.tagName == "TABLE")  // if parent is a table, then...
         {                                   // get its border as a number
            var nParBorder = parseInt(eParElement.border);
            if(isNaN(nParBorder))            // if no valid border attribute, then...
            {                                // check the table's frame attribute
               var nParFrame = eParElement.getAttribute('frame');
               if(nParFrame != null)         // if frame has ANY value, then...
               {
                  nTopPos += 1;              // append one pixel to counter
               }
            }
            else if(nParBorder > 0)          // if a border width is specified, then...
            {
               nTopPos += nParBorder;        // append the border width to counter
            }
         }
      }

      nTopPos += eParElement.offsetTop;      // append top offset of parent
      eParElement = eParElement.offsetParent; // and move up the element hierarchy
   }                                         // until no more offset parents exist
   return nTopPos;                           // return the number calculated
}
		
		
/*  macromedia's rollovers  */

function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadimages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadimages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}

}

function findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function preloadImages() {
	preloadimages("/images/spacer.gif","/images/l_rus_p.gif","/images/l_eng_p.gif","/images/l_lit_p.gif");				
	preloadFlag = true;
}		