window.element = new Array();
var main = {
	hide: function(obj, to){
		window.element[window.element.length] = obj;
		for(i = 0;i <= to+1;i++){
			if(i==to+1){ window.setTimeout('window.element[window.element.length-1].style.display="none";', (to+1)*10); break; }
			window.setTimeout('window.element['+(window.element.length-1)+'].style.filter = "Alpha(opacity=' + (to - i) + ')"; window.element['+(window.element.length-1)+'].style.MozOpacity = ' + ((to/100) - i / 100) + '; window.element['+(window.element.length-1)+'].style.opacity = ' + ((to/100) - i / 100) + ';', i * 10);
		}
	},
	show: function(obj, to){
		window.element[window.element.length] = obj;
		for(i = 0;i <= to+1;i++){
			if(i==0){
				obj.style.filter = "Alpha(opacity=0)"; obj.style.MozOpacity = 0; obj.style.opacity = 0;
				window.element[window.element.length-1].style.display="block"; continue; 
			}
			window.setTimeout('window.element['+(window.element.length-1)+'].style.filter = "Alpha(opacity=' + (i-1) + ')"; window.element['+(window.element.length-1)+'].style.MozOpacity = ' + (i-1) / 100 + '; window.element['+(window.element.length-1)+'].style.opacity = ' +  (i-1) / 100 + ';', (i-1) * 10);
		}
	},
	moduleOpen: function(id){
		main.show(document.getElementById("module_"+id+"_content"), 100);
		top.updateNews(id, "1");
		window.setTimeout('document.getElementById("module_'+id+'_button").onclick = function(){ main.moduleClose("'+id+'") };', 10);
	},
	moduleClose: function(id){
		main.hide(document.getElementById("module_"+id+"_content"), 100);
		top.updateNews(id, "0");
		window.setTimeout('document.getElementById("module_'+id+'_button").onclick = function(){ main.moduleOpen("'+id+'") };', 10);
	},
	messageOpen: function(id){
		main.show(document.getElementById("message_"+id), 100);
		window.setTimeout('document.getElementById("message_'+id+'_toggle").href = "javascript: main.messageClose(\''+id+'\')";', 10);
		window.setTimeout('document.getElementById("message_'+id+'_toggle").innerHTML = "[Ausblenden]";', 10);
	},
	messageClose: function(id){
		main.hide(document.getElementById("message_"+id), 100);
		window.setTimeout('document.getElementById("message_'+id+'_toggle").href = "javascript: main.messageOpen(\''+id+'\')";', 10);
		window.setTimeout('document.getElementById("message_'+id+'_toggle").innerHTML = "[Zeigen]";', 10);
	}
};
document.getElementsByClassName = function(cl) {
	var num = 0;
	var retnode = new Array();
	var elem = document.getElementsByTagName('*');
	for (i=0;i<elem.length;i++) {
		if(cl==elem[i].className){
			retnode[num] = elem[i];
			num++;
		}
	}
	return retnode;
};
function is_array(value)
{
   var s = typeof value;
   if (s === 'object'){
      if (value){
         if (value instanceof Array){
            s = 'array';
         }
      }else{
         s = 'null';
      }
   }
   return s;
}
function str_replace(search, replace, subject)
{
   if (is_array(search) == 'array') {
      for(i=0; i<search.length; i++) subject = subject.split(search[i]).join(replace[i]);
   }else{
      subject = subject.split(search).join(replace);
   }
   return subject;
} 
var print_r = function(arr) {
	var len = arr.length;
	var output = "Gefunden: Array("+len+") {\n";
	for(i=0;i<len;i++) output += "\t"+i+" => "+arr[i]+"\n";
	output += "}\nprint_r Javascript";
	return output;
}
