<!-- To open an html popup -->
function popup(adr, name, width, height, is_scrollbar) {
	if (typeof(name) == "undefined") {
		name = "popup";
	}
	if (typeof(width) == "undefined") {
		width = screen.width;
	}
	if (typeof(height) == "undefined") {
		height = screen.height;
	}
	if (typeof(is_scrollbar) == "undefined") {
		is_scrollbar = "no";
	}
	var largeur=screen.availWidth;
    var hauteur=screen.availHeight;
    var demiL=(eval(largeur-width)/2);
    var demiH=(eval(hauteur-height)/2);

    var windowHandle = window.open(adr,name,'toolbar=no, resizable=no, scrollbars=no, width='+width+',height='+height+',top='+demiH+',left='+demiL);
}

<!-- Google Analytics tag -->
function toGA() {
	try {
		pageTracker._trackPageview("/cequevousvoulez/");
	} catch(err) {}
}

<!-- Redirection to HTML version -->
function redirect() {
	window.location.replace("http://url/de/redirection/");
}

<!-- Place the focus on the swf object -->
function setFlashFocus() {
	if (document.getElementById('content')) {
		document.getElementById('content').focus();
	}
}

<!-- Facebook Connect -->

var as_swf_name = "content";

//Initialize Facebook
function fbInit(pAsSwfName,pApi_key,pReceiver){
	as_swf_name = pAsSwfName;
	FB.init(pApi_key,pReceiver);
}

//JavaScript Connect methods
function login(){
	//FB.Connect.requireSession( onLoginHandler, onCancelHandler );
	//<!--
	FB_RequireFeatures(["Connect", "Api", "CanvasUtil", "XdComm", "XFBML", "Common", "Base"], function(){
        //create apiclient object
        FB.Facebook.init("b338ddbf280d89edb93f386fb5b24c69", "/xd_receiver.htm");
        
        //require session to be current
        FB.Connect.requireSession(function(exeption){
            //grab the id of each of our friends
            FB.Facebook.apiClient.friends_get(new Array(), function(users, exception)
            {
                //this is the rewritten parse method. make sure it's already been loaded by putting it within the FB_RequreFeatures
                FB.JSON.parse=function(text,reviver){
                    var j;
                    function walk(a,c)
                    {
                        var b,d,e=a[c];
                        if(e&&typeof e==='object')
                            for(b in e)
                                if(Object.hasOwnProperty.call(e,b))
                                {
                                    d=walk(e,b);
                                    if(d!==undefined){
                                        e[b]=d;
                                    }else delete e[b];
                                }
                            return reviver.call(a,c,e);
                    }
                    var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
                    cx.lastIndex=0;
                    if(cx.test(text)){
                        text=text.replace(cx,function(a){ return '\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4); });
                    }

                    var replacedText = text.replace(/\\\'/g, '\'');
                    replacedText = replacedText.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,'');
                    if(/^[\],:{}\s]*$/.test(replacedText))
                    {
                        j=eval('('+text+')');
                        return typeof reviver==='function'?walk({'':j},''):j;
                    }
                    throw new SyntaxError('JSON.parse');
                };                
                
                onLoginHandler();
            })
        },
		onCancelHandler ,
		false
		)
    })
	//-->
}

//Event Handlers
function onLoginHandler(){
	flashCallBack( "onLogIn" );
}

function onCancelHandler(){
	flashCallBack( "onCancel" );
}

//Method to dispatch an Event to Flash
function flashCallBack ( func ) {
  if( arguments.length > 1 ){
    document[as_swf_name][func]( Array.prototype.slice.call(arguments).slice(1)[0]);
  }else{
    document[as_swf_name][func]();
  }
}
