function expand_about(){
		var aboutit = $('#about .post');
		var about_height = aboutit.height();
		about_height = about_height+30;
		aboutit.height('100px');

			$('#about .more').click(function(){
				if(aboutit.height() == 100){
					aboutit.animate({ height:about_height+"px"}, 500);
					$(this).html('contraer &uarr;');	
				}else{
					aboutit.animate({ height:"100px"}, 500);
					$(this).html('expandir &darr;');
				}
				return false;
			});
}

function gofacebox(){
	 $('#blog a[rel*=facebox], #pics a[rel*=facebox]').click(function(){
			var link = $(this).attr('href');
			$.facebox('cargando...');
			var toload;
			$.ajax({
			   url: link,
				dataType: 'html',
			   success: function (data) {
					$('#facebox .popup .content').html($(data).find(".post"));
			   }
			});
		return false;
	});
	
}

function paginaitor(){
	// ajax pagination
		$('#wp_page_numbers a').click(function(){ // if not using wp-page-numbers, change this to correct ID
				var link = $(this).attr('href');
						// #main is the ID of the outer div wrapping your posts
				$('#blog-entries').html('<div class="loading"><h2>Respira... se está cargando...</h2></div>');
						// #entries is the ID of the inner div wrapping your posts
						$('#blog-entries').load(link+' #entries');
						return false;
				
		});
}

function contact_form(){
	$('#form-msg').hide();
	$('.contact-form input, .contact-form textarea').each(function(){
		$(this).focus(function() {
						if( this.value == this.defaultValue ) {
							this.value = "";
						}
					}).blur(function() {
						if( !this.value.length ) {
							this.value = this.defaultValue;
						}
					});
	});
	$('.contact-form form').submit(function(){
		var hasError = false;
		$('.requiredField').each(function() {
			if(jQuery.trim($(this).val()) == this.defaultValue) { //chekea que no esté vacio
				if($(this).hasClass('capter')) {
					$.facebox('Has olvidado ingresar la palabra "yoga"');
				 	 }else{
					 	$.facebox('Has olvidado ingresar tu '+this.defaultValue+'.');
				}
			 	hasError = true;
			}else 
				if($(this).hasClass('email')) { // chekea el mail
			 		var emailReg = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
			 		if(!emailReg.test(jQuery.trim($(this).val()))) {
			 			$.facebox('Ingresa un correo electrónico correcto');
			  			hasError = true;
			 		}
			}else 
					if($(this).hasClass('capter')) { 
						if(jQuery.trim($(this).val()) != 'yoga') {
							$.facebox('Ingresa correctamente la palabra "yoga"');
						 	hasError = true;
						}
							
					}
		});

			if(!hasError) { //si no hay error...
				$('#form-msg').fadeIn('fast', function(){
					$('#form-msg p').html('Enviando...');
				});
			}
			var formInput = $(this).serialize();
			   var jqxhr = $.post($(this).attr('action'),formInput, function(data){
			 	$('#form-msg p').html(data);
			}).error(function(){
				$('#form-msg p').html("404 - Error en el envío, pruebe más tarde.");
			});
			jqxhr.complete(function(){ 	$('#form-msg p').html('Envio completado, te responderé en breve.'); });
		return false;
	});
}


