﻿
$(document).ready(
	function()
	{
		//ukrywanie elementow przy starcie strony oraz ich plynne pokazywanie
		
		$("p").hide();
		$("ul").hide();
		$("p").fadeIn("slow");
		$("ul").fadeIn("slow");
		$("#textmessage").text(" ");
		$("#topmenu a").css({'opacity':'0.0'});
		$("#topmenu .left").css({'opacity':'0.0'});
		
		$("#mainleft").css({'opacity':'0.8'});
		$("#mainright").css({'opacity':'0.8'});
		/*
		$("#topmenu").animate({
			marginLeft:"0"
		},200);	
		$("#toplogo").animate({
			marginLeft:"0"
		},200);	
		$("#toptext").animate({
			marginLeft:"0"
		},200);	
		$("#topmenu").animate({
			marginLeft:"0"
		},200);	
		$("#toplogo").animate({
			marginLeft:"0"
		},200);	
		$("#toptext").animate({
			marginLeft:"0"
		},200);	
		$("#topmenu").animate({
			marginLeft:"0"
		},500);	
		$("#toplogo").animate({
			marginLeft:"0"
		},500);	
		*/
		$("#toptext").animate({
			marginLeft:"0"
		},500, function(){
			$("#topmenu a").animate({opacity:"1.0"},2500);
			$("#topmenu .left").animate({opacity:"1.0"},2500,function(){
			$("#textmessage").text("Witam. Mam na imię Piotr i zajmuje się pisaniem stron internetowych.");
			$("#textmessage").jTypeWriter({duration:3.5});
			});
		});	
		
		$("#toplogo p").text("");
		$("#toplogo p").text("Wygląd, styl i treść.<br />Najlepsza droga by zaistnieć w internecie.");
		$("#toplogo p").jTypeWriter({duration:3.5,type:"words"});
		
		
		$("#topmenu ul li a").mouseover(function(){	
			
			$(this).fadeOut(0);
			$(this).prev().fadeOut(0);
			$(this).css({'background':'url(images/menuhover.png) no-repeat top right'});
			$(this).prev().css({'background':'url(images/menudotlefthover.png)'});
			$(this).stop(true,true).fadeIn(700);
			$(this).prev().stop(true,true).fadeIn(700);
		});
		
		
		
		$("#topmenu ul li a").mouseout(function(){
		
			$(this).css({'background':'url(images/menubasic.png) no-repeat top right'});
			$(this).prev().css({'background':'url(images/menudotleft.png)'});		
		});
		//$("#textmessage").fadeOut();
		
		//sprawdzanie poprawnosci formularza
		//gdy formularz poprawny - plynne wyswietlenie komunikatu o wyslaniu wiadomosci
		//w zaleznosci czy wiadomosc zostala wyslana pokazuje sie odpowiedni komunikat - ajax+php
		$("#wiadomosc").hide();
		$("#wyslij").click(function(){
		$("#commentForm").validate({
		   success: "valid",
		   submitHandler: function() {
							$("#wiadomosc").fadeIn("slow",function(){$("#wiadomosc").fadeOut(5000)}); 
							startRequest(); 
							}
		})
		});		
	})
	




	
