function abre_calendario(frm,name,e,home,admin)
{
	var form_name = frm;
	if (document.all && frm.attributes)
	{ form_name = frm.attributes('name').value; }
	else if (frm.getAttribute)
	{ form_name = frm.getAttribute('name'); }

	if (home == null) { home = "/"; }
	var argumentos = "form_name=" + form_name + "&name=" + name;
	if(admin != null){argumentos += '&admin=1';}
	var href = home + "common/calendar/calendario.html?" + argumentos;

	var araY=200;
	var araX=200;
	if (e != null)
	{ araX = e.screenX; araY = e.screenY - 150; }	

	var w=window.open(href,"selector","width=170,height=200,left=" + araX + ",top=" + araY);
	w.focus();
	return false;
}


function abre_time_picker(frm,name,e,home,admin)
{
	var form_name = frm;
	if (document.all && frm.attributes)
	{ form_name = frm.attributes('name').value; }
	else if (frm.getAttribute)
	{ form_name = frm.getAttribute('name'); }

	if (home == null) { home = "/"; }
	var argumentos = "form_name=" + form_name + "&name=" + name;
	if(admin != null){argumentos += '&admin=1';}
	var href = home + "common/time_picker/time_picker.html?" + argumentos;
	
	var araY=200;
	var araX=200;
	if (e != null)
	{
		if (document.all)
		{ araY=event.y - document.body.scrollTop; araX=event.x - document.body.scrollLeft; }
		else
		{ araX = e.screenX; araY = e.screenY - 150; }
	}	
	
	var w=window.open(href,"selector","width=190,height=140,left=" + araX + ",top=" + araY);
	w.focus();
	return false;
}


function abre_datetime_picker(frm,name,e,home,admin)
{
	var form_name = frm;
	if (document.all && frm.attributes)
	{ form_name = frm.attributes('name').value; }
	else if (frm.getAttribute)
	{ form_name = frm.getAttribute('name'); }

	if (home == null) { home = "/"; }
	var argumentos = "form_name=" + form_name + "&name=" + name;
	if(admin != null){argumentos += '&admin=1';}
	var href = home + "common/datetime_picker/datetime_picker.html?" + argumentos;
	
	var araY=200;
	var araX=200;
	if (e != null)
	{
		if (document.all)
		{ araY=event.y - document.body.scrollTop; araX=event.x - document.body.scrollLeft; }
		else
		{ araX = e.screenX; araY = e.screenY - 150; }
	}	

	var w=window.open(href,"selector","width=190,height=240,left=" + araX + ",top=" + araY + ",status=1");
	w.focus();
	return false;
}

function abre_remote_html_editor(frm,name,home,admin)
{
	var form_name = frm;
	if (document.all && frm.attributes)
	{ form_name = frm.attributes('name').value; }
	else if (frm.getAttribute)
	{ form_name = frm.getAttribute('name'); }

	if (home == null) { home = "/"; }
	var argumentos = "form_name=" + form_name + "&name=" + name;
	if(admin != null){argumentos += '&admin=1';}
	var href = home + "common/remote_html/editor.html?" + argumentos;
	var w=window.open(href,"remote_html_editor",
	  			  "width=470,height=235,left=200,top=60");
	w.focus();
	return false;
}

function abre_params_flash(frm,name,atr_params,home,admin)
{
	var form_name = frm;
	if (document.all && frm.attributes)
	{ form_name = frm.attributes('name').value; }
	else if (frm.getAttribute)
	{ form_name = frm.getAttribute('name'); }

	if (home == null) { home = "/"; }
	var argumentos = "form_name=" + form_name + "&name=" + name + "&params="+ atr_params;
	if(admin != null){argumentos += '&admin=1';}
	var href = home + "common/flash/editor.html?" + argumentos;
	var w=window.open(href,"params_flash","width=375,height=400,left=200,top=60");
	w.focus();
	return false;
}

function abre_html_editor(frm,name,ancho,alto,idvista,atributo,source,links,home,admin)
{
	var form_name = frm;
	if (document.all && frm.attributes)
	{ form_name = frm.attributes('name').value; }
	else if (frm.getAttribute)
	{ form_name = frm.getAttribute('name'); }

	if (home == null) { home = "/"; }
	var argumentos = "form_name=" + form_name + "&name=" + name + "&source=" + source +
			"&ebd_links=" + links;
	if(admin != null){argumentos += '&admin=1';}

	if (idvista != null && idvista > 0)
		argumentos += "&usar_vista=" + idvista;
	
	if (atributo != null && atributo.length > 0)
		argumentos += "&usar_atributo=" + atributo;

	var href = home + "common/html_editor/html_editor.html?"
				+ argumentos;
	var width=850;
	var height=600;

//	if (ancho != null && ancho > 100) width=ancho;
//	if (alto != null && alto > 100) height=alto;
	
	var w=window.open(href, "html_editor",
				"width=" + width + ",height=" + height + ",top=50,left=50,resizable=1,status=1");
	w.focus();
	return false;
}

function abre_new_html_editor(frm,name,ancho,alto,idvista,atributo,source,links,home,admin)
{
	var form_name = frm;
	if (document.all && frm.attributes)
	{ form_name = frm.attributes('name').value; }
	else if (frm.getAttribute)
	{ form_name = frm.getAttribute('name'); }

	if (home == null) { home = "/"; }
	var argumentos = "form_name=" + form_name + "&name=" + name + "&source=" + source +
			"&ebd_links=" + links;

	if(admin != null){argumentos += '&admin=1';}

	if (idvista != null && idvista > 0)
		argumentos += "&usar_vista=" + idvista;
	
	if (atributo != null && atributo.length > 0)
		argumentos += "&usar_atributo=" + atributo;

	var width=800;
	var height=550;

	if (ancho != null && ancho > 100) width=ancho;
	if (alto != null && alto > 100) height=alto;

	argumentos += "&ancho=" + width;
	argumentos += "&alto=" + height;
	width+=50;
	height+=50;
	var href = home + "common/new_html_editor/new_html_editor.html?"
				+ argumentos;
	
	var w=window.open(href, "html_editor",
				"width=" + width + ",height=" + height + ",top=50,left=50,resizable=1,status=1");
	w.focus();
	return false;
}

function abre_ebdml_editor(form_name,name,ancho,alto,home,id)
{
	if (home == null) { home = "/"; }
	var argumentos = "form_name=" + form_name + "&name=" + name;

	var href = home + "common/ebdml_editor/ebdml_editor.html?" + argumentos;
	var width=700;
    var height=500;

	if (ancho != null && ancho > 100) width=ancho;
	if (alto != null && alto > 100) height=alto;

	var w=window.open(href, "ebdml_editor_"+id, "width="+width+",height="+height+",top=100,left=100,resizable=1,status=1");
    w.focus();
	return false;
}


function abre_java_editor(form_name,name,ancho,alto,home)
{
	if (home == null) { home = "/"; }
	var argumentos = "form_name=" + form_name + "&name=" + name;

	var href = home + "common/java_editor/java_editor.html?" + argumentos;
	var width=700;
    var height=500;

	if (ancho != null && ancho > 100) width=ancho;
	if (alto != null && alto > 100) height=alto;

	var w=window.open(href, "java_editor", "width="+width+",height="+height+",top=100,left=100,resizable=1,status=1");
    w.focus();
	return false;
}


function abre_agregar_comentarios (id_objeto,es_relacion)
{
	if (id_objeto != null ){
		var href = "ver_comentarios.html?id="+id_objeto+"&es_relacion="+es_relacion ;
		var w=window.open(href,'opciones_editor','left=200,top=100,width=600,height=450,resizable=no,scrollbars=no');
		w.focus();
	}
	return false;
}


function abre_object_picker(home,type,form_name,name,type_adicional,name_adicional)
{
	var width=320;
	
	var argumentos = 'type='+type+'&form_name='+form_name+'&name='+name;
	if (name_adicional != null && type_adicional != null)
	{
		argumentos += '&type_adicional='+type_adicional+'&name_adicional='+name_adicional;
		width=550;
	}
	var w=window.open(home+"common/object_picker/object_picker.html?"+argumentos,"object_picker","width="+width+",height=330,top=200,left=200");
	w.focus();
	return false;
}


function eBD_print(url)
{
	window.open(url,'imprimir','width=1,height=1,toolbar=0,directories=0,menubar=0,status=0,resizable=0,location=0,scrollbars=0,copyhistory=0,top=9000,left=9000');
}


function obrir(pag,amp,alc,dalt,esquerra,nom,toolbar,directories,menubar,status,resizable,location,scrollbars,copyhistory)
{
/*
	pag			PAGINA K HA D'OBRIR, no hay defecto debe pasarse por parametro
	amp			AMPLADA DE LA FINESTRA, defecto => 800
	alc			ALCADA DE LA FINESTRA, defecto => 600
	dalt			DISTANCIA DL TOP, defecto => 0
	esquerra		DISTANCIA D L'ESKERRA, defecto => 0
	nom			NOM DE LA FINESTRA, defecto => finestra
	toolbar		SI VOLS LA BARRA D'EINES, defecto => 1 k es 'si'
	directories		SI VOLS LOS FAVORITOS, defecto => 1 k es 'si'
	menubar		SI VOLS LA BARRA DLS MENUS, defecto => 1 k es 'si'
	status		SI VOLS LA BARRA D'STATUS, defecto => 1 k es 'si'
	resizable		SI VOLS K SIGUI ESCALABLE, defecto => 1 k es 'si'
	location		SI VOLS LA BARRA DE DIRECCIO, defecto => 1 k es 'si'
	scrollbars		SI VOLS SCROLLBARS, defecto => yes
	copyhistory		SI VOLS COPIA EL HISTORY D LA FINESTRA MARE, defecto => 1 k es 'si'
*/

	if(!(amp)){amp=screen.availWidth-15;}
	if(!(alc)){alc=screen.availHeight-25;}
	if(dalt == ''){dalt=0;}
	if(nom == ''){nom='finestra';}
	if(esquerra == ''){esquerra=1;}
	if(toolbar != 0){toolbar=1;}
	if(directories != 0){directories=1;}
	if(menubar != 0){menubar=1;}
	if(status != 0){status=1;}
	if(resizable != 0){resizable=1;}
	if(location != 0){location=1;}
	if(scrollbars != 'no'){scrollbars='yes';}
	if(copyhistory != 0){copyhistory=1;}
	finestra=eval("window.open('"+pag+"','"+nom+"','width="+amp+",height="+alc+",toolbar="+toolbar+",directories="+directories+",menubar="+menubar+",status="+status+",resizable="+resizable+",location="+location+",scrollbars="+scrollbars+",copyhistory="+copyhistory+",top="+dalt+",left="+esquerra+"')");
	finestra.focus();
	return false;
}

