//<![CDATA[


var _main        = {

    init          : function() {
        this.before();
    },

    before        : function() {
        libraries.jqCookie.init    = true;
        libraries.jCycle.init      = true;
        _loader.core();
    },

    after         : function() {

        core.init();
		//floater.init();
       	jCycle.init();
    }
};


var core    = {

    init    : function() {

        //this.acontece.init();

    }

};


var jCycle ={

	init    : function() {

		var aux = 1;

        $('.slide').cycle({
            fx		: 'scrollHorz',
			timeout	: 5000,
			delay	: -1000,
			next	: '#next',
            prev	: '#prev',
		    after   :  onBefore

        });

        function onBefore(curr, next, opts) {

            $('#pg').html(( opts.currSlide + 1) + "/" + opts.slideCount);

        };

    }

};


var floater   = {

    init    : function() {

        if (this.check()) {
            this.core();
        }
    },

    check   : function() {

        var bool  = true;




        if ( !_exists('#content') || !_exists('div.instHomeBanner')) {
            bool  = false;
        }

        return bool;

    },

    core    : function() {


		if ($.cookie('floatercookie') == null) {

			var html    = '<div class="jqmWindowFloater" id="floater"><div id="floater-container"></div></div>';

			$('body').append(html);

			var swf         = def.project.pathSwf + 'floater_cartaoNatal_claro.swf';
			var container   = 'floater-container';
			var width       =  '826';
			var height      =  '500';
			var flashvars   = { };
			var attributes  = { };
			var params      = { menu        : 'false'  }; // wmode:'transparent'

			swfobject.embedSWF(swf, container, width, height, libraries.swfObject.version, '', flashvars, params, attributes);


			var myClose=function(hash) { hash.w.fadeOut('2000',function(){ hash.o.remove(); }); $('object, embed').show(); };

			$('#floater').jqm({
				trigger : false,
				onLoad  : function() { $('object, embed').hide(); }
				// onHide  : myClose
			});

			$('#floater').jqmShow();


			$.cookie ( "floatercookie", "null");

		}
        
        setTimeout('floater.close();', 22000);

    },

    close   : function() {

        $('#floater').jqmHide();

    }

};


_main.init();

/*
//   2009-mar-26: rmdoi: Mostra paginacao de destaques na home
   function showDestaquePage( n ) {
     for (var i= 0; i < $(".destaque-page").length;i++) {
       if (i == n) {
          $(".destaque-page:eq("   +i+")").slideDown( "slow" );
          $(".destaque-pagebtn:eq("+i+")").addClass( "selected" );
        } else {
          $(".destaque-page:eq("   +i+")").slideUp( "slow" );
          $(".destaque-pagebtn:eq("+i+")").removeClass( "selected" );
        }
     }
   }
*/

//]]>

