function pos()
{Object = document.getElementById("float");
 Object2 = document.getElementById("float2");
 Main   = document.getElementById("main");
 Frm = document.getElementById("frm");
 current = document.documentElement.clientHeight-Object.offsetHeight;
 fixed   = Main.offsetTop + Main.offsetHeight;

 if (current>fixed)
  {Object.style.top=current+'px';
   Object2.style.top=current-117+'px';}
 else
  {Object.style.top=fixed+'px';
   Object2.style.top=fixed-117+'px';}
  Object2.style.left=795+'px';
  Object2.style.visibility='visible';
}

function adjustHeight(frameId) 
{	
	document.getElementById(frameId).height = 0;

	e = document.getElementById(frameId);

	if (e.Document && e.Document.body.scrollHeight) //ie5+ syntax
	e.height = e.contentWindow.document.body.scrollHeight;
	else
		if (e.contentDocument && e.contentDocument.body.scrollHeight) //ns6+ & opera syntax
		e.height = e.contentDocument.body.scrollHeight;
		else (e.contentDocument && e.contentDocument.body.offsetHeight) //standards compliant syntax – ie8
		e.height = e.contentDocument.body.offsetHeight;

	pos();
} 
//-------------------------------------------------------------------------------------

var pics = new Array();
var objCount = 0;

function preload() // предварительная загрузка изображений и размещение их в массиве
 {a=preload.arguments;
 
  for(i=0; i<a.length; i++)
  {pics[objCount] = new Array(3);
   pics[objCount][0] = a[i];
   pics[objCount][1] = new Image();
   pics[objCount][1].src = "img/menu/_"+a[i]+".png";
   pics[objCount][2] = new Image();
   pics[objCount][2].src = "img/menu/" +a[i]+".png";
   objCount++;
  }
}

function swp(name)
{for (i = 0; i < objCount; i++)
  {if (document.images[pics[i][0]] != null)
                // вернуть в исходное состояние остальные изображения
     if (name != pics[i][0]) {document.images[pics[i][0]].src = pics[i][2].src;}
                // заменять на вторую картинку, когда курсор пересекает данное изображение
     else {document.images[pics[i][0]].src = pics[i][1].src;}
  }
}

//-------------------------------------------------------------------------------------

var debrisnumber=50
var debriscolor=new Array()
debriscolor[0]="Darkgreen"
debriscolor[1]="Green"
debriscolor[2]="Orange"
debriscolor[3]="Blue"
debriscolor[4]="Lightblue"
var x_random=new Array()
var y_random=new Array()
var timer;
var max_explsteps=20
var i_explsteps
var i_color=0
var pause=10
var xmax,ymax,X,Y;

function fireworks(x,y)
{xmax=document.documentElement.clientWidth +document.documentElement.scrollLeft;
 ymax=document.documentElement.clientHeight+document.documentElement.scrollTop;
 if ( (x>xmax-5)||(y>ymax-5) ) return;
 i_explsteps=0

 for (i=0;i<=debrisnumber;i++)
   {x_random[i]=Math.ceil(40*Math.random())-20
    y_random[i]=Math.ceil(40*Math.random())-20

    thisspan=document.getElementById('span'+i).style;
    thisspan.visibility="visible"
    thisspan.posLeft=x+document.documentElement.scrollLeft;
    thisspan.posTop =y+document.documentElement.scrollTop;
    if(navigator.userAgent.indexOf("Firefox")!=-1)
     {thisspan.left=thisspan.posLeft+'px';
      thisspan.top =thisspan.posTop+'px';}
   }
  explode();
}

function explode()
{if (i_explsteps<=max_explsteps)
 {for (i=0;i<=debrisnumber;i++)
   {thisspan=document.getElementById('span'+i).style;
    X=thisspan.posLeft+x_random[i];
    Y=thisspan.posTop +y_random[i];
    if((X<0)||(X+2>=xmax)||(Y<0)||(Y+2>=ymax)) thisspan.visibility="hidden";
    if(thisspan.visibility!="hidden")
    {thisspan.posLeft=X;
     thisspan.posTop =Y;
     if(navigator.userAgent.indexOf("Firefox")!=-1)
      {thisspan.left=thisspan.posLeft+'px';
       thisspan.top =thisspan.posTop+'px';}
    }
   }
  i_explsteps++
  timer=setTimeout("explode()",pause)
 }
 else
 {for (i=0;i<=debrisnumber;i++)
   {thisspan=document.getElementById('span'+i).style;
    thisspan.visibility="hidden";
    thisspan.posLeft=0;
    thisspan.posTop =0;
    if(navigator.userAgent.indexOf("Firefox")!=-1)
     {thisspan.left=thisspan.posLeft+'px';
      thisspan.top =thisspan.posTop+'px';}
   }
  clearTimeout(timer);
 }
}


 for (i=0;i<=debrisnumber;i++)
   {document.write("<table cellpadding=0 cellspacing=0 id='span"+i+"' style='position: absolute; visibility: hidden'>")
	document.write("<td bgcolor="+debriscolor[i_color]+">")
	document.write("<img src='img/pixel.gif' height=3 width=3>")
	document.write("</td></table>")
	i_color++
	if (i_color>=debriscolor.length) {i_color=0}
   }
