Cufon.replace('.kravitz', { fontFamily: 'kravitz' });
Cufon.replace('.cooper', { fontFamily: 'cooper' });
Cufon.replace('.dayroman', { fontFamily: 'dayroman' });

$(document).ready(function(){
	if ($.browser.msie) {
		$('#testimonial').css('margin-top', '11px');
		$('.front #contact #message_block textarea').css('height', '78px');
		$('.contact #contact #message_block textarea').css('height', '190px');
	}
	
	if ($.browser.mozilla) {
		$('.front #contact #message_block textarea').css('height', '80px');
		$('.contact #contact #message_block textarea').css('height', '192px');
	}
	
	
	$('div.portfolio-content').hide();
	
	$('#content.portfolio .portfolio-item .item-content').addClass('dayroman');
	

	$('.portfolio-header').click(function(){
		$(this).siblings('div.portfolio-content').slideToggle(800, function(){
			if( $(this).siblings('.portfolio-header').hasClass('expanded') )
			{
				$(this).siblings('.portfolio-header').removeClass('expanded');
			}
			else{
				$(this).siblings('.portfolio-header').addClass('expanded');	
			}
		});			
	});

	
	/*$('.portfolio-header.expanded').live('click', function(){
		$('body').scrollTo($(this).siblings('div.portfolio-content'), 800);									   
	});*/
	
	$('#playlist_list li:last').each(function(){
      $(this).css({border: 'none'});
	});
	
	$('#home-map').hover(function(){
		$('#home-link').css('border-bottom', '5px solid #009BE3');					 
	}, function(){
		$('#home-link').css('border-bottom', 'none');		
	});
	
	$('#about-map').hover(function(){
		$('#about-link').css('border-bottom', '5px solid #009BE3');					 
	}, function(){
		$('#about-link').css('border-bottom', 'none');		
	});
	
	$('#portfolio-map').hover(function(){
		$('#portfolio-link').css('border-bottom', '5px solid #009BE3');					 
	}, function(){
		$('#portfolio-link').css('border-bottom', 'none');		
	});
	
	$('#contact-map').hover(function(){
		$('#contact-link').css('border-bottom', '5px solid #009BE3');					 
	}, function(){
		$('#contact-link').css('border-bottom', 'none');		
	});
	
	$('#social_icons img').hover(function(){		
		var hvr_source = $(this).attr('src').replace('.','-hvr.');	
		$(this).attr('src', hvr_source);
	}, function(){
		var org_source = $(this).attr('src').replace('-hvr.','.');	
		$(this).attr('src', org_source);	
	});
	
	$("#designbox").easySlider({
		auto: false,
		continuous: true,
		controlsShow: false,
		nextId: 'd-right',
		prevId: 'd-left'
	}); 
	
	$("div.scrollable").scrollable({
		size: 3							   
	}).mousewheel().circular();
	
	$('#photobar a').lightBox();
	$('#photo-block .portfolio-item a.lightbox').lightBox();
	$('#works-block .portfolio-item a.lightbox').lightBox();
	
	if (!$.browser.msie) {
		$('#designbox img').jcaption({
			copyStyle: false,
			animate: true,
			show: {height: "show"},
			hide: {height: "hide"} 		
		});
	}

	$('#contactform').ajaxForm({ 	
		url: 'contact.php', 				   
        beforeSubmit: function(){
						  //jAlert($('#contactform #message').val());
						  jQuery.validator.messages.required = "";
						  
						  $('#contactform').validate({
							  rules:  { 
										  name: "required",
										  email: {
													  required: true, 
													  email: true 
											     },
										  message: "required"		 
									  },
							  errorPlacement: function(error, element) {}						
						  });
						  
						  if($("#contactform").valid())
						  {
								return true;  
						  }
						  else
						  {
							    jAlert("One or more fields are missing or invalid.");
								return false;  
						  }
					  },
		success: function(data) { 
       				 jAlert(data); 
    			 } 	
    }); 
});
