//form validation
function validateName(fld) {
var error = "";
if (fld.value === '' || fld.value === 'Nickname' || fld.value === 'First Name') {
error = "You didn't enter Your First Name.\n";
} else if ((fld.value.length < 2) || (fld.value.length > 50)) {
error = "First Name is the wrong length.\n";
}
return error;
}
function validateEmail(fld) {
var error="";
var illegalChars = /^[^@]+@[^@.]+\.[^@]*\w\w$/;
if (fld.value === "") {
error = "You didn't enter an email address.\n";
} else if ( fld.value.match(illegalChars) === null) {
error = "The email address contains illegal characters.\n";
}
return error;
}
function validateMessage(fld) {
var error = "";
if (fld.value === '' || fld.value === 'Message') {
error = "You didn't enter Your message.\n";
} else if (fld.value.length < 3) {
error = "The message is to short.\n";
}
return error;
}
function validateLastname(fld) {
var error = "";
if (fld.value === '' || fld.value === 'Nickname' || fld.value === 'Enter Your Name..' || fld.value === 'Your Name..') {
error = "You didn't enter Your last name.\n";
} else if ((fld.value.length < 2) || (fld.value.length > 50)) {
error = "Last Name is the wrong length.\n";
}
return error;
}
function validatePhone(fld) {
var error = "";
var illegalChars = /^\+?s*\d+\s*$/;
if (fld.value === '') {
error = "You didn't enter Your phone number.\n";
} else if ( fld.value.match(illegalChars) === null) {
error = "Please enter a valid phone number.\n";
}
return error;
}
/*---------------------------------
MAIN SLIDER
---------------------------------*/
jQuery("#featured-slider").bxSlider({
pagerCustom: "#featured-slider-pager",
controls: false,
auto: true,
mode: "horizontal", // horizontal, vertical, fade
captions: true,
onSlideAfter: function(){
// do mind-blowing JS stuff here
function playVideoYoutube(frame) {
frame.each(function(i) {
var func = this === frame ? 'playVideo' : 'pauseVideo';
this.contentWindow.postMessage('{"event":"command","func":"' + func + '","args":""}', '*');
});
}
function playVideoVimeo(frame) {
frame.each( function() {
var url = jQuery(this).attr('src').split('?')[0];
this.contentWindow.postMessage(JSON.stringify({ method: 'pause' }), url);
});
}
jQuery("ul#featured-slider li").each(function( index ) {
var element = jQuery(this).find("iframe");
playVideoYoutube(element);
playVideoVimeo(element);
});
}
});
jQuery("#featured-slider-pager a").click(function() {
if(jQuery(this).hasClass("active")) {
window.location=jQuery(this).attr("href");
}
});
/*---------------------------------
POST SLIDER
---------------------------------*/
jQuery(".slider ul").bxSlider({
mode: "fade", // horizontal, vertical, fade
captions: false,
controls: false,
auto: true});
/*---------------------------------
WIDGET SLIDER
---------------------------------*/
jQuery(".widget-slider ul").bxSlider({
mode: "horizontal", // horizontal, vertical, fade
pause: 3000,
captions: true,
controls: true,
pager: false,
auto: true,
prevText: "",
nextText: ""
});