// JavaScript Document
	$(document).ready(function() { 
		
		
		$("#contact_button").click(function() {
			
			$("#contact_col").animate({
				width: "530px"
			})
			.animate({
				width: "500px"
			}, "fast");
			$("#contact_button").hide();
			$("#contact_close_button").show();
		});
		
		$("#contact_close_button").click(function() {
			
			$("#contact_col").animate({
				width: "530px"
			})
			.animate({
				width: "0px"
			}, "fast");
			$("#contact_close_button").hide();
			$("#contact_button").show();
		});	      
         
		// initialize scrollable 
		$("div.portfolio").scrollable({ 
			vertical:true,  
			size: 2,
			clickable: false
			 
		}).mousewheel().navigator(); 
			   
        $(".p_item a.photolink").overlay({ 
 
			// each trigger uses the same overlay with the id "gallery" 		
			//effect: 'apple',
			target: '#gallery',
			expose: {maskId: 'mask'} 
		 
		// let the gallery plugin do its magic! 
		}).gallery({ 
		 
			// the plugin accepts its own set of configuration options 
			speed: 800 
		});
		
		$('#contactForm').ajaxForm({ 
			target:'#alert'
		}); 
		
		$(".frmfield").focus(function(){
			$(this).css("background-color","#578689").css("color","#fff");			  
		});
		
		$(".frmfield").blur(function(){
			$(this).css("background-color","#292929").css("color","#777");			  
		});
		
		
	   $('a[href*=#]').click(function() {
		 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		 && location.hostname == this.hostname) {
		   var $target = $(this.hash);
		   $target = $target.length && $target
		   || $('[name=' + this.hash.slice(1) +']');
		   if ($target.length) {
		  var targetOffset = $target.offset().top;
		  $('html,body')
		  .animate({scrollTop: targetOffset}, 1000);
			return false;
		   }
		 }
		});
		
		
	}); 

$.fn.clearForm = function() {
  return this.each(function() {
	var type = this.type, tag = this.tagName.toLowerCase();
	if (tag == 'form')
	  return $(':input',this).clearForm();
	if (type == 'text' || type == 'password' || tag == 'textarea')
	  this.value = '';
	else if (type == 'checkbox' || type == 'radio')
	  this.checked = false;
	else if (tag == 'select')
	  this.selectedIndex = -1;
  });
};
	