/*
   __________        __ 
  / __/ _/ _/__ ____/ /_
 / _// _/ _/ -_) __/ __/
/___/_//_/ \__/\__/\__/ */


var effectZahl;
var durchgang = 0;
var firstClick = 1;

function effect() {
	var effect = document.getElementById("container");
	var effectButton = document.getElementById("top");
	if (firstClick == 1) {

		firstClick = 0;

		if (typeof(window.innerHeight)=='number') {
			myHeight = window.innerHeight;
		} else if (document.documentElement && (document.documentElement.clientHeight)) {
			myHeight = document.documentElement.clientHeight;
		} else if (document.body && (document.body.clientHeight)) {
			myHeight = document.body.clientHeight;
		}

		effectButton.style.top = 0;
		effectButton.style.marginTop = Math.round(myHeight/2)-100 + "px";
	}
	
	if (parseInt(effectButton.style.marginTop) > 17) {
		effectButton.style.marginTop = parseInt(effectButton.style.marginTop) - 10 + "px";
		setTimeout("effect()",15);
	} else {
		if (durchgang == 0) {
			effect.style.display = "block";
			effectZahl = Math.round(effect.clientHeight/2);
		}
		if (effectZahl > -20) {
			effect.style.clip = "rect(" + effectZahl + "px auto " + (effect.clientHeight-effectZahl) + "px auto)";
			effectZahl -= 20;
			setTimeout("effect()",15);
		}
		durchgang++;
	}
}


/*_____            _          _              _       
 / ____|          (_)        | |            | |      
| (___  _ __   ___ _ ___  ___| | ____ _ _ __| |_ ___ 
 \___ \| '_ \ / _ \ / __|/ _ \ |/ / _` | '__| __/ _ \
 ____) | |_) |  __/ \__ \  __/   < (_| | |  | ||  __/
|_____/| .__/ \___|_|___/\___|_|\_\__,_|_|   \__\___|
       | |                                           
       |_|
       
var table;
var test;
var boxes;
var width = 600;
		
function countBoxes() {
	boxes = table.getElementsByTagName("li").length;
}

function container() {
	listcont.style.width = boxes * width + "px";
}

function updateTest() {
	table.style.left = test.updatePosition() + 'px';
}
				
function updateTarget(x){
	var y;
	var z = new Array(width, -width);
	if (parseInt(table.style.left) == 0 || parseInt(table.style.left) > -width) {
		z[0] = (boxes-1)*-width;
	}

	if (parseInt(table.style.left) <= (boxes-1)*-width) {
		z[1] = -parseInt(table.style.left);
	}

	if (x == 'l') {
		y = parseInt(table.style.left)+z[0]-(parseInt(table.style.left)%width);
		test.changeTarget(y);
	} else if (x == 'r') {
		y = parseInt(table.style.left)+z[1]-(parseInt(table.style.left)%width);
		test.changeTarget(y);
	}
}
			
*/

			
var OnloadScheduler =
    new function(){

      var negative = new Array();
      var positive = new Array();

      window.onload = function(){
        for (var i = negative.length - 1; i > 0; i--) execute(negative[i]);
        for (var i = 0; i < positive.length; i++)     execute(positive[i]);
        OnloadScheduler = null;
      }

      function execute(tasks){
        if (tasks){
          for (var i = 0; i < tasks.length; i++) tasks[i]();
        }
      }

      this.schedule = function(task, priority){
        if (task instanceof Function){
          if (!priority) priority = 0;
          if (priority < 0){
            if (negative[-priority]){
              negative[-priority].push(task);
            }else{
              negative[-priority] = [task];
            }
          }else{
            if (positive[priority]){
              positive[priority].push(task);
            }else{
              positive[priority] = [task];
            }
          }
        }else{
          this.schedule(function(){eval(task)}, priority);
        }
      }

    };

	var first = 1;
	var i = 0;
	var jOriginal = 30;
	var j = jOriginal;
        
    function setOpacity(opacity, dir) {
	    // If it's 100, set it to 99 for Firefox.
	 	var obj = document.getElementById("appear");
	 	

	    if (navigator.userAgent.indexOf("Firefox") != -1) {
	    	if (opacity == 100) { opacity = 99.9999; } // This is majorly awkward
	    }
	 
	    // Multi-browser opacity setting
	 
	    obj.style.filter = "alpha(opacity=" + opacity + ")"; // IE/Win
	    obj.style.opacity = (opacity / 100);                 // Safari 1.2, Firefox+Mozilla
	    
	    if (dir == "in") {
	    	i += 10;
	    	j -= jOriginal/10;
	    	setTimeout("fade('in')", 20);
	    } else if (dir == "out") {
	    	i -= 10;
	    	j -= jOriginal/10;
	    	setTimeout("fade('out')", 20);
	    } else if (dir == "off" && j <= -30) {
	    	obj.style.display = "none";
	    	first = 1;
	    	obj.style.marginTop = jOriginal + "px";
	    }
	    
	}
	
	function fade(dir) {
	    var obj = document.getElementById("appear");
	    
	    var op = 0;
	    if (dir == "out") {
	    	op = -1*jOriginal;
	    }
	    
	    if (first == 1) {
	    	obj.style.display = "block";
	    	first = 0;
	    } if (j != op && first == 0) {
	    	obj.style.marginTop = j + "px";
	    	setOpacity(i, dir);
	    } else {
	 	    obj.style.marginTop = j + "px";
	    	setOpacity(i, "off");
	    	j = parseInt(obj.style.marginTop);
	    	i = 100*obj.style.opacity;
	    }
	}

