$(document).ready(function() {
    
    tellAFriend.ini();
        
});

var tellAFriend = {
    
    ini : function() {
        
        $('.tellAFriendLink').click(function() {
        
            $('#dialogContainer').dialog('destroy');
            
            $('#dialogContainer').load('/xhr/tellafriend/tellafriend.php', {
                sid : conf.sid,
                loc : conf.loc,
                art : $(this).attr("rel"),  
            }, function (responseText, textStatus, XMLHttpRequest) {
                if (textStatus == 'success') {
                    $('#dialogContainer')
                        .dialog({
                            close: function(event, ui) {
                                $(this).dialog('destroy');
                            },
                            autoOpen: true,
                            bgiframe: true,
                            width: 550,
                            modal: true,
                            draggable: false,
                            resizable: false,
                            title: 'Tell a friend',
                            buttons: {
                                "cancel": function() { $('#dialogContainer').dialog('close'); },
                            },
                        });
                } 
            });
                
            return false;
        });
        
    }
                        
}

