// JavaScript Document



function valida_data() {
	var date = document.getElementById('data').value;
	var array_data = new Array;
	var ExpReg = new RegExp("(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/[12][0-9]{3}");
	//vetor que contem o dia o mes e o ano
	array_data = date.split("/");
	erro = false;
	//Valido se a data esta no formato dd/mm/yyyy e se o dia tem 2 digitos e esta entre 01 e 31
	//se o mes tem d2 digitos e esta entre 01 e 12 e o ano se tem 4 digitos e esta entre 1000 e 2999
	if ( date.search(ExpReg) == -1 )
		erro = true;
	//Valido os meses que nao tem 31 dias com execao de fevereiro
	else if ( ( ( array_data[1] == 4 ) || ( array_data[1] == 6 ) || ( array_data[1] == 9 ) || ( array_data[1] == 11 ) ) && ( array_data[0] > 30 ) )
		erro = true;
	//Valido o mes de fevereiro
	else if ( array_data[1] == 2 ) {
		//Valido ano que nao e bissexto
		if ( ( array_data[0] > 28 ) && ( ( array_data[2] % 4 ) != 0 ) )
			erro = true;
		//Valido ano bissexto
		if ( ( array_data[0] > 29 ) && ( ( array_data[2] % 4 ) == 0 ) )
			erro = true;
	}
	if ( erro ) {
		alert("Data Invalida");
		document.getElementById('data').focus();
	}
}

<!--
/* -- 1. Player Version detection -- */

//set player version here
var MM_contentVersion = 6;

//set sub version here
var release = "6,0,67,0";


//check for flash player
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i];
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}


/* -- 2. Deployment function -- */

function writeFlash(swf,flashVarString,w,h,bgcolor,menu,mode,q,id){
  if ( MM_FlashCanPlay ) {
     document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
     +'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+release+'" '
     +'width="'+w+'" height="'+h+'" id="'+id+'" align="">'
     +'<param name="movie" value="'+swf+'">'
     +'<param name="menu" value="'+menu+'"> '
     +'<param name="quality" value="'+q+'"> '
     +'<param name="wmode" value="'+mode+'"> '
     +'<param name="bgcolor" value="'+bgcolor+'"> '
     +'<param name="flashvars" value="'+flashVarString+'"> '
     +'<embed src="'+swf+'" flashvars="'+flashVarString+'" menu="'+menu+'" quality="'+q+'" wmode="'+mode+'" '
     +' bgcolor="'+bgcolor+'"  width="'+w+'" height="'+h+'" name="'+swf+'" '
     +' align=""  type="application/x-shockwave-flash" '
     +' pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object> ');
  } else {
     //behaviour for if there is no flash player
     document.write('You require Flash Player '+MM_contentVersion+' or later to use this site. ');
     document.write('<em><a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">');
     document.write('Click here to install it now.</a></em>');


     //this can be replaced by anything you want
     //e.g. document.location.replace("text.html");

  }
}


// -->







<!-- Begin
function CaricaFoto(img){
  foto1= new Image();
  foto1.src=(img);
  Controlla(img);
}
function Controlla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
  }
  else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img){
  largh=foto1.width+20;
  altez=foto1.height+20;
  stringa="width="+largh+",height="+altez;
  finestra=window.open(img,"",stringa);
}
//  End -->

<!--
<!-- Begin

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//  End -->
// -->


<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=260,height=150');");
}
// End -->



<!-- Begin
function copia_entrega(){
	var n='';
	var v='';
	var s='';
	var i=0;
	var form=document.Endereco;
	var x=form.length-1;
	//if(form.cobranca_igual.checked){
		for(var y = 0; y <= x; y++){
			n=form.elements[y].name;			
			if(n.substring(0,2)=='E_'){
				s=n.substring(2,n.length);
				if(form.elements[s].type == "select-one"){					
					i=form.elements[s].selectedIndex;
					form.elements[n].selectedIndex=i;
				}
				else{
					
					v=form.elements[s].value;
					form.elements[n].value=v;
				}
			}
		}
	//}
}

// End -->

<!-- Begin
 function testacampos()
 {
 aux=0;
 xnome=document.cv.nome.value;
 if (aux==0) {
 if (xnome==""){
 aux=1;
 alert("Preencha o campo Nome");
 document.cv.nome.focus();
 return false;
 }
 }
 xemail=document.cv.email.value;
 if (aux==0) {
 if (xemail == ""){
 aux=1;
 alert("Preencha o campo Email");
 document.cv.email.focus();
 return false;
 }
 }
 if (aux==0) {
 if (document.cv.email.value.indexOf("@") < 0){
 aux=1;
 alert("Preencha o campo e-mail no formato seu@email.com.br")
 document.cv.email.focus();
 return false;
 }
 }
 if (aux==0) {
 if (document.cv.email.value.indexOf(".") < 0){
 aux=1;
 alert("Preencha o campo e-mail no formato seu@email.com.br");
 document.cv.email.focus();
 return false;
 }
 }
 aux=0;
 xnome_amigo=document.cv.nome_amigo.value;
if (aux==0) {
if (xnome_amigo==""){
 aux=1;
 alert("Preencha o campo Nome do amigo");
 document.cv.nome_amigo.focus();
 return false;
 }
 }
 xemail_amigo=document.cv.email_amigo.value;
 if (aux==0) {
 if (xemail_amigo == ""){
 aux=1;
 alert("Preencha o campo Email do amigo");
 document.cv.email_amigo.focus();
 return false;
 }
 }
 if (aux==0) {
 if (document.cv.email_amigo.value.indexOf("@") < 0){
 aux=1;
 alert("Preencha o campo e-mail no formato amigo@email.com.br")
 document.cv.email_amigo.focus();
 return false;
 }
 }
 if (aux==0) {
 if (document.cv.email_amigo.value.indexOf(".") < 0){
 aux=1;
 alert("Preencha o campo e-mail no formato amigo@email.com.br");
 document.cv.email_amigo.focus();
 return false;
 }
 }
 }
function fecharErrata(){
	var errata = document.getElementById("errata");
	errata.style.display = "none";
}
// End -->