// JavaScript Document
var img;
var index = 0;
var pics = ['BFS_center_sample01.png','BFS_center_sample02.png','BFS_center_sample03.png','BFS_center_sample04.png'];
var links = ['product_baltic_fence_systems-panels_laminated_posts.html','product_baltic_fence_systems-panels_laminated_posts.html','product_baltic_fence_systems-panels_laminated_posts.html','product_baltic_fence_systems-panels_laminated_posts.html'];
var picsCount = (pics.length - 1);
var prevIndex = 1;
/* animation preloader */
function changepic(param,source)
{
	param.src = source;//graphics/Gazebo_297px_Loading1.gif
}

/* navigation */
function prev()
{
	if( index <= 0 )
	{
		index = picsCount;
	}
	else
	{
		index --;	
	}
	slider(index);
}
function next()
{
	if( index >= picsCount )
	{
		index = 0;
	}
	else
	{
		index ++;	
	}
	slider(index);
}
function slider(_index)
{
	index = _index;
	var _prevBtn = document.getElementById('nr'+prevIndex);
	_prevBtn.src = 'graphics/Slideshow_nr' + prevIndex + '.png';
	var _activBtn = document.getElementById('nr'+(index+1));
	_activBtn.src = 'graphics/Slideshow_nr' + (index+1) + '_active.png';
	prevIndex = (index+1);
	
	var _el = document.getElementById('sliderimg');
	_el.src = 'products/' + pics[index];
}

// redirect page

redirectTo = function redirectTo(_url)
{
	document.location.href = _url;
}

function rollover(_el)
{
	_el.id = "over";
}
function rollout(_el)
{
	_el.id = " ";
}
function goto(_url)
{
	document.location.href = _url;
}


function changePic(param)
{
	img = param;
	changepic(img,'graphics/Gazebo_297px_Loading1.gif');
	$.loadImages('graphics/Gazebo_297px_animation.gif',callback());	
}
function callback()
{
	setTimeout(function(){ changepic(img,'graphics/Gazebo_297px_animation.gif'); },2000);
	
	//changepic(img,'graphics/Gazebo_297px_animation.gif');
}
