
function addToFavorites(){
    var url = "http://www.syncallia.com";
    var title = "Syncallia - the private way to share anything with anyone";
    if (window.sidebar) {
        window.sidebar.addPanel(title, url, "");
    }
    else 
        if (window.external) {
            window.external.AddFavorite(url, title);
        }
        else {
            alert('Votre naviguateur ne permet pas de marquer cette page automatiquement, veuillez le faire manuellement ! ');
        }
}


Ajax.Responders.register({

    onCreate: function(){
        if ($('ajax_busy') && Ajax.activeRequestCount > 0) {
            Effect.Appear('ajax_busy', {
                duration: 0.5,
                queue: 'end'
            });
        }
    },
    
    onComplete: function(){
        if ($('ajax_busy') && Ajax.activeRequestCount == 0) {
            Effect.Fade('ajax_busy', {
                duration: 0.5,
                queue: 'end'
            });
        }
    }
    
});

function new_fullwindow(nom, url){
	if ( nom == "" ) { 
	  nom = Math.floor(Math.random() * 1000000 )+1;
	}	
    var w = window.open(url, nom, "status=yes,resizable=yes"); 
	w.focus();
}

function new_window(nom, url){
	if ( nom == "" ) { 
	  nom = Math.floor(Math.random() * 1000000 )+1;
	}
	
    var w = window.open(url, nom, "width=500px,height=500px,status=no,resizable=no"); 
	w.focus();
}


position_x = 0;
position_y = 0;


function position(evt){

    if (evt) { // Dans ce cas on obtient directement la position dans la page
        position_x = evt.pageX - (window.innerWidth - 799) / 2 - window.pageXOffset + 8;
        position_y = evt.pageY - 235;
        
    }
    else { // Dans ce cas on obtient la position relative à la fenêtre d'affichage
        position_x = event.clientX - (document.body.clientWidth - 799) / 2 - 440;
        position_y = event.clientY - 235;
    }
    
}

var Position = {
    getx: function(upid){
        return position_x;
    }
}

current_menu_contextuel = '';
isdisplayed_menu_contextuel = 0;

function set_curent_menu_contextuel(menu){
    current_menu_contextuel = menu
}


function fermer_menus(){

    if (current_menu_contextuel != undefined) {
        if (document.getElementById(current_menu_contextuel)) {
            document.getElementById(current_menu_contextuel).style.top = 0;
            document.getElementById(current_menu_contextuel).style.left = 0;
            document.getElementById(current_menu_contextuel).style.visibility = "hidden";
        }
    }
    
    isdisplayed_menu_contextuel = 0;
    
    
}





