// JavaScript Document
// Developed by Wilbelison Junior with JQuery and Cycle Plugin

var tvXML = tvXML + '?anticache=' + Math.floor(Math.random()*999);

function validaData(entrada,saida){
	var sEntrada = new splitData(entrada);
	var sAtual = new splitData(clienteData());
	var sSaida = new splitData(saida);
	if(sEntrada.invertida() <= sAtual.invertida() && sAtual.invertida() <= sSaida.invertida()){
		return true;
	}
}

function splitData(d){
	var dataHora = d.split('-');
	var sData = dataHora[0].split('/');
	var sHora = dataHora[1].split(':');
	var retorno = {
		'ano' : sData[2],
		'mes' : sData[1],
		'dia' : sData[0],
		'hora' : sHora[0],
		'minuto' : sHora[1]
	}
	this.get = function(i){
		return retorno[i];
	}
	this.invertida = function(){
		var dataInvertida = new String();
		$.each(retorno, function(key,value){
			dataInvertida += value;
		});
		return parseInt(dataInvertida);
	}
	this.completa = function(){
		return d;
	}
}

function clienteData(){
	var d = new Date();
	var dia = adicionaZero(d.getDate());
	var mes = adicionaZero(d.getMonth() + 1);
	var ano = d.getFullYear();
	var hora = adicionaZero(d.getHours());
	var minuto = adicionaZero(d.getMinutes());
	var data =  dia + '/' +  mes + '/' + ano + '-' + hora + ':' + minuto;
	return data;
}

function adicionaZero(i){
	if(i < 10){
		i = '0' + i;
	}
	return i;
}

/* IE PNG fix multiple filters */
(function ($) {
    if (!$) return;
    $.fn.extend({
        fixPNG: function(sizingMethod, forceBG) {
                if (!($.browser.msie)) return this;
                var emptyimg = "empty.gif"; //Path to empty 1x1px GIF goes here
                sizingMethod = sizingMethod || "scale"; //sizingMethod, defaults to scale (matches image dimensions)
                this.each(function() {
                        var isImg = (forceBG) ? false : jQuery.nodeName(this, "img"),
                                imgname = (isImg) ? this.src : this.currentStyle.backgroundImage,
                                src = (isImg) ? imgname : imgname.substring(5,imgname.length-2);
                        this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + sizingMethod + "')";
                        if (isImg) this.src = emptyimg;
                        else this.style.backgroundImage = "url(" + emptyimg + ")";
                });
                return this;
        }
    });
})(jQuery);

