$(function(){
	jQuery('a[rel*=facebox]').facebox();

	$("a#solicitar-animais").click(function(){
		$("#formSolicita").toggle('fast');	
	});

	$("#listaVideos li").click(function(){
		rel = $(this).find('a').attr('rel');
		alterarVideo(rel);
		$("#listaVideos .ativo").removeClass('ativo');
		$(this).addClass('ativo');
	});
	$('#prod-caracteristica').corner("15px");
});

function alterarVideo(idvideo)
{
	$.ajax({
		type: "POST",
		data: {idvideo: idvideo},
		url: "inc_alterar_video.php",
		success: function(html)
		{
			$("#video").empty();
			$("#video").append(html);
		}
	});
}

function digitos(event){
	if (window.event) {
		// IE
		var key = event.keyCode;
	} else if ( event.which ) {
		// netscape
		var key = event.which;
	}

	if ( key != 8 || key != 13 || key < 48 || key > 57 )
		return ( ( ( key > 47 ) && ( key < 58 ) ) || ( key == 8 ) || ( key == 13 )  || ( key == undefined ) );
	return true;
}


function checkMail(mail){
	var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
	if(typeof(mail) == "string"){
		if(er.test(mail)){ return true; }
	}else if(typeof(mail) == "object"){
		if(er.test(mail.value)){
			return true;
		}
	}else{
		return false;
	}
}
