File: //old_home_backup/themewsdentalstudio.co.uk/public_html/js/contact.js
$('.testimonial_middle').cycle({
fx: 'scrollUp'
});
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
$(window).ready(function() {
$('.clear_btn').click(function() {
$(".mustFields_01").val("");
document.getElementById('CaptchaError1').style.display = "none";
document.getElementById('CaptchaError2').style.display = "none";
});
$('.submit_btn_01').click(function() {
var valid = true;
$('.mustFields_01').each(function() {
if($(this).val() == '' || $(this).val() == 'Please enter...')
{
$(this).val('Please enter...');
valid = false;
}
else if($(this).attr('id') == 'formEmail'){
if (!filter.test($(this).val())) {
valid = false;
alert('Please enter a valid email address...');
}
}
else if($(this).attr('id') == 'txtInput')
{
if (document.getElementById('txtInput').value.split(' ').join('')!=document.getElementById('txtCaptcha').value.split(' ').join(''))
{
valid = false;
alert("Enter Validation code");
document.getElementById('CaptchaError1').style.display = "block";
document.getElementById('CaptchaError2').style.display = "none";
document.getElementById('txtInput').focus();
}
}
});
if(valid)
{
var msgbody = '<b>Name:</b> ' + $('#formSalu :selected').text() + ' ' + $('#formName').val() + '<br/><br/>' +
'<b>Address:</b><br/> ' + $('#formAddress').val().replace(/\r|\n|\r\n/g, '<br/>') + '<br/><br/>' +
'<b>Post Code:</b> ' + $('#formPostcode').val() + '<br/><br/>' +
'<b>Telephone Number:</b> ' + $('#formTel').val() + '<br/><br/>' +
'<b>Mobile Number:</b> ' + $('#formMob').val() + '<br/><br/>' +
'<b>Email:</b> ' + $('#formEmail').val() + '<br/><br/>' +
'<b>Additional Information:</b><br/> ' + $('#formMessage').val().replace(/\r|\n|\r\n/g, '<br/>') + '<br/><br/>' ;
$.post("sendemail.php", { emailFrom: $('#formEmail').val(), subject: 'Message From ' + $('#formName').val(), message: msgbody },
function(data){
$('.requestform').hide().html("<div class=\"thanks\" style=\"margin: 200px 0 0 0;\"> Thank you. Your request has been sent.</div>").fadeIn('fast');
}
);
}
return false;
});
$('.mustFields_01').click(function() {
if($(this).val() == 'Please enter...')
{
$(this).val('');
}
});
$('.mustFields_01').focus(function() {
if($(this).val() == 'Please enter...')
{
$(this).val('');
}
});
$('.mustFields_01').blur(function() {
if($(this).val() == '')
{
$(this).val('Please enter...');
}
});
$("#inline2").colorbox({width:"615", inline:true, href:"#light2"});
$('.submenu_wrapper').hide().height(0);
$('.menu').hover(
function () {
$(this).addClass('menu_fees');
$('.submenu_wrapper', this).stop().show().animate({height:182}, 300);
},
function () {
obj = this;
if( $(obj).children('div').size() == 0 ) $('.menu').removeClass('menu_fees');
$('.submenu_wrapper', this).stop().animate({height:0}, 300, function(){ $('.menu').removeClass('menu_fees'); $('.submenu_wrapper').hide(); });
}
);
imageCount = jQuery("#mygalthree").find("img").size();
$("#txtName").val("");
$("#txtEmail").val("");
$("#txtMobNo").val("");
$('.mustFields').click(function() {
if($(this).val() == 'Please enter...')
{
$(this).val('');
}
});
$('.mustFields').focus(function() {
if($(this).val() == 'Please enter...')
{
$(this).val('');
}
});
$('.mustFields').blur(function() {
if($(this).val() == '')
{
$(this).val('Please enter...');
}
});
$("#hrefHidden").colorbox({width:"615", inline:true, href:"#light1"});
$('#inline1').click(function() {
var valid = true;
$('.mustFields').each(function() {
if($(this).val() == '' || $(this).val() == 'Please enter...')
{
$(this).val('Please enter...');
$(this).addClass('error_input');
valid = false;
}
else if($(this).attr('id') == 'txtEmail')
{
if (!filter.test($(this).val()))
{
valid = false;
alert('Please enter a valid email address...');
}
}
});
if(valid)
{
$("#spanName").html($("#txtName").val());
$("#spanEmail").html($("#txtEmail").val());
$("#spanMobNo").html($("#txtMobNo").val());
$("#hrefHidden").trigger("click");
}
return false;
});
});