$(document).ready(
	function() {
		init();
		localInit();
	}
);
//
function localInit(){
	//
	setupNav();
	//
	testAjax();
	//
	if($('#headerFlash').length > 0){
		///
		$('#headerFlash').flash({
            'swf':'banner.swf',
            'width':'994',
            'height':'208',
			'wmode': 'transparent' 
        });
	}	
}; 

var nCnt = -1;
var nCntMax = -1;
var firstRun = true;
var nData = Array();
var tData = '';

function showNews(){

	nCnt++;
	if (nCnt > nCntMax){
		nCnt = 0;
	}
	//hide
	$("#homeNewsHide").slideDown(0);
	$("#homeNews").animate({opacity: 0}, 0);
	//set
	tData = '';
	tData += '<p><strong>';
	tData += nData[nCnt]['d_subject'];
	tData += '</strong><br />';
	tData += nData[nCnt]['d_teaser'];
	tData += '<br />';
	tData += '<a href="/News_' + nData[nCnt]['d_id'] + '">Read more ></a>';
	tData += '</p>';
	//
	$("#homeNews").html(tData);
	//show
	$("#homeNewsHide").slideUp(1000);
	$("#homeNews").animate({opacity: 1}, 1000);

	setTimeout('showNews()', 4500);

}

function testAjax(){
	//alert("testAjax");
	$.post("scripts/ajax_calls/homeNewsGet.php", {}, function(data){testAjax_callback(data);}, "json");
	//$.post("scripts/ajax_calls/homeNewsGetStatic.php", {}, function(data){testAjax_callback(data);}, "json");
}		

function testAjax_callback(data){
	//alert("testAjax_callback");

	$.each(data, function(i,item){
		nCntMax++;
		nData[i] = Array();
		nData[i]['d_id'] = item.d_id;
		nData[i]['d_subject'] =item.d_subject;
		nData[i]['d_teaser'] =item.d_teaser;
	});
	//
	if (firstRun){
		firstRun = false;
		showNews();
	}	
	//
}

-->

