function BrowserCheck() {
	isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.ie6 = (this.version.indexOf('MSIE 6')>0)
	this.iemac=((document.all)&&(isMac))
	this.min = (this.ns||this.ie)
	this.comp = (this.ns5||this.ie5||this.ie6||this.iemac)
}  
is = new BrowserCheck()

if(is.ns4){document.write("<style><!--.Button,.boton{font-size:8pt;font-family:Verdana;font-weight:normal;height:18px}--></style>")}

function findWH() {
	winW = screen.availWidth;
	winH = screen.availHeight;
}

function css(id,left,top,width,height,vis,z,clip,color,other) {
	if (id=="START") return '<STYLE TYPE="text/css">\n'
	else if (id=="END") return '</STYLE>'
	var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' {position:relative;'
	if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
	if (arguments.length>=5 && height!=null) {
		str += ' height:'+height+'px;'
	}	
	if (arguments.length>=6 && vis!=null) str += ' visibility:'+vis+';'
	if (arguments.length>=7 && z!=null) str += ' z-index:'+z+';'
	if (arguments.length>=8 && clip==true) str += ' clip:rect('+ 0 + ' ' + width + ' ' + height + ' ' + 0 +');'
	if (arguments.length>=9 && color!=null) str += (is.ns4)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
	if (arguments.length==10 && other!=null) str += ' '+other + ';'
	str += '}\n'
	var index = id.indexOf("Div")
	return str
}
function writeCSS(str,showAlert) {
	str = css('START')+str+css('END')
	document.write(str)
	if (showAlert) alert(str)
}

function escriuCSS(){
	writeCSS(css('llegDiv',528,24,150,20,'visible',1,false))
}
escriuCSS();

function DynLayer(id,nestref,frame) {
	if (!is.ns5 && !DynLayer.set && !frame) DynLayerInit()
	this.frame = frame || self
	if (is.ns4) {
		if (!frame) {
			if (!nestref) var nestref = DynLayer.nestRefArray[id]
			if (!DynLayerTest(id,nestref)) return
			this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
		}
		else this.css = (nestref)? eval("frame.document."+nestref+".document."+id) : frame.document.layers[id]
		this.elm = this.event = this.css
		this.doc = this.css.document
		this.x = this.css.left
		this.y = this.css.top
		this.w = this.css.clip.width
		this.h = this.css.clip.height
	}
	else if (is.ie4) {
		this.elm = this.event = this.frame.document.all[id]
		this.css = this.frame.document.all[id].style
		this.doc = document
		this.x = this.elm.offsetLeft
		this.y = this.elm.offsetTop
		this.w = (is.ie4)? this.css.pixelWidth : this.elm.offsetWidth
		this.h = (is.ie4)? this.css.pixelHeight : this.elm.offsetHeight
	}
	else if (is.comp) {
		this.elm = this.event = document.getElementById(id)
		this.css = this.elm.style
		this.doc = document
		this.x = this.elm.offsetLeft
		this.y = this.elm.offsetTop
		this.w = this.elm.offsetWidth
		this.h = this.elm.offsetHeight
	}
	this.id = id
	this.nestref = nestref
	this.obj = id + "DynLayer"
	eval(this.obj + "=this")
}
DynLayerTest = new Function('return true')

function DynLayerInit(nestref) {
	if (!DynLayer.set) DynLayer.set = true
	if (is.ns4) {
		if (nestref) ref = eval('document.'+nestref+'.document')
		else {nestref = ''; ref = document;}
		for (var i=0; i<ref.layers.length; i++) {
			var divname = ref.layers[i].name
			DynLayer.nestRefArray[divname] = nestref
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
			}
			if (ref.layers[i].document.layers.length > 0) {
				DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
			}
			//if(i==ref.layers.length-1)retrassa();
		}
		if (DynLayer.refArray.i < DynLayer.refArray.length) {
			DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
		}
	}
	else if (is.ie4) {
		for (var i=0; i<document.all.tags("DIV").length; i++) {
			var divname = document.all.tags("DIV")[i].id
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
			}
			//if(i==document.all.tags("DIV").length-1)retrassa();
		}
	}
	else if (is.comp) {
		for(i=0;i<document.getElementsByTagName("div").length;i++){
			var divname = document.getElementsByTagName("div")[i].id
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
			}
			//if(i==document.getElementsByTagName("div").length-1)retrassa();
		}
	}
	return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false
function DynLayerWrite(html) {
	if (is.ns4) {
		this.doc.open()
		this.doc.write(html)
		this.doc.close()
	}
	else if (is.comp) {
		this.event.innerHTML = html
	}
}
DynLayer.prototype.write = DynLayerWrite

function init(){
	DynLayerInit();
}


function ventana(talla,pag,nom){
  switch(talla){
  	case 0: carac='width=350,height=303,screenX=100,screenY=100,left=100,top=100,resizable=no,menubar=no,scrollbars=yes,status=no,locationbar=no';
    break;
	//gran
	case 1: carac='width=567,height=303,screenX=100,screenY=100,left=100,top=100,resizable=no,menubar=no,scrollbars=yes,status=no,locationbar=no';
    break;
    case 2: carac='width=760,height=400,location=yes,resizable=yes,menubar=yes,scrollbars=no,status=yes,screenX=0,screenY=0,top=0,left=0,toolbar=yes';
    break;
	default:
	carac='width=650,height=500,screenX=50,screenY=50,top=50,left=50,scrollbars=yes,resizable=yes,status=yes';
	break;
  }
  if(!nom)nom='FINESTRA';
  eval(nom+'=window.open("'+pag+'","'+nom+'","'+carac+'")');
  eval(nom+'.focus()');
}

function llegenda(text){
  lleg.write("<span class=llegen>"+text+"</span>");
}