String.prototype.trim = function() {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

function AttachEventToObject(object, evento, refFunction) {
	if (object.addEventListener) {
		object.addEventListener(evento.replace('on',''), refFunction, false);
	}
	else if (object.attachEvent) {
		object.attachEvent(evento, refFunction);
	}
}

function AttachEvent(evento, refFunction) {
	AttachEventToObject(window,evento, refFunction);
}

var _AllLoad_Executed = false;
function _AllLoad_() {
    window.setTimeout(function() {
        if(!_AllLoad_Executed) {
            _AllLoad_Executed = true;
            try {
	            _btnAux_DoPostBack();
	        } catch(e) {
	            //nada
	        }
	    }
    },20);
}


AttachEvent("onload", _AllLoad_);

//<img src="/_layouts/IMAGES/BLANK.GIF" onreadystatechange="_AllLoad_()" />

function MascaraTelefone(objeto){ 
 //trava letras
  var tecla = window.event.keyCode;
  tecla = String.fromCharCode(tecla);
  if(!((tecla >= "0") && (tecla <= "9"))){
    window.event.keyCode = 0;
 //fim do trava   
 }else{
   if(objeto.value.length == 0)
     objeto.value = '(' + objeto.value;

   if(objeto.value.length == 3)
      objeto.value = objeto.value + ')';

 if(objeto.value.length == 8)
     objeto.value = objeto.value + '-';
 }
}

function MascaraCep(objeto){
 //trava letras
  var tecla = window.event.keyCode;
  tecla = String.fromCharCode(tecla);
  if(!((tecla >= "0") && (tecla <= "9"))){
    window.event.keyCode = 0;
 //fim do trava 
 }else{
    if(objeto.value.length == 5)
        objeto.value = objeto.value + '-';
 }
}

/* ======= Variaveis de Suoprte ======== */

function VotorantimCommonObj() {
    this.AdmServerUrl = ""
    this.CurrentServerUrl = "";
    this.User = new MOSSUserObject();
}

/* ======= Variations Support ======== */

function VariationsObj() {
    this.hasVariations = false;
    this.Source = new VariationLabelObj();
    this.Current = new VariationLabelObj();
}
function VariationLabelObj() {
    this.Language = "";
    this.DisplayName = "";
    this.Locale = "";
    this.Title = "";
    this.TopUrl = "";
}

function VotorantimUnidadeObject() {
    this.Nome = "";
    this.Dominio = "";
    this.Sigla = "";
}

function MOSSUserObject() {
    this.LoginName = "";
    this.Name = "";
    this.email = "";
    this.ID = 0;
    this.isSiteAdmin = false;
    this.isSiteAuditor = false;
    this.Unidade = new VotorantimUnidadeObject();
}

var _Variations = new VariationsObj();
var VCommon = new VotorantimCommonObj();

/* =================================== */