s).attr('href');
if(linking != ''){
$('#content').fadeOut('slow',function(){
$('#content').load(linking, function(){ $('#content').fadeIn('slow'); });
});
var paging = $(this).attr('title');
var hash3 = window.location.hash.substr(1); var harshArray3 = hash3.split('-'); window.location.hash = '2-'+harshArray3[1]+'-'+paging;
}
return false;
});
//$('#message').live('blur',function(){ alert($('textarea#message').val()); });
//FORM
$('.form_button').live('click',function(){
var lastname = $('#lastname').val(); var tlastname = $('#lastname').attr('title');
var firstname = $('#firstname').val(); var tfirstname = $('#lastname').attr('title');
var company = $('#company').val(); var tcompany = $('#lastname').attr('title');
var email = $('#email').val(); var temail = $('#lastname').attr('title');
var telephone = $('#telephone').val();
var fax = $('#fax').val();
var country = $('#country').val(); var tcountry = $('#lastname').attr('title');
var address = $('#address').val();
var postal = $('#postal').val();
var message = $('textarea#message').val();
//var send = 'email_div.php?lastname='+lastname+'&firstname='+firstname+'&company='+company+'&email='+email+'&telephone='+telephone+'&fax='+fax+'&country='+country+'&address='+address+'&postal='+postal+'&message='+message;
var send = 'lastname='+lastname+'&firstname='+firstname+'&company='+company+'&email='+email+'&telephone='+telephone+'&fax='+fax+'&country='+country+'&address='+address+'&postal='+postal+'&message='+message;
if($(":input").hasClass('error')){ alert("Il semble y avoir une erreur dans le formulaire. Merci de rectifier les cases en rouge."); return false; }
$.ajax({
type: "POST",
url: "email_div.php",
data: send,
success: function() {
//display message back to user here
$('#content').fadeIn('slow').html("
Message envoyé
Celui-ci a bien été reçu. Nous vous répondrons dans les meilleurs délais.
");
}
});
return false;
});
$(":input").live('click', function(){ var strval = $(this).val(); var strtitle = $(this).attr('title'); if( strtitle == strval){ $(this).val(''); } });
$(":input").live('blur', function(){
// Get the value, if it has ... inside then do nothing, else empty it.
var field = $(this).attr('name');
var classing = $(this).attr('class');
var there = classing.match('needed');
if( there == 'needed' ){
var strval = $(this).val();
var strtitle = $(this).attr('title');
if( strval == '' ){ $(this).val(strtitle); $(this).addClass('error'); }
else {
var value = $(this).val();
if( field == 'lastname' || field == 'firstname' || field == 'company' || field == 'country' ){
if(value.length < 4){
$(this).animate().addClass("error");
return false;
}
//if it's valid
else{
$(this).animate().removeClass("error");
return true;
}
}
if( field == 'email' ){
//var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var reg = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
var address = strval;
if(reg.test(address) == false) {
$(this).animate().addClass("error");
return false;
} else {
$(this).animate().removeClass("error");
}
}
}
} else {
var strval = $(this).val();
var strtitle = $(this).attr('title');
if( strval == '' ){ $(this).val(strtitle); }
}
});
});