function isAlphabetic(str){
  var re =  /^[a-zA-Z]+$/;
	if (re.test(str))
	{
	return true;
	}
	else
	{
	return false;
	}
}

String.prototype.rtrim = function() {
  return this.replace(/\s*$/g, '');
}
String.prototype.ltrim = function() {
  return this.replace(/^\s*/g, '');
}
String.prototype.trim = function() {
  return this.ltrim().rtrim();
}

String.prototype.rpl = function(){
	return this.split(s1).join(s2);
}

function getcookie( check_name){
	return getCookie( check_name);
}
function getCookie( check_name ) {
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; 
	
	for ( i = 0; i < a_all_cookies.length; i++ ){

		a_temp_cookie = a_all_cookies[i].split( '=' );
		

		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
	

		if ( cookie_name == check_name ){
			b_cookie_found = true;

			if ( a_temp_cookie.length > 1 ){
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}

			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found ) {
		return null;
	}
}

function setcookie( name, value, expires, path, domain, secure ) {
	return setCookie( name, value, expires, path, domain, secure );
}
function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	//la fecha de expiracion debe ir en dias
	if ( expires ){
		expires = expires * 1000 * 60 * 60 * 24;
	}

	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString()
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}

function delcookie( name, path, domain ) {
	return delCookie( name, path, domain );
}

function delCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}



	
/**
 * @author Alexander Farkas
 * v. 1.02
 */
(function($) {
	$.extend($.fx.step,{
	    backgroundPosition: function(fx) {
            if (fx.state === 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
			}
            var nowPosX = [];
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];
            
           function toArray(strg){
               strg = strg.replace(/left|top/g,'0px');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
           }
        }
	});
})(jQuery);


	
	function addOpt(oCntrl, sTxt, sVal,pos){
        var selOpcion=new Option(sTxt, sVal);
        eval(oCntrl.options[pos]=selOpcion);
   }

	
	
	function desaparecer(objeto, como, caida, velocida){
		caida=(caida || 100);
		velocida=(velocida || 'slow');
		como=(como|| 'abajo');
		if(como!='abajo') caida='-'+caida;
		$(objeto).animate({	opacity: 0.0,	marginTop: caida
		}, 500 ).hide(velocida);
	}
	
	function aparecer(objeto, como, caida, velocida){
		caida=(caida || 100);
		velocida=(velocida || 'normal');
		como=(como|| 'arriba');
		if(como!='abajo') caida='-'+caida;
		$(objeto)
			.animate({
				opacity: '0.0',
				marginTop: caida
			}, 10 ).show(velocida)
			.animate({
				opacity: '1.0',
				marginTop: "0"
			}, 1000 );
	}
	
	
	function mover(objeto,direccion,desde,hasta){
		direccion=(direccion|| 'horizontal');
		desde=(desde|| '-20px');
		hasta=(hasta|| '300%');
		if(direccion=='vertical'){
			$(objeto)
				.animate({
						top: desde
					}, 10)
				.animate({
						hasta: hasta
					}, 1000);
		}else{		
			$(objeto)
				.animate({
					left: desde
				}, 10)
				.animate({
					left: hasta
				}, 1000);		
		}
	}
	
	
	
	var oAlert = alert;
	function alert(txt, title) {
	    try {
	        jAlert(txt, title);
	    } catch (e) {
	        oAlert(txt);
	    }
	}

	var oConfirm = confirm;
	function confirm(txt, title, func) {
	    try {
	        jConfirm(txt, title, func);
	    } catch (e) {
	        if (oConfirm (txt, title)) func();
	    }
	}

	
	var oPrompt = prompt;
	function prompt(txt, input, title, func){
	    try {
	        jPrompt(txt, input, title, func);
	    } catch(e) {
	        func(prompt(txt, input, title));
	    }
	}
	
	
	
	var url;
	
	function delayer(){	 window.location = url; }
	
	function redirecciona(urlx,tiempox){ url=urlx;	 tiempox=(tiempox|| '100');	setTimeout('delayer()', tiempox);}
	
	function redir(urlx,tiempox){ redirecciona(urlx,tiempox); }


		
function emailCheck (emailStr) {
/* Verificar si el email tiene el formato user@dominio. */
var emailPat=/^(.+)@(.+)$/

/* Verificar la existencia de caracteres. ( ) < > @ , ; : \ " . [ ] */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"

/* Verifica los caracteres que son vÃ¡lidos en una direcciÃ³n de email */
var validChars="\[^\\s" + specialChars + "\]"

var quotedUser="(\"[^\"]*\")"

/* Verifica si la direcciÃ³n de email estÃ¡ representada con una direcciÃ³n IP VÃ¡lida */


var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/

/* Verificar caracteres invÃ¡lidos */

var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
//domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
return false
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) {

return false
}

/* Si la direcciÃ³n IP es vÃ¡lida */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
return false
}
}
return true
}

var domainArray=domain.match(domainPat)
if (domainArray==null) {
return false
}

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) {

return false
}

if (len<2) {
return false
}

return true;
}


function esEmail(e){
	return emailCheck(e);
}
