﻿// JScript File
    var DIVPopUp = "pop_up";			//CONTEM O NOME DA DIV QUE O POP-UP DEVERÁ SER ABERTO
	addLoadEvent(exibePopup);    	//INICIA A EXIBIÇÃO DO POP-UP
	
	function addLoadEvent(func) { //alert('teste');
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				if (oldonload) {
					oldonload();
				}
				func();
			}
		}
	}
	
	function exibePopup()
	{
	    if(document.getElementById(DIVPopUp)!= null)
	    {
	        var pop_up = document.getElementById(DIVPopUp);
    	    //alert(pop_up);
	        //var Data = new Date();
		    demo.start(pop_up);
//	        makeRequestPopUp("inc_pop_up.aspx?dt="+Data.getSeconds());
	        
	    }
	}

    //Função chamada ao se fechar o pop-up manualmente.
	function closeDiv()
    {
	    document.getElementById(DIVPopUp).style.display='none';
    }

	var demo =
	{
	    colorIndex:0,
	    interval:0,
	    element:null,
	    getRandom:function()
	    {
		    return Math.ceil(Math.random()*3) + 1;
		},
	    color:function()
	    {
		    var colors = ["#FFF"];
		    bytefx.color(
			    document.getElementById("text"),
			    "color",
			    colors[demo.colorIndex],
			    colors[++demo.colorIndex],
			    1,
			    demo.color
		    );
		    if(demo.colorIndex + 1 === colors.length)
			    demo.colorIndex = 0;
	    },
	    move1:function()
	    {
		    bytefx.move(demo.element, {x:645,y:110}, 10, null);
	    },
	    
		start:function(element)
	    {
		    this.element = element;
		    this.move1();
		    //this.color();
		    bytefx.drag(this.element,function()
		    {
				    bytefx.clear(demo.element)
				    // you could clear span clor too
				    // [i.e. bytefx.clear(document.getElementById("text"))]
			    },
			    function()
			    {
				    demo.move1()
			    }
		    );
	    }
    };
    



