/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
/**
* Edited by martin@nestdesign.com
* In begining it will duplicate all content of marqueed object and then it is moving that object.
*/
var delayb4scroll=1000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?
var marqueescroll=60 //Delay to next scroll (in ms 10 - 100)

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=0

function scrollmarquee(){
  objTop=parseInt(cross_marquee.style.top);
  if (objTop>(2*actualheight*(-1)+8)) {//(parseInt(cross_marquee.style.height)*(-1)+8)
    cross_marquee.style.top=objTop-copyspeed+"px"
  } else {
    cross_marquee.style.top=parseInt((actualheight*(-1)+8))+'px'
  }
}
var i = 0;

/**
  find object, which is some of child names as objTagName
*/
function getValidChild(parentObj, objTagName){
  parentObj = parentObj.firstChild
  i ++;
  if (i > 20)return ;
  while (parentObj){
    if (parentObj.tagName){
      if (parentObj.tagName == objTagName.toUpperCase()){
        return parentObj;
      } else {
        obj = getValidChild(parentObj, objTagName);
        if (typeof(obj) == "object")
          return obj;
      }
    }
    parentObj = parentObj.nextSibling;
  }
}

function initializemarquee(){
  cross_marquee=document.getElementById("vmarquee") // P
  if(!cross_marquee)
    return
  actualheight=parseInt(getValidChild(cross_marquee, "div").offsetHeight) // gets all images height
  /*    MICHAL CHANGES    */
/*
  if(getValidChild(cross_marquee, "div")){
    cross_marquee.parentNode.style.height = parseInt(getValidChild(cross_marquee, "div").offsetHeight)+"px" // sets displayed height
  }
*/
  /*    MICHAL CHANGES END    */
  cross_marquee.innerHTML = cross_marquee.innerHTML+cross_marquee.innerHTML+cross_marquee.innerHTML; // copy content
  cross_marquee.style.height = parseInt(getValidChild(cross_marquee, "div").offsetHeight)*3+"px"; // sets marqueed object height
  cross_marquee.style.top = 0
  marqueeheight=parseInt(document.getElementById("marqueecontainer").offsetHeight) // gets displayed height
  if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
    cross_marquee.style.height=marqueeheight+"px"
    cross_marquee.style.overflow="scroll"
    return
  }
  setTimeout('lefttime=setInterval("scrollmarquee()",marqueescroll)', delayb4scroll)
}

if (window.addEventListener)
  window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
  window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
  window.onload=initializemarquee
