$(document).ready(function(){
var randomZahl = Math.floor((Math.random() * 9) + 1);
if(randomZahl == 1) {
	$("#werbung").attr({src: "http://motoso.de/motozone/wp-content/themes/livewire/images/werbung/1.jpg"});
	$("#werbeLink").attr({href: "http://www.motoso.de"});
}
if(randomZahl == 2) {
	$("#werbung").attr({src: "http://motoso.de/motozone/wp-content/themes/livewire/images/werbung/2.jpg"});
	$("#werbeLink").attr({href: "http://motoso.de/"});
}
if(randomZahl == 3) {
	$("#werbung").attr({src: "http://motoso.de/motozone/wp-content/themes/livewire/images/werbung/3.jpg"});
	$("#werbeLink").attr({href: "http://motoso.de/motozone/fahrzeuginfo-blog/russpartikelfilter-dieselfilter-feinstaub-abgasfiler/"});
}
if(randomZahl == 4) {
	$("#werbung").attr({src: "http://motoso.de/motozone/wp-content/themes/livewire/images/werbung/4.jpg"});
	$("#werbeLink").attr({href: "http://motoso.de/"});
}
if(randomZahl == 5) {
	$("#werbung").attr({src: "http://motoso.de/motozone/wp-content/themes/livewire/images/werbung/5.jpg"});
	$("#werbeLink").attr({href: "http://www.motoso.de/reifen.htm"});
}
if(randomZahl == 6) {
	$("#werbung").attr({src: "http://motoso.de/motozone/wp-content/themes/livewire/images/werbung/5.jpg"});
	$("#werbeLink").attr({href: "http://www.motoso.de/reifen.htm"});
}
if(randomZahl == 7) {
	$("#werbung").attr({src: "http://motoso.de/motozone/wp-content/themes/livewire/images/werbung/1.jpg"});
	$("#werbeLink").attr({href: "http://www.motoso.de"});
}
if(randomZahl == 8) {
	$("#werbung").attr({src: "http://motoso.de/motozone/wp-content/themes/livewire/images/werbung/2.jpg"});
	$("#werbeLink").attr({href: "http://motoso.de/motozone/kontakt/"});
}
if(randomZahl == 9) {
	$("#werbung").attr({src: "http://motoso.de/motozone/wp-content/themes/livewire/images/werbung/3.jpg"});
	$("#werbeLink").attr({href: "http://motoso.de/motozone/fahrzeuginfo-blog/russpartikelfilter-dieselfilter-feinstaub-abgasfiler/"});
}
if(randomZahl == 10) {
	$("#werbung").attr({src: "http://motoso.de/motozone/wp-content/themes/livewire/images/werbung/5.jpg"});
	$("#werbeLink").attr({href: "http://www.motoso.de/reifen.htm"});
}

$("#leute").click(function() {
		$(".slider").animate({
			marginLeft: "-1880px"
		}, 500);
		$(".hidder").animate({
			height: "292px"
		}, 500);
	});
$("#Fahrzeuge").click(function() {
		$(".slider").animate({
			marginLeft: "-1880px"
		}, 500);
		$(".hidder").animate({
			height: "292px"
		}, 500);
	});
$("#Gruppen").click(function() {
		$(".slider").animate({
			marginLeft: "-2820px"
		}, 500);
		$(".hidder").animate({
			height: "292px"
		}, 500);
	});
$("#Punkte").click(function() {
		$(".slider").animate({
			marginLeft: "-3760px"
		}, 500);
		$(".hidder").animate({
			height: "292px"
		}, 500);
	});
$("#Fotos").click(function() {
		$(".slider").animate({
			marginLeft: "-4700px"
		}, 500);
		$(".hidder").animate({
			height: "292px"
		}, 500);
	});
$("#Videos").click(function() {
		$(".slider").animate({
			marginLeft: "-4700px"
		}, 500);
		$(".hidder").animate({
			height: "292px"
		}, 500);
	});
$("#Schraubertipps").click(function() {
		$(".slider").animate({
			marginLeft: "-5640px"
		}, 500);
		$(".hidder").animate({
			height: "292px"
		}, 500);
	});
$("#_Specials").click(function() {
		$(".slider").animate({
			marginLeft: "-6580px"
		}, 500);
		$(".hidder").animate({
			height: "292px"
		}, 500);
	});



if ( $("#show1").css("display") == "block" || $("#show1").css("display") == "inline" ) {
	$(".hidder").animate({
			height: "292px"
		}, 500);
}
if ( $("#sliderSmall1").css("display") == "block" || $("#sliderSmall1").css("display") == "inline" ) {
	$(".hidder").animate({
			height: "102px"
		}, 500);
}
if ( $("#show1").css("display") == "block" || $("#show1").css("display") == "inline") {
	$(".zurueckBottom").css("visibility","hidden");
	$(".send").click(function() {
		$(".zurueckBottom").css("visibility","visible");
		var email = $('.email').val();
		$.post("newsletter.php", { email: email } );
		$(".slider").animate({
			marginTop: "-292px",
			marginLeft:"0"
		}, 500);
	});
}
if ( $("#sliderSmall1").css("display") == "block" ||$("#sliderSmall1").css("display") == "inline") {
	$(".send").click(function() {
		var email = $('.email').val();
		$.post("newsletter.php", { email: email } );
		$(".hidder").animate({
			height: "292px"
		}, 500);
		$(".slider").animate({
			marginTop: "-102px",
			marginLeft:"0"
		}, 500);
	});
}
	$(".zurueck").click(function() {
		$(".slider").animate({
			marginTop: "0px",
			marginLeft: "-940px"
		}, 500);
	});
	$(".zurueckBottom").click(function() {
		$(".zurueckBottom").css("visibility","hidden");
		$(".slider").animate({
			marginTop: "0px",
			marginLeft: "-940px"
		}, 500);	
	});
	$(".next").click(function() {
		var oldMargin = parseInt($(".slider").css("margin-left"));
		oldMargin = oldMargin - 940;
		$(".slider").animate({
			marginLeft: oldMargin
		}, 500);
	});
	$(".next1").click(function() {
		var oldMargin = parseInt($(".slider").css("margin-left"));
		oldMargin = oldMargin - 940;
		$(".slider").animate({
			marginLeft: oldMargin
		}, 500);
	});
	$(".prev").click(function() {
		var oldMargin = parseInt($(".slider").css("margin-left"));					  
		if( oldMargin < 0) { 
			oldMargin = oldMargin + 940;
		} else {
			oldMargin = 0;
		}
		$(".slider").animate({
			marginLeft: oldMargin
		}, 500);
	});
	$(".smallNext1").click(function() {
		$(".slider").animate({
			marginLeft: "-940px"
		}, 500);
		$(".hidder").animate({
			height: "292px"
		}, 500);
	});
	$(".smallPrev").click(function() {
		$(".slider").animate({
			marginLeft: "0px"
		}, 500);
		$(".hidder").animate({
			height: "102px"
		}, 500);
	});
	$(".first").click(function() {
		$(".slider").animate({
			marginLeft: "0px"
		}, 500);
	});
	$(".email").click(function() {
		$(".email").val('');
	});
	
	
	$(".newsUp").click(function() {
		var oldMargin = parseInt($("#sidetabber").css("margin-top"));
		if( oldMargin < 0) { 
			oldMargin = oldMargin + 260;
		} else {
			oldMargin = 0;
		}
		$("#sidetabber").animate({
			marginTop: oldMargin
		}, 500);
	});
	$(".newsDown").click(function() {
		var oldMargin = parseInt($("#sidetabber").css("margin-top"));
		oldMargin = oldMargin - 260;
		$("#sidetabber").animate({
			marginTop: oldMargin
		}, 500);
	});
	$(".newsTop").click(function() {
		$("#sidetabber").animate({
			marginTop: 0
		}, 500);
	});
	
});

