/*
	javascript development
	============================
	website 	: 	www.brazabra.com/
	date 		: 	9-10-2008		
	author 		: 	mayra metaxa / developer
	company		: 	mozaik creative business solutions
	url			:	http://www.mozaik.com

*/

function bring_next_protogroup()
{
	var num_of_img = img_arr.length;
	var thumb_id = 0;
	var displayed =0;
	
	protogroup_to = Number(protogroup_from + how_many);		
	
	previous_from = protogroup_from;
	
	for (i=protogroup_from;i<protogroup_to;i++)
	{
		document.getElementById("thumb"+thumb_id).src = img_arr[i];
		document.getElementById("thumb"+thumb_id).title = img_titles_arr[i];
		
		if (img_arr[i]!="")
		{
			displayed = displayed + 1;
			document.getElementById("thumb"+thumb_id).style.display = "block";
		}
		else
			document.getElementById("thumb"+thumb_id).style.display = "none";
			
		thumb_id = thumb_id +1;		
	}	
	protogroup_from = protogroup_to;
	
	if (protogroup_from >=num_of_img-1)
		protogroup_from = 0;
		
	if (previous_from==0)
	{
		previous_from=1;
		displayed = how_many-1;
	}
	document.getElementById('small_letters').innerHTML = previous_from + " - " + (previous_from+displayed);
}

function bring_prev_protogroup()
{	
	var num_of_img = img_arr.length;

	var x = protogroup_from - (how_many*2);
	protogroup_from = x;
		
	if (x<=0)
		protogroup_from = how_many - x;
		
	if (x>=num_of_img-1)
		protogroup_from = 0;
	
	if (x<=0)
		protogroup_from = 0;

	bring_next_protogroup();
}

function show_image(id)
{
	document.getElementById('preview_thumbs').src = document.getElementById(id).src;
	document.getElementById('preview_thumbs').title = document.getElementById(id).title;
}



/* media */

function show_nextmedia(prefix, id, total)
{
	if (id<total)
	{
		for (i=1;i<=total;i++)
		{
			document.getElementById('media_'+prefix+'_'+i).style.display = "none";
			//document.getElementById('next_'+i).style.visibility = "visible";
			//document.getElementById('prev_'+i).style.visibility = "visible";
			if (i<total)
				document.getElementById('next_'+prefix+'_'+id).className = "";			
		}

		id = id+1;
		document.getElementById('media_'+prefix+'_'+id).style.display = "block";
		
		if (id==total)
			document.getElementById('next_'+prefix+'_'+id).className = "inactive";
	}
}

function show_prevmedia(prefix, id, total)
{
	if (id>1)
	{
		for (i=1;i<=total;i++)
		{
			document.getElementById('media_'+prefix+'_'+i).style.display = "none";
			//document.getElementById('next_'+i).style.visibility = "visible";
			//document.getElementById('prev_'+i).style.visibility = "visible";
			if (i>1)
				document.getElementById('prev_'+prefix+'_'+id).className = "";
		}
			
		id = id-1;
		document.getElementById('media_'+prefix+'_'+id).style.display = "block";
		
		if (id==1)
			document.getElementById('prev_'+prefix+'_'+id).className = "inactive";
	}
}
