	var blnTopo = false;
	
	function LinkAbrir(strUrl) 
	{
		document.location.href = strUrl;
	} 

	function VerCarrinho() 
	{
		var intIDIdioma = document.all.item("intIDIdioma").value;
		var strURLVerCarrinho = document.all.item("strURLVerCarrinho").value;
		var strEmail = document.all.item("strEmailSite").value;

		strURLVerCarrinho = strURLVerCarrinho + "?intIDIdioma=" + intIDIdioma + "&strEmail=" + strEmail

		var dx = 500;
		var dy = 500;
		var x = 200; //window.screen.width/2-(dx/2);
		var y = 200; //window.screen.height/2-(dy/2);

		window.open(strURLVerCarrinho, "", "top=" + x + ",left=" + y + ",height=" + dy + "px,width=" + dx + "px,center=yes,help=no,status=no,scroll=no")
	} 

	function AdicionarCarrinho() 
	{
		var intIDIdioma = document.all.item("intIDIdioma").value;
		var strURLCarrinho = document.all.item("strURLCarrinho").value; 
		var strTitulo = document.all.item("strTitulo").value;
		var strReferencia = document.all.item("strReferencia").value;
		var strPreco = document.all.item("strPreco").value;
		var strEmail = document.all.item("strEmailCarrinho").value;
		
		strURLCarrinho = strURLCarrinho + "?intIDIdioma=" + intIDIdioma + "&strPreco=" + strPreco + "&strTitulo=" + strTitulo + "&strReferencia=" + strReferencia + "&strEmail=" + strEmail

		var dx = 500;
		var dy = 250;
		var x = window.screen.width/2-(dx/2);
		var y = window.screen.height/2-(dy/2);

		window.open(strURLCarrinho, "", "top=" + x + ",left=" + y + ",height=" + dy + "px,width=" + dx + "px,center=yes,help=no,status=no,scroll=no")
	} 

	function FormularioEnviar() 
	{
		var strURLFormulario = document.all.item("strURLFormulario").value;
		var intIDIdioma = document.all.item("intIDIdioma").value;
		var strTitulo = document.all.item("strTitulo").value;
		var strTipo = document.all.item("strTipo").value;
		var strEmail = document.all.item("strEmail").value;
		var strReferencia = ""
		
		if(strTipo == "PRODUTO")
			if(document.all.item("strReferencia").value != "noreference")
				strReferencia = document.all.item("strReferencia").value;
		
		strURLFormulario = strURLFormulario + "?intIDIdioma=" + intIDIdioma + "&strTitulo=" + strTitulo + "&strReferencia=" + strReferencia + "&strEmail=" + strEmail

		var dx = 500;
		var dy = 250;
		var x = window.screen.width/2-(dx/2);
		var y = window.screen.height/2-(dy/2);

		window.open(strURLFormulario, "", "top=" + x + ",left=" + y + ",height=" + dy + "px,width=" + dx + "px,center=yes,help=no,status=no,scroll=no")
	} 

	function MostrarImagemReal(strImagem) 
	{
  		window.showModalDialog("ficheiros_html/imagem_visualizar_real.htm", strImagem, "dialogHeight: 600px; dialogWidth: 750px; center: yes; help: no; status: no; scroll: yes")  		
	}

	function Voltar()
	{
		var strUrl = window.location.href;
		var strBackValue = strUrl.substr(strUrl.indexOf("strBackValue") + 13, 2)

		if(blnTopo && (strBackValue == -2))
			window.history.go(-3);
		else
		if(blnTopo || (strBackValue == -2))
			window.history.go(-2);
		else 
			window.history.go(-1);
	}
	
	function Imprimir()
	{
		window.print();
	}
	
	function Topo()
	{
		blnTopo = true;
		window.location.href = "#";
	}
	
	function Copyright()
	{
		var dtmData = new Date()
		var dtmAno  = dtmData.getYear();
		
		document.write("Copyright &copy; " + dtmAno + " <a class='copyright_link' href='http://www.sitexpress.pt' target='_blank'>sit<span class='copyright_E'>E</span>xpress</a>");
	}
	
// trim a string
function trim(str)
{
  return( (""+str).replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') );
}	
