var gallery = new Array('/images/gallery/bsg_s50/img0.jpg', '/images/gallery/bsg_s50/img1.jpg','/images/gallery/bsg_s50/img2.jpg','/images/gallery/bsg_s50/img3.jpg','/images/gallery/bsg_s50/img4.jpg','/images/gallery/bsg_s50/img5.jpg','/images/gallery/bsg_s50/img6.jpg','/images/gallery/bsg_s50/img7.jpg');
var gallery_image_description = new Array('BSG Cast','Need Info','Grace Park as Boomer','Need Info','Need Info','Need Info','Need Info','Need Info');
var gallery_out='<div id="gallery_left"><img src="images/btn_arrow-photogalleryleft.gif" border="0"></div><div id="gallery_shim"><div id="gallery_container">';

if(IsThisBrowserIE6())
{
ieExtraSpace = -1;
increment = 102;
}
else
{
ieExtraSpace = 0;
increment = 102;
}


for (var inc=0;inc<gallery.length;inc++)
{

gallery_out += '<div><img src="'+gallery[inc]+'"  width="94" height="66" alt="'+gallery_image_description[inc]+'"></div>';


}
gallery_out+='</div></div><div id="gallery_right"><img src="images/btn_arrow-photogalleryright.gif" border="0"></div><div id="prev_pic"><img src="images/btn_arrow-slideshowleft.gif" border="0"></div><div id="gallery_image"></div><div id="next_pic"><img src="images/btn_arrow-slideshowright.gif" border="0"></div>';


document.write(gallery_out);


var number_gallery = ($('#gallery_container > div').length) - 1;
var current_image=0;
	
$('#gallery_container > div').css('background-color','#FF0000');
$('#gallery_container > div').css('opacity','0.6');
$('#gallery_container > div:eq(0)').css('opacity','1');
$('#gallery_container').width(($('#gallery_container > div').length*increment)+2); //damned ie 6

$('#gallery_right').click(function () { 
	$('#gallery_shim').scrollTo('+='+increment+'px', 1000,{axis:'x'} );
});
	
$('#gallery_left').click(function () { 
	$('#gallery_shim').scrollTo('-='+increment+'px', 1000,{axis:'x'} );
});

$('#prev_pic').click(function () { 
	if(current_image != 0)
		{
			current_image--;
	 	}
	$('#gallery_shim').scrollTo('-=102px', 1000,{axis:'x'} );
	$('#gallery_container > div').css('opacity','0.6');
	$('#gallery_container > div:eq('+current_image+')').css('opacity','1');
	$('#gallery_image').html($('#gallery_container > div:eq('+current_image+')').html())
	$('#gallery_image > img').width(527);
	$('#gallery_image> img').height(368);
});

$('#next_pic').click(function () { 
	if(current_image != number_gallery)
		{
	 		current_image++;
	 	}
	$('#gallery_shim').scrollTo('+=102px', 1000,{axis:'x'} );
	$('#gallery_container > div').css('opacity','0.6');
	$('#gallery_container > div:eq('+current_image+')').css('opacity','1');
	$('#gallery_image').html($('#gallery_container > div:eq('+current_image+')').html())
	
	$('#gallery_image > img').width(527);
	$('#gallery_image> img').height(368);
});
$('#gallery_container > div').click(function(){
	current_image = $('#gallery_container > div').index(this);

	$('#gallery_container > div').css('opacity','0.6');
	$('#gallery_container > div:eq('+current_image+')').css('opacity','1');
	$('#gallery_image').html($(this).html());
	$('#gallery_image > img').width(527);
	$('#gallery_image> img').height(368);
});

$('#gallery_image').html($('#gallery_container > div:eq(0)').html())
$('#gallery_image > img').width(527);
$('#gallery_image> img').height(368);