function set_language(language, url) {
	
	var url = url;
	
	new Ajax.Request('/ajax.php', {
		method: 'post',
		asynchronous: false,
		parameters: 'action=set_session_key_value_pair&k=language&v='+language,
		onSuccess: function() {
			document.location.href=url;
		}
	});
	
}



/**
 * shouts to a specific shoutbox
 * 
 * @param id
 * @return false
 */
function shout_to_group(id) {
	
	var id = id;
	
	new Ajax.Updater('tippgroup_shoutbox_'+id,'/members/tipp_groups.php', {
		method: 'post',
		parameters: {
			action: 'shout_to_group',
			id: id,
			message: $F('shout_'+id)
		},
		onSuccess: function() {
			$('shout_'+id).value = '';
		}
	});

	return false;
}


/**
* shouts to the global shoutbox
* 
* @return false
*/
function shout() {
	
	new Ajax.Updater('shoutbox','/ajax.php', {
		method: 'post',
		parameters: {
			action: 'shout',
			message: $F('shout')
		},
		onSuccess: function() {
			$('shout').value = '';
		}
	});

	return false;
}



/**
 * posts to facebook
 * 
 * @param type
 * @return
 */
function post_to_facebook(type, id) {
	
	// post the user's statistics
	if (type == "stats") {
		parameter = 'action=fb_stats';
	}
	
	// post a tipp
	if (type == 'tipp') {
		parameter = 'action=fb_tipp&tipp='+id;
	} 

	// post "i'm in a tippgroup"
	if (type == 'group') {
		parameter = 'action=fb_group&group='+id;
	}
	
	// post the tipps for a whole gameday
	if (type == 'gd') {
		parameter = 'action=fb_tipp_gd&gameday='+id;
	}
	
	if (parameter) {
		new Ajax.Request('/ajax.php', {
			method: 'post',
			parameters: parameter,
			onSuccess: function(r) {
				text = r.responseText.evalJSON();

				FB.ensureInit(function() {
					FB.Connect.streamPublish(
						text.message,
						{
							name: text.name,
							href: text.imagelink,
							description: text.description,
							properties: text.properties,
							media: [
							{
								type: 'image',
								src: text.image,
								href: text.imagelink
							}
							]
						},
						null,
						null,
						text.headline
					);
				});
			}
		});
	}
}


function openflash() {
  var flashwin = window.open("../flash/pre_flash2007.php","goalchance","width=800,height=450,scrollbars=no");
  flashwin.focus();
}

function isnotdefined( variable) {    return (typeof(window[variable]) == "undefined")?  true: false;}

