var h = null;
var image = null;
var index  = null;

/*
onload = function() {
	h = document.getElementsByTagName('html')[0];
	image = document.getElementById("bg"); 
	
	// adjust on first time load
	if (image != null) { 
		index = h.clientWidth / 2 - 913;
		if (index > 0)
			index = 0;
		if (index < -360)
			index = -360;
		image.style.left = index + 'px'; 
		image.style.display = 'block';
		image.style.visibility = 'visible';
		//opacity('bg',0,100,400);
	} 


}
*/

function initBg() {
	h = document.getElementsByTagName('html')[0];
	image = document.getElementById("bg"); 
	
	// adjust on first time load
	if (image != null) { 
		index = h.clientWidth / 2 - 913;
		if (index > 0)
			index = 0;
		if (index < -360)
			index = -360;
		image.style.left = index + 'px'; 
		image.style.display = 'block';
		image.style.visibility = 'visible';
		//opacity('bg',0,100,400);
	} 


}



onresize = function() {
	if (image != null) { 
		index = h.clientWidth / 2 - 913;
		if (index > 0)
			index = 0;
		if (index < -360)
			index = -360;
		image.style.left = index + 'px'; 
	} 
};


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++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 




function showScroller() {
   var object = document.getElementById("scroller").style; 
   object.display = 'block';
   object.visibility = 'visible';
   var spacer = document.getElementById("scrollerspacer").style; 
   spacer.display = 'none';
   spacer.visibility = 'hidden';

}

