function executaScripts(texto){
        var ini = 0;
        while (ini!=-1){
                ini = texto.indexOf('<script', ini);
                if (ini >=0){
                        ini = texto.indexOf('>', ini) + 1;
                        var fim = texto.indexOf('</script>', ini);
                        codigo = texto.substring(ini,fim);
                        novo = document.createElement("script");
						$("body").append("<div id='scriptsResponse'></div>")
						$("#scriptsResponse").html("<script>" + eval(codigo) + "</script>");
						$("#scriptsResponse").remove();						
						
                }
        }
}

function mostraMensagemErro(n,e) {
	if (e == '') {
		alert("Problemas no processamento, tente novamente!")
	}
}
function mascaras(e,src,mask) {
if(window.event) { _TXT = e.keyCode; } 
else if(e.which) { _TXT = e.which; }
if((_TXT > 47 && _TXT < 58) || (_TXT == 8)) { var i = (src.value.length); var saida = mask.substring(0,1); var texto = mask.substring(i)
	if (_TXT > 7 && _TXT <9) { return true; }
	if (texto.substring(0,1) != saida) {src.value += texto.substring(0,1); obmv = src.createTextRange(); obmv.collapse(false); obmv.select(); } return true; } else {if (_TXT != 14) { return false; } else { return true; }

}
}
function popup(url, width, height, left, top, scrollbars, toolbar, location, status, menubar, resizable, nome) {
  top = ( (screen.height/2) - (height/2) )
  left = ( (screen.width/2) - (width/2) -10 )
  text = "Você deve desativar o bloqueador de popup.";
  janela = window.open(url,nome,'width='+width+',height='+height+',scrollbars='+scrollbars+',toolbar='+toolbar+',location='+location+',status='+status+',menubar='+menubar+',resizable='+resizable+',left='+left+',top='+top);
  if(janela == null) { alert(text); return; }
  janela.focus();
}
function newsletter_verifica() {
if ($("#newsletter_email").val() == " informe o email") {
	$("#newsletter_email").val("");
}
}

function newsletter() {
	$("#botaoNewsletterEnviar").hide();
	$("#botaoNewsletterAguarde").show();
    $.ajax({
    type: "POST",
    url: "includes/newsletter_exe.asp",
    dataType: "html",
    timeout: 60000,
    data: 'email=' + $("#newsletter_email").val(),
    success:function(response){
	  $("#botaoNewsletterEnviar").show();
	$("#botaoNewsletterAguarde").hide();
	  executaScripts(response);
    },
    error: function( objAJAXRequest, strError ){
	  $("#botaoNewsletterEnviar").show();
	$("#botaoNewsletterAguarde").hide();
	  alert("Erro: " + objAJAXRequest.status);
    }
    });
  return false;
}


function contato() {
	$("#botaoEnviar").hide();
	$("#botaoAguarde").show();
    $.ajax({
    type: "POST",
    url: "includes/contato_exe.asp",
    dataType: "html",
    timeout: 60000,
    data: $("#form_contato").serialize(),
    success:function(response){
	  $("#botaoEnviar").show();
	$("#botaoAguarde").hide();
	  executaScripts(response);
    },
    error: function( objAJAXRequest, strError ){
	  $("#botaoEnviar").show();
	$("#botaoAguarde").hide();
	  alert("Erro: " + objAJAXRequest.status);
    }
    });
  return false;
}

var bo_ns_id = 0;

function startIeFix(){
  if(isIE()){
    document.write('<div id="bo_ns_id_' + bo_ns_id + '"><!-- ');
  }
}

function endIeFix(){
  if(isIE()){
    document.write('</div>');
    var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
    var theCode = theObject.innerHTML;
    theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"))
    document.write(theCode);
  }
}

function isIE(){
  var strBrowser = navigator.userAgent.toLowerCase();
  if(strBrowser.indexOf("msie") > -1 && strBrowser.indexOf("mac") < 0){
    return true;
  }else{
    return false;
  }
}


function jsScroller (o, w, h) {
	var self = this;
	var list = o.getElementsByTagName("div");
	for (var i = 0; i < list.length; i++) {
		if (list[i].className.indexOf("boxRolagemConteudo") > -1) {
			o = list[i];
		}
	}
	
	//Private methods
	this._setPos = function (x, y) {
		if (x < this.viewableWidth - this.totalWidth) 
			x = this.viewableWidth - this.totalWidth;
		if (x > 0) x = 0;
		if (y < this.viewableHeight - this.totalHeight) 
			y = this.viewableHeight - this.totalHeight;
		if (y > 0) y = 0;
		this._x = x;
		this._y = y;
		with (o.style) {
			left = this._x +"px";
			top  = this._y +"px";
		}
	};
	
	//Public Methods
	this.reset = function () {
		this.content = o;
		this.totalHeight = o.offsetHeight;
		this.totalWidth	 = o.offsetWidth;
		this._x = 0;
		this._y = 0;
		with (o.style) {
			left = "0px";
			top  = "0px";
		}
	};
	this.scrollBy = function (x, y) {
		this._setPos(this._x + x, this._y + y);
	};
	this.scrollTo = function (x, y) {
		this._setPos(-x, -y);
	};
	this.stopScroll = function () {
		if (this.scrollTimer) window.clearInterval(this.scrollTimer);
	};
	this.startScroll = function (x, y) {
		this.stopScroll();
		this.scrollTimer = window.setInterval(
			function(){ self.scrollBy(x, y); }, 40
		);
	};
	this.swapContent = function (c, w, h) {
		o = c;
		var list = o.getElementsByTagName("div");
		for (var i = 0; i < list.length; i++) {
			if (list[i].className.indexOf("boxRolagemConteudo") > -1) {
				o = list[i];
			}
		}
		if (w) this.viewableWidth  = w;
		if (h) this.viewableHeight = h;
		this.reset();
	};
	
	//variables
	this.content = o;
	this.viewableWidth  = w;
	this.viewableHeight = h;
	this.totalWidth	 = o.offsetWidth;
	this.totalHeight = o.offsetHeight;
	this.scrollTimer = null;
	this.reset();
};


function resolucao(){
        h = screen.height;
        DcOnt = document.getElementById("base");
		if (((h/2)-392)>0) {
        DcOnt.style.marginTop = ((h/2) - 392)+ "px";
		}
}

$(document).ready(function() {
	resolucao();
  }
);