// -----------------------------------------------------------------------------------
//
//	showroom v1.00
//	by jan Willms, plan p. GmbH
//
// 	(c) Copyright by  plan p. GmbH
// -----------------------------------------------------------------------------------


// -----------------------------------------------------------------------------------
//   homenews - SwapNews Functions
// -----------------------------------------------------------------------------------


function homenewsFade () {
	var elem = $('news_frame');
	if(elem) { new Effect.Fade(elem, { to: 0.001 , duration: 0.75 } ); }

}

function homenewsAppear () {
	var elem = $('news_frame');
	if(elem) { new Effect.Appear(elem, { to: 1.0 , duration: 0.75 } ); }
}

var global_news_req_id = 1;
function homenewsGetMore (i) {
	if(!$('news_frame')) return;
	if(!$('news_container')) return;
	
	homenewsFade();
	
	(function(){
		$('news_container').setStyle( { 'background': 'url(_gfx/loading02.gif) center center no-repeat' } );
	}).bind(this).delay(0.50);
	
	global_news_req_id = i;
	
	(function(){
		var ajaxHomeNews = new Ajax.Request(
			"ajax.php",
			{
				asynchronous: true,
				method: 'get',
				requestHeaders: { Accept: 'application/javascript' },
				parameters: { source: 'news', r: 'getHomeFrame', s: global_news_req_id },
				onComplete: homenewsGetMoreComplete
			}
		);
	}).bind(this).delay(0.75);

}


function homenewsGetMoreComplete( originalRequest )
{
	if(!$('news_container')) return;

	(function(){
		$('news_container').setStyle( { 'background': 'none' } );
	}).bind(this).delay(1.00);
	(function(){
		homenewsAppear();
	}).bind(this).delay(0.50);
}

