/*
// dynamic content

$(document).ready(function(){
	$("#content").height($(document).height());
});
*/

// Hover

$(document).ready(function(){
	$("a.mainhome").hover(function() {

		$("#hoverhome").fadeIn(500);

		},
		function() {
		$("#hoverhome").fadeOut(500);


	});
	$("#mainhome").mouseleave(function() {

		$("#hoverhome").stop(true, true);

	});	
});

$(document).ready(function(){
	$("a.mainabout").hover(function() {

		$("#hoverabout").fadeIn(500);
		},
		function() {
		$("#hoverabout").fadeOut(500);

	});
		$("#mainabout").mouseleave(function() {

		$("#hoverabout").stop(true, true);

	});
});

$(document).ready(function(){

	$("#servicedrop").hover(function() {

		$("#servicedrop").fadeIn(500);
		},
		function() {
		$("#servicedrop").fadeOut(500);
		
	});
	$("#servicedrop").mouseleave(function() {

		$("#servicedrop").stop(true, true);

	});


	$("a.mainservice").hover(function() {

		$("#hoverservice").fadeIn(500);
		$("#servicedrop").fadeIn(500);
		},
		function() {
		$("#hoverservice").fadeOut(500);
		
	});
	$("#mainservice").mouseleave(function() {

		$("#hoverservice").stop(true, true);

	});

});



$(document).ready(function(){
	$("a.mainkontakt").hover(function() {

		$("#hoverkontakt").fadeIn(500);
		},
		function() {
		$("#hoverkontakt").fadeOut(500);

	});
		$("#mainkontakt").mouseleave(function() {

		$("#hoverkontakt").stop(true, true);

	});
});

$(document).ready(function(){
	$("a.mainblog").hover(function() {

		$("#hoverblog").fadeIn(500);
		},
		function() {
		$("#hoverblog").fadeOut(500);

	});
		$("#mainblog").mouseleave(function() {

		$("#hoverblog").stop(true, true);

	});
});

$(document).ready(function(){
	$("a.mainsupport").hover(function() {

		$("#hoversupport").fadeIn(500);
		},
		function() {
		$("#hoversupport").fadeOut(500);

	});
	$("#mainsupport").mouseleave(function() {

		$("#hoversupport").stop(true, true);

	});
});

// Slider Left Hover


$(document).ready(function(){
	$("#slide_one").hover(function() {

		$("#slide_hover_one").fadeIn(500);
		},
		function() {
		$("#slide_hover_one").fadeOut(500);

	});
});

$(document).ready(function(){
	$("#slide_two").hover(function() {

		$("#slide_hover_two").fadeIn(500);
		},
		function() {
		$("#slide_hover_two").fadeOut(500);

	});
});

$(document).ready(function(){
	$("#slide_three").hover(function() {

		$("#slide_hover_three").fadeIn(500);
		},
		function() {
		$("#slide_hover_three").fadeOut(500);

	});
});

$(document).ready(function(){
	$("#slide_four").hover(function() {

		$("#slide_hover_four").fadeIn(500);
		},
		function() {
		$("#slide_hover_four").fadeOut(500);

	});
});


// Slide Content fade


function clear_slider(){

		$("#slide_right_two").css("display","none");
		$("#slide_right_three").css("display","none");
		$("#slide_right_one").css("display","none");
		$("#slide_right_four").css("display","none");


};


$(document).ready(function(){
	$("#slide_one").click(function() {

		clear_slider();
		$("#slide_right_one").fadeIn(500);

	});

});

$(document).ready(function(){
	$("#slide_two").click(function() {

		clear_slider();
		$("#slide_right_two").fadeIn(500);

	});

});

$(document).ready(function(){
	$("#slide_three").click(function() {

		clear_slider();
		$("#slide_right_three").fadeIn(500);

	});

});

$(document).ready(function(){
	$("#slide_four").click(function() {

		clear_slider();
		$("#slide_right_four").fadeIn(500);

	});

});

// Slider

$(document).ready(function() {
// Get URL Split after =
    var pathname = window.location.href;
    var furl = pathname.split(".de/")[1];
// check if url is = X
	if(furl == "computer_service"){

		clear_slider();
		$("#slide_right_three").fadeIn(500);

	}else if(furl == "webdesign"){

		clear_slider();
		$("#slide_right_one").fadeIn(500);

	}else if(furl == "software"){

		clear_slider();
		$("#slide_right_two").fadeIn(500);

	}else if(furl == "konsolen"){

		clear_slider();
		$("#slide_right_four").fadeIn(500);

	}
	else{
// if url does not contain one of the above, generate a random one
		var slideArray = ["#slide_right_three","#slide_right_one","#slide_right_two","#slide_right_four"];
		var numRand = Math.floor(Math.random()*3)

			clear_slider();
			$(slideArray[numRand]).fadeIn(500);

	};


});


// Tipsy Tooltip for Social Links
$(document).ready(function(){
	$('#facebook').tipsy({gravity: 'w'});
	$('#xing').tipsy({gravity: 'w'});
	$('#twitter').tipsy({gravity: 'w'});
	$('#googleplus').tipsy({gravity: 'w'});
	$('#newsletter').tipsy({gravity: 'w'});
	});

// Webdesign Preview Opacity Fade
$(document).ready(function(){
 $('#web_pre, #web_pre2, #web_pre3, #consoleButton').css('opacity', '0.7');
  });

$(document).ready(function(){
 $('#web_pre, #web_pre2, #web_pre3, #consoleButton').mouseenter(function() {
	$(this).css('opacity', '0.7').fadeTo(300, 1);
  });
   $('#web_pre, #web_pre2, #web_pre3, #consoleButton').mouseleave(function() {
	$(this).css('opacity', '1').fadeTo(300, 0.5);
  });
 });
