
function escribirOpciones( ancho, cantidad) {

	var i, j;

	with( document) {

		for( i = 1; i <= cantidad; i++) {
			write( "<OPTION>");
			for( j = 1; j <= ancho; j++)
				write( "&nbsp;");
			writeln( "</OPTION>");
		}
	}
}

function optIndexOf( opt, str) {

	for( var i = 0; i < opt.length; i++) {
        if( opt[ i].value) {
            if( opt[ i].value.toLowerCase() == str.toLowerCase())
			    return i;
        } else if( opt[ i].text.toLowerCase() == str.toLowerCase())
			return i;
	}

	return -1;

}

Array.prototype.indexOf = indexOf;
Array.prototype.compare = compare;
Array.prototype.findItem = findItem;
Array.prototype.sorted = false;
Array.prototype.li = -1;

function /*Array::*/compare( aKey1, aKey2) {
	if( aKey1 < aKey2)
		return -1;
	else if( aKey1 > aKey2)
		return 1;
	else
		return 0;
}

function /*Array::*/findItem( aKey) {
	var L = 0, H = this.length - 1, I, C;
	var result = false;

	while( L <= H) {
		I = ( L + H) >> 1;
	    C = this.compare( this[ I], aKey);
	    if( C < 0)
	    	L = I + 1;
	    else {
			H = I - 1;
			if( C == 0) {
				result = true;
				//if Duplicates <> dupAccept then
				L = I;
			}
	    }
	}

	this.li = L;
	return result;
}

function /*Array::*/indexOf( str) {
	if( this.sorted) {
		if( this.findItem( str))
			return this.li;
		else
			return -1;
	} else
		for( var i = 0; i < this.length; i++)
			if( this[ i] == str)
				return i;

	return -1;

}

function opcionSeleccionada( campo) {
	return campo.options[ campo.selectedIndex];
}

String.prototype.startsWith = function ( s) {
    return this.substring( 0, s.length) == s;
}

function startsWith( src, swith) {
    return src.substring( 0, swith.length) == swith;
}
var utils = true;
