var lastURL;

function init() {
	document.getElementById('flashcontent').style.overflow = "hidden";
}

function getRedirectURL() {
	var basePath = 'http://www.flashlabs.eu/';
	var loc = location.toString();
	if(loc != basePath && location.hash == '') {
		return basePath + '#/' + loc.substr(loc.indexOf(basePath, 0) + basePath.length);
	}
	return '';
}

function startHistoryTimer() {
	setTimeout(historyTimerHandler, 100);
}

function historyTimerHandler() {
	var loc = location.toString();
	if(loc != lastURL) {
		if(lastURL != undefined) {
			
			// treba najprv zohnat skutocne fonty ...
			// potom treba vsetku logiku prepisovania URLciek sustredit do jednej singleton triedy
			// tato trieda bude vediet co si sama vyziadala a preto ked dostane z JS feedback
			// o zmene URL (ktoru sama vyvolala) bude vediet nezareagovat
			
			//alert("URL change: " + loc);
			// send message to flash
		}
		lastURL = loc;
	}
	startHistoryTimer();
}
