var rubsWidth=80;var rubsTop=30;var lastIdr;function siteStart(idr,idsr,ida,info){createRubs(idr);moveRubs(idr,idsr,info);getMainContents(idr,idsr,ida);}
function createRubs(idr){for(x=1;x<rubs.length;x++){a=document.createElement('DIV')
a.setAttribute('id','rub'+rubs[x]);a.setAttribute('className','rubs');a.setAttribute('class','rubs');if(idr!=0)a.setStyle('visibility:hidden;');$('main').appendChild(a);$('rub'+rubs[x]).style.height=(getScreen('y')-80)+'px'
$('rub'+rubs[x]).style.width=rubsWidth+'px'
$('rub'+rubs[x]).innerHTML='\n<p class="prubs" id="prub'+x+'"><a id="prub'+x+'_a" href="javascript:void(0);" onclick="shootSrubs('+rubs[x]+',0)">'+rubs_tit[x]+'</a></p>';$('prub'+x+'_a').style.marginTop=Element.getDimensions('prub'+x).height-Element.getDimensions('prub'+x+'_a').height-12+'px';if(idr>0)$('rub'+rubs[x]).style.left=(10+(x*rubsWidth))+'px'}
a=document.createElement('DIV')
a.setAttribute('id','midx')
$('main').appendChild(a);if(idr==0)$('midx').style.display='none';$('midx').style.height=(getScreen('y')-80)+'px';$('midx').style.width=(getScreen('x')-(x*rubsWidth+140))+'px';$('midx').style.top=rubsTop+'px';$('midx').style.left=(rubsWidth*x+10)+'px';}
function moveRubs(idr,idsr,info){if(info!=''||idr!=0)timeShift=0;else timeShift=2;for(x=1;x<rubs.length;x++){if(x==(rubs.length-1)){new Effect.Move('rub'+rubs[x],{x:10+(x*rubsWidth),y:rubsTop,duration:timeShift,mode:'absolute',afterFinish:function(){if(idr==0)Effect.Appear('midx');}});}
else new Effect.Move('rub'+rubs[x],{x:10+(x*rubsWidth),y:rubsTop,duration:timeShift,mode:'absolute'});}
if(idr>0)setTimeout('shootSrubs('+idr+','+idsr+')',timeShift?1500:0);}
function shootSrubs(idr,idsr){if(lastIdr!=idr){if($('sr_'+lastIdr+'_1'))hideRubs(lastIdr);if($('rub'+idr)){activeRub(idr);createSrubs(idr,idsr);moveSrubs(idr);lastIdr=idr;}}}
function createSrubs(idr,idsr){var rubN=document.getElementsByClassName('prubs','rub'+idr)[0].id.substr(4);var a;var Nsrubs=eval('srubs_tit_'+idr+'.length');for(x=1;x<Nsrubs;x++){a=document.createElement('P');a.setAttribute('id','sr_'+idr+'_'+x);if(eval('srubs_idsr_'+idr+'['+x+']')==idsr)enh='enh';else enh='std';a.setAttribute('class','srubs r'+rubN+' '+enh);a.setAttribute('className','srubs r'+rubN+' '+enh);$('rub'+idr).appendChild(a);$('sr_'+idr+'_'+x).style.display='none';$('sr_'+idr+'_'+x).innerHTML='<a href="'+eval('srubs_lnk_'+idr+'['+x+']')+'">'+eval('srubs_tit_'+idr+'['+x+']')+'</a>';}}
function moveSrubs(idr){var Nsrubs=eval('srubs_tit_'+idr+'.length');var stepSr=(getScreen('y')-180)/Nsrubs;for(x=1;x<Nsrubs;x++){timeShift=timeShift?(3*Math.random()):0;new Effect.Move('sr_'+idr+'_'+x,{y:10+(x*stepSr),x:0,duration:timeShift,mode:'absolute'});try{Effect.Appear('sr_'+idr+'_'+x,{duration:timeShift});}
catch(err){alert(err.description);$('sr_'+idr+'_'+x).style.display='';}}}
function hideRubs(myIdr){var Nsrubs=eval('srubs_tit_'+myIdr+'.length')
for(x=1;x<Nsrubs;x++){timeShift=3*Math.random();new Effect.Move('sr_'+myIdr+'_'+x,{y:10,x:0,duration:timeShift,mode:'absolute',afterFinish:function(){try{$('rub'+myIdr).removeChild('sr_'+myIdr+'_'+x);}catch(err){}}});try{Effect.Fade('sr_'+myIdr+'_'+x,{duration:timeShift});}
catch(err){$('sr_'+myIdr+'_'+x).style.display='none';}}}
function getMainContents(idr,idsr,ida){$('midx').innerHTML=$('midm').innerHTML;document.body.removeChild($('midm'));}
function activeRub(idr){myRubs=document.getElementsByClassName('rubs')
for(x=0;x<myRubs.length;x++)myRubs[x].style.backgroundImage='url(supp/rubs.jpg)'
$('rub'+idr).style.backgroundImage='url(supp/rubslight.jpg)'
thisRubX=$('rub'+idr).style.left;$('rub'+idr).style.zIndex=2
for(x=0;x<myRubs.length;x++){if(myRubs[x].id!=('rub'+idr)){new Effect.Move(myRubs[x],{y:rubsTop,x:20+Math.random()*400,duration:timeShift?0.5:0,mode:'absolute'});}}
setTimeout('setRubAsFirst('+idr+')',timeShift?100:0);setTimeout('arrangeRubs('+idr+')',timeShift?550:0);}
function setRubAsFirst(idr){new Effect.Move('rub'+idr,{y:rubsTop,x:10+(myRubs.length*rubsWidth),duration:timeShift?1:0,mode:'absolute'});}
function arrangeRubs(idr){move=1;for(x=0;x<myRubs.length;x++){if((myRubs[x].id!=('rub'+idr))&&($('rub'+idr))){new Effect.Move(myRubs[x],{y:rubsTop,x:10+(move*rubsWidth),duration:timeShift?1:0,mode:'absolute'});move++}
myRubs[x].setStyle('visibility:visible;');}}
function getScreen(what){var x,y;if(self.innerHeight){x=self.innerWidth;y=self.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight){x=document.documentElement.clientWidth;y=document.documentElement.clientHeight;}
else if(document.body){x=document.body.clientWidth;y=document.body.clientHeight;}
if(what=='y')return y;else return x;}
