function anchoDiv() {
	if(navigator.userAgent.indexOf("MSIE")>=0) {
		width = document.body.scrollWidth;
		widthdiv = document.body.scrollWidth-299;
		document.getElementById("div2").style.width = "150px";
	}
	else {
		width = document.width;
		widthdiv = document.width-327;
	}
	
	document.getElementById("div3").style.width = widthdiv + "px";
//	document.getElementById("sdiv3").style.left = (width-19) + "px";

/*	if (document.getElementById("div2").scrollHeight>document.getElementById("div2").offsetHeight)
		document.getElementById("cajaDespl1").style.visibility="visible";
	else
		document.getElementById("cajaDespl1").style.visibility="hidden";
	
	if (document.getElementById("div3").scrollHeight>document.getElementById("div3").offsetHeight)
		document.getElementById("sdiv3").style.visibility="visible";
	else
		document.getElementById("sdiv3").style.display="hidden";
*/
}

function posicionarScroll() {
	anchoDiv();
//	document.getElementById("div3").className='flexcroll';
}

function senyalar(link) {
	document.getElementById(link).style.color='#FF0000';
}

function addImagen(imagen) {
	document.frm_cont.f_contenido.value += '[a href$$"fotos/' + imagen + '" rel$$"lightbox"][img src$$"fotos/m_' + imagen + '"][/a]';
}

function confirmar(tipo, id) {
	switch (tipo) {
		case "apartado":
			resultado = confirm("¿Estás seguro de eliminar el apartado? Esta acción eliminará además los contenidos del apartado");
			if (resultado)
				 location.href="actions.php?op=delApartado&id=" + id;
			break

		case "trabajo":
			resultado = confirm("¿Estás seguro de eliminar el trabajo?");
			if (resultado)
				 location.href="actions.php?op=delTrabajo&id=" + id;
			break
			
		case "config":
			resultado = window.prompt("Nuevo valor de configuración:");
			if (resultado!=null) {
				location.href="actions.php?op=actConfig&clave=" + id + "&valor=" + resultado;
			}
			break;
			
		case "orden":
			resultado = window.prompt("Posición de orden:");
			if (resultado!=null) {
				location.href="actions.php?op=changeOrden&apartado=" + id + "&valor=" + resultado;
			}
			break;
			
		case "ordenTrabajo":
			resultado = window.prompt("Posición de orden:");
			if (resultado!=null) {
				location.href="actions.php?op=changeOrdenTrabajo&apartado=" + id + "&valor=" + resultado;
			}
			break;
			
		case "contenido":
			resultado = confirm("¿Estás seguro de eliminar la entrada?");
			if (resultado)
				 location.href="actions.php?op=delContenido&id=" + id;			
			break;
	}
	
	return resultado;

}