var StaticContent = new Class
(
	{
		file: "",
		xml: "",
		target: "",
		Implements: Events,
		params: "",
		req: "",
		
		initialize: function(xml)
		{
			
			 
			
			this.file = xml.template;
			
			this.xml = xml;
			this.target = xml.target;
			this.init();
			
			//jQuery('#'+xml.target).hide();

			
		},
	
		
		
		init: function()
		{	
			
			//xml per ajax laden und in eigenschaft tun
		
		},
		
		
		loadContent: function(template,target,querystr,ts,ca){
			
			
			if(!ca)
			ca = "";
			 		
				var oldheight = jQuery('#'+target).innerHeight();	
				jQuery('#'+target).html('<div align="center" style="height:'+oldheight+'px; text-align:center; padding:50px;"><img src="assets/ajax-loader.gif" alt="ajax-loader" /></div>');
			 		
			if(this.req != ""){
			this.req.abort(); 
				
			}
			
			this.req =  $.ajax({url: "system.php"+querystr+'&content_area='+ca+'&ts='+ts, context: document.body, error:function(){}, success: function(e){
      	  		
      	  		
      	  		switch(this.xml.fadeeffect){
			
				case 'none':
				
				break;
				
				
				default:
				
					jQuery('#'+target).stop(true,true).fadeIn('fast');
					
				break;
			
			}
      	  		
      	  		
      	  		
      	  		
      	  		
      	  		jQuery('#'+target).html(e)
      	  		
      	  	 
					  	
				if(document.isIE6)
					DD_belatedPNG.fix("*"); 
      	  		
      	  		this.fireEvent('loaded')
      	  		document.Global.main.contentHandler.loading = false;
      	  		
      	  		if(this.xml.plugins)
      	  		{
      	  			
      	  			var search = this.xml.plugins.plugin;
			   		if(jQuery(search).length == 1)
 						search[0] = search;
			  
			  		jQuery(search).each(function(e)
			  		{	 
			  		   document.Global.main.pluginHandler.load(search[e].name,search[e].target);
			  		   
 			  		}.bind(this))
      	  			
      	  		}
      	  		
      	  	}.bind(this)})

			
		},
		
		load: function(params){
			
		 	
		 	
		 	
			this.params = params;
			
			var querystr = "?";
			var ts= new Date();
			ts = ts.getTime();
			
			for(var i in params){
					 querystr += i+'='+params[i];
					 querystr +='&';
					
			}
			
			
			 
			switch(this.xml.fadeeffect){
			
				case 'none':
					if(this.xml.template) this.loadContent(this.xml.template,this.xml.target,querystr,ts)
					if(this.xml.template2) this.loadContent(this.xml.template2,this.xml.target2,querystr,ts,2)
					if(this.xml.template3) this.loadContent(this.xml.template3,this.xml.target3,querystr,ts,3)
				break;
				
				
				default:
					
					
					
				 	if(this.xml.template) jQuery('#'+this.xml.target).stop(true,true).fadeOut(300,function(){this.loadContent(this.xml.template,this.xml.target,querystr,ts)}.bind(this));
					 
					if(this.xml.template2) jQuery('#'+this.xml.target2).stop(true,true).fadeOut(300,function(){this.loadContent(this.xml.template2,this.xml.target2,querystr,ts,2)}.bind(this));
					 
				 	if(this.xml.template3) jQuery('#'+this.xml.target3).stop(true,true).fadeOut(300,function(){this.loadContent(this.xml.template3,this.xml.target3,querystr,ts,3)}.bind(this));
				
				break;
			
			}
			
      			 
      			
      			
      			       			       		 
			
		
		}
		
		
	}
)
