// file character encoding: UTF-8 - hungarian example: ö(&#246;) ü(&#252;) ó(&#243;) ő(&#337;) ú(&#250;) é(&#233;) á(&#225;) ű(&#369;) í(&#237;), Ö(&#214;) Ü(&#220;) Ó(&#211;) Ő(&#336;) Ú(&#218;) É(&#201;) Á(&#193;) Ű(&#368;) Í(&#205;)

function my_is_frame() {
	// bebe INFO: try here!
	//if (parent.frames[0] == null) {
	if (parent.document.getElementById('inside') == null) {
		return 0;
	} else {
		return 1
	}
}

function my_is_player() {
	// bebe INFO: try here!
	if (parent.document.getElementById('player') != null) {
		return true;
	} else {
		return null;
	}
}

function my_flash2js ( my_flash2js_variable , my_flash2js_value ) {
	// bebe INFO: try here!
	// alert('my_flash2js'+' '+my_flash2js_variable+' '+my_flash2js_value);
	if (my_flash2js_variable == 'play') {
		// bebe INFO: try here!
		// alert('play');
		if (my_is_frame() == 1) {
			try {
				parent.document.getElementById('player').sendEvent("PLAY","true");
			} catch (err) {
			}
		} else {
			try {
					//parent.document.location.href='http://www.luxfunkradio.com/player/en/online-radio-hallgatas.html';
					create_iframe();
			} catch (err) {
			}
		}
	}
	if (my_flash2js_variable == 'stop') {
		// bebe INFO: try here!
		// alert('stop');
		if (parent.document.getElementById('player') != null) {
			try {
				// bebe INFO: try here!
				parent.document.getElementById('player').sendEvent("STOP");
			} catch (err) {
			}
		}
	}
	if (my_flash2js_variable == 'volume') {
		// bebe INFO: try here!
		// alert('volume');
		if (my_is_frame() == 1) {
			try {
				// bebe INFO: try here!
				parent.document.getElementById('player').sendEvent("VOLUME",my_flash2js_value);
			} catch (err) {
			}
		}
	}
	if (my_flash2js_variable == 'playvolume') {
		// bebe INFO: try here!
		// alert('playvolume');
		if (my_is_frame() == 1) {
			try {
				// bebe INFO: try here!
				parent.document.getElementById('player').sendEvent("PLAY","true");
				parent.document.getElementById('player').sendEvent("VOLUME",my_flash2js_value);
			} catch (err) {
			}
		}
	}
	if (my_flash2js_variable == 'start') {
		// bebe INFO: try here!
		// alert('start');
		if (my_is_frame() == 0) {
			try {
				//parent.document.location.href='http://www.luxfunkradio.com/player/en/online-radio-hallgatas.html';
				create_iframe();
			} catch (err) {
			}
		}
	}
}

function create_controller(cc_var, cc_debugstate, cc_adverticumzone) {
	// bebe INFO: try here!
	// alert("function create_controller()");
	
	var controller_attributes = {}
	controller_attributes.id = "controller1";
	controller_attributes.name = "controller1";
	
	var controller_params = {};
	controller_params.menu = "false";
	controller_params.scale = "noscale";
	controller_params.salign = "tl";
	controller_params.allowfullscreen = "false";
	controller_params.allowscriptaccess = "always";
	controller_params = "EEEEEE";

	var controller_flashvars = {};
	controller_flashvars.my_debugstate = 0;
	controller_flashvars.my_characterset = "utf-8";
	controller_flashvars.my_xmlbase = cc_var+"xml/";
	controller_flashvars.my_controllertype ="controller";

	if (cc_adverticumzone) {
		controller_flashvars.my_adverticumzone = cc_adverticumzone;
	} else {
		controller_flashvars.my_adverticumzone = -1;
	}

	var jmy_websiteurl = parent.document.location.href;
	
	if (jmy_websiteurl.indexOf("preview") == -1) { // POSSIBLE BUG: Wordpress preview
		controller_flashvars.my_autostart = 1;
	} else {
		controller_flashvars.my_autostart = 0;
	}
	

	if (my_is_frame() == 0) {
		// bebe INFO: try here!
		controller_flashvars.my_frameset = 0;
	} else {
		// bebe INFO: try here!
		controller_flashvars.my_frameset = 1;
	}

	// swfobject.embedSWF(cc_var+"controller.swf?my_random="+Math.floor(Math.random()*2147483648), "controller1", "960", "230", "9.0.0", false, controller_flashvars, controller_params, controller_attributes);
	// bebe INFO: ha debug van, akkor ez random legyen!
	swfobject.embedSWF(cc_var+"controller.swf", "controller1", "960", "230", "9.0.0", false, controller_flashvars, controller_params, controller_attributes);

}

function create_iframe() {
	// alert("function create_iframe()");
	$j('body').empty();
	$j('html, body').css({'height':'100%'});
	$j('html, body').css({'overflow':'hidden'});
	$j('body').append('<div style="margin-top: -25px; margin-left: -470px; float:left; "><div id="player" ></div></div><div style="clear:both;"></div><iframe id="inside" width="100%" height="100%" frameborder="0" marginwidth="0" marginheight="0" src="'+'#'+Math.floor(Math.random()*2147483648)+'"></iframe><script type="text/javascript">create_player();</script>'); // bebe INFO: kötelező berakni src-be valamit! ha # teszel, akkor nem tölt be semmit sem, ha ide is randomozol, akkor 2x-tölt és az ronda
}

function playerReady(obj) {
	// alert("function playerReady()");
	$j('#inside').attr('src', window.location+'?'+'utm_source=luxfunkradio.com'+'&'+'utm_medium=iframe-javascript'+'&'+'utm_content=v65hu-my_random'+Math.floor(Math.random()*2147483648)+'&'+'utm_campaign=luxfunk_websiteplayer_be51af');
	
	// bebe INFO: muszáj randomolni, mert különben, azt hiszi önmaga van az iframe-ben, ezért kell megtéveszteni - Chrome-ban nem volt ez a hiba jelenség
	// bebe INFO: ezzel az url-lel még vigyázni kell, vizsgálni kellene beküldés előtt!
}

function create_player() {
	// alert("function create_player()");
	// http://developer.longtailvideo.com/trac/wiki/FlashApi
	// http://code.google.com/p/swfobject/wiki/documentation
	// http://www.longtailvideo.com/players/jw-flv-player/

	// bebe INFO: try here!
	var player_install = null;
	var player_flashvars = null;
	var player_flashvars = {
		file : "http://www.luxfunkradio.com/player/en/playlist.xml"+"?random=" +Math.floor(Math.random()*2147483648),
		// autostart:"true", 
		item : 0,
		bufferlength : 3,
		repeat : "always",
		shuffle : true,
		respectduration : true,
		volume : 100
	};
	var player_params = null;
	var player_params = {
		allowScriptAccess : "always",
		allowfullscreen : false
	};
	var player_attributes = null;
	var player_attributes = {
		id : "player",
		name : "player"
	};
	
	// swfobject.embedSWF("http://www.luxfunkradio.com/player/player.v4.6.485.licensed/player.swf"+"?random="+Math.floor(Math.random()*2147483648), "player", "1", "1", "9.0.0", player_install, player_flashvars, player_params, player_attributes);
	// bebe INFO: ha debug van, akkor ez random legyen!
	swfobject.embedSWF("http://www.luxfunkradio.com/player/player.v4.6.485.licensed/player.swf", "player", "1", "1", "9.0.0", player_install, player_flashvars, player_params, player_attributes);
}

// bebe INFO: try here!

