var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 115;

var hasProductInstall = DetectFlashVer(6, 0, 65);

// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);



function embedFlash(){
	
    if(document.location.hash == '#noflash') {
	return;    
    }

    if (hasRequestedVersion) {
        // if we've detected an acceptable version
        // embed the Flash Content SWF when all tests are passed
        AC_FL_RunContent.apply(this, arguments);
    }
    else 
        if (hasProductInstall && !hasRequestedVersion) {
        
            // MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
            // This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
            // DO NOT MODIFY THE FOLLOWING FOUR LINES
            // Location visited after installation is complete if installation is required
            var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
            var MMredirectURL = window.location;
            document.title = document.title.slice(0, 47) + " - Flash Player Installation";
            var MMdoctitle = document.title;
            
            AC_FL_RunContent("src", "playerProductInstall", "FlashVars", "MMredirectURL=" + MMredirectURL + '&MMplayerType=' + MMPlayerType + '&MMdoctitle=' + MMdoctitle + "", "width", "100%", "height", "100%", "align", "middle", "id", "ggg", "quality", "high", "bgcolor", "#ffffff", "name", "ggg", "allowScriptAccess", "sameDomain", "type", "application/x-shockwave-flash", "pluginspage", "http://www.adobe.com/go/getflashplayer");
            
        }
        else { // flash is too old or we can't detect the plugin
            var alternateContent = 'Tento aktivní prvek nelze zobrazit.<br/> ' +
            'Pro jeho zobrazení potřebujete Adobe Flash Player 9.  ' +
            '<a href=http://www.adobe.com/go/getflash/>Získat Flash nyní!</a>';
            document.write(alternateContent); // insert non-flash content
        }
    
}

function flashVars(o){
    var v = '';
    for (var item in o) {
        v += item + '=' + o[item] + '&';
    }
    return v;
}

var PriceChartOld = {
	show: function(params){
		 embedFlash("src", "http://charts.false.cz/price-chart?x=" + Math.random(),
			"width", "420",
			"height", "300",
			"align", "middle",
			"id", "hotel-graph",
			"quality", "high",
			"bgcolor", "#ffffff",
			"allowscriptaccess","always",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer",
			"flashvars", flashVars(params)); 
	},
	show2: function(params){
		params.baseUrl = 'http://charts.false.cz/';
		
		embedFlash("src", "http://charts.false.cz/price-chart-v2",

		//embedFlash("src", "http://charts.false.cz/price-chart-v2?x=" + Math.random(),
			"width", "520",
			"height", "320",
			"align", "middle",
			"id", "hotel-graph",
			"quality", "high",
			"bgcolor", "#ffffff",
			"allowscriptaccess","always",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer",
			"flashvars", flashVars(params)); 
	},
	showHistory: function(params) {
		params.type = 'history';
		PriceChart.show2(params);
	},
	showFuture: function(params) {
		params.type = 'future';
		PriceChart.show2(params);
	}
};


var PriceChart = {
	show: function(params){
		params.baseUrl = 'http://static.ncore.cz/charts/';
		
		embedFlash("src", "http://static.ncore.cz/charts/price-chart-v2",

		//embedFlash("src", "http://charts.false.cz/price-chart-v2?x=" + Math.random(),
			"width", "520",
			"height", "320",
			"align", "middle",
			"id", "hotel-graph",
			"quality", "high",
			"bgcolor", "#ffffff",
			"allowscriptaccess","always",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer",
			"flashvars", flashVars(params)); 
	},
	showHistory: function(params) {
		params.type = 'history';
		PriceChart.show(params);
	},
	showFuture: function(params) {
		params.type = 'future';
		PriceChart.show(params);
	}
};


var Maps = {
	regionShow: function(params){

	
		params.apiKey = 'ABQIAAAAfdaAp0Kld0lAIGZqsvXbhxQmz9k-q3sREFh1NLlWxNl896FCEhQzwOh6FCaGh4zgg-dGApDN0G5aZQ';
		 embedFlash("src", "http://charts.false.cz/regionmap?x=1", // + Math.random(),
			"width", "535",
			"height", "260",
			"align", "middle",
			"id", "hotel-graph",
			"quality", "high",
			"bgcolor", "#ffffff",
			"allowscriptaccess","always",
			"wmode", "transparent",
			"style", "z-index:10",

			"allowFullScreen", "true",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer",
			"flashvars", flashVars(params)); 


	},
	hotelShow: function(params){
		params.type = 'hotel';
		Maps.regionShow(params);
		phxx(params);
	}

};

function phxx(params) {
//	if(document.location.href == "#bender") {
/*
var x = unescape(params.data);
var o = x.split('"');
var lng = o[11];
var lat = o[15];
document.write('<script src="http://bender/panoramio/?lat='  + lat + '&lng=' + lng+'">');
*/
}

//document.write('<!--[if lt IE 7]>');
//document.write('<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js" type="text/javascript"></script>');
//document.write('<![endif]-->');