// Desativa o botao direito do mouse
var message=""; 
function clickIE() {
	if (document.all) {
		(message);
		return false;
	}
}
function clickNS(e) {
	if (document.layers||(document.getElementById&&!document.all)) 	{ 
		if (e.which==2||e.which==3) {
			(message);
			return false;
		}
	}
} 
if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS;
} else {
	document.onmouseup=clickNS;
	document.oncontextmenu=clickIE;
}
function ClipBoard(_text) {
	//holdtext.innerText = copytext.innerText;
	Copied = _text.createTextRange();
	Copied.execCommand("Copy");
}
// verificando tamanho da tela para resetPass > Login
function tamanhoTela()
{
	var w, h;
    if (self.innerHeight) {
		// Firefox
        w = self.innerWidth;
        h = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
		// IE
        w = document.documentElement.clientWidth;
        h = document.documentElement.clientHeight;
    } else if (document.body) {
		// Others?
        w = document.body.clientWidth;
        h = document.body.clientHeight;
    }

	// Padronizando valor para pixels
	w = w+"px";
	h = h+"px";
	
	// Setando o valor nos campos desejados
	document.getElementById('divFundoResetPass').style.width = w;
	document.getElementById('divFundoResetPass').style.height = h;
	document.getElementById('table').style.width = w;
	document.getElementById('table').style.height = h;
}
// Novos # SecondTheme DNA Design - Inicio #
// Importante
/* function trocarBackground() {
	var field = document.getElementById('bgbody');	
	// Vericando resolucao
	if (screen.height <= "616"){
		if(screen.width > "985" && screen.width <= "1229") {
			field.className = 'back_1024';
		} else if (screen.width > "1229") { 
			field.className = 'back_1280';
		} else {
			field.className = 'back_800';
		}		
	}
	else if (screen.height <= "768" && screen.height > "600"){
		if(screen.width > "1229" && screen.width <= "1440") {
			if(screen.width <= "1280") {
				field.className = 'back_1280';
			} else {
				field.className = 'back_1440';
			}
		} else if (screen.width > "1440") { 
			field.className = 'back_1680';
		} else {
			field.className = 'back_1024';
		}
	}
	else if (screen.height <= "800" && screen.height > "768" ){
		field.className = 'back_1280';
	}
	else if (screen.height <= "900" && screen.height > "800"){
		if(screen.width > "1440") {
			field.className = 'back_1680';
		} else {
			field.className = 'back_1440';
		}		
	}      
	else if (screen.height <= "1050" && screen.height > "900"){
		if(screen.width > "1680") {
			field.className = 'back_1920';
		} else {
			field.className = 'back_1680';
		}			
	}
	else if (screen.height <= "1200" && screen.height > "1050"){
		if(screen.width > "1920") {
			field.className = 'back_2560';
		} else {
			field.className = 'back_1920';
		}		
	}
	else if (screen.height <= "1600" && screen.height > "1200"){
		field.className = 'back_2560';
	}
	else {
		field.className = 'back_2560';
	}
} */
// Verifica quantidade de caracteres > contato
function counterUpdate(opt_countedTextBox, opt_minSize, opt_maxSize)
{
	var field = document.getElementById(opt_countedTextBox);
	// Verificando quantidade maxima de caracteres
	if (field && field.value.length >= opt_maxSize) {
		field.value = field.value.substring(0, opt_maxSize);
	}
	// Verificando quantidade minima de caracteres
	if (field && field.value.length <= opt_minSize) {
		// verificando se é textarea
		if(opt_countedTextBox == 'mensagem') {
			field.className = 'textareaContatoErro';
		} else {
			field.className = 'inputContatoErro';
		}
		// desabilitar enviar
		document.getElementById('submit').disabled = true;
	} else {
		if(opt_countedTextBox == 'mensagem') {
			field.className = 'textareaContato';
		} else {
			field.className = 'inputContato';
		}
		// habilitar enviar
		document.getElementById('submit').disabled = false;		
	}
}
// Scroll div sem barra de rolagem
function scrollDiv(_div, _position)
{
	var objDiv = document.getElementById(_div);
	// Height total do div
	var alturaDiv = objDiv.scrollHeight;
	// Limitando o espaço no bottom do div
	alturaDiv = alturaDiv - 70;
	// Calculando valor aleatorio com base na Height do div para realizar o salto do "up" e "down"
	var tamanhoAumentar = alturaDiv / 10;
	
	// Altura padrao via CSS - Necessario para calcular a posição atual
	var alturaPadraoDiv = objDiv.offsetHeight;
	// Verificando a altura atual do div
	var alturaAtual = objDiv.scrollTop;
	// Altura atual é a soma da altura padrao do div (css) com a posição atual
	var alturaObjeto = alturaAtual+alturaPadraoDiv;
	
	if(_position == "top") {
		objDiv.scrollTop = objDiv.scrollTop - tamanhoAumentar;
	} else if(_position == "bottom") {
		if(alturaDiv > alturaObjeto)
			objDiv.scrollTop = objDiv.scrollTop + tamanhoAumentar;
	}
}
// Desabilita a seleção do texto quando executado duplo-clique
function disableSelection(target)
{
    //For IE This code will work
    if (typeof target.onselectstart!="undefined")
    target.onselectstart=function(){return false}
    
    //For Firefox This code will work
    else if (typeof target.style.MozUserSelect!="undefined")
    target.style.MozUserSelect="none"
    
    //All other  (ie: Opera) This code will work
    else
    target.onmousedown=function(){return false}
    target.style.cursor = "default"
}
// Função adicionar favoritos
function addFavoritos() {
    var url = document.location;
    var title = document.title;
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}
// Novos # SecondTheme DNA Design - Fim #
