function open_full_window (target)
{
	var mywindow = window.open (target,'_blank','fullscreen=yes,toolbar=yes,scrollbars=yes,resizable=yes,menubar=yes,titlebar=yes,location=yes');
	mywindow.moveTo(0,0);
}
function verificaSelectionBox ()
{
	var id = document.getElementById("selection_box").value;
	if (id!='none')
	{
		getURL('mostrarFotos.php?id='+id+'&page=1');
	}
}
function open_window (target)
{
	var mywindow = window.open (target,'_blank','height=470,width=550,scrollbars=yes,resizable=no');
	mywindow.moveTo(0,0);
}
function iframe_getURL ( target )
{
	//IE
	if(navigator.appName.indexOf('Internet Explorer')>0)
	{
		parent.location.href=target;
		self.location.reload();
	}
	//FF
	else
	{
		parent.location.href=target;
	} 
}
function getURL ( target )
{
	//IE
	if(navigator.appName.indexOf('Internet Explorer')>0)
	{
		window.document.write('<meta HTTP-EQUIV=\'Refresh\' CONTENT=\'0;URL='+target+'\' />');
		self.location.reload();
	}
	//FF
	else
	{
		window.location.href=target;
	} 
}
function show_or_hide ( id )
{
	var obj = document.getElementById(id);
	if(obj.style.display=='none')
	{
		obj.style.display='block';
	}
	else
	{
		obj.style.display='none';
	}
}
function show ( id )
{
	window.document.getElementById(id).style.display="block";
}
function hide ( id )
{
	window.document.getElementById(id).style.display="none";
}
function deleta ( numero )
{
	if ( confirm("Tem certeza que desejas remover o arquivo da lista?") )
	{
		var div_to_hide = window.document.getElementById('div'+numero)
		div_to_hide.innerHTML='';
		div_to_hide.style.display='none';
	}
}

//FUNCAO PARA ADICIONAIS CAMPOS DINAMICAMENTE
function addCampoImg( numero )
{
	var qtd_fotos = window.document.getElementById("qtd_fotos");
	var num = numero;
	var adicionar_mais = window.document.getElementById("nome_action");
	var form = window.document.getElementById("myForm");
	var div = window.document.getElementById("nova_div");
	var new_input = '<input type="file" value="" size="50px" name="foto'+numero+'" />';
	var remover_button = '<span style="margin-left:5px"><a id="bt_rem_'+numero+'" href="javascript:void(0);" onclick="deleta('+numero+')" >Remover</a></span>';
	var novaDiv = '<div id="nova_div" class="nova_div" ></div>';
	div.id='randomdiv';
	div.innerHTML= '<div id="div'+numero+'" class="nova_div">'+new_input+remover_button+'</div>'+novaDiv;
	num++;
	qtd_fotos.value=num;
	adicionar_mais.innerHTML = '<div id="nome_action"> <a href="javascript:void(0);" onclick="addCampoImg(' + num+ ')" > Adicionar mais... </a></div>';
}
function verificaData()
{
	var form = window.document.getElementById("myForm");
	var data = window.document.getElementById("data").value;
	var dia = data.charAt(0) + data.charAt(1);
	var mes = data.charAt(3) + data.charAt(4);
	var ano = data.charAt(6) + data.charAt(7) + data.charAt(8) + data.charAt(9);
	if ( dia >= 01 && dia <= 31 && mes >=01 && mes <= 12 && ano > 1900 )
	{
		var dif = 31 - dia;
		if (dif == 0 )
		{
			if ( mes < 8 )
			{
				if ( mes % 2 == 1)
				{
					return form.submit();
				}
				else
				{
					alert ("Data inválida!\nVerifique se este mês tem 31 dias");
				}
			}
			else
			{
				if ( mes % 2 == 0)
				{
					return form.submit();
				}
				else
				{
					alert ("Data inválida!\nVerifique se este mês tem 31 dias");
				}
			}
		}
		else if (dif == 1 )
		{
			if ( mes != 2 )
			{
				return form.submit();
			}
			else
			{
				alert ("Data inválida!\nO mês 02 (Fevereiro) pode ter no máximo 29 dias ");
			}
		}
		else
		{
			return form.submit();
		}
	}
	else
	{
		alert ("Data inválida! \nA data deve estar no formato dd/mm/aaaa.\nO dia deve estar entre 01 - 31.\nO mês deve estar entre 01 - 12.\nO ano deve ser superior a 1900");
	}
}

function formataData(objeto)
{
	if (objeto.value.length == 2 || objeto.value.length == 5 )
	{
		objeto.value = objeto.value + "/";
	}
}

