var maxTop;
var pictTop;
var scrollID;

if (window.addEventListener) // for fire fox add event for scroll
{
    window.addEventListener("DOMMouseScroll", window_onscroll, true); 
}

function window_onscroll()
{
   maxTop = 1500;
   pictTop = 140;
//alert ("maxTop:"+maxTop + "pictTop:"+ pictTop + "div:"+document.getElementById(scrollID).style.top)
    if (navigator.appName=="Netscape")
    {
       if(document.getElementById(scrollID))
        {
                var newTop=document.body.scrollTop+50;
                if (newTop>pictTop)
                {
                        if (newTop>maxTop) 
                        {
                                newTop=maxTop;
                        }
                        document.getElementById(scrollID).style.top=newTop;
                        document.getElementById(scrollID).style.position="absolute"
                }
                else
                {
                        window.document.getElementById(scrollID).style.top=pictTop;
                }
        } 
    }
    else
    {
        if(document.all && document.getElementById) //added for IE4
        {
            if(document.getElementById(scrollID))
                    {
                            var newTop=document.body.scrollTop+20;
                            if (newTop>pictTop)
                            {
                                    if (newTop>maxTop) 
                                    {
                                            newTop=maxTop;
                                    }
                                    //document.getElementById("download").alt=newTop;
                                    document.getElementById(scrollID).style.top=newTop;
                            }
                            else
                            {
                                    window.document.getElementById(scrollID).style.top=pictTop;
                            }
                    }
        }
        else if(document.all && !document.getElementById) //added for IE4
        {
            if(document.all[scrollID])
                document.all[scrollID].style.top=document.body.scrollTop+pictTop;
        }
    }
}
function SetScrollingDownload(scrollElement)
{
  if (navigator.appName=="Netscape")
        {
               
               scrollID=  scrollElement;
        }
	if(document.all)
	{
		scrollID=  scrollElement;
	
		var frameWidth;
		var frameHeight;
	
		if(document.all[scrollID])
		{
			if(document.getElementById)
			{
				document.all[scrollID].style.position="absolute";
			}
			
			window_onscroll();
		}
	}
    
}

function getPosY(obj)
{
    var curtop = 0;
    while (obj.offsetParent)
    {
      curtop += obj.offsetTop;
      obj = obj.offsetParent;
    }

    return curtop;
}

function openTerms(id)
{
 
    var terms=document.getElementById("tcText" + id); 
    terms.style.display="inline"; 
    var termsLabel=document.getElementById("tcLabel" + id); 
    termsLabel.style.display="none"; 
    var bonusTable=document.getElementById("bonus" + id); 
    bonusTable.style.height = "331";
    bonusTable.className="termsBg";
}

function closeTerms(id)
{
     var terms=document.getElementById("tcText" + id); 
    terms.style.display="none"; 
    var termsLabel=document.getElementById("tcLabel" + id); 
    termsLabel.style.display="inline"; 
    termsLabel.className="termsConditionsTitle";
    var bonusTable=document.getElementById("bonus" + id); 
    bonusTable.style.height = "172";
    bonusTable.className="bonusBg";
}