/* Alexa Original */



document.write('<iframe frameborder="0" width="1" height="1" style="height: 1px; width:1px; display:none; position:absolute; top:-1000px; left:-1000px;" src="http://data.alexa.com/data/Ae7E31+kj740Ee?cli=10&dat=snba&ver=7.0&url=http%3A%2F%2Fwww.webspring.de"></iframe>');

if(top.location != self.location){
	//window.top.location.href="http://www.webspring.de/";
}


var go_ajax = function (element, updateid, column) {

    var lod = $('loading');
    lod.innerHTML = '<img src="tl_files/img/loading.gif" alt="" />';


    var to_update = $(updateid);

    switchHeadline( to_update, element );


    $$(element+' a').each(function(el){
        el.onclick = function() {

            var url = el.href;
            var urlextend = url+"?request="+column;
			
			if( el.className.indexOf('noajx')>=0){
				return true;
			}
			
			if( urlextend.indexOf('http://')==0){
				if( urlextend.indexOf('http://www.webspring.de')<0){
					el.target = "_blank";
					return true;
				}
			}
			
			lod.style.display = "block";
			var loadung_fadeout = new Fx.Tween( lod , {property: 'opacity'}).start(0,1);

			// Class Names ....
			var classNames = this.className.split(' ');
			var className = null;
			if( classNames.length > 0)
				for(var i=0; i<classNames.length; i++){
					var cl = classNames[i];
					if( cl!="active" && cl!="first" && cl!="last"){
						className = cl;
						break;
					}
				}
			// EOF ClassNames ....
			
			// -------------------
			
			fadeout = new Fx.Tween(to_update, {property: 'opacity'}).start(1,0);
			$$(element+' A').each(function(e2){
				e2.removeClass('active');
			});
			if( className ){
				$$(element+' A.' + className).each(function(e2){
					e2.className += " active";
				});
			}
			
			fadeout.addEvent('onComplete', function(e) {
				var request1 = new Request.HTML({
												url: urlextend,
												method: 'post',
												update: to_update,
												evalScripts: false,
												onComplete: function(response){
													var fadeout3 = new Fx.Tween(to_update, {property: 'opacity'}).start(0,1);
													var loadung_fadeout = new Fx.Tween( lod , {property: 'opacity'}).start(1,0);
													loadung_fadeout.addEvent('onComplete', function(e) {
														lod.style.display = "none";
													});
													initAevent();
													
													var h1 = document.getElementsByTagName('h2')[0];
													document.title = unescape(h1.innerHTML);
													$('htt').innerHTML = h1.innerHTML;
													$('hff').innerHTML = h1.innerHTML;
												}
				}).send();

            });

		fadeout2 = new Fx.Tween($('right'), {property: 'opacity'}).start(1,0);  
		fadeout2.addEvent('onComplete', function(e) {
			var request2 = new Request.HTML({
				url: 'unten.php?uri=' + escape( urlextend ),
				method: 'post',
				update: 'right',
				evalScripts: false,
				onComplete: function(response){
					fadeout2 = new Fx.Tween($('right'), {property: 'opacity'}).start(0,1);
					initAevent();
				}
			}).send();
		});
		return false;
        }
    });

}







function switchHeadline( to_update , element ){



	var cp = $('cp');

	if( cp ){
		cp.style.cursor = "pointer";
		cp.style.display = "block";

		$$(element + ' div').each(function(e2){ 
			if( e2.className.indexOf('varticle') >= 0 ){
				e2.style.display = "none";
			}
		});

	

	

		cp.onclick = function(){
			var fadeout = new Fx.Tween(this, {property: 'opacity'}).start(1,0); 
			fadeout.addEvent('onComplete', function(e) {
				$$(element + ' div').each(function(e2){ 
					if( e2.className.indexOf('varticle')>=0 ){
						var fout = new Fx.Tween(e2, {property: 'opacity'}).start(0.5,0);
						fout.addEvent('onComplete', function(e) {
							var fout2 = new Fx.Tween(e2, {property: 'opacity'}).start(0,1);
							e2.style.display = "block"; 
						});
					}
				}); 
			});
		}
	}
}









function initAevent(){

	window.addEvent('domready', function(e) {
		go_ajax(
			'#wrapper',
			'mod_article_inner',
			'main'
	         );
	});
}



initAevent();






