if (location.href.indexOf('index.php') != -1 || location.href.length == 27) {
	top.location = 'default.php';
	var el = document.getElementsByTagName('applet')[0];
	el = el.parentNode;
	el.parentNode.removeChild(el);
}

function insereFlash(filename,name,largura,altura){
			AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', largura,
			'height', altura,
			'src', 'a',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'a',
			'bgcolor', '#ffffff',
			'name', 'a',
			'menu', 'true',
			'allowScriptAccess','sameDomain',
			'movie', filename,
			'salign', ''
			); //end AC code
	
}

function insereFlashJogos(filename,name,largura,altura){
			AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', largura,
			'height', altura,
			'src', 'a',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'devicefont', 'false',
			'id', 'a',
			'bgcolor', '#ffffff',
			'name', 'a',
			'menu', 'true',
			'allowScriptAccess','sameDomain',
			'movie', filename,
			'salign', ''
			); //end AC code
	
}

function limitaTexto(campo,div,tamanho)
{
	campo = document.getElementById(campo)
	div	  = document.getElementById(div)
    quant = tamanho;
    total = campo.value.length;
    if(total <= quant)
    {
        resto = quant - total;
        div.innerHTML = resto;
    }
    else
    {
         campo.value = campo.value.substr(0,quant);
    }
}

function getEstados(uf,obj){
	new Ajax.Request('includes/getEstados.php?uf='+uf, {
			onComplete: function(xhr) {
			document.getElementById(obj).innerHTML = xhr.responseText;
	}});
}
function getCidades(id,uf,obj){
	new Ajax.Request('includes/getCidades.php?uf='+uf+"&id="+id, {
			onComplete: function(xhr) {
			if(xhr.responseText==0){
				document.cadastro.estado.focus();
				alert('Escolha seu estado')
			}else{
				document.getElementById(obj).innerHTML = xhr.responseText;
			}
	}});
}

function showDiv(id){
	document.getElementById('div0').style.display='none';
	document.getElementById('div1').style.display='none';
	document.getElementById('div2').style.display='none';
	document.getElementById('div'+id).style.display='block';
}