//========================================================
//	Função para checar se o CPF é válido
//========================================================
function checaCPF(intCpf)
{
	var  aux =  String(intCpf).replace(/\D/g, "");
	
	if (aux.length != 11 || aux == "00000000000" || aux == "11111111111" ||
		aux == "22222222222" ||	aux == "33333333333" || aux == "44444444444" ||
		aux == "55555555555" || aux == "66666666666" || aux == "77777777777" ||
		aux == "88888888888" || aux == "99999999999")
	{return false;}
	
	soma = 0;
	for (i=0; i < 9; i ++) soma += parseInt(aux.charAt(i)) * (10 - i);
	
	resto = 11 - (soma % 11);
	
	if (resto == 10 || resto == 11) resto = 0;
	
	if (resto != parseInt(aux.charAt(9))){return false;}
	
	soma = 0;
	for (i = 0; i < 10; i ++) soma += parseInt(aux.charAt(i)) * (11 - i);
	
	resto = 11 - (soma % 11);
	
	if (resto == 10 || resto == 11) resto = 0;
	
	if (resto != parseInt(aux.charAt(10))){return false;}
	
	return true;
}

// Função para checar se o CNPJ é válido
function checaCNPJ(intCnpj)
{
	var aux = String(intCnpj).replace(/\D/g, "");
	var a = new Array();
    var b = new Number;
    var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
	
	if(aux.length != 14){return false;}
	
    for (i=0; i<12; i++)
	{
		a[i] = aux.charAt(i);
		b += a[i] * c[i+1];
	}
	
	if ((x = b % 11) < 2){a[12] = 0;}
	else{a[12] = 11-x;}
	
	b = 0;
	for (y=0; y<13; y++){b += (a[y] * c[y]);}
	
	if ((x = b % 11) < 2){a[13] = 0;}
	else{a[13] = 11-x;}
	
	if ((aux.charAt(12) != a[12]) || (aux.charAt(13) != a[13])){return false;}
	
	return true;
}

isDate = function(y, m, d){
        if(typeof y == "string" && m instanceof RegExp && d){
            if(!m.test(y)) return 1;
            y = RegExp["$" + d.y], m = RegExp["$" + d.m], d = RegExp["$" + d.d];
        }
        d = Math.abs(d) || 0, m = Math.abs(m) || 0, y = Math.abs(y) || 0;
        return arguments.length != 3 ? 1 : d < 1 || d > 31 ? 2 : m < 1 || m > 12 ? 3 : /4|6|9|11/.test(m) && d == 31 ? 4
        : m == 2 && (d > ((y = !(y % 4) && (y % 1e2) || !(y % 4e2)) ? 29 : 28)) ? 5 + !!y : 0;
};



flash = function(swf,w,h)
{
	document.write(
	'<object type="application/x-shockwave-flash" data="swf/'+swf+'" id="menu" width="'+w+'" height="'+h+'" style="margin:0px auto">'+
	'	<param name="movie" value="swf/'+swf+'" />'+
	'	<param name="allowScriptAcess" value="sameDomain" />'+
	'	<param name="quality" value="best" />'+
	'	<param name="bgcolor" value="#FFFFFF" />'+
	'	<param name="scale" value="noScale" />'+
	'	<param name="salign" value="TL" />'+
	'	<param name="wmode" value="transparent" />'+
	'	<param name="FlashVars" value="playerMode=embedded" />'+
	'</object>'			   
	);
};


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function al(){
if(screen.width <= 800){$('#menu').css({'left':'31%'})}
else if(screen.width <= 1024){$('#menu').css({'left':'35%'})}
else if(screen.width <= 1280){$('#menu').css({'left':'38%'})}
else if(screen.width <= 1440){$('#menu').css({'left':'39%'})}
$('#menu').show("slow");
};
   
