var form = $(“#customForm”);
var name = $(“#name”);
var nameInfo = $(“#nameInfo”);
var city = $(“#city”);
var cityInfo = $(“#cityInfo”);
var email = $(“#email”);
var emailInfo = $(“#emailInfo”);
var documento = $(“#documento”);
var documentoInfo = $(“#documentoInfo”);
var twitter = $(“#twitter”);
var twitterInfo = $(“#twitterInfo”);
var facebook = $(“#facebook”);
var facebookInfo = $(“#facebookInfo”);
var link_site = $(“#link_site”);
var link_siteInfo = $(“#link_siteInfo”);
var curso = $(“#curso”);
var cursoInfo = $(“#cursoInfo”);
var inst = $(“#inst”);
var instInfo = $(“#instInfo”);
var message = $(“#message”);
//On blur
name.blur(validateName);
city.blur(validateCity);
email.blur(validateEmail);
documento.blur(validateDocumento);
twitter.blur(validateTwitter);
facebook.blur(validateFacebook);
link_site.blur(validateLink_site);
curso.blur(validateCurso);
inst.blur(validateInst);
//On key press
name.keyup(validateName);
city.keyup(validateCity);
email.keyup(validateEmail);
documento.keyup(validateDocumento);
twitter.keyup(validateTwitter);
facebook.keyup(validateFacebook);
link_site.keyup(validateLink_site);
curso.keyup(validateCurso);
inst.keyup(validateInst);
message.keyup(validateMessage);
//On Submitting
form.submit(function(){
if (validateName() & validateCity() & validateEmail() & validateDocumento() & validateTwitter() & validateFacebook() & validateLink_site() & validateCurso() & validateInst() & validateMessage()) {
return true;
}
else {
return false;
}
});
//validation functions
function validateEmail(){
//testing regular expression
var a = $(“#email”).val();
var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/;
//if it’s valid email
if(filter.test(a)){
email.removeClass(“error”);
emailInfo.text(“Digite um email valido”);
emailInfo.removeClass(“error”);
return true;
}
//if it’s NOT valid
else{
email.addClass(“error”);
emailInfo.text(“Redefina seu email pois ele está errado!”);
emailInfo.addClass(“error”);
return false;
}
}
function validateName(){
//if it’s NOT valid
if(name.val().length < 4){
name.addClass("error");
nameInfo.text("Digite seu nome completo");
nameInfo.addClass("error");
return false;
}
//if it's valid
else{
name.removeClass("error");
nameInfo.text("Seu nome completo por favor");
nameInfo.removeClass("error");
return true;
}
}
function validateDocumento(){
//testing regular expression
var a = $("#documento").val();
var filter = /[^0-9]+/g;
//if it's valid doc
if(filter.test(a)){
documento.removeClass("error");
documentoInfo.text("Digite um valor de documento valido!");
documentoInfo.removeClass("error");
return true;
}
//if it's NOT valid
else{
documento.addClass("error");
documentoInfo.text("Redefina valor de documento existem letras!");
documentoInfo.addClass("error");
return false;
}
}
function validateCity(){
//testing regular expression
var a = $("#city").val();
var filter =/[^a-z]+/gi;
if(filter.test(a)){
city.removeClass("error");
cityInfo.text("Digite uma cidade com apenas letras");
cityInfo.removeClass("error");
return true;
}
//if it's NOT valid
else{
city.addClass("error");
cityInfo.text("Redefina a cidade existem numeros!");
cityInfo.addClass("error");
return false;
}
}
function validateLink_site(){
//testing regular expression
var a = $("#link_site").val();
var filter =/[^a-z]+/gi;
if(filter.test(a)){
link_site.removeClass("error");
link_siteInfo.text("Digite o link do seu site/blog com letras apenas");
link_siteInfo.removeClass("error");
return true;
}
//if it's NOT valid
else{
link_site.addClass("error");
link_siteInfo.text("Redefina o nome do seu blog");
link_siteInfo.addClass("error");
return false;
}
}
function validateTwitter(){
//testing regular expression
var a = $("#twitter").val();
var filter =/[^a-z]+/gi;
if(filter.test(a)){
twitter.removeClass("error");
twitterInfo.text("Digite o link do seu twitter com letras apenas");
twitterInfo.removeClass("error");
return true;
}
//if it's NOT valid
else{
twitter.addClass("error");
twitterInfo.text("Redefina o seu twitter sem @");
twitterInfo.addClass("error");
return false;
}
}
function validateFacebook(){
//testing regular expression
var a = $("#facebook").val();
var filter =/[^a-z]+/gi;
if(filter.test(a)){
facebook.removeClass("error");
facebookInfo.text("Digite o link do seu site/blog com letras apenas");
facebookInfo.removeClass("error");
return true;
}
//if it's NOT valid
else{
facebook.addClass("error");
facebookInfo.text("Redefina o nome do seu blog");
facebookInfo.addClass("error");
return false;
}
}
function validateCurso(){
//if it's NOT valid
if(curso.val().length < 6){
curso.addClass("error");
cursoInfo.text("Digite seu nome do curso completo");
cursoInfo.addClass("error");
return false;
}
//if it's valid
else{
curso.removeClass("error");
cursoInfo.text("nome do curso muito curto, favor digitar nome completo");
cursoInfo.removeClass("error");
return true;
}
}
function validateInst(){
//if it's NOT valid
if(inst.val().length < 6){
inst.addClass("error");
instInfo.text("Digite seu nome da instituição completo");
instInfo.addClass("error");
return false;
}
//if it's valid
else{
inst.removeClass("error");
instInfo.text("nome da instituição muito curto, favor digitar nome completo");
instInfo.removeClass("error");
return true;
}
}
function validateMessage(){
//it's NOT valid
if(message.val().length < 10){
message.addClass("error");
return false;
}
//it's valid
else{
message.removeClass("error");
return true;
}
}
/* CONFIG */
/*——————————————————————-*/
body {
font-size:12px;
background:url(‘/bg.png’) top center;
}
#geral {
width:970px;
margin:0 auto;
}
/* CONTENT – POSTS */
/*——————————————————————-*/
#content {
width:970px;
margin:-40px 0 0 0;
}
#article {
background-color:#1f282f;
width:630px;
float:left;
padding:0 35px 0 35px;
margin:40px 0 0 0;
}
#article section {
padding:0 0 25px 0;
margin:0 0 25px 0;
border-bottom:1px solid #2d3942;
overflow:hidden;
}
#article .others {
width:315px;
float:left;
}
#article section .first {
width:55px;
float:left;
}
#article section .first .time {
width:40px;
background-color:#2d3942;
color:#cddb1c;
padding:5px 0 0 0;
text-align:center;
font-weight:700;
font-size:25px;
display:block;
}
#article section .first .time span {
display:block;
background-color:#cddb1c;
color:#2d3942;
width:40px;
height:15px;
font-weight:700;
font-size:12px;
margin:5px 0 0 0;
}
#article .others .last {
width:250px !important;
height:340px;
margin:0 10px 0 0;
}
#article section .last {
float:left;
width:575px;
}
#article .others h2 {
width:250px !important;
}
#article section .last h2 {
display:block;
margin:0 0 10px 0;
font-family:Helvetica, Arial, sans-serif;
}
#article .others .last h2 a {
font-size:22px !important;
}
#article section .last h2 a {
color:#cddb1c;
font-weight:700;
font-size:28px;
text-decoration:none;
}
#article section .last > p {
background-color:#2d3942;
padding:5px 10px 7px 10px;
margin:0 0 20px 0;
float:left;
color:#aebb1f;
}
#article section .last p strong {
font-weight:700 !important;
}
#article section .last > p > a {
color:#aebb1f;
text-decoration:none;
}
#article section .last > p > a:hover {
color:#FFF;
}
#article .others .last div {
width:250px !important;
clear:both;
}
#article section .last div {
width:575px;
clear:both;
}
#article section .last div p, #article section .last div blockquote {
line-height:18px;
margin:0 0 10px 0;
}
#article .others .last div p {
width:250px !important;
clear:both;
}
#article section .last div blockquote {
padding:15px 10px 10px 50px;
background:url(‘images/quote.jpg’) no-repeat 15px 10px #2d3942;
overflow:hidden;
}
#article section .last div p a, #article section .last div blockquote a {
/*padding:0 0 0 10px;
background:url(‘images/bglink.png’) no-repeat left center;*/
color:#cddb1c;
text-decoration:none;
}
#article section .last div p a:hover, #article section .last div blockquote a:hover {
text-decoration:underline;
}
#article section .last div h2 {
font-size:18px;
color:#4ecdc4;
line-height:25px;
}
#article section .last .leiamais {
color:#1f282f;
padding:5px 10px;
background-color:#cddb1c;
text-decoration:none;
margin:10px 0;
display:inline-block;
font-weight:700;
font-style:italic;
}
a img.alignright {
float:right;
margin: 5px 0 20px 20px;
}
a img.alignnone {
margin: 5px 20px 20px 0;
}
a img.alignleft, img.attachment-thumb-post {
float:left;
margin: 0 20px 20px 0;
}
a img.aligncenter {
display: block;
margin:20px auto;
}
/* FORMS */
/*——————————————————————-*/
.frm_form_fields label {
display:block;
font-weight:700;
}
.frm_form_fields .text, .frm_form_fields .textarea {
border:none;
padding:5px 7px;
margin:5px 0 15px 0;
background-color:#171e24;
color:#FFF;
width:250px;
}
.frm_form_fields .frm_description {display:none}
.frm_form_fields .textarea {
font-family:Arial, sans-serif;
width:350px;
}
.submit input {
border:none;
padding:7px 25px;
background-color:#cddb1c;
color:#1f282f;
font-size:18px;
font-style:italic;
font-weight:700;
cursor:pointer;
}
/*fomulario de inscricao*/
.clear{
clear: both;
height: 0;
visibility: hidden;
display: block;
}
a{
text-decoration: none;
}
strong{
font-weight: 700;
}
/******* CONTAINER *******/
#container{
width: 600px;
margin: 40px auto;
text-align: left;
}
/******* /CONTAINER *******/
/******* FORM *******/
#customForm{
padding: 0 10px 10px;
}
#customForm label{
display: block;
color: #797979;
font-weight: 700;
line-height: 1.4em;
}
#customForm input{
width: 220px;
padding: 6px;
color: #949494;
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 11px;
border: 1px solid #cecece;
}
#customForm input.error{
background: #f8dbdb;
border-color: #e77776;
}
#customForm textarea{
width: 550px;
height: 80px;
padding: 6px;
color: #adaeae;
font-family: Arial, Verdana, Helvetica, sans-serif;
font-style: italic;
font-size: 12px;
border: 1px solid #cecece;
}
#customForm textarea.error{
background: #f8dbdb;
border-color: #e77776;
}
#customForm div{
margin-bottom: 15px;
}
#customForm div span{
float:none;
margin-left: 10px;
color: #b1b1b1;
font-size: 11px;
font-style: italic;
}
#customForm div span.error{
color: #e46c6e;
}
#customForm #send{
background: #99CD00;
color: #fff;
font-weight: 700;
font-style: normal;
border: 0;
cursor: pointer;
}
#customForm #send:hover{
background: #99CD00;
opacity:0.6;
}
#error{
margin-bottom: 20px;
border: 1px solid #efefef;
}
#error ul{
list-style: square;
padding: 5px;
font-size: 11px;
}
#error ul li{
list-style-position: inside;
line-height: 1.6em;
}
#error ul li strong{
color: #e46c6d;
}
#error.valid ul li strong{
color: #93d72e;
}
/******* /FORM *******/
$(function(){
// esconde o conteúdo de “saiba mais” que fica no rodape da pagina
$(‘div#contentcolumn .relacionada’).hide();
// armazena o conteudo da div
var contentDivSaibaMais = $(‘div#contentcolumn .relacionada’).html();
$(‘div#contentcolumn .new-div-relacionada’).html(contentDivSaibaMais);
});