/**
 * @author: Martin Prado - mprado@spartan-code.com
 */

$(document).ready(function() {
   //Search clear on focus and onblur
   $("#search").focus(function() {
	 if ($(this).val() == $(this).attr("title")) {
		$(this).val('');
	 }
	 }); 
	 $("#search").blur(function() {
		 if ($(this).val() == '') {
			 $(this).val($(this).attr("title"));
		 }
	});
	//Search clear on focus and onblur
   $("#search_contenedor").focus(function() {
	 if ($(this).val() == $(this).attr("title")) {
		$(this).val('');
	 }
	 }); 
	 $("#search_contenedor").blur(function() {
		 if ($(this).val() == '') {
			 $(this).val($(this).attr("title"));
		 }
	});
	//Newsletter
	$("#newsEmail").focus(function() {
	 if ($(this).val() == $(this).attr("title")) {
		$(this).val('');
	 }
	 }); 
	 $("#newsEmail").blur(function() {
		 if ($(this).val() == '') {
			 $(this).val($(this).attr("title"));
		 }
	});
	//Nueva Busqueda
   $("#new_search").focus(function() {
	 if ($(this).val() == $(this).attr("title")) {
		$(this).val('');
	 }
	 }); 
	 $("#new_search").blur(function() {
		 if ($(this).val() == '') {
			 $(this).val($(this).attr("title"));
		 }
	});
	 
	 //$('#myselectbox').selectbox();
	 
	// spartanFixHeight($(".faux"));
});

//Spartan Fix Height
//Stretches the 3 columns of the same high
function spartanFixHeight(group)
{
    tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if (thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}

function votarEncuesta()
{
	if ($("input[name='encuesta']:checked").val() != null) {
		$('#load_encuesta').show();
		var votoUser = $("input[name='encuesta']:checked").val();
		alert(votoUser);
		jQuery.get('../html/@originales/inc/encuesta.php', { voto: votoUser} , 
		function(data) {
			$('#encuesta').html(data);
			$('#load_encuesta').hide();
		  }
		, "html" );
	}
}