function getFlashMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}

function loadDiv(url,titel) {
	$("#flashContent").load(url, {}, makeLinks);
	if(titel!='')
	{
		document.title = 'rhtb: - '+titel;
		window.location.hash = titel
	}
	
}

function makeLinks() {
	$("#flashContent").fadeIn(400);
	$("a[href$='.gif'], a[href$='.jpg'], a[href$='.jpeg']").lightBox();
	$("a[href^='/'][target!='_blank']").each( function() {
		$(this).attr('title',$(this).attr('href')).attr('href','#');
	});
	$("a[title]").click(function(e) {
		loadDiv($(this).attr('title'),'');
	});
	$('#cContentWide, #cContent').append('<br />');
	$('#cContent').jScrollPane({showArrows:true});
	$('#cContentWide').jScrollPane({showArrows:true});
	$(document).pngFix(); 
}

function showInfo() {
	$("#flashInfo").fadeIn(400);
}

function hideInfo() {
	$("#flashInfo").fadeOut(400);
}

function contact(form) {
	var formData = $(form).serialize();
	$('#flashContent').load('/kontakt/kontaktformular.php', ({data: formData}));
}

function contactUmfrage(form) {
	var formData = $(form).serialize();
	$('#flashContent').load('/rhtb/news/charityUmfrage.php', ({data: formData}));
}

$(document).ready(function() {
if(hasReqestedVersion) {
	var hash = window.location.hash.substr(1);
	if(hash=="")
	{
		loadDiv("/_index.php","");
	}
	else
	{
		switch(hash) {
			case 'RHTB':
			loadDiv("/rhtb/news.php","RHTB");
			break;
			case 'Leistungen':
			loadDiv("/leistungen/beratung.php","Leistungen");
			break;
			case 'Projekte':
			loadDiv("/projekte/projektuebersicht.php","Projekte");
			break;
			case 'Kontakt':
			loadDiv("/kontakt/mitarbeiter.php","Kontakt");
			break;
		}
	}
	
	$('a').click(function(e) {
		loadDiv($(this).attr('title'),'');
	});
	$('#cContent').jScrollPane({showArrows:true});
	$('#cContentWide').jScrollPane({showArrows:true});
	$('#flashContent').hover(function() {
		hideNavi();
	},function() {});
}
});

function hideNavi() {
	getFlashMovie("rhtb").sendToActionscript();
}


