﻿var num



function verifica(f, somarValor) {





	//f.action = "javascript:void(0)"; f.target = "_self";

	

	var numSeqReal = (somarValor)?f.NUMSEQUENCIATemp.value:f.NUMSEQUENCIA.value;





	NUMFATURArightPattern = new RegExp("^[^(\W|\D|0)*][0-9]{0,20}$");

	if(f.NUMFATURA.value==''){

		alert('Por favor, informe o número da Nota Fiscal'); f.NUMFATURA.focus(); return false;

	} else {

		if(!NUMFATURArightPattern.test(f.NUMFATURA.value)){

			alert('Nº da Nota Fiscal/Fatura: Preencha somente com números, não digite zeros à esquerda.'); f.NUMFATURA.focus(); return false;

		} else {

			

		}

	}

	

	NUMSEQUENCIArightPattern = new RegExp("^[^(\W|\D|0)*][0-9]{0,20}$");

	if(numSeqReal==''){

		alert('Por favor, informe a Parcela/Código'); if(somarValor){f.NUMSEQUENCIATemp.focus()}else{f.NUMSEQUENCIA.focus()}; return false;

	} else {

		if(!NUMSEQUENCIArightPattern.test(numSeqReal)){

			alert('Parcela/Código: Preencha somente com números, não digite zeros à esquerda.'); if(somarValor){f.NUMSEQUENCIATemp.focus()}else{f.NUMSEQUENCIA.focus()}; return false;

		}

	}



	if(f.CNPJ.value.length==14){//CNPJ

		if(isCNPJ(f.CNPJ,'CNPJ')==false){f.CNPJ.focus(); f.CNPJ.select();  return false;}	

	} else if(f.CNPJ.value.length==11){//CPF

		if(isCPF(f.CNPJ,'CPF')==false){f.CNPJ.focus(); f.CNPJ.select();  return false;}	

	} else {

		alert('CPF/CNPJ: Preencha este campo, somente com números'); f.CNPJ.focus(); f.CNPJ.select(); return false;

	}

	

	if(somarValor){

		f.NUMSEQUENCIA.value = parseInt(numSeqReal)+50;

	}

	

	//if(somarValor){alert("Valor Somado: "+f.NUMSEQUENCIA.value);}

	

	return true;



	

}



var onlyNumbers = function(input){

	input.value = input.value.replace(/\D/,"");

}




// VERIFICA B2B
function verifica(f) {

	var strCheck = '';

	if(f.EMPRESA.value.length < 3){alert('Por favor, informe a empresa'); f.EMPRESA.focus(); f.EMPRESA.select(); return false;}



	for (i = 0; i < f.EMPRESA.value.length; i++) {		

		if (!isNaN(f.EMPRESA.value.substr(i, 1))) {

			alert('Por favor, informe apenas letras'); f.EMPRESA.focus(); f.EMPRESA.select(); return false;

		}

	}



	if(f.LOGIN.value==''){alert('Por favor, informe a usuário'); f.LOGIN.focus(); return false;}

	if(f.SENHA.value==''){alert('Por favor, informe a senha'); f.SENHA.focus(); return false;}

}

// lightbox	

$(document).ready(function(){
	var tamW = $(window).width();
	var tamH = $(window).height();
	var tp = $(window).height() * 0.1;
	var mt = $(window).scrollTop();
	
	$(".lightbox-content").css('margin-left', (tamW-500)/2 + 'px');
	
	mt = mt + tp;
	mt = mt + "px";
	$(".lightbox-content").css("margin-top",mt);
		
	$(".lightbox-background, .lightbox-close").click(function(){
		$(".lightbox-background, .lightbox-content").hide();
	});
	
});



















