$(document).ready(function(e){
	
	$("div#modellen a.item").hover(
		function () {
			slideHover(this);
		},
		function () {
			slideBack(this);
		}
	);
	
	$("div#modellen a.item").click(function(){
		var href = $(this).attr('href');
		if (href!==''){
    		location.href=href;
    	}
    	return false;
    });
    
    $('#gallery').innerfade({
		speed: 1500,
		timeout: 4000,
		type: 'random' //sequence
	}); 
	
});

function slideHover(t) {
	if ($(t).children('.slide').children('.hover').length > 0){
		$(t).children().animate({
			marginTop: "-120px"
		}, { "duration": 160, queue: false, "easing": "easeOutQuad" } );
	}
}

function slideBack(t) {
	if ($(t).children('.slide').children('.hover').length > 0){
		$(t).children().animate({
			marginTop: "0px"
		}, { "duration": 150, queue: false, "easing": "easeInQuad" } );
	}
}

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=500,left = 390,top = 262');");
}
