function adsPreloadClearDiv(e){
   //if (e.getElementsByTagName('script')) {t=e.getElementsByTagName('script'); t[0].parentNode.removeChild(t[0]);}
   //if (e.getElementsByTagName('script')) {t=e.getElementsByTagName('script'); t[0].parentNode.removeChild(t[0]);}      
}
function adsPreloadClear(){
   var e=document.getElementById('preloadAds');
   var t=e.getElementsByTagName('div');
   for(i=0;i<t.length;i++){
      var s=t[i].id;
      s=s.substring(0,10);
      if (s=='preloadAds')
         adsPreloadClearDiv(t[i]);
   }
}
function adsGetFlashVars(id){
   var o=document.getElementById(id);
   var t=o.getElementsByTagName('param');
   for(var i=0;i<t.length;i++){
      if (t[i].name.toLowerCase()=='flashvars')
         return t[i].value;
   }
   return '';
}
function adsPutContent(s,id1){
   var id2=id1.replace('preloadAds','ads');   
   if ((document.getElementById(id2))&&(s.length>3)){
      var a=adsGetFlashVars(id1);
      s=s.replace('<PARAM NAME="FlashVars" VALUE="">','<PARAM name="FlashVars" value="'+a+'">');   
      document.getElementById(id2).innerHTML=s;
   }
}
function adsPut(){
   var e=document.getElementById('preloadAds');
   var t=e.getElementsByTagName('div');
   for(i=0;i<t.length;i++){
      var id1=t[i].id;      
      var e1=document.getElementById(id1);
      if (e1)             
      adsPutContent(e1.innerHTML,id1);
   }
}
var adsLoaded=false;
function adsInit(){
   if (adsLoaded)
      return;
   adsLoaded=true;
   adsPreloadClear();
   adsPut();
}

function homeSliderRun(){  
  var e=document.getElementById('homeSlider');
  var t=e.getElementsByTagName('span');
  var active=0;
  for(var i=0;i<t.length;i++)
    if (t[i].className=='selected'){ active=i; t[i].className=''}   
  (active>=t.length-1) ? active=0 : active++;
  e=t[active];
  e.className='selected';
  var img=e.title;
  var lnk=e.parentNode.href      
  var dsc=e.parentNode.title;
  var s='<a href="'+lnk+'"><img src="'+img+'" alt="" class="ui-tabs-panel"></a><div class="info"><a href="'+lnk+'">'+dsc+' ...</a></div>';
  document.getElementById('homeSliderPanel').innerHTML=s; 
}
      
function showNav(element) {
	element.getElementsByTagName('UL')[0].style.left='auto';
	element.getElementsByTagName('A')[0].className='wpabar-menupop wpabar-menuhover';
}
function hideNav(element) {
	element.getElementsByTagName('UL')[0].style.left='-999em';
	element.getElementsByTagName('A')[0].className='wpabar-menupop';
}

var movesIds=[];
function movesInit(){
  var o=ayId('moves-rel');
  o.style.height=o.clientHeight+'px';
  ayIdStyleSet('moves','position:absolute');
  var all=ayIdNodesClass('moves','div','postbox');
  for(var i=0;i<all.length;i++){
    movesIds[i]=all[i].id;
    all[i].style.position='absolute';    
  }
  movesByNrs(ayCookieGet('catOrder'));
}
function movesByNrs(ids){
  ids=(ids+','+movesIds.join(',')).split(',');
  var nr=0;
  var top=0;    
  var displayed=[];
  movesIds=new Array();
  for(var i=0;i<ids.length;i++){
    id=ids[i];
    if ((id)&&(ayId(id))&&(!(displayed[id]))){ 
      var ob=ayId(id);
      ob.style.display='';
      ob.style.top=top+'px';
      top=top+ob.clientHeight;
      displayed[id]=1;
      ayIdDisplaySet(id+'up',nr>0);
      movesIds[nr++]=id;   
    }
  }
  ayCookieSet('catOrder',movesIds.join(','),0,'/');
}
function movesUp(id){
  var pos=ayIndexOf(movesIds,id);
  if ((!pos)||(pos<1))
    return;
  var e=ayId(movesIds[pos-1]);
  var h=ayObjStyleI(e,'top');    
  movesIds.splice(pos-1,0,id); 
  ayAnimY(id,h,movesUpFin);
}
function movesUpFin(){
  movesByNrs('');
}
	

