$(document).ready(function() {

	$('#sonnyform').submit(function () {
		var submname   = document.getElementById('submname').value;
		var formemail   = document.getElementById('formemail').value;
		var formtitle   = document.getElementById('formtitle').value;
		var formkoment   = document.getElementById('formkoment').value;
		
		if ( submname == "" || formemail == "" || formtitle == "" || formkoment == "" ) {

		//alert (''+formname+''+formemail + ''+formtitle+''+formkoment+'');
			$.fn.prettyPhoto({
				animationSpeed:'slow',
				theme:'dark_rounded',
				deeplinking: false,
				social_tools: false,
				slideshow:2000}); //usually $("a[rel^='prettyPhoto']").prettyPhoto();
			$.prettyPhoto.open('#InfoSys');
			return false;
			}
		else {
			return true;
		}
	});
	
	$('.subm').click(function () {
		$.ajax({
		url: 'send.php',
		type: "POST",
		data: "type=add&tags=" + $("#submname").val() + "&title=" + $("#formemail").val()+ "&code=" + $("#formtitle").val(),
		dataType: 'text',
		success: function(data) {
			$('#infomessage2').html(data);
			//$("#title").val("");
			//document.getElementById('code').value= '';
			//document.getElementById('tags2').value= '';
			//$('.bit-box').remove();
			}
		});
		return false;
	});

	/* =Reflection Nav
	-------------------------------------------------------------------------- */	
		
		// Append span to each LI to add reflection
		
		$("#nav-reflection li").append("<span></span>");	
		
		// Animate buttons, move reflection and fade
		
		$("#nav-reflection a").hover(function() {
		    $(this).stop().animate({ marginTop: "-10px" }, 200);
		    $(this).parent().find("span").stop().animate({ marginTop: "18px", }, 200);
		},function(){
		    $(this).stop().animate({ marginTop: "0px" }, 300);
		    $(this).parent().find("span").stop().animate({ marginTop: "1px",  }, 300);
		});
			
		
		// Animate buttons, move reflection and fade
		
		$("#nav-kuche a").hover(function() {
		    $(this).stop().animate({ marginTop: "-10px" }, 200);
		    $(this).parent().find("span").stop().animate({ marginTop: "18px", }, 200);
		},function(){
		    $(this).stop().animate({ marginTop: "0px" }, 300);
		    $(this).parent().find("span").stop().animate({ marginTop: "1px",  }, 300);
		});
				
	/* =Shadow Nav
	-------------------------------------------------------------------------- */
	
		// Append shadow image to each LI
		
		$("#nav-shadow li").append('<img class="shadow" src="images/sh.png" height="25" width="105" alt="" />');
	
		// Animate buttons, shrink and fade shadow
		
		$("#nav-shadow li").hover(function() {
			var e = this;
		    $(e).find("a").stop().animate({ marginTop: "-14px" }, 250, function() {
		    	$(e).find("a").animate({ marginTop: "-10px" }, 250);
		    });
		    $(e).find("img.shadow").stop().animate({ width: "80%",  marginLeft: "8px",  }, 250);
		},function(){
			var e = this;
		    $(e).find("a").stop().animate({ marginTop: "4px" }, 250, function() {
		    	$(e).find("a").animate({ marginTop: "0px" }, 250);
		    });
		    $(e).find("img.shadow").stop().animate({ width: "100%",  marginLeft: "0", }, 250);
		});
						
	// End jQuery menu
	
	$('.css-scrollbar').scrollbar();
	$('.css-scrollbar2').scrollbar({
		containerHeight:   '270px',});
	

	
	$('#mycarousel').jcarousel();
	
	$("a[rel^='sonnybar'] , a[rel^='kontaktinfo'] , a[rel^='maplink']").prettyPhoto({
		animationSpeed:'slow',
		theme:'dark_rounded',
		deeplinking: false,
		social_tools: false,
		slideshow:2000});


	$('.scrolldiv').click(function() {
		$('#content').scrollTo($($(this).attr("href")), {top:'110px', left:'-290px', duration: 550});
        return false;
    });
	
	$('.scrollkuchediv').click(function() {
		$('#kuchealles').scrollTo($($(this).attr("href")), {top:'110px', left:'-290px', duration: 550});
        return false;
    });


<!-- prettyPhoto -->

<!-- cycle images -->

    $('.slideshow').cycle({
		fx: 'fade',
		speed:   300,
		cleartypeNoBg: true,
		timeout: 5000,
		next:   '.slideshow'
	});
	
	coddml=('info@' + 'sonnysbar.ch')
	$('span#emladdr').html('<a href="mailto:' + coddml + '">'+ coddml + '</a><br><br>');


	
});
