function show_CEP_dialog(page,detalhes,cat)
{
	var url = "./cep_dialog.php?page="+page+"&detalhes="+detalhes+cat;
	alert(url);
	window.open(url,"Informe seu CEP","width=300,height=160");
}

function lp_lightbox(page,detalhes,cat,w,h)
{
	bigfoto = new Image;
	w = Number(w);
	var url = "./cep_dialog.php?page="+page+"&detalhes="+detalhes+cat;
	
	montarjanela();	
	
	document.getElementById('detalhes').style.width = w+'px';
	document.getElementById('detalhes').style.height = h+'px';
	document.getElementById('close').style.marginLeft = ((w)-50)+'px';
	document.getElementById('bar_titulo').style.width = (w)-7+'px';	
	
	document.getElementById('detalhes').style.top = getPageScroll()+(getPageSize()[3] / 2)- (h /2)+'px';
	document.getElementById('detalhes').style.left =(getPageSize()[2] / 2) - (w/2)+'px';
	
	document.getElementById('bar_titulo').innerHTML = 'Simulador de Frete';	
	window.document.getElementById('close').innerHTML = '<strong><a href="javascript:closeDT();" title="Fechar Simulador de Frete">X&nbsp;&nbsp;</a></strong>';		
	
	runpage(url,'dt_miolo');	
}

function registrar_cep()
{
	var detalhes = document.getElementById('d_detalhes').value;
	var page = document.getElementById('d_page').value;
	var cat = document.getElementById('d_cat');
	var tipo = document.getElementById('d_frete_tipo').value;
	var cep = document.getElementById('d_cep').value;
	
	if (cat != null) { cat = '&cat='+document.getElementById('d_cat').value; } else { cat = ''; }
	var url = 'set_cep_user.php?detalhes='+detalhes+'&page='+page+'&frete_tipo='+tipo+'&cep='+cep+cat;
	
	if (runpage(url,'dt_miolo') == true)
	{
		var url2 = 'loja_lista.php?detalhes='+detalhes+'&page='+page+cat;
		if (runpage(url2,'conteudo') == true)
		{ // for clean cache
			setTimeout('reload_page("'+url2+'")','2000');
		}	
	}
}

function reload_page(url)
{
	if (runpage(url,'conteudo') == true)
	{
		closeDT();
	}
}

function showfoto(id)
{
	pathfoto = id.style.backgroundImage;
	if (pathfoto.indexOf('url("') >= 0)
	{
		pathfoto = pathfoto.replace('url("','');
		pathfoto = pathfoto.replace('")','');
	}
	if (pathfoto.indexOf("url('") >= 0)
	{
		pathfoto = pathfoto.replace("url('",'');
		pathfoto = pathfoto.replace("')",'');
	}
	if (pathfoto.indexOf("url(") >= 0)
	{
		pathfoto = pathfoto.replace("url(",'');
		pathfoto = pathfoto.replace(")",'');
	}		
	
	document.getElementById('detalhes_foto_grande').src = pathfoto;
}
function showmain(loja)
{
	document.getElementById('detalhes_foto_grande').style.backgroundImage = 'url('+loja+')';
}

function foto_grande()
{ //detalhes_show_normal
	if (document.getElementById('detalhes_foto_main').style.height == '300px')
	{
		document.getElementById('detalhes_foto_main').style.height = '98%';
		document.getElementById('detalhes_foto_grande').style.width = '98%';
		document.getElementById('detalhes_foto_grande').style.height = null;
		document.getElementById('detalhes_show_normal').innerHTML = '(-) Mostrar Foto Menor&nbsp;';
	}
	else
	{
		document.getElementById('detalhes_foto_main').style.height = '300px';
		document.getElementById('detalhes_foto_grande').style.width = null;
		document.getElementById('detalhes_foto_grande').style.height = '98%';
		document.getElementById('detalhes_show_normal').innerHTML = '(+) Mostrar Foto Grande&nbsp;';
	}
}

