// http://www.java2s.com/Code/JavaScriptReference/Javascript-Properties/CatalogJavascript-Properties.htm
//http://quentinc.net/ref/js/htmlelement

function xoopsGetElementById(id){
	if (document.getElementById) {
		return (document.getElementById(id));
	} else if (document.all) {
		return (document.all[id]);
	} else {
		if ((navigator.appname.indexOf("Netscape") != -1) && parseInt(navigator.appversion == 4)) {
			return (document.layers[id]);
		}
		//?
		return (document.layers[id]);
	}
}

var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4);

var Div_IMG = document.getElementById("ID_Animation").style;

var coord;
var coord_x = 0;
var coord_y = 0;
var delta   = 1;

var offsetx;

if ( isNS ) {
	tailley = window.innerHeight;
	taillex = window.innerWidth;
	offsety = window.pageYOffset;
	offsetx = window.pageXOffset;
} else{
//navigator.appName == "Microsoft Internet Explorer")
	tailley = document.body.clientHeight;
	taillex = document.body.clientWidth;
	offsety = document.body.scrollTop;
	offsetx = document.body.scrollLeft;
}
//alert(taillex);
if ( taillex > 820 ) {
	coord_x = (taillex-820) / 2;
} else {
	coord_x = 0;
}

var maxi;

if ( isNS ) {
	maxi =  -38 + document.getElementById("Div_Bottom").offsetTop;
	maxi =  maxi + document.getElementById("Div_Bottom").offsetHeight;
	maxi =  maxi - document.getElementById("ID_Animation").offsetHeight;
} else {
	maxi =  -30 + document.getElementById("Div_Bottom").offsetTop;
	maxi =  maxi + document.getElementById("Div_Bottom").offsetHeight;
	maxi =  maxi - document.getElementById("ID_Animation").offsetHeight;
}

coord_y = maxi;

var stop = 0;

var Vlr_Opa = 10; // @TL@HF28 was 0

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  alert( 'Width = ' + myWidth );
  alert( 'Height = ' + myHeight );
}

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.visibility = "visible";
	object.opacity = (opacity / 100); 
	object.MozOpacity = (opacity / 100); 
	object.KhtmlOpacity = (opacity / 100); 
	object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function Rebond_CallBack() {

	document.body.onresize = function (){
		if ( isNS ) {
			taillex = window.innerWidth;
		} else {
			taillex = document.body.clientWidth;
		}
		if ( taillex > 820 ) {
			Div_IMG.pixelLeft = (taillex-820) / 2;
		} else {
			Div_IMG.pixelLeft = 0;
		}
	}

	Vlr_Opa = Vlr_Opa + 1;
	if ( Vlr_Opa > 100 ) {
	} else {
		changeOpac( Vlr_Opa, "ID_Animation");
		tempo = setTimeout("Rebond_CallBack()", 40); // @TL@HF28 was 60
	}
	
	Div_IMG.pixelLeft = coord_x;
	Div_IMG.pixelTop  = coord_y;

	Div_IMG.left = Div_IMG.pixelLeft + "px";
	Div_IMG.top  = Div_IMG.pixelTop  + "px";
}

var Previous_Onload = (window.onload) ? window.onload : function(){};

window.onload = function() { 
	Previous_Onload();
	Rebond_CallBack();
}

