
function PopupWindow(ficheiro,x,y){
	newwindow= window.open(ficheiro,"popup","toolbar=0,directories=0,status=0,resizable=0,location=0,scrollbars=1,copyhistory=0,width=" +  x + ",height=" + y);
	newwindow.focus();

}

function PopupWindowSimple(ficheiro){
	window.open(ficheiro,"popup","toolbar=1,directories=1,status=1,resizable=1,location=1,scrollbars=1,copyhistory=1");
}

function PopupWindowSimpleWithRef(ficheiro){
	return window.open(ficheiro,"popup","toolbar=1,directories=1,status=1,resizable=1,location=1,scrollbars=1,copyhistory=1");
}

function VerDestaqueMaquinaOcasiao(empresaUsername, produtoID){
	PopupWindow('/cgi-bin/usados.cgi?accao=mais_info_usado&id_usado=' + produtoID + '',600,500);
//	self.location = '/clientes/' + empresaUsername;
}

function GetData(){
	var meses = new Array('Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro');
	var dias_semana = new Array('Domingo','Segunda-Feira','Ter&ccedil;a-Feira','Quarta-Feira','Quinta-Feira','Sexta-Feira','S&aacute;bado');


	var time = new Date() 
	var dd = time.getDate() 
	var wd = time.getDay() 
	var mm = time.getMonth() 
	var yy = time.getYear()
	yy = (yy > 2002) ? yy : yy + 1900

	var data = "[ " + dias_semana[wd] + ", " + dd + " de " + meses[mm] + " de " + yy + " ]";
	return data;
}

function ToggleLayerVisibility(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}

function ChangeLayerHeight(szDivID, height)
{
	if(document.layers)	   //NN4+
    {
       document.layers[szDivID].height = height;
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.height = height;
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.height = height;
    }
}
