jQuery.noConflict();

/*
 * General DOM ready statemenets
 */
jQuery(function($) {
	
	$('.home-image').cycle({
		fx: 'fade',
		pause: true,
		speed: 'fast',
		timeout: 3500,
		pager: '#control_panel',
		next: '#prev2',     
		prev: '#next2'
	}); 
	
	 $("form.contact-form,#newsletters").submit(function(event) {
		/* stop form from submitting normally */
		event.preventDefault(); 
		/* get some values from elements on the page: */
		var $form = $( this ),
			url = $form.attr( 'action');
		/* Send the data using post and put the results in a div */
		$.post( url,$(this).serializeArray(),
		  function( data ) {
			$('html,body').animate({scrollTop: '0px'}, 500);
			  var content = $( data );
			  $( "#html-message" ).empty().append( content );
		  }
		);
	  });
	$('.newsletter-button').click(function(){
		$('html,body').animate({scrollTop: 0}, 0)
	});
	$('.porfolio-item').hover(function(){
		$(".cover", this).stop().animate({top:'135px'},{queue:false,duration:160});
		$(".porfolio-img", this).stop().animate({top:'-218px'},{queue:false,duration:300});
		$("h3", this).stop().css({color:"#333"}, 100);
		$("a", this).stop().css({color:"#333"}, 100);
		
	}, function() {
		$(".cover", this).stop().animate({top:'180px'},{queue:false,duration:160});
		$(".porfolio-img", this).stop().animate({top:'0'},{queue:false,duration:300});
		$("h3", this).stop().css({color:"#DADADA"}, 100);
		$("a", this).stop().css({color:"#DADADA"}, 100);
	
	});


	$('.nav a.level-top').click(function(){
		if($(this).next('normal').css('left')=='-10000px'){
			$(this).next('normal').css('left','0');
		}else{
			$(this).next('normal').css('left','-10000px');
		}
	});
});
