function ChangeLanguage( selectbox, language_array )
{
	var current_location = String(window.location);
	var current_language = '';
	var founded = false;
	
	for( i = 0; i < language_array.length && !founded; i++ )
	{
		if ( current_location.indexOf( '/' + language_array[i] + '/' ) > 0 )
		{
			founded = true;
			current_language = '/' + language_array[i] + '/';
		}
	}

	if ( founded )
	{
		if ( selectbox.value != '' )
		{
			current_location = current_location.replace( current_language, '/' + selectbox.value + '/' );
		}
		else
		{
			current_location = current_location.replace( current_language, '/' );
		}
	}
	else
	{
		var file_name = String(document.location.href);
		var end = (file_name.indexOf('?') == -1) ? file_name.length : file_name.indexOf('?');
		file_name = file_name.substring(file_name.lastIndexOf('/')+1, end);
		current_location = current_location.replace( file_name, selectbox.value + '/' + file_name );
	}
	
	window.location = current_location;
}
