/*
lib.js for Panoramahaus Dorabira

Author:			  manfred.schneiderbauer@world-direct.at
Version:      1.03
Last Changed:	2006-07-18
*/

// write subsub menu start tag in left navigation
function writeSubSubMenuStartTag(){
  document.write('<div class=dv_leftsubsubmenuitem id=ssm_'+window.ssmCount+'>');
}
// ...and also close the DIV (XHTML validity)
function writeEndDiv(){
document.write('</div>');
}

// replace sub menu separator in left navigation
function replaceSubMenuSeparator(){
d('ssm_'+window.ssmCount).previousSibling.previousSibling.innerHTML='';
d('ssm_'+window.ssmCount).nextSibling.innerHTML='<div class="dv_sep"><img class="im_dottedsep" src="fileadmin/dev/img/dottedsep.gif"/></div>'; // put the dotted separator into the subsub nav items container
d('ssm_'+window.ssmCount).previousSibling.previousSibling.style.display='none'; // make the gap verschwind
}

// ensure equal window width on Opera, otherwise body bgimage and content bg will not match
function oprResizeEqual(){
if(document.body)
  {
  if(String(window.innerWidth/2).indexOf('.')!=-1) // if width has unequal value...
    {document.body.style.marginLeft='1px'; // add a margin
    }else{document.body.style.marginLeft='0px';} // else remove the margin
  window.setTimeout("oprResizeEqual();",250);
  } else {window.setTimeout("oprResizeEqual();",250);
  }
}
if(isOpr){oprResizeEqual();}

// ensure content to stretch to menu height on Opr
function oprStretchContent(){
 if(d('tdContent'))
  {
  var c=d('tdContent'); var l=d('tdLeftMenu');
  if(Number(c.offsetHeight)<Number(l.offsetHeight)) // if menu height > content height...
    {c.style.height=d('tdLeftMenu').offsetHeight+'px'; // make content height == menu height}
    }else{window.setTimeout("oprStretchContent();",250);}
  }
}
if(isOpr){oprStretchContent();}

// append padding-left to photo images
function padPhotos(){
if(document.body){if(document.body.innerHTML){

  var imgColl=d('tdContent').getElementsByTagName('img');
  for(var i=0;i<imgColl.length;i++)
    {
      if(imgColl[i].src.indexOf('typo3temp/pics')!=-1)
        {
         imgColl[i].style.marginLeft='14px';
         imgColl[i].parentNode.style.borderBottom='none';
        }
    }
}else{window.setTimeout("padPhotos();",250);}}else{window.setTimeout("padPhotos();",250);}
}
padPhotos();

// Color the first row of the price table white, since the buggy RTE would always return it to grey
function colorPreistableFirstRow(){
  if(d('tbPreise'))
    {
     var theSpans=d('tbPreise').getElementsByTagName('tr')[0].getElementsByTagName('span');
     for(var i=0;i<theSpans.length;i++)
      {
       theSpans[i].style.color='white';
      }
    }
}
clib_onload("colorPreistableFirstRow()");