jQuery(function($){
				
	$('input, textarea').focus(function()
			{
				$(this).not('.submit').val('');
			
			});
			
				
							
					
			
			
			$('#copy-btn').click(function()
			{
			
				// HIDE FOOTER WHEN CONTENT OPENS
				 if(!$.browser.msie)
				{
				 	$('#contact-container').fadeOut();
				}
				
				else
				{
					$('#contact-container').hide();
				}
				
				if($('#copy-container').is(":visible"))
				{
					$('#copy-btn img').attr('src' , 'images/btns/readme.jpg');
					
				}
				
				else
				{
					$('#copy-btn img').attr('src' , 'images/btns/hideme.jpg');
				}
				
				 $('#footer').stop(true,true).animate({height: 47}, 1500);
				 $('#contact-btn-close').hide();
				 $('#contact-btn-expand').show();
				 
				 //end
				 
				 
				 
				var state = $('#copy-container').attr('state');
				 
				if(state == 'open')
				{
					// HIDE COPY CONTAINER
					$('#copy-container').hide("fold", {horizFirst : true}, 1500 , function() { $('#footer').css('top' , '');
					$('#nav').animate({height: '100%'}, 1);
					$('#footer').stop(true,true).animate({bottom: 0}, 1 , function () 
						{ 
							
						
						});
					
					});
					
					$('#copy-container').attr('state','closed');
				}
				
				else
				{
				
					
					var height = $('#copy-container').height() + 250;
					
					if($(window).height() < height)
					{
						$('#nav').css('height', height + 47);
					}
					
					
					$('#copy-container').show("fold", {horizFirst : true}, 1500,  function(){  });
					
					
					
					if(height >= 700)
					{
						if($(window).height() < height)
						{
						$('#nav').css('height', height + 47);
						$('#footer').stop(true,true).animate({bottom: -(height - $(window).height() + 47) + 'px'}, 1500);
						if($.browser.msie && $.browser.version < "8")
								{
							$('#contact-btn-expand').css('padding-right' , '10px');
								}
						}
						
						
					}
					
					$('#copy-container').attr('state','open');
				}
				
				
			
			});
			
			if ($('span').hasClass('error')) {
				$('#footer').stop(true,true).animate({height: 180}, 1);
				$('#contact-container').show();
			}
			
			$('input').focus(function()
			{
				$(this).val('');
			
			});
			
			$('#contact-btn-expand').click(function () {
				
				if($('#copy-container').is(":visible"))
				{
					$('#copy-container').hide("fold", {horizFirst : true}, 1500);
					
				}
				
				
				
				 $('#footer').stop(true,true).animate({height: 180}, 1500);
				 $('#contact-btn-expand').hide();
				 $('#contact-btn-close').show();
				 
				if(!$.browser.msie)
				{
				 	$('#contact-container').delay(750).fadeIn(1000);
				}
				
				else
				{
					$('#contact-container').delay(750).show();
				}
			
			});

			 $('#contact-btn-close').click(function () {
			 	 if(!$.browser.msie)
				{
				 	$('#contact-container').fadeOut();
				}
				
				else
				{
					$('#contact-container').hide();
				}
				 $('#footer').stop(true,true).animate({height: 47}, 1500);
				 $('#contact-btn-close').hide();
				 $('#contact-btn-expand').show();
 			}); 
			
			if(!$.browser.msie)
			{
				$('#title-container').fadeIn(8000);
				
			}
			
			else
			{
				$('#title-container').show();
			}
			
			$('#siteby').hover(
			function()
			{
				$(this).find('img').attr('src', 'images/btns/siteby-pink.png');
			},
			
			function()
			{
				$(this).find('img').attr('src', 'images/btns/siteby.png');
			});
			
			
			
			if($('.gallery').size()>0){
				$(".gallery li a").attr('rel','images');
				$(".gallery li a").fancybox({
					'onClosed':function(){
						if ($.browser.msie && $.browser.version.substr(0,1)<7) {
							$('#supersized').supersized(); 
						}
					}
				});
						
			}
});
