as_images_count_images = 13;
as_images_count_containers = 3;



pattern = /(.*?)\/gromad_sud/;
var project_url_path_arr = pattern.exec(document.location.href);


PROJECT_URL_PATH = project_url_path_arr[0]+'/';

//PROJECT_URL_PATH = 'http://suzdaltsev/developers/dorian/svn/hydra/gromad_sud/';
AJAX_URL_PATH = PROJECT_URL_PATH + 'index.php';


function as_images_load_image(image_index, container_index)
{
	
	if(image_index > as_images_count_images) 
	{
		image_index = 1;
	}

	if(container_index > as_images_count_containers) 
	{
		container_index = 1;
	}

	var container = document.getElementById('images_' + container_index);
	container.style.backgroundImage = "URL(upload/image_" + image_index + ".gif)";
	image_index++;
	container_index++;
	setTimeout("as_images_load_image(" + image_index + "," + container_index + ")", 1000);

}


function as_images_ron_load_image()
{

	var container = document.getElementById('preload_images');
	
	/*for (i = 1; i < as_images_count_images+1; i++) 
	{
		container.style.backgroundImage = "URL(upload/image_" + i + ".gif)";
	}*/	
	
	
	as_images_load_image(1,1);
}


/*INTRASITE_CONTENT_CONTAINER_ID = 'content';


function show_documents(div_id)
{
	erase_container(INTRASITE_CONTENT_CONTAINER_ID);

	create_plugin('documents_list_filter', 'documents_list_filter', INTRASITE_CONTENT_CONTAINER_ID);
	set_plugin_param('documents_list_filter', 'filtered_plugin', 'documents_list');
	load_plugin('documents_list_filter');

	create_plugin('documents_list', 'documents_list', INTRASITE_CONTENT_CONTAINER_ID);
	if (div_id > 0) 
	{
	    set_plugin_param('documents_list', 'filter_div_id', div_id);
	}
	load_plugin('documents_list');
}


function erase_container(container_id)
{
	var container = document.getElementById(container_id);

	if(container) 
	{
		container.innerHTML = '';
	}

}*/

   



function add_bookmark()
{
	var bookmarkurl="http://sudnaroda.org.ua/"
	var bookmarktitle="Громадянський суд України"
	if (document.all)
		window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function set_home_page(elem) 
{
    elem.style.behavior='url(#default#homepage)';
	elem.setHomePage(document.location);
}




function active_chosen_page_link(obj)
{

	var plugin_body_news_groups_titles_list = document.getElementById('news_groups_titles_list');

	var elements = plugin_body_news_groups_titles_list.getElementsByTagName('a');
	for(var i = 0; i < elements.length; i++) 
	{
		element = elements[i];
		element.className = 'line_2_item_a';
	}


	var plugin_body_text_pages_show_pages_titles = document.getElementById('text_pages_show_pages_titles');

	var elements = plugin_body_text_pages_show_pages_titles.getElementsByTagName('a');
	for(var i = 0; i < elements.length; i++) 
	{
		element = elements[i];
		element.className = 'line_2_item_a';
	}
	
	obj.className = 'chosen_page_link';


}



function resize()
{
	
	var client_width = document.body.clientWidth;
	var main = document.getElementById('main'); 
	var line_3 = document.getElementById('line_3');

	if(client_width > 1200) 
	{
		main.style.width = client_width + 'px';
		var line_3_width = client_width - 630;
		line_3.style.width = line_3_width + 'px';
	}
	else 
	{
		main.style.width = '1200px';
		line_3.style.width = '570px';
	}
	

}




/**
 * function 
 * 
 * @access public	
 * @param 
 * @return 
*/

function show_photos(photo_number) 
{
 	var photos = document.getElementById('photos');
	var collection = photos.getElementsByTagName('div');
	if (collection) 
	{
		for (i = 0; i < collection.length; i++) 
		{
		    collection[i].style.display = 'none';
		}
	}
	
	var photo_index = photo_number - 1;
	var photo = document.getElementById('photo_' + photo_index);
	if(photo == null) 
	{
		return false;		
	}
	photo.style.display = 'block';
	
	var count_photos = document.getElementById('photos_count').value;
	photo_number = photo_number + 1;
	if(photo_number > count_photos) 
	{
		photo_number = 1;
	}

	setTimeout("show_photos(" + photo_number + ")", 5000);
}

