function borrar(url,box){
	var texto="Se eliminar&aacute; el registro!";
	opciones="actualizar_box('" + url + "','"+box+"')";
	confirmar(texto,opciones, '');
}

function alertar_error(datos)
{
	texto = "Atenci&oacute;n: Se han encontrado los siguientes errores: <br /><br />";
	for (var i=0; i < datos.length; i++) {
		dato = datos[i];
		texto += dato.mensaje+"<br />";
		if(dato.campo!=""){
			Element.setStyle(dato.campo,{border:'solid 1px #81a7d7',backgroundColor:'#b5dcea'});
		}
	}
	
	Field.activate(datos[0].campo);
	Field.focus(datos[0].campo);
	Field.select(datos[0].campo);

	alertar(texto, '');
}
function alertar_atencion(mensaje)
{
	alertar(mensaje, '');
}
function alertar_ok(mensaje)
{
	alertar(mensaje, '');
}
function alertar(mensaje, funcion)
{
	Dialog.alert(mensaje, 
		{
			width:300, 
			height:100, 
			okLabel: "Aceptar", 
			ok:function(win) 
			{
				if (funcion != "")
					eval(funcion);
				
				return true;
			}
		}
	);
}
function confirmar(mensaje, funcionOk, funcionCancel)
{
	Dialog.confirm(mensaje, 
		{
			width:300, 
			height:100, 
			okLabel: "Si",
			cancelLabel: "No",
			buttonClass: "myButtonClass",
			id: "myDialogId",
			cancel:function(win)
			{
				if (funcionCancel != ""){
					funcionCancel = funcionCancel.gsub('&comilla;', "'");
					eval(funcionCancel);
				}

				return false;
			},
			ok:function(win)
			{
				if (funcionOk != ""){
					funcionOk = funcionOk.gsub('&comilla;', "'");
					eval(funcionOk);
				}

				return true;
			}
		}
	);
}

function ventana()
{
	win = new Window({className: "alphacube", title: "Sample", width:200, height:150, destroyOnClose: true, recenterAuto:false});
	win.getContent().update("http://lenainjewelry.com.wm/ajax.php?modulo=contacto");
	win.showCenter();
}

function str_search(string, substring)
{
	for(x=0; x<string.length; x++){
		if (string.substring(x, (x+1)) == substring)
			return true;
	}

	return false;
}


