
function ajaxInit() {
	var req;
	try {
		 req = new ActiveXObject("Microsoft.XMLHTTP");
	} catch(e) {
		 try {
			  req = new ActiveXObject("Msxml2.XMLHTTP");
		 } catch(ex) {
		 try {
		   req = new XMLHttpRequest();
	     } catch(exc) {
	 		  alert("Esse browser não tem recursos para uso do Ajax");
	  		 req = null;
	     }
	 }
}
return req;
}

function carregaCombo(url, codigo, id) {
	ajax = ajaxInit();
	if(ajax) {
		
		
		ajax.open("GET",url + "?codigo=" + codigo, true);
		
		ajax.onreadystatechange = function() {
			if(ajax.readyState == 4) {
				if(ajax.status == 200) {
					document.getElementById(id).innerHTML = ajax.responseText;
				}else{
					alert(ajax.statusText);
				}
			}
		}
		ajax.send(null);
	}
}






function isInt(valor)
{
    var valor_text = valor;
	var str = /^\d+$/;
	return str.test(valor_text);
}


function formatar(id, mask)
{
	src = document.getElementById(id);
	var i = src.value.length;
  	var saida = mask.substring(0,1);
  	var texto = mask.substring(i)
	if (texto.substring(0,1) != saida)
  	{
    	src.value += texto.substring(0,1);
  	}
}
function formatarFone(id)
{
	src = document.getElementById(id);
	var i = src.value.length;
	if(i==1)
	{
		src.value = "(" + src.value;
	}
	if(i==3)
	{
		src.value = src.value + ") " 
	}
	if(i==9)
	{
		src.value = src.value + "-" 
	}
	
	
}
function formatarValor(id)
{
	obj = document.getElementById(id)
	if( obj )
	{
		valor_aux = new String(obj.value);
	}
	else
	{
		valor_aux = new String(id)
	}
	
	if( valor_aux != "")
	{
		if(isFloat(valor_aux) == true)
		{
			pos = valor_aux.search(",");
			valorFinal = 0
			if(pos != -1)
			{
				vet_valor = valor_aux.split(",");
				valor = vet_valor[0];
				valor= valor.replace(".","")
				valor= valor.replace(".","")
				valor= valor.replace(".","")
				valor= valor.replace(".","")
				valor= valor.replace(".","")
				valor = valor * 100;
				valor = valor / 100;
				valor = new String(valor);	
				if(valor != "")
				{
					if (vet_valor[1].length == 2)
					{
						valor = formataFloatPonto(valor) + "," + vet_valor[1];
						valorFinal = valor;
					}
					else
					{
						if (vet_valor[1].length > 2)
						{
							vet_valor[1] = vet_valor[1].substring(0,2);	
							valor = formataFloatPonto(valor) + "," + vet_valor[1]
							valorFinal = valor;
						}
						else
						{
							valor = formataFloatPonto(valor) + "," + vet_valor[1] + "0"	
							valorFinal = valor;
						}
					}
				}
				else
				{
					valor = formataFloatPonto(valor) + ",00"; 
					valorFinal = valor;
				}
			}
			else
			{
				valor_aux= valor_aux.replace(".","")
				valor_aux= valor_aux.replace(".","")
				valor_aux= valor_aux.replace(".","")
				valor_aux= valor_aux.replace(".","")
				valor_aux= valor_aux.replace(".","")				
				valorFinal = formataFloatPonto(valor_aux) + ",00"
				
			}
			if( document.getElementById(id) )
			{
				document.getElementById(id).value = valorFinal;	
			}
			else
			{
				return valorFinal	
			}
		}
	}
	
}
function formataFloatPonto(valorParam)
{
	valor = valorParam;	
	tam_vet = parseInt(valor.length / 3)
	var vet_aux = new Array();				
	cont = 0;
	contVet = 0
	if (valor != "")
	{
		if (valor.length > 3)
		{
				
			for(i=valor.length;i>0;i--)
			{
				if( ( cont % 3 == 0)  && (cont > 0) )
				{
					vet_aux[contVet] = i;
					contVet = contVet + 1;
				}	
				cont = cont + 1
			}
			for(i=0;i<vet_aux.length;i++)
			{
				valor = valor.substring(0,vet_aux[i]) + "." + valor.substring(vet_aux[i],valor.length);				
			}
			
		}
	}
	else
	{
		valor = "0";
	}
	return valor
}

function insNumeric(obj,event)
{
    var tecla = event.charCode;
	
    var ie = event.keyCode;
    if (!event) event = window.event;
    var code;
    if (event.keyCode) code = event.keyCode;
    else if (event.which) code = event.which; // Netscape 4.?
	
	//se nao for número nem parentesis ou espaço
    if ((code < 48 || code > 59) && (code != 8 ) ){
      event.returnValue = false;
      if (event.which){
        event.preventDefault();
      }
      return false;
    }else{
      event.returnValue = true;
      return true;
    }
}
function insFloat(obj,event)
{
    var tecla = event.charCode;
    var ie = event.keyCode;
    if (!event) event = window.event;
    var code;
    if (event.keyCode) code = event.keyCode;
    else if (event.which) code = event.which; // Netscape 4.?
//se nao for número nem parentesis ou espaço
    if ((code < 48 || code > 59) && (code != 8 ) & (code != 44)){
      event.returnValue = false;
      if (event.which){
        event.preventDefault();
      }
      return false;
    }else{
      event.returnValue = true;
      return true;
    }
 } 


function isFloat(valor)
{
	var valor_text = valor;
	var str = /^[+-]?((\d+|\d{1,3}(\.\d{3})+)(\,\d*)?|\,\d+)$/;
	return str.test(valor_text);
}

function pegarHora(campo){
	hora = new Date;
	wHora = hora.getHours();
	wMin = hora.getMinutes();
	if(wMin < 10){
		wMin = "0" + wMin;
	}
	wSec = hora.getSeconds();
	if(wSec < 10){
		wSec = "0" + wSec;
	}
	
	//wHoraF = wHora +":"+ wMin +":"+ wSec;
	wHoraF = wHora +":"+ wMin;
	
	document.getElementById(campo).innerHTML = wHoraF;
	
	setTimeout("pegarHora('"+campo+"')",1);
}
function pegarData(){
	var nomeDia;
	data = new Date;
	dia  = data.getDay();
	mes = data.getMonth();
	ano = data.getFullYear();
	
	switch(dia){
		case 0:
			nomeDia = "Domingo";
		case 1:
			nomeDia = "Segunda-feira";
		case 2:
			nomeDia = "Terça-feira";
		case 3:
			nomeDia = "Quarta-feira";
		case 4:
			nomeDia = "Quinta-feira";
		case 5:
			nomeDia = "Sexta-feira";
		case 6:
			nomeDia = "Sábado";
	}
	
	switch(mes){
		case 0:
			nomeMes = "janeiro";
		case 1:
			nomeMes = "fevereiro";
		case 2:
			nomeMes = "março";
		case 3:
			nomeMes = "abril";
		case 4:
			nomeMes = "maio";
		case 5:
			nomeMes = "junho";
		case 6:
			nomeMes = "julho";
		case 7:
			nomeMes = "agosto";
		case 8:
			nomeMes = "setembro";
		case 9:
			nomeMes = "outubro";
		case 10:
			nomeMes = "novembro";
		case 11:
			nomeMes = "dezembro";
	}
	
	campoData = document.getElementById("data_semana");
	campoData.innerHTML = nomeDia +", "+ dia +" de "+ nomeMes +" de "+ ano +".";	
}

var urlImagem = "http://www.fortalezaguapore.com.br/intranet/imagens/";
function liberarCampos()
{
	obj_input = document.getElementsByTagName('input');	
	ob_select = document.getElementsByTagName('select');
	ob_area = document.getElementsByTagName('textarea');
	for (i=0;i<obj_input.length;i++)
	{
		if (obj_input[i].name != "codigo")
		{
			obj_input[i].disabled = "";	
		}
	}
	for (i=0;i<ob_select.length;i++)
	{
		ob_select[i].disabled = "";	
	}
	for (i=0;i<ob_area.length;i++)
	{
		ob_area[i].disabled = "";	
	}
}
function bloqCampos()
{
	obj_input = document.getElementsByTagName('input');	
	ob_select = document.getElementsByTagName('select');
	ob_area = document.getElementsByTagName('textarea');
	for (i=0;i<obj_input.length;i++)
	{
		if (obj_input[i].name != "codigo")
		{
			obj_input[i].disabled = "disabled";	
		}
	}
	for (i=0;i<ob_select.length;i++)
	{
		ob_select[i].disabled = "disabled";	
	}
	for (i=0;i<ob_area.length;i++)
	{
		ob_area[i].disabled = "disabled";	
	}
}


function janelaForm(largura,altura,url)
{
	winDt = window.open(url,'','top=150,left=150,width='+ largura +',height='+ altura +',scrollbars=1,status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1');
	winDt.focus();
}


function excluirReg(url)
{
	if (confirm("Deseja realmente excluir o registro"))
	{
		location.href=url;	
	}
}
function addEstoque(url)
{
	if (valor = prompt("Digite a quantidade que deseja inserir"))
	{
		
		if( isInt(valor) )
		{
			url = url+"&valor="+valor;
			location.href=url;	
		}
		else
		{
			alert("Digite um valor inteiro")
			addEstoque(url)
		}
	}
}
function fechar()
{
	close();
}
function salvar(id)
{
	document.getElementById(id).submit();	
}

function abrirMenu(wcontrole)
{
	$("#"+wcontrole).slideToggle("normal")
}

function camposFile(idFoto,idLegenda,contador,acao){
	if(acao == "+"){
		if(parseInt(document.getElementById(contador).value) < 30){
			document.getElementById(contador).value = parseInt(document.getElementById(contador).value)+1;
			//document.getElementById(idFoto + document.getElementById(contador).value).style.display = "";
			document.getElementById(idLegenda + document.getElementById(contador).value).style.display = "";
			document.getElementById('botDel').style.display = "";
		}
		
		if(parseInt(document.getElementById(contador).value) == 30){
			document.getElementById('botAd').style.display = "none";
		}
	}else{
		if(parseInt(document.getElementById(contador).value) > 1){
			//
			document.getElementById('qtde' + document.getElementById(contador).value).value = "";
			document.getElementById('unid' + document.getElementById(contador).value).value = "";
			document.getElementById('cod_espec' + document.getElementById(contador).value).value = "";
			document.getElementById('descricao' + document.getElementById(contador).value).value = "";
			//
			
			//document.getElementById(idFoto + document.getElementById(contador).value).style.display = "none";
			document.getElementById(idLegenda + document.getElementById(contador).value).style.display = "none";
			document.getElementById(contador).value = parseInt(document.getElementById(contador).value)-1;
			document.getElementById('botAd').style.display = "";
		}
		
		if(parseInt(document.getElementById(contador).value) == 5){
			document.getElementById('botDel').style.display = "none";
		}
	}
}

function janelaRelatorio(wurl)
{
	var winDt = window.open(wurl,'','scrollbars=1,status=1,toolbar=1,location=0,menubar=1,directories=1,resizable=1');
	winDt.focus();
}

function horaImpressao()
{
	data_aux = new Date;
	whora = data_aux.getHours()
	wminuto = data_aux.getMinutes()
	
	dia = data_aux.getDate();
	mes = data_aux.getMonth();
	mes = parseInt(mes) + 1;
	ano = data_aux.getFullYear();
	if (dia < 10)
	{
		dia = "0" + dia;
	}
	if (mes < 10)
	{
		mes = "0" + mes;
	}
	if (whora < 10)
	{
		whora = "0" + whora;
	}
	if (wminuto < 10)
	{
		wminuto = "0" +wminuto;
	}
	
	obj = document.getElementsByTagName("span");
	
	for (i=0;i<obj.length;i++)
	{
		
		if (obj[i])
		{
			if (obj[i].className == "hora")
			{
				obj[i].innerHTML = dia + "/" + mes + "/" + ano + " " + whora + ":" + wminuto;
			}
		}
	}		
	
}


//fim funcoes intranet

var index = 1
objIntervalo = new Object();
function troca(pos)
{
	index = pos
	
	for(i=1;i<8;i++)
	{
		if(i!= index)
		{
			document.getElementById("end_" + i).style.display = "none"	
			document.getElementById("label_" + i).className = "numEnd"	
		}
		else
		{
			document.getElementById("end_" + index).style.display = "block"
			document.getElementById("label_" + index).className = "numEndFundo"	
		}
	}
	
	index = parseInt(index)+ 1;
	
	if( index == 8 )
	{
		index = 1						
	}
	clearInterval(objIntervalo)
	trocaEndAuto(index)
}
function trocaEndAuto(pos)
{
 	objIntervalo = setInterval("troca('"+ pos +"')", 5000);
}
function mostraOculta(idMostra,idOculta)
{
	$("#"+idMostra).css("display","block")
	$("#"+idOculta).css("display","none")
				
}


function ocultaCanais(id)
{
	id_par = id;
	vet_id = id_par.split("_");
	id_element = vet_id[1];
	img = document.getElementById(id);
	div_canais = document.getElementById(id_element);
	var aux_class = div_canais.style.display;
	if (id_element == "equipe")
	{
		if (aux_class == "block")
		{
			div_canais.style.display = "none";
			img.src = "imagens/icon_mais.jpg";
			img.alt = "Mostrar"
		}
		if (aux_class == "none")
		{
			div_canais.style.display = "block";
			img.src = "imagens/icon_menos.jpg";
			img.alt = "Esconder"
			document.getElementById("colaboradores").style.display = "none";
			
		}	
	}
	else
	{
		if (aux_class == "block")
		{
			div_canais.style.display = "none";
			img.src = "imagens/lat_fecha.jpg";
			img.alt = "Mostrar"
		}
		if (aux_class == "none")
		{
			div_canais.style.display = "block";
			img.src = "imagens/lat_abre.jpg";
			img.alt = "Esconder"			
		}
	}
}
/*
function validaCont(id)
	{			
		if(validaFrmGeral2(id) == false)
		{
			return false;				
		}
						
		if(document.getElementById("mensagem").value == "")
		{
			alert("Preencha o campo Mensagem");
			document.getElementById("mensagem").focus();
			return false;
		}
		if(document.getElementById("modalidade").value == "")
		{
			alert("Preencha o campo Modalidade");
			document.getElementById("modalidade").focus();
			return false;
		}
		if(document.getElementById("estado").value == "")
		{
			alert("Preencha o campo Estado");
			document.getElementById("estado").focus();
			return false;
		}
		if(document.getElementById("estado_u").value == "")
		{
			alert("Preencha o campo Estado - Universidade");
			document.getElementById("estado_u").focus();
			return false;
		}
		if(document.getElementById("comentario").value == "")
		{
			alert("Preencha o campo Comentário");
			document.getElementById("comentario").focus();
			return false;
		}
		
	}
	*/
function checadoTodos(qtd,name,namehidden)
{
	
	quantidade  = qtd;
	valor = 0;
	if (document.getElementById(name).checked == true)
	{
		document.getElementById(namehidden).value= "";
		for(i=1; i<=quantidade; i++)
		{
			if( document.getElementById("c_"+i) )
			{
				document.getElementById("c_"+i).checked = true;
				valor = document.getElementById("c_"+i).value;
				document.getElementById(namehidden).value += valor+"|";
			}
		}
	}
	else
	{
		for(i=1; i<=quantidade; i++)
		{
			if( document.getElementById("c_"+i) )
			{
				document.getElementById("c_"+i).checked = false;
				document.getElementById(namehidden).value = "";
			}
		}
	}
}
function checadoTodos(name,idCliqueTodos)
{
	objT = $("#"+idCliqueTodos)
	obj = $("input[name='" + name + "']")	
	if( obj.length > 0)
	{
		for(i=0; i<=obj.length; i++)	
		{
			
			if( objT[0].checked == true)
			{
				obj[i].checked = true;
			}
			else
			{
				obj[i].checked = false;	
			}
		}
	}
}

function checado(name, cod, id)
{
	novoCod="";
	if(document.getElementById(name).checked){
		document.getElementById(id).value += cod+"|"; 
	}
	if(document.getElementById(name).checked==false){
		valores = document.getElementById(id).value;
		document.getElementById(id).value="";
		codigos = valores.split("|");
		
		for (i=0;i<=codigos.length-2;i++){
			
			if(codigos[i] != cod){
				novoCod = novoCod+codigos[i]+"|";
				document.getElementById(id).value=novoCod;
			}
		}
	}
}



function editDadosCli(codigo,nome,data,cpf,rg,endereco,numero,complemento,bairro,cep,cidade,estado,telefone,celular,email)
{
	
	$("#codClienteEditar").val(codigo)
	$("#nome").attr("value",nome)	
	$("#data_nasc").attr("value",data)
	$("#cpf").attr("value",cpf)
	$("#rg").attr("value",rg)
	$("#endereco").attr("value",endereco)
	$("#numero").attr("value",numero)
	$("#complemento").attr("value",complemento)
	$("#bairro").attr("value",bairro)
	$("#cep").attr("value",cep)
	$("#cidade").attr("value",cidade)
	objEstado = document.getElementById("estado")
	for(i=0;i<objEstado.options.length;i++)
	{
		if(objEstado.options[i].value == estado)
		{
			objEstado.options[i].selected = true
			break
		}
	}
	vetTel = telefone.split("|")
	$("#ddd_telefone").attr("value",vetTel[0])
	$("#telefone").attr("value",vetTel[1])
	
	vetCel = celular.split("|")
	$("#ddd_celular").attr("value",vetCel[0])
	$("#celular").attr("value",vetCel[1])
	
	$("#end_eletronico").attr("value",email)
	
	
}

function mostraVale()
{
	
	if( $("#vendaVale").is(':checked') == true)
	{
		$("#divVale").show()
		$("#divTipoVale").show()
		$("#numeroVale").addClass("obrigatorio")
		$("#qtdVale").addClass("obrigatorio")
		$("#vale_franquias").addClass("obrigatorio")
		$("#terapia").addClass("obrigatorio")
	}
	else
	{
		$("#divVale").hide()
		$("#divTipoVale").hide()
		$("#numeroVale").removeClass("obrigatorio")
		$("#qtdVale").removeClass("obrigatorio")
		$("#vale_franquias").removeClass("obrigatorio")
		$("#terapia").removeClass("obrigatorio")
	}
}
function tipoVale()
{
	if( $("#tipoV").is(':checked') == true)
	{
		$("#txtTipo").text("Vale Massagem")
		$("#qtdVale").css("background-color","#CCCCCC")
		$("#qtdVale").attr("readonly","readonly")
		$("#qtdVale").val("1")
	}
	else
	{
		$("#txtTipo").text("Pacote de Massagem")
		$("#qtdVale").css("background-color","#FFFFFF")
		$("#qtdVale").attr("readonly","")
	}	
}

function setarNameArq()
{
	obj = $("input[type='file']")
	for(i=0;i<obj.length;i++)
	{
		idElement =  obj[i].id.replace("arquivo","arquivoAux")
		$("#"+idElement).val($("#"+obj[i].id).val())
	}
	
}

function mostraTipoFornecedor()
{
	if( $("#tipoFF").is(':checked') == true)
	{
		$("#fornecedor_f").show()
		$("#fornecedor_p").hide()
		$("#cod_fornecedor").addClass("obrigatorio")
		$("#fornecedor").addClass("obrigatorio")
		$("#cod_profissional").removeClass("obrigatorio")
		$("#profissional").removeClass("obrigatorio")
	}
	else
	{
		$("#fornecedor_f").hide()
		$("#fornecedor_p").show()
		$("#cod_profissional").addClass("obrigatorio")
		$("#profissional").addClass("obrigatorio")
		$("#cod_fornecedor").removeClass("obrigatorio")
		$("#fornecedor").removeClass("obrigatorio")
	}
}


function showBanner(imagem, url)
{
	objImg = new Image()
	objImg.src = 'imagens/'+imagem 
	var img_b = 'imagens/'+imagem
	var url
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;


	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	pageWidth = parseInt(pageWidth)-25
	
	
	if (document.all)
	{
		//var wtop = parseInt(document.documentElement.scrollTop) + 20
		var wtop = ( (parseInt(screen.height) - 450) / 2 ) - 50
		
	}
	else
	{
		//var wtop = parseInt(window.scrollY) + 20
		var wtop = ( (parseInt(screen.height) - 450) / 2 ) - 50
	}
	
	
	var wleft = ( (parseInt(pageWidth) - 1000) / 2 ) 
	wleft = parseInt(wleft) + ( (1000-parseInt(477)) / 2)
	wleft = parseInt(wleft)
	
	$("#caixaCores").remove()
	$("#fundoOpacoBannner").remove()	
	str = "<div id='caixaCores'>"	
	str += "<label onclick='"+url+"'><img id='impressora' src='imagens/icon_print.jpg' alt='' border='0'></label>"			
	str += "<label onclick='"+url+"'><img src='"+img_b+"' alt='' border='0'></label>"
	//str += "<img src='"+img_b+"' alt='' border='0'>"
	str += "<div id='div_fecharCor'><img src='imagens/fecha_cartaz.jpg' id='btn_fechar' title='Fechar' alt='Fechar'></div>"
	str +="</div>"

	
	$(str).css("left",wleft).css("top",wtop).appendTo("body")	
	
	$("#btn_fechar").click(function(){
		$("#caixaCores").remove()		
		$("#fundoOpacoBannner").remove()
		foto_atual = 0;
		id_foto_atual = "#img_0"
	})

	
	
	$("<div id='fundoOpacoBannner'>&nbsp;</div>").appendTo("body")		
	
	objF = document.getElementById('fundoOpacoBannner')
	objF.style.width = pageWidth + "px"
	
	objF.style.height = (pageHeight+100) + "px"
	$("#fundoOpacoBannner").click(function(){
		$("#div_fecharCor").remove()		
		$("#caixaCores").remove()		
		$("#fundoOpacoBannner").remove()		
		foto_atual = 0;
		id_foto_atual = "#img_0"
		
		
	})
	
}

function showBanner2(div, url)
{
	/*objImg = new Image()
	objImg.src = 'imagens/'+imagem 
	var img_b = 'imagens/'+imagem*/
	var url
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;


	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	pageWidth = parseInt(pageWidth)-25
	
	
	if (document.all)
	{
		//var wtop = parseInt(document.documentElement.scrollTop) + 20
		var wtop = ( (parseInt(screen.height) - 450) / 2 ) - 50
		
	}
	else
	{
		//var wtop = parseInt(window.scrollY) + 20
		var wtop = ( (parseInt(screen.height) - 450) / 2 ) - 50
	}
	
	
	var wleft = ( (parseInt(pageWidth) - 1000) / 2 ) 
	wleft = parseInt(wleft) + ( (1000-parseInt(477)) / 2)
	wleft = parseInt(wleft)
	
	$("#caixaCores").remove()
	$("#fundoOpacoBannner").remove()	
	str = "<div id='caixaCores'>"	
	str += "<label onclick='"+url+"'><img id='impressora' src='imagens/icon_print.jpg' alt='' border='0'></label>"			
	str += "<label onclick='"+url+"'>"+div+"</label>"
	//str += "<img src='"+img_b+"' alt='' border='0'>"
	str += "<div id='div_fecharCor'><img src='imagens/fecha_cartaz.jpg' id='btn_fechar' title='Fechar' alt='Fechar'></div>"
	str +="</div>"

	
	$(str).css("left",wleft).css("top",wtop).appendTo("body")	
	
	$("#btn_fechar").click(function(){
		$("#caixaCores").remove()		
		$("#fundoOpacoBannner").remove()
		foto_atual = 0;
		id_foto_atual = "#img_0"
	})

	
	
	$("<div id='fundoOpacoBannner'>&nbsp;</div>").appendTo("body")		
	
	objF = document.getElementById('fundoOpacoBannner')
	objF.style.width = pageWidth + "px"
	
	objF.style.height = (pageHeight+100) + "px"
	$("#fundoOpacoBannner").click(function(){
		$("#div_fecharCor").remove()		
		$("#caixaCores").remove()		
		$("#fundoOpacoBannner").remove()		
		foto_atual = 0;
		id_foto_atual = "#img_0"
		
		
	})
	
}

function incluirFundoOpaco(idFundo)
{
	$("#"+idFundo).remove()
	$("<div id='" + idFundo + "' class='fundoOpaco'>&nbsp;</div>").appendTo("body")	
	objF = document.getElementById(idFundo)
	objF.style.width = dimensoesTela().split("x")[0] + "px"
	objF.style.height = dimensoesTela().split("x")[1] + "px"
		

}
function incluirCarregando(txt)
{
	
	$("#caixaCarregando").remove()
	pageWidth = dimensoesTela().split("x")[0]
	pageHeight = dimensoesTela().split("x")[1]	
	$("<div id='caixaCarregando'><img src='imagens/loading2.gif'><label></label></div>").appendTo("body").hide()
	$("#caixaCarregando label").text(txt)
	wleft = ( parseInt(dimensoesTela().split("x")[0]) - parseInt($("#caixaCarregando").width() ) ) / 2
	if (document.all)
	{
		var wtop = parseInt(document.documentElement.scrollTop) + 20
		
	}
	else
	{
		var wtop = parseInt(window.scrollY) + 20	
	}
	//wtop = ( parseInt(dimensoesTela().split("x")[1]) - parseInt( ) ) / 2	
	$("#caixaCarregando").css("left",parseInt(wleft))
	$("#caixaCarregando").css("top",wtop)
	$("#caixaCarregando").show()

}
function dimensoesTela()
{
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;


	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	scrollPage = false
	if(yScroll <= windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
		scrollPage = true
	}

	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	if( scrollPage )
	{
		pageWidth = parseInt(pageWidth)
	}
	
	dimensao = pageWidth + "x" + pageHeight
	return dimensao
}
function exibeOculta(idConteudo)
{
	if( $("#"+idConteudo).is(":hidden") )
	{
		$("#"+idConteudo).show("normal")	
	}
	else
	{
		$("#"+idConteudo).hide("normal")	
	}
}



