// Softloop site.js - Copyright 2008 by Softloop (Hirbod)

// www.softloop.net

// Ajax Abfrage

var homeAktiv = true;
var hManager = null; //History Manager
var noUpdate = false;
var ajaxCallStat = null;



function callAJAX(pageid, sprache, ctype, html_id, page_bar) {
			
	if (ajaxCallStat)
	{
		ajaxCallStat.cancel();
	}
	
	
	var url = "index.php?article_id=27&pageid=" + pageid + "&clang=" + sprache + "&seite=" + ctype + "&page_bar=" + page_bar;
	
	//hManager.setValues('callAJAX', [pageid, id, seite]);
	
		
	ajaxCallStat = new Fx.Tween(html_id,{
			onComplete: function(){

				ajaxCallStat = new Request.HTML({
					method: 'post',
					update: $(html_id),
					evalScripts: true,
					url: url,
					onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript){
						ajaxCallStat = new Fx.Tween(html_id,{
								onComplete: function(){
									ajaxCallStat = null;	
									initCoverflow();
								}
							}
						).start('opacity', '0', '1');
		
					}
				}).send();			
			}
		}).start('opacity', '1', '0');
	if((pageid == 161 || pageid == 162 || pageid == 163) && ctype == 2){
		var image = './files/';
		if(pageid == 161){
			image += '110701_north.png';
		}
		if(pageid == 162){
			image += '110701_deuschland_central.png';
		}
		if(pageid == 163){
			image += '110711_south.png';
		}
		var article = $('article');
		var pnormal = article.getElement('.pnormal');
		if(pnormal){
			pnormal.get('morph').start( { 'opacity': 0 } ).chain(
				function(){
					var pn_image = pnormal.getElement('img');
					pn_image.set('src', image);
					pnormal.get('morph').start( { 'opacity': 1 } );
				}
			);
		}
	}

	return false;
}

