function ofTrim(as_value)
{
    var len, st, off;
    if (null==as_value || ""==as_value) {
        return as_value;
    }
    len=as_value.length;
    off=0;
    st=0;
    while ((st < len) && ( as_value.charAt(off+st) <=' ') ) st++;
    while ((st < len) && ( as_value.charAt(off+len-1) <=' ') ) len--;
    return ((st > 0) || (len < as_value.length)) ? as_value.substring(st, len) : as_value;
}
function ofEMailCheck (emailStr) 
{
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
	var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
	var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
	var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
	var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
	var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
//		alert("Email address seems incorrect (check @ and .'s)")
		return false
	}

	var user=matchArray[1]
	var domain=matchArray[2]

// See if "user" is valid 
	if (user.match(userPat)==null) {
	// user is not valid
//		alert("The username doesn't seem to be valid.")
		return false
	}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
	// this is an IP address
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
//				alert("Destination IP address is invalid!")
				return false
			}
		}
		return true
	}

// Domain is symbolic name
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
//		alert("The domain name doesn't seem to be valid.")
		return false
	}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>3) 
	{
        // the address must end in a two letter or three letter word.
//		alert("The address must end in a three-letter domain, or two letter country.")
		return false
	}

// Make sure there's a host name preceding the domain.
	if (len<2) {
		var errStr="This address is missing a hostname!"
//		alert(errStr)
		return false
	}

// If we've gotten this far, everything's valid!
	return true;
}




function loadIm(){


			if(!highlight('PortalDesempeno')) MM_swapImage('bancos','','Imagen?SITIO=0&ID_IMAGEN=bancos.gif',1)
			if(!highlight('AtencionPublico') && !highlight('ideudas')) MM_swapImage('atencion','','Imagen?SITIO=0&ID_IMAGEN=atencion.gif',1);
			if(!highlight('Noticia')) MM_swapImage('noticias','','Imagen?SITIO=0&ID_IMAGEN=noticias.gif',1);
			if(!highlight('LeyNorma')) MM_swapImage('leyes','','Imagen?SITIO=0&ID_IMAGEN=leyes.gif',1);
			if(!highlight('InfoFinanciera') || highlight('BFPublicacion')) MM_swapImage('info','','Imagen?SITIO=0&ID_IMAGEN=info.gif',1);
			if(!highlight('Biblioteca') && !highlight('BBiblioteca') && !highlight('BSBiblioteca') && !highlight('DBiblioteca') && !highlight('PBiblioteca')){
 			MM_swapImage('biblioteca','','Imagen?SITIO=0&ID_IMAGEN=biblioteca.gif',1);
 			}
			if(!highlight('Glosario')) MM_swapImage('glosario','','Imagen?SITIO=0&ID_IMAGEN=glosario.gif',1);
			if(!highlight('ConozcaSBIF')) MM_swapImage('conozca','','Imagen?SITIO=0&ID_IMAGEN=conozca.gif',1);

			if(highlight('PortalDesempeno')) MM_swapImage('bancos','','Imagen?SITIO=0&ID_IMAGEN=bancos1.gif',1)
			if(highlight('AtencionPublico') || highlight('ideudas')) MM_swapImage('atencion','','Imagen?SITIO=0&ID_IMAGEN=atencion1.gif',1);
			if(highlight('Noticia')) MM_swapImage('noticias','','Imagen?SITIO=0&ID_IMAGEN=noticias1.gif',1);
			if(highlight('LeyNorma')) MM_swapImage('leyes','','Imagen?SITIO=0&ID_IMAGEN=leyes1.gif',1);
			if(highlight('InfoFinanciera') || highlight('BFPublicacion')) MM_swapImage('info','','Imagen?SITIO=0&ID_IMAGEN=info1.gif',1);
			if(highlight('Biblioteca') || highlight('BBiblioteca') || highlight('BSBiblioteca') || highlight('DBiblioteca') || highlight('PBiblioteca')){
			MM_swapImage('biblioteca','','Imagen?SITIO=0&ID_IMAGEN=biblioteca1.gif',1);
			}
			if(highlight('Glosario')) MM_swapImage('glosario','','Imagen?SITIO=0&ID_IMAGEN=glosario1.gif',1);
			if(highlight('ConozcaSBIF')) MM_swapImage('conozca','','Imagen?SITIO=0&ID_IMAGEN=conozca1.gif',1);
}





function highlight(servlet){
if(document.location.href.indexOf('?')!=-1){
servlet1 = document.location.href.substring(document.location.href.indexOf('servlet')+8,document.location.href.indexOf('?'));
}
else{
servlet1 = document.location.href.substring(document.location.href.indexOf('servlet')+8,document.location.href.length);
}

		//alert("1"+servlet1);
		//alert("2"+servlet);

	if(servlet==servlet1){
			return true;
	}
	else{
		return false;
	}
}


/****************************/
/*DHTML SIMULADOR CUOTAS*/

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	return false;
    }
} // changeObjectVisibility

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.left = newXCoordinate;
	styleObject.top = newYCoordinate;
	return true;
    } else {
	// we couldn't find the object, so we can't very well move it
	return false;
    }
} // moveObject




var xOffset = -100;
var yOffset = 10;

function showPopup (targetObjectId, eventObj) {
    if(eventObj) {
	// hide any currently-visible popups
	hideCurrentPopup();
	// stop event from bubbling up any farther
	eventObj.cancelBubble = true;
	// move popup div to current cursor position 
	// (add scrollTop to account for scrolling for IE)
	var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft:0);
	var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0);
	moveObject(targetObjectId, newXCoordinate, newYCoordinate);
	// and make it visible
	if( changeObjectVisibility(targetObjectId, 'visible') ) {
	    // if we successfully showed the popup
	    // store its Id on a globally-accessible object
	    window.currentlyVisiblePopup = targetObjectId;
	    return true;
	} else {
	    // we couldn't show the popup, boo hoo!
	    return false;
	}
    } else {
	// there was no event object, so we won't be able to position anything, so give up
	return false;
    }
} // showPopup

function hideCurrentPopup() {
    // note: we've stored the currently-visible popup on the global object window.currentlyVisiblePopup
    if(window.currentlyVisiblePopup) {
	changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
	window.currentlyVisiblePopup = false;
    }
} // hideCurrentPopup



var xOffsetEYN = -100;
var yOffsetEYN = 10;

function showPopupEYN (targetObjectId, eventObj) {
    if(eventObj) {
	// hide any currently-visible popups
	hideCurrentPopup();
	// stop event from bubbling up any farther
	eventObj.cancelBubble = true;
	// move popup div to current cursor position 
	// (add scrollTop to account for scrolling for IE)
	var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffsetEYN:eventObj.x + xOffsetEYN + ((document.body.scrollLeft)?document.body.scrollLeft:0);
	var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffsetEYN:eventObj.y + yOffsetEYN + ((document.body.scrollTop)?document.body.scrollTop:0);
	moveObject(targetObjectId, newXCoordinate, newYCoordinate);
	// and make it visible
	if( changeObjectVisibility(targetObjectId, 'visible') ) {
	    // if we successfully showed the popup
	    // store its Id on a globally-accessible object
	    window.currentlyVisiblePopup = targetObjectId;
	    return true;
	} else {
	    // we couldn't show the popup, boo hoo!
	    return false;
	}
    } else {
	// there was no event object, so we won't be able to position anything, so give up
	return false;
    }
} // showPopup

function hideCurrentPopupEYN() {
    // note: we've stored the currently-visible popup on the global object window.currentlyVisiblePopup
    if(window.currentlyVisiblePopup) {
	changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
	window.currentlyVisiblePopup = false;
    }
}