SKYPE.namespace("www");
SKYPE.www.PairedInviteSharedObject = function()
{
    var flashUrl = "/i/flash/paired-invite.swf";

    var D = YAHOO.util.Dom;
    var E = YAHOO.util.Event;
    E.onDOMReady(function() {
        if (location.href.match(/[?&]username=([^&]+)/)) {
            var skypename = location.href.match(/[?&]username=([^&]+)/)[1];
            
            var fullnameMatch = location.href.match(/[?&]fullname=([^&]+)/);
            var fullname = fullnameMatch ? fullnameMatch[1] : "";

            writeFlash(skypename, fullname);
        }
    });
            
    function writeFlash(skypename, fullname) {
          var params = {
              wmode: "transparent"
          };
          var flashvars = {
              skypename: skypename,
              fullname: fullname
          };

          var divId = makeContainerDiv("pairedInviteFlashDiv").id;
          swfobject.embedSWF(flashUrl, divId, 3, 3, "9.0.0", null, flashvars, params, {id: "pairedInviteFlash", bgcolor:"#FFFFFF"});
    }
    function makeContainerDiv(divId){
        var container = document.createElement("DIV");
        container.id = divId;
        YAHOO.util.Dom.setStyle(container, "position", "absolute");
        YAHOO.util.Dom.setStyle(container, "width", "3px");
        YAHOO.util.Dom.setStyle(container, "height", "3px");
        YAHOO.util.Dom.setStyle(container, "font", "1px monospace");
        YAHOO.util.Dom.setStyle(container, "top", "0px");
        YAHOO.util.Dom.setStyle(container, "left", "0px");
        document.body.appendChild(container);
        return container;
    }
}();
