function recomana(id){
         window.open("recomana.php?noticia="+id,"recomana","width=520, height=400, scrollbars=yes, menubar=no, location=no, resizable=no")
}
function ampliaimmo(id){
         window.open("popup.php?seccio=veureimmoble&id="+id,"","width=650, height=500, scrollbars=yes, menubar=no, location=no, resizable=no")
}
function ampliapromo(id){
         window.open("popup.php?seccio=veurepromo&id="+id,"amplia","width=680, height=500, scrollbars=yes, menubar=no, location=no, resizable=no")
}
function abrirpopup(id,width,height){
         window.open(id,"popup","width="+width+", height="+height+", scrollbars=yes, menubar=no, location=no, resizable=no")
}
function activa(camp) {
        document.getElementById(camp).checked = true;
}
function fitxaimmo(id){
         window.open("popup.php?seccio=immobiliaries&id="+id,"fitxa","width=650, height=500, scrollbars=yes, menubar=no, location=no, resizable=no")
}
function fitxaofi(id){
         window.open("popup.php?seccio=oficines&id="+id,"fitxa","width=650, height=500, scrollbars=yes, menubar=no, location=no, resizable=no")
}
function recomanaweb(){
         window.open("recomanaweb.php","recomana","width=520, height=400, scrollbars=yes, menubar=no, location=no, resizable=no")
}
function imprimirnoticia(id){
         window.open("imprimir.php?seccio=noticies&accio=veure&versio=impressora&id="+id,"imprimir","width=580, height=490, scrollbars=yes, menubar=no, location=no, resizable=no")
}

function canvia(cascapa,valor) {
        document.getElementById("amagat").src = "intern.php?cas="+cascapa+"&valor="+valor;
}
function escriu(cascapa,valor) {
        eval("document.getElementById(\""+cascapa+"\").innerHTML = \""+valor+"\"");
}
function afehab(immoble,planta) {
        document.getElementById("formulari").target = "amagat";
        document.getElementById("formulari").action = "intern.php";
        document.getElementById("tipussubmit").value = "hab";
        document.getElementById("immoblesubmit").value = immoble;
        document.getElementById("plantasubmit").value = planta;
        document.getElementById("formulari").submit();
}
function afeplanta(immoble) {
        document.getElementById("formulari").target = "amagat";
        document.getElementById("formulari").action = "intern.php";
        document.getElementById("tipussubmit").value = "planta";
        document.getElementById("immoblesubmit").value = immoble;
        document.getElementById("formulari").submit();
}
function delhab(immoble,planta) {
        document.getElementById("formulari").target = "amagat";
        document.getElementById("formulari").action = "intern.php";
        document.getElementById("tipussubmit").value = "delhab";
        document.getElementById("immoblesubmit").value = immoble;
        document.getElementById("plantasubmit").value = planta;
        document.getElementById("formulari").submit();
}
function delplanta(immoble,planta) {
        document.getElementById("formulari").target = "amagat";
        document.getElementById("formulari").action = "intern.php";
        document.getElementById("tipussubmit").value = "delplanta";
        document.getElementById("immoblesubmit").value = immoble;
        document.getElementById("plantasubmit").value = planta;
        document.getElementById("formulari").submit();
}
function checkAll(field) {
field = eval("document.getElementsByName('"+field+"[]')");
for (i = 0; i < field.length; i++)
        field[i].checked = true ;
}

function uncheckAll(field) {
field = eval("document.getElementsByName('"+field+"[]')");
for (i = 0; i < field.length; i++)
        field[i].checked = false ;
}
function comprovachecks(camp,field) {
         if (document.getElementById(camp).checked) {
            checkAll(field);
         } else {
            uncheckAll(field);
         }
}
function comprovamunichecks() {
         if (document.getElementById("comprovamunicipi").checked) {
            checkAll("municipi");
         } else {
            uncheckAll("municipi");
         }
}
function escriu(text,capa) {
	   document.getElementById(capa).innerHTML = text;
}
function reobre() {
   document.location.reload();
}
