// JavaScript Document
$(document).ready(function(){
	// setting the Date in the header
	$("#tel span.last").removeClass("last");
	d = new Date();
	$("#tel").append('<span>'+ d.getDate() +'.'+ (d.getMonth()+1) +'.'+ d.getFullYear() +'</span><span class="last">'+d.getHours()+':'+d.getMinutes()+'</span>');
	
	//startseite angebote
	$("#angebot-gallery").wrap('<div id="angebot-gallery-wrap"></div>').css({position:"relative"});
	var items = $("#angebot-gallery img").css({position:"absolute"}).hide().length;
	h = $("#angebot-gallery img:first").show().height();
	str = '<ul id="angebot-nav">';
	for (i=0;i<items;i++){
		str = str + '<li>'+(i+1)+'</li>';
	}
	str = str+'</ul>';
	$("#angebot-gallery-wrap").css({position:"relative",height:h + "px"}).append(str).after('<div id="start-seperator"></div>');
	$("#angebot-nav li:first").addClass("cur");
	$("#angebot-nav li").hover(function(){
		$(this).addClass("hover");
	},function(){
		$(this).removeClass("hover");
	}).click(function(){
		$("#angebot-nav li").removeClass("cur");
		$("#angebot-gallery img:visible").fadeOut(500);
		$("#angebot-gallery li:nth-child("+$(this).addClass("cur").text()+") img").fadeIn(500);
		
	});
	$("a[href=http://www.pro-jex.de/shop/index.php?k=2]").attr("target","");
});
