package classes.matuto.social

{
    import flash.display.*;
    import flash.net.*;
    
    public class RedeSocial extends flash.display.MovieClip
    {
        public function RedeSocial(arg1:SingletonEnforcer)
        {
            api = new ShareAPI();
            options = new Object();
            super();
            if (arg1 == null)
            {
                throw new Error("Só pode haver uma instância de ExemploSingleton");
            }
            return;
        }

        public function addParams(arg1:String, arg2:String, arg3:String):void
        {
            options.url = share_url;
            options.swfurl = share_url+"/Main.swf";
            options.width = 480;
            options.height = 200;
            options.description = arg1;
            options.title = arg2;
            options.screenshot = arg3;
            return;
        }

        public function enviarFacebook():void
        {
            api.share(share_url, "facebook", options);
            return;
        }

        public function enviarOrkut():void
        {
            var loc1:*="http://promote.orkut.com/preview?nt=orkut.com&tt=" + options.title + "&du=" + options.url + "&cn=" + options.description + "&tn=" + options.screenshot;
            var loc2:*=new flash.net.URLRequest(loc1);
            flash.net.navigateToURL(loc2, "_blank");
            return;
        }

        public function enviarTwitter(arg1:String):void
        {
			var loc1:*=encodeURI("http://api.addthis.com/oexchange/0.8/forward/twitter/offer?url=http://migre.me/4rnH7&title=" + arg1 + "&username=@safaristudio&template={{title}} {{url}}");
            flash.net.navigateToURL(new flash.net.URLRequest(loc1));
            return;
        }

        public static function getInstance():RedeSocial
        {
            if (instance == null)
            {
                instance = new RedeSocial(new SingletonEnforcer());
            }
            return instance;
        }

        public var api:ShareAPI;

        public static var share_url:String="http://www.shoppingcostadourada.com.br";

        public var options:Object;

        private static var instance:RedeSocial;
    }
}


class SingletonEnforcer extends Object
{
    public function SingletonEnforcer()
    {
        super();
        return;
    }
}


/*
case "twitter":
{
classes.site.utils.RedeSocial.getInstance().enviarTwitter(frase);
break;
}
case "facebook":
{
classes.site.utils.RedeSocial.getInstance().addParams(frase, "Battlefolio Ogilvy", thumb);
classes.site.utils.RedeSocial.getInstance().enviarFacebook();
break;
}
case "orkut":
{
classes.site.utils.RedeSocial.getInstance().addParams(frase, "Battlefolio Ogilvy", thumb);
classes.site.utils.RedeSocial.getInstance().enviarOrkut();
break;
} * 

*/