/* Author:
	@fileOverview Main JS file for verunkavlkova.com
	@author <a href="mailto:jacob.fierro@gmail.com">Jacob Fierro</a>
	@version 2011 first release
*/




(function(context, $, undefined){
	
	/**
	* @namespace Private NameSpaces
	*/
	var gallery = {},
		bio = {},
		contact = {};

	gallery.init = function() {
		$("a[rel^='prettyPhoto']").prettyPhoto({
			theme : "light_square",
			deeplinking : false
		});
	}

	function form_success(response, status, xhr, $form) {
		$('#response_target').html(response);
	    $('#contactform').hide();
	    $('#response').fadeIn();
	}

	contact.init = function() {
		$("#contactform").validate({
			submitHandler: function(form) {
				$(form).ajaxSubmit({
					success: form_success
				});
			},
			invalidHandler: function(form, validator) {
				log('invalid');
			}
		});

		$('.reload a').click(function(e) {
			e.preventDefault();
			$('#response').hide();
			$('#contactform').resetForm().fadeIn();
		});
	}

	bio.init = function() {
		$('#en').addClass('active');

		$('.button a').click(function(e) {
			e.preventDefault();

			$('.bio').addClass('hide');
			$('.'+$(this).attr('id')).removeClass('hide');

			$('.button').find('a').removeClass('active');
			$(this).addClass('active');
		});
	}

	context.init = function() {
		gallery.init();
		bio.init();
		contact.init();

		$('.tab').click(function(e){
			e.preventDefault();
			VV.router.goToTab($(this).attr('href'));
		});
	}

})(VV, jQuery);


$(document).ready(function() {
	VV.init();

	VV.Radio.Views.main = new VV.Radio.Views.Main;
});



