
function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
        setTimeout("OpacityReadyClose(" + id + ")",(timer * speed)); 
	
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
	//alert(id)
     	setTimeout("OpacityReady(" + id + ")",(timer * speed)); 

    } 


} 



function shiftOpacity(id, millisec,sTot) { 
    //if an element is invisible, make it visible, else make it ivisible 
    if(document.getElementById(id).style.opacity == 0) { 
        opacity(id, 0, sTot, millisec); 
    } else { 
        opacity(id, sTot, 0, millisec); 
    } 
} 

function opacity(id, opacStart, opacEnd, millisec) { 
		    //speed for each frame 
		    var speed = Math.round(millisec / 100); 
		    var timer = 0; 

		    //determine the direction for the blending, if start and end are the same nothing happens 
		    if(opacStart > opacEnd) { 
		        for(i = opacStart; i >= opacEnd; i--) { 
		            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
		            timer++; 
		        } 
		        setTimeout("OpacityReadyClose(" + id + ")",(timer * speed)); 
			
		    } else if(opacStart < opacEnd) { 
		        for(i = opacStart; i <= opacEnd; i++) 
		            { 
		            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
		            timer++; 
		        } 
		        
		        setTimeout("OpacityReady(" + id+ ")",(timer * speed)); 

		    } 


		} 
//change the opacity for different browsers 
	
function changeOpac(opacity, id) { 
		//alert(id)
			if (opacity!=100)
			{
		  	  var object = document.getElementById(id).style; 
		  	  object.opacity = (opacity / 100); 
		  	  object.MozOpacity = (opacity / 100); 
		  	  object.KhtmlOpacity = (opacity / 100); 
		  	  object.filter = "alpha(opacity=" + opacity + ")"; 
			}
			else
			{
			//	alert("klaar")
				//OpacityReady();
			}
		} 


function getposOffset(what, offsettype)
		{
			var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
			var parentEl=what.offsetParent;
			while (parentEl!=null)
			{
				totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
				parentEl=parentEl.offsetParent;
			}
			return totaloffset;
		}		
		