var rubsWidth=80;var rubsTop=30;var lastIdr;function marcoStart(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');$('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!=''||idsr>0){timeSrb=0;for(x=1;x<rubs.length;x++){$('rub'+rubs[x]).style.position='absolute';$('rub'+rubs[x]).style.top=rubsTop+'px';}}
else{timeSrb=1500;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:2,mode:'absolute',afterFinish:function(){if(idr==0)Effect.Appear('midx');}});else new Effect.Move('rub'+rubs[x],{x:10+(x*rubsWidth),y:rubsTop,duration:2,mode:'absolute'});}}
if(idr>0)setTimeout('shootSrubs('+idr+','+idsr+')',timeSrb);else if(info!='')activeRub(idr,idsr,info);}
function shootSrubs(idr,idsr){if(lastIdr!=idr){if(lastIdr)hideRubs(lastIdr);activeRub(idr,idsr,'');createSrubs(idr,idsr);moveSrubs(idr,idsr);if(idsr==0)$('midx').innerHTML=$('rTmp'+idr).innerHTML;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,idsr){var Nsrubs=eval('srubs_tit_'+idr+'.length');var stepSr=(getScreen('y')-180)/Nsrubs;for(x=1;x<Nsrubs;x++){if(idsr>0)timeShift=0;else timeShift=(3*Math.random());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').insert($('midm'));$('midm').setStyle('display:block;');}
function activeRub(idr,idsr,info){myRubs=document.getElementsByClassName('rubs')
for(x=0;x<myRubs.length;x++)myRubs[x].style.background='#333';if(idr!=0){$('rub'+idr).style.background='#333';$('rub'+idr).style.zIndex=2;if(idsr==0){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:0.5,mode:'absolute'});}}
setTimeout('setRubAsFirst('+idr+')',100);setTimeout('arrangeRubs('+idr+')',550);}
else{$('rub'+idr).style.left=10+(myRubs.length*rubsWidth)+'px';move=1;for(x=0;x<myRubs.length;x++){if((myRubs[x].id!=('rub'+idr))&&($('rub'+idr))){$(myRubs[x]).style.left=10+(move*rubsWidth)+'px';move++}}}}
else{move=1;for(x=0;x<myRubs.length;x++){$(myRubs[x]).style.left=10+(move*rubsWidth)+'px';move++}
$('midx').style.display='';}}
function setRubAsFirst(idr){new Effect.Move('rub'+idr,{y:rubsTop,x:10+(myRubs.length*rubsWidth),duration:1,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:1,mode:'absolute'});move++}}}
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;}
