<!--

function ajax_form(form, _url) 
{    
    if(typeof(_url) == 'undefined'){
        _url = $(form).attr("action");
    }
    
    $.ajax({type: $(form).attr("method"), url: _url , data: $(form).serialize(), success: function (data) {eval(data);}}); 
}


function guest_message(_msg, _function)
{
    if(_msg){
        alert(_msg);   
    }
    
    if( typeof(_function) == 'function' ){
        _function();    
    }
}

function scroll_to_element(_el)
{
    $('html,body').animate({scrollTop:$(_el).offset().top},'normal');    
}


String.prototype.is_mail = function(){
    var filter_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    return filter_email.test(this);
}

String.prototype.is_postcode = function(){
    var filter_postcode=/^\d{5}$/i;
    return filter_postcode.test(this);
}

String.prototype.is_phone = function(){
    filter_phone = /^[+0-9. ()-]*$/i;
    return filter_phone.test(this);
}

String.prototype.is_date = function(){
    var filter_date=/^\d{2}\/\d{2}\/\d{4}$/i;
    return filter_date.test(this);
}

function PopupCentrer(page,name,largeur,hauteur,options) 
{
    var top=(screen.height-hauteur)/2;
    var left=(screen.width-largeur)/2;
    
    window.open(page,"_blank","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}




jQuery.extend(jQuery.fn,
{
    isAncestor:function(_parent) 
    {
        _parent = _parent[0];
        var walker = $(this)[0];
        while (walker != document.body) {
            walker = walker.parentNode;
            if (_parent == walker) return true;
        }
        return false;           
    }
});
    




