var nav="";
var marca=0;
function navegador(){
if(document.layers){//NS4
	nav="ns4";}
	else if(document.getElementById){//IE 5 i posteriors i NS6
		nav="ie5ns6"}
		else if(document.all && !document.getElementById){
			nav="ie4"} //anteriors a IE 5
tamany_finestra();		
}

function veure(nom_capa){
	eval(ref(nom_capa) + "visibility = 'visible'");     
}
function amagar(nom_capa){
    eval(ref(nom_capa) + "visibility = 'hidden'");
}
function ref(nom_capa){
    if (nav == "ie5ns6") return "document.getElementById('" + nom_capa + "').style."
 	else 	if (nav == "ie4") return "document.all['" + nom_capa + "'].style."
			else return "document." + nom_capa + "."
} 

function mourecapa(capa,posx,posy){
   	if (nav=="ns4" || nav=="ie5ns6") {
        eval(ref(capa) + "left=posx;");
        eval(ref(capa) + "top=posy;");
  	}
    else {
    	eval(ref(capa) + "pixelLeft=posx;");
        eval(ref(capa) + "pixelTop=posy;");
    }
}


function getDocHeight(doc) {
  var docHt = 0, sh, oh;
  if (doc.height) docHt = doc.height;
  else if (doc.body) {
    if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
    if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
    if (sh && oh) docHt = Math.max(sh, oh);
  }
  return docHt;
}

function setIframeHeight(iframeName) {
  var iframeWin = window.frames[iframeName];
  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
  if ( iframeEl && iframeWin ) {
    iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous  
    var docHt = getDocHeight(iframeWin.document);
    // need to add to height to be sure it will all show
    if (docHt) iframeEl.style.height = docHt + 30 + "px";
  }
}

function loadIframe(iframeName, url) {
  if ( window.frames[iframeName] ) {
    window.frames[iframeName].location = url;   
    return false;
  }
  else return true;
}

function obre(desti,am,al,nom){
  var ampla = am;
  var altura = al;
  strURL = desti;
  poshoritz = (screen.width) ? (screen.width-ampla)/2 : 0;
  posvert = (screen.height) ? (screen.height-altura)/2 : 0;
  strW = 'toolbar=0,directories=0,location=0,status=no,menubar=0,resizable=false,copyhistory=yes,scrollbars=no,width='+ ampla + ',height='+ altura + ',top='+ posvert + ',left='+ poshoritz;
  eval("window.open('" + strURL + "',nom,'" + strW + "')");
}
