$(window).load(function() {
	$('#slider').nivoSlider({
		effect:'random',
		slices:15,
	//	animSpeed:500,
		pauseTime:5000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8 //Universal caption opacity
	});
});

//Cufon.replace('h2, .topnav, .description p, h3, .sidebar h4', { fontFamily: 'Aller' });
//Cufon.replace('.infoh4', { fontFamily: 'Aller' });

$(document).ready(function(){
$("ul.subnavigation").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled – Adds empty span tag after ul.subnav
$("ul.topnav li span").hover(
function() { //When trigger is clicked…
//Following events are applied to the subnav itself (moving subnav up and down)
$(this).parent().find("ul.subnavigation").slideDown(400).show(); //Drop down the subnav on click
$(this).parent().hover(function() {
}, function(){
$(this).parent().find("ul.subnavigation").slideUp(500); //When the mouse hovers out of the subnav, move it back up
});
//	 //Following events are applied to the trigger (Hover events for the trigger)
//	 }).hover(function() {
//	 $(this).addClass(“subhover”); //On hover over, add class “subhover”
//	 }, function(){ //On Hover Out
//	 $(this).removeClass(“subhover”); //On hover out, remove class “subhover”
},
function () {
//
}
);
});

$(document).ready(function() {
	$("a[rel=lightbox]").fancybox({
		'showCloseButton'	: false,
		'padding'			: 0,
		'hideOnContentClick': true,
		'centerOnScroll'	: true,
		'overlayOpacity'	: 0.6,
		'overlayColor'		: '#000',
		'easingIn'			: 'easeInExpo',
		'easingOut'			: 'easeInExpo',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'enableEscapeButton': true,
		'titleShow'			: false,
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});

	$("#fancy").fancybox({
		'padding'			: 0,
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
});



//________________moje funkcje______________________________________
$(document).ready(function(){
						   if($('#sideNavServices').length) 
								{
									
								$("#sideNavServices").mouseenter(function(){
									$('.subSubNav').slideDown();
								});						
									
								$('.subnav').mouseleave(function(){
									$('.subSubNav').slideUp();
								});								
									
									
								}
							if($(".portfolioDiv").length)
						   {
							   $(".portfolioDiv:not(:first)").css('margin-top','30px');
						   }
								
});
						   
function generateQuote(){
							   
	$("#quoteForm").validate();	 
						   
	$('ul#filter a').click(function() {
		$(this).css('outline','none');
		$('ul#filter .current').removeClass('current');
		$(this).parent().addClass('current');
		
		var filterVal = $(this).text().toLowerCase().replace('-','').replace(' | ','').replace(' ','');
		$('ul#questions li').each(function() 
		{
		if(!$(this).hasClass(filterVal)) 
		{
			$(this).fadeOut('normal').addClass('hidden');
		} 
		else 
		{
			$(this).fadeIn('slow').removeClass('hidden');
		}
		});
		
		return false;
	});
		$("#go").click(function(){
							$( 'html, body' ).animate( { scrollTop: 0 }, 'normal' );

							if($("#quoteForm").valid() == false)
								return false;
							else
							{
							$(".hidden").empty();  //dziala ale psuje wyswietlanie interest 
							$("#mailSent").remove();
							$("#mailNotSent").remove();
							var interestV = $("input[name='interest']").val();
							var nameV = $("input[name='name']").val();
							var companyV = $("input[name='company']").val();
							var emailV = $("input[name='email']").val();
							var numberV = $("input[name='number']").val();
							var methodV = $("input[name='method']:checked").val(); 
							var domainV = $("input[name='wantsDomain']:checked").val(); 
							var logoV = $("input[name='wantsLogo']:checked").val(); 
							var supplyStuffV= $("input[name='supplyStuff']:checked").val(); 
							var timeFrameV= $("input[name='timeFrame']:checked").val(); 
							var commentsV = $("#comments").val();						
							
							
							//alert(interestV+nameV+companyV+emailV+numberV+methodV+domainV+logoV+supplyStuffV+timeFrameV+commentsV);
							$.ajax({
								   type: "POST",
								   url: "/qOps.php",
								   data: "interest="+interestV+"&name="+nameV+"&company="+companyV+"&email="+emailV+"&number="+numberV+"&method="+methodV+"&wantsDomain="+domainV+"&wantsLogo="+logoV+"&supplyStuff="+supplyStuffV+"&timeFrame="+timeFrameV+"&comments="+commentsV,
								   success: function(msg){
									   $("#quoteForm").before('<center><span id="mailSent"> Your quote request has been sent. We\'ll get back to you very soon...</span></center>').fadeIn('slow');
								   },
								   error: function(msg){
									   $("#quoteForm").before('<center><span id="mailNotSent"> There was a problem submitting your request. Please try again or contact us <a href="mailto:carl.klonowski@teslacreations.com"> by email</a></span></center>').fadeIn('slow');
								   }
								   });
							
							return false;
							}
							});
}

