
var imageOffsets = [];
var imageHeights = [];
var imageWidths = [];
var imageContainerActiveIdx = 4;

//iefix spaltehome
if ($.browser.msie && $.browser.version < 7) 
{
	document.write('<style type="text/css">#spaltehome {margin: 58px 0 0 43px !important;}</style>');
}

$(document).ready(function() {
	
	
    if(false)
    {
        // #imageboxhref #imagebox
        var moffset = 0;
        for(var i=1;i<=4;i++)
        {
            imageOffsets['i'+i] = -1*moffset;
            imageWidths['i'+i] = $('#bildhomex'+i)[0].width;
            imageHeights['i'+i] = $('#bildhomex'+i)[0].height;
            moffset += $('#bildhomex'+i)[0].width;
        }
        
        GoToSelectedIndex();
        
        $('#imageboxlinks').css('cursor', 'pointer').click(function() {
            if(imageContainerActiveIdx == 1) imageContainerActiveIdx = 5; //endless loop
            imageContainerActiveIdx--;
            ScrollToSelectedIndex();
        });
        $('#imageboxrechts').css('cursor', 'pointer').click(function() {
            if(imageContainerActiveIdx == 4) imageContainerActiveIdx = 0; //endless loop
            imageContainerActiveIdx++;
            ScrollToSelectedIndex();
        });
    }	   
        $('.linkboxtable .mover').hover(mover_mouseover, mover_mouseout);
        $('.linkboxtable .mover').click(function(){
            document.location.href = $(this).find('a').attr('href');
        });
        $('.linkboxtable .mover a').click(function(){
            document.location.href = this.href;
            return false;
        });
  
});

function mover_mouseover()
{
	var extrainfobox = $('#extrainfobox_'+ (this.id.replace(/tdmover/,'')-1) );
	
	$('#conextra').html(extrainfobox.html());
	$('#conextra').css({
		position: 'absolute',
		top: $(this).offset().top - $('#conextra')[0].offsetHeight - 4,
		left: $(this).offset().left,
		width: ($.browser.msie) ? $(this).width()+2 : $(this).width()-10,
		display: 'block',
		border: 'solid 1px white',
		backgroundColor: 'black',
		color:'white'
	});
	$('#conextra').css({
		top: $(this).offset().top - $('#conextra')[0].offsetHeight - 4
	});
	this.style.borderColor='white';
}
function mover_mouseout()
{
	$('#conextra').hide();
	if (this.id.replace(/tdmover/, '') != (''+imageContainerActiveIdx)) 
	{
		this.style.borderColor = '#41A62A';
	}
}

function ScrollToSelectedIndex()
{
	//debugger;
	$('#imagecontainer').animate({
		left: imageOffsets['i'+imageContainerActiveIdx]
	}, 500, 'easeOutQuad');
	
	SetStylesForSelectedIndex();
}
function GoToSelectedIndex()
{
	//debugger;
	$('#imagecontainer').css({
		left: imageOffsets['i'+imageContainerActiveIdx]
	}, 500, 'easeOutQuad');
	
	SetStylesForSelectedIndex();
}

function SetStylesForSelectedIndex()
{
	$('.mover').css({
		borderColor:'#41A62A'
	});
	$('#tdmover'+imageContainerActiveIdx).css({
		borderColor:'white'
	});
	
	$('#imageboxhref')
		.html($('#tdmover'+imageContainerActiveIdx+' a').html())
		.unbind('click')
		.bind('click', function() {
			document.location.href = $('#tdmover'+imageContainerActiveIdx+' a').attr('href');
			return false;
		});
		
	$('#imagebox')
		.css('cursor','pointer')
		.unbind('click')
		.bind('click', function() {
			document.location.href = $('#tdmover'+imageContainerActiveIdx+' a').attr('href');
			return false;
		});
}



