function tabFicador()
	{
	this.checaTab = taber_ChecaTab;
	this.marcaPos = taber_MarcaPosTab;

	this.posTab = 0;
	function taber_MarcaPosTab( pos )
		{
		this.posTab = pos;
		}

	function taber_ChecaTab( campo )
		{
		if( campo.value.length == 2 )
			{
			this.posTab++;
			if( this.posTab < campo.form.elements.length  )
				{
				campo.form.elements[this.posTab].focus();
				}
			}
		}

	}//tabFicador()

var oTaber = new tabFicador();

function CheckDate( iDay , iMonth , iYear ){
	// acerta ano se for apenas de dois digitos
	// toma como base para Y2K compliance o ano 1930
	iDay   = Number( iDay ) ;
	iMonth = Number( iMonth ) ;
	iYear  = Number( iYear ) ;
	if ( iYear < 100 && iYear != '' ) {
		if ( iYear > 30 ) {
			iYear += 1900;
		} else {
			iYear += 2000;
		}
	}
	iMonth --; // o objeto Date usa meses de 0 a 11
	var dTmp = new Date( iYear, iMonth, iDay );
	return( iYear == dTmp.getFullYear() && iMonth == dTmp.getMonth() && iDay == dTmp.getDate() ) ;
}

function CheckIdade( oForm ){
	var iForm = oForm.length;
	for ( var i = 0; i< iForm; i++ ){
		var oElement = oForm.elements[ i ];
		var sNome = oElement.name;
		if( sNome == "dia" )
			var iDia = oElement.value;
		if( sNome == "mes" )
			var iMes = oElement.value;
		if( sNome == "ano" )
			var iAno = oElement.value;
	}
	if( !CheckDate( iDia, iMes, iAno ))
		return false;

	var iMes = Number( iMes );
	iMes -= 1;
	var iAno = Number( iAno );
	iAno += 1900;
	var iDate = new Date( iAno, iMes, iDia );

	var iToday = new Date();
	var iAnoMaior = iToday.getYear();
	iAnoMaior -= 18;
	var iMesMaior = iToday.getMonth();
	var iDiaMaior = iToday.getDate();
	var iDateMaior = new Date( iAnoMaior, iMesMaior , iDiaMaior );

	if ( iDate < iDateMaior )
		return true;
	else
		return false;

}



function isOk( oForm ){

	dia = document.formdata.dia.value;
	mes = document.formdata.mes.value;
	ano = document.formdata.ano.value;

	if ( !CheckIdade( oForm ) ){
		self.location = "http://www.graffikpix.com.br";
	} else {
		//self.location ="index.asp?dia="+dia+"&mes="+mes+"&ano="+ano;
		self.location ="home.html";
	}
}



function Abre()
{
	var iLeft, iTop;
	var iScrWidth, iScrHeight;
	var iWidth, iHeight;

	var sParametros;

	iScrWidth = screen.width;
	iScrHeight = screen.height;

	iWidth = 740;
	iHeight = 550;

	iLeft = (iScrWidth / 2) - (iWidth / 2) - 8;
	iTop = (iScrHeight / 2) - (iHeight / 2) - 20;

	sParametros = "status=no,left="+iLeft+",top="+iTop+",width="+iWidth+",height="+iHeight;

	window.open('/skolbeats/', 'Skol_beats', sParametros);
}
