function changelang( base_url )
{
	//var lang_list = get_object_by_id( 'lang_list' )
	var lang_list = document.getElementById('lang_list' );
	if ( !lang_list )
	{
		alert( 'object not found' );
		return;
	}
	
	var lang = lang_list.options[ lang_list.selectedIndex ].value;
	window.top.location.href = 'container.php?g_lang=' + lang;
	
}

function changelang1( base_url )
{
	var lang_list = get_object_by_id( 'lang_list' )
	if ( !lang_list )
	{
		alert( 'object not found' );
		return;
	}
	
	parent.location.href = base_url + lang_list.options[ lang_list.selectedIndex ].value;
}

var _img_count = 0;
var _img_path  = new Array( );
var _img_text  = new Array( );
var _current_img = -1;
var _time_id = -1;

function get_roll_images( )
{
	AjaxRequest.get(
    {
      'url':'xmlhttp.php?g_scr=collect_roll_images'
      ,'onSuccess':function(req)
      				{
      					var msg = req.responseText
      					var ret = parseInt( req.responseText );
      					if ( ret == -1 ) return;
      					
      					var photos = msg.split( "---" );
      					_img_count = photos.length;
      					
      					for ( var i = 0 ; i < _img_count ; i++ )
      					{
      						var photo_props = photos[ i ].split( "|||" );
      						_img_path[ i ] = photo_props[ 0 ];
      						_img_text[ i ] = photo_props[ 1 ];
      					}
      					
      					_time_id = setInterval( "roll_image( )" , 3000 );
      				}
    }
    );
}

function roll_image( )
{
	if ( _current_img == -1 ) _current_img = 0;
	if ( _current_img >= _img_count ) _current_img = 0
	
	img_div = get_object_by_id( "IMG_ROLL" );
	if ( !img_div ) return;
	
	//txt_div = get_object_by_id( "TEXT_ROLL" );
	//if ( !img_div ) return;
	
	var html = "<table width=\"100%\" height=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" +
			   "<tr><td align=\"left\" valign=\"middle\" style=\"font-family:Tahoma;font-size:12pt\">"
	img_div.innerHTML = html + "<image src=\"" + _img_path[ _current_img ] + "\"  />" + "</td></tr></table>";
	//txt_div.innerHTML = html + _img_text[ _current_img ] + "</td></tr></table>";
	
	_current_img++;
}


// SCROLLING FUNCTIONS ------------------------------------------------------------- //

_scroll_timer_up = null;
_scroll_timer_down = null;
_scroll_step = 10;
_scroll_time = 10;

function moveUp( divid )
{
	divobj = document.getElementById( divid );
	if ( !divobj ) return;
	
	divobj.scrollTop -= _scroll_step;
	_scroll_timer_up = setTimeout( "moveUp( '" + divid + "' )" , _scroll_time );
}


function moveDown( divid )
{
	divobj = document.getElementById( divid );
	if ( !divobj ) return;
	
	divobj.scrollTop += _scroll_step;
	_scroll_timer_down = setTimeout( "moveDown( '" + divid + "' )" , _scroll_time );
}

function moveStop( )
{
	if ( _scroll_timer_up )
	{
		clearTimeout( _scroll_timer_up );
		_scroll_timer_up = null;
	}
		
	if ( _scroll_timer_down )
	{
		clearTimeout( _scroll_timer_down );
		_scroll_timer_down = null;	
	}
}
