/* 
written by THANI and not you! But you can use it if you really want.
*/

$(document).ready(function(){
	  $("label").inFieldLabels();

/*
	    $('#rotator').cycle({
			fx: 'fade',
			timeout: 5000,
			speedOut: 1500,
			speedIn: 1500
		});
*/

	$("#contactform").validate();	    
	$('#contactform').submit( function(){
		if(!($('#contactform').valid())){
			showErrors();	    	
	    	return false;
	    }
		$('#contactform').hide();
		$('#message').html($('<p>Thank you! I will get back to you in a few hours.</p>')); 
		$.get('contact.php',{name:$('#name').val(), email:$('#email').val(), comment:$('#comment').val(), subject:$('#subject').val()});	
		
		return false;
	});
	
		    $('.prog').cycle({
		        fx:     'scrollLeft',
		        speed:  '700',
		        timeout: 6000,
		        pager:  '#prog_pager',
		        onPagerEvent: function(){
		        	 $('.prog');
		        }
    		}).cycle('pause');
    	$('#atndr').cycle({
    	    fx:     'scrollLeft',
    	    speed:  '700',
    	    timeout: 6000,
    	    pager:  '#atndr_pager',
    	    onPagerEvent: function(){
    	    	 $('.prog');
    	    }
    	}).cycle('pause');
    	$('#mango').cycle({
		        fx:     'scrollLeft',
		        speed:  '700',
		        timeout: 6000,
		        pager:  '#mango_pager',
		        onPagerEvent: function(){
		        	 $('#mango');
		        }
    		}).cycle('pause');
    	$('#aa').cycle({
		        fx:     'scrollLeft',
		        speed:  '700',
		        timeout: 6000,
		        pager:  '#aa_pager',
		        onPagerEvent: function(){
		        	 $('#aa').cycle('pause');
		        }
    		});
      	$('#open').cycle({
		        fx:     'scrollLeft',
		        speed:  '700',
		        timeout: 6000,
		        pager:  '#open_pager',
		        onPagerEvent: function(){
		        	 $('#open').cycle('pause');
		        }
    		});
      	$('#hero').cycle({
		        fx:     'scrollLeft',
		        speed:  '700',
		        timeout: 6000,
		        pager:  '#hero_pager',
		        onPagerEvent: function(){
		        	 $('#hero').cycle('pause');
		        }
    		});
    		
    var top = /* $('#selected_works').offset().top */1140;
    $(window).scroll(function (event) {
      var y = $(this).scrollTop();
      if (y >= top) {
        $('#main_nav').addClass('fixed');
      } else {
        $('#main_nav').removeClass('fixed');
      }
    });
    
    
    $('#nav_float a').click(function(){
    	var where = $(this).attr('href');
		$('html, body').animate({
    		scrollTop: $(where).offset().top
		}, 600);
    
    	return false;
    	
    });
});




















