function dump(arr,level) {var dumped_text = "";if(!level) level = 0; var level_padding = "";for(var j=0;j<level+1;j++) level_padding += "    ";if(typeof(arr) == 'object') {for(var item in arr) {var value = arr[item];if(typeof(value) == 'object') {dumped_text += level_padding + "'" + item + "' ...\n";dumped_text += dump(value,level+1);} else {dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";}}} else { dumped_text = "===>"+arr+"<===("+typeof(arr)+")";}    return dumped_text;}

var Camorra = [];
Camorra.Session = FB_CW_SES;
Camorra.Walkthrough = [];
Camorra.Facebook = [];
Camorra.Gallery = [];
Camorra.Admin = [];

Camorra.Admin.OpenPopup = function(url, w, h) {
    var pwidth = w || 700;
    var pheight = h || 600;
    var iwidth = pwidth-3;
    var iheight = pheight-35;
    if( $('#admin_popup').length ) {$('#admin_popup').show();} 
    else {$('#container').append('<div id="admin_popup" style="position:absolute;top:50px;right:25px;border:5px solid #CCC;width:100%;height:'+pheight+'px;background-color:#000;z-index:5000;"></div>');}   
    $('#admin_popup').html('<div style="line-height:30px;font-face:Verdana;font-weight:bold;height:30px;border:1px solid #AAA;text-align:center;background-color:#EFEFEF;cursor:pointer;" onclick="javascript:$(\'#admin_popup\').hide();">Close popup</div><iframe src="'+url+'" style="height:'+iheight+'px;width:100%;" height="'+iheight+'px" width="100%"></iframe>'); 
}

Camorra.Gallery.Init = function() {
    Camorra.Gallery.Shadowbox = Shadowbox;
    Camorra.Gallery.Shadowbox.init({skipSetup:true,continuous:true,overlayOpacity:"0.8",handleOversize:"resize"});
}
Camorra.Gallery.OpenScreenshots = function () {
    Camorra.Gallery.Shadowbox.open([
            {content:LAYOUT_PATH+'../3/images/layout_facebook/screenshots/1.jpg',player:"img",title:"",width:709},
            {content:LAYOUT_PATH+'../3/images/layout_facebook/screenshots/2.jpg',player:"img",title:"",width:709},
            {content:LAYOUT_PATH+'../3/images/layout_facebook/screenshots/3.jpg',player:"img",title:"",width:709},
            {content:LAYOUT_PATH+'../3/images/layout_facebook/screenshots/4.jpg',player:"img",title:"",width:709},
            {content:LAYOUT_PATH+'../3/images/layout_facebook/screenshots/5.jpg',player:"img",title:"",width:709},
            {content:LAYOUT_PATH+'../3/images/layout_facebook/screenshots/6.jpg',player:"img",title:"",width:709},
            {content:LAYOUT_PATH+'../3/images/layout_facebook/screenshots/7.jpg',player:"img",title:"",width:709},
            {content:LAYOUT_PATH+'../3/images/layout_facebook/screenshots/8.jpg',player:"img",title:"",width:709},
            {content:LAYOUT_PATH+'../3/images/layout_facebook/screenshots/9.jpg',player:"img",title:"",width:709}           
        ]    
    );                 
};

Camorra.CheckDocumentForIframe_check = function() {
    if(top === self) {Camorra.has_iframe = 0;} 
    else {Camorra.has_iframe = 1;}
}
Camorra.CheckDocumentForIframe_execute = function() {
    if( Camorra.has_iframe === 1) {
        addNotice(2, 'Use Facebook layout?', '<a href="/user/settings.php?DoLayout=3&facebook=1">Click here to set Facebook layout</a>');
    }
}
Camorra.SetFacebookLayoutInFacebookIframe = function() {
    setTimeout("Camorra.CheckDocumentForIframe_check()",500); 
    setTimeout("Camorra.CheckDocumentForIframe_execute()",1000);  
}

Camorra.Facebook.AppData = [];  
Camorra.Facebook.AppUser = [];
Camorra.Facebook.AppUser.data = [];
Camorra.Facebook.AppUser.friends = [];
Camorra.Facebook.Credits = [];
Camorra.Facebook.Graph = [];
Camorra.Facebook.Publish = [];
Camorra.Facebook.Publish.to = 0;  
    
switch(HOSTNAME) {
    case 'www.camorraworld.nl' :
        Camorra.Facebook.AppData.id = '129796350407928';
        Camorra.Facebook.AppData.key = '87c62a1a2bd513b72fe2d3a57887793a';
        break;

    case 'www2.camorraworld.nl' :
        Camorra.Facebook.AppData.id = '129796350407928';
        Camorra.Facebook.AppData.key = '87c62a1a2bd513b72fe2d3a57887793a';
        break;
        
    case 'www.camorraworld.org' :
        Camorra.Facebook.AppData.id = '153561751827';
        Camorra.Facebook.AppData.key = '41306adbc1db1c33cedf1a7896250415';
        break;
        
    default :
        Camorra.Facebook.AppData.id = '130605796993676';
        Camorra.Facebook.AppData.key = '76db43d8d20f036c5dc79005d72be0f7';
        break;
}    

Camorra.Init = function() {
    setTimeout("Camorra.Walkthrough.Init()",1000);
}

Camorra.Walkthrough.Init = function() {
    if($('div.walkthrough_container').length > 0) {
        $('div.walkthrough_container_bg').height($('div.walkthrough_container').height());
        $('div.walkthrough_container_dragger').height($('div.walkthrough_container').height()-40);
        $('div.walkthrough_container_dragger').draggable();
        $('div.walkthrough_container_dragger').bind("drag", function(event, ui) {
            Camorra.Walkthrough.Drag($('div.walkthrough_container_dragger').position().top-40, $('div.walkthrough_container_dragger').position().left);         
        });
        if( WALKTHROUGH_SHOW === 1 ) { Camorra.Walkthrough.Show();}
        if( WALKTHROUGH_ICON === 1 ) { Camorra.Walkthrough.ShowIcon();}
    }
}
Camorra.Walkthrough.Drag = function(top, left) {
    $('div.walkthrough_container').css('top',top+'px');
    $('div.walkthrough_container').css('left',left+'px');
    $('div.walkthrough_container_bg').css('top',top+'px');
    $('div.walkthrough_container_bg').css('left',left+'px');    
}
Camorra.Walkthrough.Show = function() {
    if( WALKTHROUGH_SHOW != 1 ) {Camorra.Walkthrough.ToggleUpdate();}
    $('div.walkthrough_container').show(700);
    $('div.walkthrough_container_bg').show(700);
    $('div.walkthrough_container_dragger').show(700);
    $('div.walkthrough_icon').hide();     
}
Camorra.Walkthrough.Hide = function() {
    if( WALKTHROUGH_SHOW === 1 ) { Camorra.Walkthrough.ToggleUpdate();  }
    $('div.walkthrough_container').hide(300);
    $('div.walkthrough_container_bg').hide(300);
    $('div.walkthrough_container_dragger').hide(300);
    Camorra.Walkthrough.ShowIcon();      
}
Camorra.Walkthrough.ShowIcon = function() {
    setTimeout("$('div.walkthrough_icon').show()", 300);
    setTimeout("$('div.walkthrough_icon').hide()", 500);
    setTimeout("$('div.walkthrough_icon').show()", 700);
    setTimeout("$('div.walkthrough_icon').hide()", 900);
    setTimeout("$('div.walkthrough_icon').show()", 1100);
}
Camorra.Walkthrough.ToggleUpdate = function() {
    var call_link = 'http://'+HOSTNAME+'/sys/CWE/cwe.doaction.php?type=toggle_walkthrough';
    $.getJSON(call_link+'&callback=?');    
}

Camorra.Facebook.Init = function(FacebookJsObject) {
    Camorra.FbKit = FacebookJsObject;
    
    /* bij de init functie kan nog sessie vanuit php->cookie meegegeven worden*/
    /* en moet nog asynchronous laden */
    window.fbAsyncInit = function() {
        /*FB.init({appId: 'your app id', status: true, cookie: true, xfbml: true});*/

        Camorra.FbKit.init({appId:Camorra.Facebook.AppData.id, status: true, cookie: true, xfbml: true},"http://"+HOSTNAME+"/facebook/xd_receiver.htm");
        
        /* buggy shit in FB SDK : http://bugs.developers.facebook.net/show_bug.cgi?id=10889 */
        Camorra.FbKit.Canvas.setSize({height:$(document.body).height() + 20});
        Camorra.FbKit.Canvas.setAutoResize();
        Camorra.FbKit.Canvas.setSize({height:$(document.body).height() + 20});
        Camorra.FbKit.Canvas.HACKscrollCanvas = function(x, y) {
            if( y > 400 ) {
                $("body").append('<iframe id="scrollTop" style="border:none;width:1px;height:1px;position:absolute;top:-10000px;left:-100px;" src="http://static.ak.facebook.com/xd_receiver_v0.4.php?r=1#%7B%22id%22%3A0%2C%22sc%22%3Anull%2C%22sf%22%3A%22%22%2C%22sr%22%3A2%2C%22h%22%3A%22iframeOuterServer%22%2C%22sid%22%3A%220.957%22%2C%22t%22%3A0%7D%5B0%2C%22iframeInnerClient%22%2C%22scrollTo%22%2C%7B%22x%22%3A'+x+'%2C%22y%22%3A'+y+'%7D%2Cfalse%5D" onload="$(\'#scrollTop\').remove();"></iframe>');
                window.scroll(0,y-40);
            }
        } 
        
        Camorra.FbKit.Event.subscribe('auth.login', function(response) {});
        Camorra.FbKit.Event.subscribe('auth.logout', function(response) {window.location.href = 'http://'+HOSTNAME+'/facebook/canvas_callback_url_2.0.php'; });
        Camorra.FbKit.Event.subscribe('auth.sessionChange', function(response) {
            if (response.session) {
          
            } else {

            }
        });
        
        Camorra.Facebook.AppData.access_token = '';
        Camorra.Facebook.AppData.uid = 0;
        Camorra.Facebook.CheckLoginStatus();
        Camorra.Facebook.AppUser.LoadExtraInfo();
        Camorra.Facebook.AppUser.friends_loaded = 0;        
        
    };
    (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol +
        '//connect.facebook.net/en_US/all.js';
        document.getElementById('fb-root').appendChild(e);
    }());    

}

Camorra.Facebook.Login = function() {
    Camorra.FbKit.login(function(response) {
        if (response.session) {
                window.location.href = 'http://'+HOSTNAME+'/facebook/canvas_callback_url_2.0.php';
            } else {
                //alert('login failed')
            }
        },{perms:''}
    );
};
Camorra.Facebook.Logout = function() {
    Camorra.FbKit.logout(function(response) {
        window.location = '/sys/login.php?dologout&FB';
    });   
}
Camorra.Facebook.CheckLoginStatus = function() {
    Camorra.FbKit.getLoginStatus(function(response) {
        if (response.session) {
            Camorra.Facebook.AppUser.data = response.session;
            Camorra.Facebook.AppUser.data.logged_in = 1;
            Camorra.Facebook.AppUser.data.loaded = 1;   
            return 1;
        } else {
            return 0;
        }
    });
};

Camorra.Facebook.Publish.SetSelectedFriend = function(friend_id) {
    /*var select_box = $('div#'+select_container+' select');*/
    Camorra.Facebook.Publish.to = friend_id;
}
Camorra.Facebook.Publish.Stream = function(data) {
    if( "first_name" in Camorra.Session && "uid" in Camorra.Session && Camorra.Session.uid > 0 ) { var FbLoginSes = 'true'; } else { var FbLoginSes = 'false'; Camorra.Session.first_name = USERNAME; }
    
    var dialogTitle = 'Camorra World'; 
    var dialogTitleHref = 'http://'+HOSTNAME+'/friend/index.php?friend=facebookcriminal-'+USERNAME;
    var dialogPic = 'http://'+HOSTNAME+'/style/3/images/layout_facebook/publish_icons/logo_with_wanted.jpg';
    var dialogActionlink = [{text:CW_JS_LANG[170],href:'http://'+HOSTNAME+'/friend/index.php?friend=facebookcriminal-'+USERNAME}];
    var dialogActions = [{name:CW_JS_LANG[170],link:'http://'+HOSTNAME+'/friend/index.php?friend=facebookcriminal-'+USERNAME}];
    var userCustomMsg = '';  
    
    var uidata = 
        {
            method: 'stream.publish',
            link : "http://"+HOSTNAME+"/friend/index.php?friend=facebookcriminal-"+USERNAME,
            actions : dialogActions,
            message : userCustomMsg,
            picture : dialogPic,
            href: dialogTitleHref 
        } 
        
    /* Checken of target friend heeft en als nog niet geset, friend selecten */
    if( (data.type == 'stats-to-friend' || data.type == 'action-to-friend' || data.type == 'invite-friend' || data.type == 'share-news-to-friend') && Camorra.Facebook.Publish.to < 1 ) {
        if( FbLoginSes == 'false' ) {
            Camorra.Facebook.Login();
        } else {
            Camorra.Facebook.AppUser.LoadFriendOptionsInContainer(data.btn_container);    
        }   
    } else { 
        
        if( data.type == 'stats-to-friend' || data.type == 'action-to-friend'|| data.type == 'invite-friend' || data.type == 'share-news-to-friend' ) { uidata['to'] = Camorra.Facebook.Publish.to; }
        switch(data.type) {
            case 'stats' :
            case 'stats-to-friend' :
                var stats_properties = data.stats_string.split(', ');
                var json_properties = '';
                for( prop in stats_properties ) {
                    var temp = stats_properties[prop];
                    if(typeof(temp) == 'string') {
                        var propdata = temp.split(': ');
                        json_properties = json_properties + '"' + propdata[0] + '":"' + propdata[1] + '",';
                    }
                } 
                uidata['picture'] = 'http://'+HOSTNAME+'/style/3/images/layout_facebook/publish_icons/my_score_logo.jpg'; 
                uidata['properties'] = '{' + json_properties + '}';
                uidata['name'] = Camorra.Session.first_name + CW_JS_LANG[162]; 
                uidata['caption'] = CW_JS_LANG[163] + USERNAME + CW_JS_LANG[164];
                uidata['description'] = CW_JS_LANG[165];
                break;
                
            case 'action' :
            case 'action-to-friend' :
                uidata['picture'] = 'http://'+HOSTNAME+'/style/3/images/layout_facebook/publish_icons/logo_with_wanted.jpg'; 
                uidata['name'] = Camorra.Session.first_name + ' ' + data.action_title + CW_JS_LANG[168]; 
                uidata['caption'] = Camorra.Session.first_name + ' ' + data.action_text;
                uidata['description'] = CW_JS_LANG[167] + Camorra.Session.first_name + CW_JS_LANG[169];
                uidata['properties'] = '{"'+CW_JS_LANG[175]+'":"'+USERNAME+'","'+CW_JS_LANG[176]+'":"'+data.rank+'"}';
                break; 
                
            case 'share-news-to-wall' :
            case 'share-news-to-friend' :
                uidata['link'] = "http://"+HOSTNAME+"/sys/news.php?newsid="+data.id; 
                uidata['picture'] = 'http://static.camorraworld.nl/style/3/images/layout_facebook/publish_icons/logo_default.jpg';  
                uidata['name'] = data.title; 
                uidata['caption'] = CW_JS_LANG[172];
                uidata['description'] = CW_JS_LANG[173] + ' ' + USERNAME + ' ' + CW_JS_LANG[174];
                uidata['properties'] = '{"'+CW_JS_LANG[177]+'":"'+data.author+'","'+CW_JS_LANG[178]+'":"'+data.date+'","URL":{"text":"http://'+HOSTNAME+"/sys/news.php?newsid="+data.id+'","href":"http://'+HOSTNAME+"/sys/news.php?newsid="+data.id+'"}}';
                break;
                       
            case 'direct-invite' :
                Camorra.Facebook.Publish.to = data.friend_id;
                uidata['to'] = data.friend_id;  
            case 'invite-wall' :
            case 'invite-friend' :
                uidata['picture'] = 'http://'+HOSTNAME+'/style/3/images/layout_facebook/publish_icons/logo_with_wanted.jpg';  
                uidata['name'] = Camorra.Session.first_name + CW_JS_LANG[109];
                uidata['caption'] = CW_JS_LANG[110]; 
                uidata['description'] = CW_JS_LANG[167] + Camorra.Session.first_name + CW_JS_LANG[169]; 
                break;               
        }
        
        if( "cw_publish_pic" in data && data.cw_publish_pic != '' ) {uidata['picture'] = data.cw_publish_pic;}
        /*alert(uidata['picture']);*/
        
        Camorra.FbKit.ui(
            uidata, 
            function(response) {
                Camorra.Facebook.AppUser.CloseFriendOptionsContainer(data.btn_container);
            }
        );

        Camorra.FbKit.Canvas.HACKscrollCanvas(10,$('div.fb_dialog_content').offset().top);  
    }
}

Camorra.Facebook.Credits.Buy = function() {
    var obj = {method: 'pay.prompt',credits_purchase: true};
    Camorra.FbKit.ui(obj, function(response) {
        
    }); 
};
Camorra.Facebook.Credits.Order = [];
Camorra.Facebook.Credits.Order.star_gain = 0;
Camorra.Facebook.Credits.Order.vip_item = 0;
Camorra.Facebook.Credits.Order.Star = function(amount) {
    this.star_gain = amount;
    switch(this.star_gain) {
        case 1 : this.price = 20; break;
        case 2 : this.price = 40; break;
        case 5 : this.price = 95; break;
        case 25 : this.price = 450; break;
        case 50 : this.price = 700; break;
    }
    this.Place();
};
Camorra.Facebook.Credits.Order.Item = function(vip_item) {
    this.vip_item = vip_item;
    switch(this.vip_item) {
        case 1 : this.price = 40; break;
        case 2 : this.price = 20; break;
        case 3 : this.price = 40; break;
        case 4 : this.price = 20; break;
        case 5 : this.price = 40; break;
        case 6 : this.price = 40; break;
        case 7 : this.price = 40; break;
        case 8 : this.price = 450; break;
        case 9 : this.price = 40; break;
        case 10 : this.price = 40; break;
        case 11 : this.price = 20; break;
        case 12 : this.price = 20; break;
        case 13 : this.price = 20; break;
        case 14 : this.price = 20; break;
        case 99 : this.price = 5; break;
    }
    this.Place();
};
Camorra.Facebook.Credits.Order.Place = function() {   
    if( this.star_gain > 0 ) {
        this.title = this.star_gain + CW_JS_LANG[220];
        this.desc = CW_JS_LANG[221];        
        this.notice_description = this.title;
    }
    if( this.vip_item > 0 ) {
        var lang_index = this.vip_item + 200;
        this.title = CW_JS_LANG[222];
        this.desc = CW_JS_LANG[lang_index];  
        this.notice_description = this.desc;      
    }
 
    this.img_url = LAYOUT_PATH + 'images/layout_facebook/publish_icons/logo_default.jpg'; 
    this.product_url = 'http://' + HOSTNAME + '/sys/vip/';  
    
    this.price = this.price;
    
    // Order info object samenstellen
    var order_info = { 
        "criminal":USERNAME,
        "title":this.title,
        "description":this.desc,
        "star_gain":this.star_gain,
        "vip_item":this.vip_item,
        "price":this.price,
        "image_url":this.img_url,
        "product_url":this.product_url
    };

    // Popup object genereren en weergeven
    var popup = {method: 'pay.prompt',order_info: order_info,purchase_type: 'item'};

    Camorra.FbKit.ui(popup, this.Verify);        
}
Camorra.Facebook.Credits.Order.Verify = function(data) {
    fb_api_ec = [];
    fb_api_ec['1383001'] = "Facebook system issue.";
    fb_api_ec['1383002'] = "Error in order info.";
    fb_api_ec['1383003'] = "Payment process declined.";
    fb_api_ec['1383004'] = "Invalid operation requested.";
    fb_api_ec['1383005'] = "Facebook system permission issue.";
    fb_api_ec['1383006'] = "Facebook system database issue.";
    fb_api_ec['1383007'] = "This Camorra Application is still in testmode or current user is not a test user.";
    fb_api_ec['1383008'] = "No communication.";
    fb_api_ec['1383009'] = "Invalid communication response.";
    fb_api_ec['1383010'] = "You succesfully canceled the order.";
    fb_api_ec['1383011'] = "Facebook system disable issue.";
    fb_api_ec['1353010'] = "Facebook captcha decline.";
    fb_api_ec['1353011'] = "Facebook security decline.";
    fb_api_ec['1383046'] = "No communication.";
    
    if(data['order_id']) {
        addNotice(2, 
            CW_JS_LANG[223],
            "<b>"+CW_JS_LANG[224]+" " + data['order_id'] + " "+CW_JS_LANG[225]+" </b>" + data['status'] + '<br /><br />'
            + CW_JS_LANG[226] + ' [' + Camorra.Facebook.Credits.Order.notice_description + '] '+CW_JS_LANG[227]+'<br /><br />'
            + '<a href="/sys/vip/">'+CW_JS_LANG[228]+'</a>'
        );
    } 
    else if(data['error_code']) {
        if( data['error_code'] in fb_api_ec ) { data['error_code'] = data['error_code'] + ' - ' + fb_api_ec[data['error_code']]; }
        addNotice(0, CW_JS_LANG[229], CW_JS_LANG[230]+' ' + data['error_code'] + '<br />'+CW_JS_LANG[231]); 
    } 
    else {addNotice(0, CW_JS_LANG[229], CW_JS_LANG[232]);}
};

Camorra.Facebook.AppUser.LoadExtraInfo = function() {
    for(var d in FB_CW_SES) { 
        /*alert('setting: '+d+ ' => '+ FB_CW_SES[d]);*/ 
        Camorra.Facebook.AppUser.data[d] = FB_CW_SES[d];
    }
    var DoLoad = 'false';
    for(var e in FB_AJAX_EXTRA_LOAD) {
        if( FB_AJAX_EXTRA_LOAD[e] in Camorra.Facebook.AppUser.data || FB_AJAX_EXTRA_LOAD[e] == 'null' ) {} else { DoLoad = 'true'; } 
    }
    if( DoLoad === 'true' ) { 
        if( Camorra.Facebook.AppUser.data.access_token != '' ) {
            var call_link = 'https://graph.facebook.com/'+Camorra.Facebook.AppUser.data.uid+'/?access_token='+Camorra.Facebook.AppUser.data.access_token;
        } else {
            var call_link = 'https://graph.facebook.com/'+Camorra.Facebook.AppUser.data.uid+'/';
        }
        $.getJSON(call_link+'&callback=?',
            function(json) {
                for(var d in json) {
                    Camorra.Facebook.AppUser.data[d] = json[d];
                }
            }
        );    
    }
};
Camorra.Facebook.AppUser.LoadFriendOptionsInContainer = function(target_container) {
    /* Friends al gecached */
    if( Camorra.Facebook.AppUser.friends_loaded == '1' ) {
        var sel_container = $('div#'+target_container).parent();  
        sel_container.append('<br /><select id="fbsel_"'+target_container+'" onChange="Camorra.Facebook.Publish.SetSelectedFriend('+target_container+');"><option value="-1">'+CW_JS_LANG[171]+'</option>');        
        for(var f in Camorra.Facebook.AppUser.friends) {
            if(typeof(Camorra.Facebook.AppUser.friends[f]) == 'object') {
                sel_container.find('select').append('<option value="'+Camorra.Facebook.AppUser.friends[f].uid+'">'+Camorra.Facebook.AppUser.friends[f].name+'</option>');
            }
        }
        sel_container.parent().css({ position: "relative"});    
        sel_container.css({ position: "absolute",
            marginLeft: 0, marginTop: 0,
            top : $('div#'+select_container+' select').parent().height(),
            right: 0 
        });               
        sel_container.attr('style','display:block;');                        
    } else
    
    // Friends ophalen
    if( Camorra.Facebook.AppUser.data.access_token != '' ) {
        var call_link = 'https://graph.facebook.com/'+Camorra.Facebook.AppUser.data.uid+'/friends/?access_token='+Camorra.Facebook.AppUser.data.access_token;
        FB.api({
            method: 'fql.query',
            query: 'SELECT uid, name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) ORDER BY name'
        },
        function(json) {       
            Camorra.Facebook.AppUser.friends = json;
            Camorra.Facebook.AppUser.friends_loaded = 1;
            
            var sel_container = $('div#'+target_container).parent();  
            sel_container.append('<br /><select onChange="Camorra.Facebook.Publish.SetSelectedFriend(this.options[this.selectedIndex].value);"><option value="-1">'+CW_JS_LANG[171]+'</option>');
            for(var f in json) {
                if(typeof(json[f]) == 'object') {
                    sel_container.find('select').append('<option value="'+json[f].uid+'">'+json[f].name+'</option>');
                }
            }
            sel_container.parent().css({ position: "relative"});    
            sel_container.css({ position: "absolute",
                marginLeft: 0, marginTop: 0,
                top : $('div#'+select_container+' select').parent().height(),
                right: 0 
            });               
            sel_container.attr('style','display:block;');
        });         
    } else {
        alert('You are not logged into Facebook\rThe feauture that was loaded requires you to be logged in.\rFeauture: load friend selectbox');
    }
}
Camorra.Facebook.AppUser.CloseFriendOptionsContainer = function(target_container) {
    var sel_container = $('div#'+target_container).parent();
    sel_container.find('select').html('');
    sel_container.find('select').attr('style','display:none;');
    Camorra.Facebook.Publish.to = 0;                        
}
Camorra.Facebook.AppUser.ShowData = function() {
    /*alert(dump());*/
}
