//Cerrar, abrir opciones
function refer(object) {
    if (document.getElementById) {
       return document.getElementById(object);
    } else if (document.all) {
       return eval('document.all.' + object);
    } else {
       return false;
    }
}
function klik(object, path) {
    object = refer(object);
    if( !object.style ) {
	return false;
    }
    if( object.style.display == 'none' ) {
	object.style.display = '';
    } else {
	object.style.display = 'none';
    }
}


//Funciones uno y dos para resaltar la tabla
function uno(src,color_entrada) {
src.bgColor=color_entrada;src.style.cursor="default"; }

function dos(src,color_default) {
src.bgColor=color_default;src.style.cursor="default"; }

// Roll Over imagenes
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
}


//Obrir finestra centrada
function obret(pagina,ample,alt,scroll)
{
	if (scroll=="si")d=1;
	if (scroll=="no")d=0;
	if (scroll=="")d=0;
	
	LeftPosition = (screen.width) ? (screen.width-ample)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-alt)/2 : 0;
	
	popup=window.open(pagina,"xyz","toolbar=0,location=0,directories=0,scrollbars="+d+",menubar=0,status=0,resizable=0,width="+ample+",height="+alt+",left="+LeftPosition+",top="+TopPosition+""); 
	popup.focus();
}


// Obre imatge centrada
function imatge(imatge,text)
{
	pagina="finestra.htm?"+imatge+"&"+text;
 	var img = new Image();
 	img.src = imatge;
	ample=img.width;

	if(text!="") alt=img.height+20;
	else alt=img.height;
		
	LeftPosition = (screen.width) ? (screen.width-ample)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-alt)/2 : 0;
	
	popup = window.open(pagina,null,"toolbar=0,location=0,directories=0,scrollbars=0,menubar=0,status=0,resizable=0,width="+ample+",height="+alt+",left="+LeftPosition+",top="+TopPosition+"");
	//popup.window.resizeTo(650, 488); 
	popup.focus();
}