function message(str){
	alert(str);
}
function isDomaineMaxiCheque(loca) {
    if(typeof(window.domaine) != "undefined" && loca.match(new RegExp("^http(?:s)?:\/\/[^.\/]*\\." + window.domaine.replace(/\./g, "\\.") + "(?:\:?\/?.*)", "i"))) {
        return true;
    }
    return true;
}

function message(str,useFermer){
    setOverlay(true);
   $("#pop-content").html(str);    
   $("#pop").css({display:"block"});   
   $urlImg = "skins/site/default/images/popup/basic/bt_pop.png";
   if(typeof useFermer !='undefined'){
       $urlImg = "skins/site/default/images/popup/basic/bt_fermer.png";
   }
   $("#bt-pop-ferme").attr("src",$urlImg) ;
    if(typeof window.mustHack !='undefined'){
        $("#pop").css({left:'50%',marginLeft:'-250px'});
   }
}
 
function partager(url,type){
    var obj = document.forms['formshare'];
    obj.url.value=url;obj.type.value=type;obj.submit()
}
/*  TRACKING */ 
function supDomaine(str){
    return str;
    
}
/* ne doit pas faire de return */
function trackPage(chaine){if(typeof(window.googleAna)!='undefined' && typeof(pageTracker)!="undefined"){
    pageTracker._trackPageview(supDomaine(chaine.toLowerCase())); 
}}
function trackEvent(category, action, identifiant, opt_value){
    if(typeof(window.googleAna)!='undefined'){

       var _category = category;
       if(category==undefined && category!=''){_category='no-definie';}
       
       var _action = action;
       if(action==undefined && action!=''){_action='no-definie';}
       
       var _identifiant = identifiant;
       if(identifiant==undefined || identifiant==''){_identifiant='no-definie';}
       
       var _opt_value = opt_value;
       if(opt_value==undefined && opt_value!=''){_opt_value='0';}
//,_opt_value   
       //pageTracker._trackEvent(_category.toLowerCase(), _action.toLowerCase(), _identifiant);
    }
}
/* Popup */
function setOverlay(show){
    $("#overlay").css({display:"none"});
    var sDisplay = "block";
    var w = 100;
    var h =100;
    if(show==false){
        sDisplay = "none";
    }
    $("#overlay").css({opacity:0.5,display:sDisplay,width:jQuery(window).width()+'px',height:jQuery(window).height()+'px'})
}
function closePop(){
    $("#pop").css({display:"none"});    
    setOverlay(false);
    $("#pop-content").html('');
}

function popupcentree(page,largeur,hauteur,options){
    var top=(screen.height-hauteur)/2;
    var left=(screen.width-largeur)/2;
    window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}
function initPopup(){
    $('.popup').each(function(index){
        if($(this).hasClass('invitation')){
            $(this).click(function(event) {
                event.preventDefault();
                popupcentree(this.href,440,700,"menubar=no,scrollbars=yes,statusbar=no")
            });
        }else if($(this).hasClass('offrir')){
            $(this).click(function(event) {
                event.preventDefault();
                popupcentree(this.href,865,710,"menubar=no,scrollbars=yes,statusbar=no")
            
            });
        }else if($(this).hasClass('contact')){
            $(this).click(function(event) {
                event.preventDefault();
                popupcentree(this.href,420,610,"menubar=no,scrollbars=no,statusbar=no")
            });
        }else if($(this).hasClass('cadeaux')){
            $(this).click(function(event) {
                event.preventDefault();
                popupcentree(this.href,490,740,"menubar=no,scrollbars=yes,statusbar=no")
            });
        }else if($(this).hasClass('reglement')){
            $(this).click(function(event) {
                event.preventDefault();
                popupcentree(this.href,440,620,"menubar=no,scrollbars=yes,statusbar=no")
            });
        }
    });
}
/* FACEBOOK */
function login(loginUrl){
    
    var  screenX    = typeof window.screenX != 'undefined' ? window.screenX : window.screenLeft,
         screenY    = typeof window.screenY != 'undefined' ? window.screenY : window.screenTop,
         outerWidth = typeof window.outerWidth != 'undefined' ? window.outerWidth : document.body.clientWidth,
         outerHeight = typeof window.outerHeight != 'undefined' ? window.outerHeight : (document.body.clientHeight - 22),
         width    = 500,
         height   = 270,
         left     = parseInt(screenX + ((outerWidth - width) / 2), 10),
         top      = parseInt(screenY + ((outerHeight - height) / 2.5), 10),
         features = (
            'width=' + width +
            ',height=' + height +
            ',left=' + left + 
            ',top=' + top
          );

    newwindow = window.open(loginUrl,'Login_by_facebook',features);

     if (window.focus) {newwindow.focus()}
}

