/* Main Actions // Script loaded when $(document).ready */ 
$(document).ready(function() {

var ingallery = $("ul.ingallery");    

var sn = '<div class="shortnav"><a class="prevmove" href=""><img src="syspics/icons/go-previous.png" alt="zur&uuml;ck" title="zur&uuml;ck" /></a><a class="nextmove" href=""><img src="syspics/icons/go-next.png" alt="vor" title="vor" /></a></div>';

var igw = '<div class="ingallerywrapper"></div>'
var st_w = "258";
var st_h = "208";
var tnlength = $("ul.ingallery li").length;
var piccounter = 0;


ingallery.wrap(igw);
ingallery.after(sn);


$(".ingallerywrapper").css({
	'width' : st_w+'px',
	'height' : st_h+'px',
	'position' : 'relative',
	'display' : 'block',
	'float' : 'right',
	'clear' : 'right',
	'overflow' : 'hidden',
	'border' : '1px solid #800000'
   });
   
     
$(".ingallerywrapper .shortnav").css({
	'width' : st_w+'px',
	'position' : 'absolute',
	'display' : 'block',
	'bottom' : '0px'
     });

ingallery.css({
	'backgroundColor' : '#ff0000', 
	'font-weight' : 'bolder',
	'overflow' : 'hidden',
	'height' : st_h+'px',
	'width' : '20000px',
	'display' : 'inline',
	'position' : 'absolute',
	'left' : '0px'
     });
     
function manage_arrows() {
  if (piccounter<=0) {
   $('.ingallerywrapper .prevmove').hide(600)
  } else  {
   $('.ingallerywrapper .prevmove').show(600)
  }
  
  if (piccounter>=tnlength-1) {
   $('.ingallerywrapper .nextmove').hide(600)
  } else  {
   $('.ingallerywrapper .nextmove').show(600)
  }
}

$('.ingallerywrapper .shortnav a').click(function(event) {
 event.preventDefault();
});
  
  
  manage_arrows();
  
$('.ingallerywrapper .prevmove').click(function(event) {
 ingallery.animate({'left': '+='+st_w,}, 500);
 piccounter-=1;
 manage_arrows();
});

$('.ingallerywrapper .nextmove').click(function(event) {
 ingallery.animate({'left': '-='+st_w,}, 500);
 piccounter+=1;
 manage_arrows();
});
});
