function changestFree(iconte,idimage,mode)
{
	change_status_content(iconte,mode,idimage);
}

function changest(iconte,idimage)
{
	change_status_content(iconte,"ALL",idimage);
}

function changdest(iconte,idimage)
{
	change_status_content(iconte,"DEST",idimage);	
}

function change_status_content(id,mode,idimage)
{
	url = SERVER_NAME+"modules/mod_admin/ajax/changestatuscontentlang.php";
	valores = "id="+id+"&mode="+mode;
	var sec = getHTTPObject();
	sec.open("POST", url, true); 
	//alert(url);
	sec.onreadystatechange = function() {
		if(sec.readyState == 1)
		{
			/*cargando*/
		}
		if(sec.readyState == 4) 
		{
			if(sec.status == 200)
			{
				//alert(sec.responseText);
				document.getElementById(idimage).src = sec.responseText;				
			} else
			{
				/*acurrio algun erro*/
			}
		}
	}
	sec.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
	sec.send(valores);
}

function setactionlist(url)
{
	frm = document.formlist;
	val = frm.dropdown.value;
	switch(val)
	{
		case "edit":
			selid = getFirstSelecion(frm,"c_file[]")
			if(selid == 0)
			{
				alert("Debes seleccionar un item.");
			}else
			{
				document.location = url+selid;
			}
			break;
		case "deletemas":
			deleteSeletecteds(frm);
			break;
	}
}

function getFirstSelecion(frm,ob_name)
{
	for (var i = 0; i < frm.elements.length; i++)
	{
        if (frm.elements[i].name == ob_name)
		{
            if(frm.elements[i].checked)
			{
				return frm.elements[i].value;
			}
        }
    }
	return 0;
}






function deleteSeletecteds(frm)
{
	frm = document.formlist;
	if(validateFields(frm))
	{
		if(confirm("Ésto borrará permanentemente los items seleccionados de la base de datos"))
		{
			frm.action.value = "masdel";
			frm.submit();
		}
	}
}

function htmlentities (string, quote_style) {
    // Convert all applicable characters to HTML entities  
    // 
    // version: 909.322
    // discuss at: http://phpjs.org/functions/htmlentities    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: nobbler
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Ratheous
    // -    depends on: get_html_translation_table
    // *     example 1: htmlentities('Kevin & van Zonneveld');    // *     returns 1: 'Kevin &amp; van Zonneveld'
    // *     example 2: htmlentities("foo'bar","ENT_QUOTES");
    // *     returns 2: 'foo&#039;bar'
    var hash_map = {}, symbol = '', tmp_str = '', entity = '';
    tmp_str = string.toString();    
    if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {
        return false;
    }
    hash_map["'"] = '&#039;';    for (symbol in hash_map) {
        entity = hash_map[symbol];
        tmp_str = tmp_str.split(symbol).join(entity);
    }
        return tmp_str;
}

function get_html_translation_table (table, quote_style) {
    // Returns the internal translation table used by htmlspecialchars and htmlentities  
    // 
    // version: 909.322
    // discuss at: http://phpjs.org/functions/get_html_translation_table    // +   original by: Philip Peterson
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: noname
    // +   bugfixed by: Alex
    // +   bugfixed by: Marco    // +   bugfixed by: madipta
    // +   improved by: KELAN
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Frank Forte    // +   bugfixed by: T.Wild
    // +      input by: Ratheous
    // %          note: It has been decided that we're not going to add global
    // %          note: dependencies to php.js, meaning the constants are not
    // %          note: real constants, but strings instead. Integers are also supported if someone    // %          note: chooses to create the constants themselves.
    // *     example 1: get_html_translation_table('HTML_SPECIALCHARS');
    // *     returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
    
    var entities = {}, hash_map = {}, decimal = 0, symbol = '';    var constMappingTable = {}, constMappingQuoteStyle = {};
    var useTable = {}, useQuoteStyle = {};
    
    // Translate arguments
    constMappingTable[0]      = 'HTML_SPECIALCHARS';    constMappingTable[1]      = 'HTML_ENTITIES';
    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
    constMappingQuoteStyle[2] = 'ENT_COMPAT';
    constMappingQuoteStyle[3] = 'ENT_QUOTES';
     useTable       = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS';
    useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT';
 
    if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') {
        throw new Error("Table: "+useTable+' not supported');        // return false;
    }
 
    entities['38'] = '&amp;';
    if (useTable === 'HTML_ENTITIES') {        entities['160'] = '&nbsp;';
        entities['161'] = '&iexcl;';
        entities['162'] = '&cent;';
        entities['163'] = '&pound;';
        entities['164'] = '&curren;';        entities['165'] = '&yen;';
        entities['166'] = '&brvbar;';
        entities['167'] = '&sect;';
        entities['168'] = '&uml;';
        entities['169'] = '&copy;';        entities['170'] = '&ordf;';
        entities['171'] = '&laquo;';
        entities['172'] = '&not;';
        entities['173'] = '&shy;';
        entities['174'] = '&reg;';        entities['175'] = '&macr;';
        entities['176'] = '&deg;';
        entities['177'] = '&plusmn;';
        entities['178'] = '&sup2;';
        entities['179'] = '&sup3;';        entities['180'] = '&acute;';
        entities['181'] = '&micro;';
        entities['182'] = '&para;';
        entities['183'] = '&middot;';
        entities['184'] = '&cedil;';        entities['185'] = '&sup1;';
        entities['186'] = '&ordm;';
        entities['187'] = '&raquo;';
        entities['188'] = '&frac14;';
        entities['189'] = '&frac12;';        entities['190'] = '&frac34;';
        entities['191'] = '&iquest;';
        entities['192'] = '&Agrave;';
        entities['193'] = '&Aacute;';
        entities['194'] = '&Acirc;';        entities['195'] = '&Atilde;';
        entities['196'] = '&Auml;';
        entities['197'] = '&Aring;';
        entities['198'] = '&AElig;';
        entities['199'] = '&Ccedil;';        entities['200'] = '&Egrave;';
        entities['201'] = '&Eacute;';
        entities['202'] = '&Ecirc;';
        entities['203'] = '&Euml;';
        entities['204'] = '&Igrave;';        entities['205'] = '&Iacute;';
        entities['206'] = '&Icirc;';
        entities['207'] = '&Iuml;';
        entities['208'] = '&ETH;';
        entities['209'] = '&Ntilde;';        entities['210'] = '&Ograve;';
        entities['211'] = '&Oacute;';
        entities['212'] = '&Ocirc;';
        entities['213'] = '&Otilde;';
        entities['214'] = '&Ouml;';        entities['215'] = '&times;';
        entities['216'] = '&Oslash;';
        entities['217'] = '&Ugrave;';
        entities['218'] = '&Uacute;';
        entities['219'] = '&Ucirc;';        entities['220'] = '&Uuml;';
        entities['221'] = '&Yacute;';
        entities['222'] = '&THORN;';
        entities['223'] = '&szlig;';
        entities['224'] = '&agrave;';        entities['225'] = '&aacute;';
        entities['226'] = '&acirc;';
        entities['227'] = '&atilde;';
        entities['228'] = '&auml;';
        entities['229'] = '&aring;';        entities['230'] = '&aelig;';
        entities['231'] = '&ccedil;';
        entities['232'] = '&egrave;';
        entities['233'] = '&eacute;';
        entities['234'] = '&ecirc;';        entities['235'] = '&euml;';
        entities['236'] = '&igrave;';
        entities['237'] = '&iacute;';
        entities['238'] = '&icirc;';
        entities['239'] = '&iuml;';        entities['240'] = '&eth;';
        entities['241'] = '&ntilde;';
        entities['242'] = '&ograve;';
        entities['243'] = '&oacute;';
        entities['244'] = '&ocirc;';        entities['245'] = '&otilde;';
        entities['246'] = '&ouml;';
        entities['247'] = '&divide;';
        entities['248'] = '&oslash;';
        entities['249'] = '&ugrave;';        entities['250'] = '&uacute;';
        entities['251'] = '&ucirc;';
        entities['252'] = '&uuml;';
        entities['253'] = '&yacute;';
        entities['254'] = '&thorn;';        entities['255'] = '&yuml;';
    }
 
    if (useQuoteStyle !== 'ENT_NOQUOTES') {
        entities['34'] = '&quot;';    }
    if (useQuoteStyle === 'ENT_QUOTES') {
        entities['39'] = '&#39;';
    }
    entities['60'] = '&lt;';    entities['62'] = '&gt;';
 
 
    // ascii decimals to real symbols
    for (decimal in entities) {        symbol = String.fromCharCode(decimal);
        hash_map[symbol] = entities[decimal];
    }
    
    return hash_map;}

function deleteSeletecteds(frm)
{
	frm = document.formlist;
	if(validateFields(frm))
	{
		if(confirm("Ésto borrará permanentemente los items seleccionados de la base de datos"))
		{
			frm.action.value = "masdel";
			frm.submit();
		}
	}
}

function ActiveAll(frm,ob,name_chec)
{
	if(ob.checked)
	{
		makeSelection(frm,name_chec,true);
	}else
	{
		makeSelection(frm,name_chec,false);
	}
	
	return true;
}

function makeSelection(frm,ob_name,est)
{
	for (var i = 0; i < frm.elements.length; i++)
	{
        if (frm.elements[i].name == ob_name)
		{
            frm.elements[i].checked = est;
        }
    }
}



function roundjs ( val, precision ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +    revised by: Onno Marsman
    // *     example 1: round(1241757, -3);
    // *     returns 1: 1242000
    // *     example 2: round(3.6);
    // *     returns 2: 4
 
    return parseFloat(parseFloat(val).toFixed(precision));
}

function checkNull(inComp, inMsg)
{
  var er_empty = /^$/ 
	while (er_empty.test(inComp.value))
	{
	   alert(inMsg); 
	   inComp.focus(); 
	   return false;
	    
	 }
	 return true
}



function checkEmailb(inEmail)
{
 var er_email1 = /^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ ;//primer filtro
 var er_email2 = /^([0-9]|[a-z]|[A-Z]|\.|\@|\_|-)+$/ ;//segundo filtro
 var myTest1 =! er_email1.test(inEmail.value); 
 var myTest2 =! er_email2.test(inEmail.value);

    xvar = checkNull(inEmail, "Ingrese por favor su e-mail"); 
	if (!xvar)return false; 
	
	if (inEmail.value.indexOf('@') == -1)
	{
		alert ("Ingrese un e-mail valido"); 
		inEmail.focus(); 
		return false 
	}
	
	if (myTest1 || myTest2) 
	{
		alert('Su e-mail no es Válido\n'
		+'Verifique que este correctamente escrito\n'
		+'Posibles errores:\n'
		+'- Su e-mail contiene caracteres especiales [#$%&8¿?Çñ]\n'
		+'- Su e-mail contiene tildes [áéíóú]\n- Su e-mail contiene espacios en blanco');
		inEmail.focus(); 
		return false;
	}
	return true
}


function checkList(inComp, inMsg){
	if(inComp.options[inComp.selectedIndex].value == -1)
	{
		alert(inMsg);
		inComp.focus();
		return false;
	}
	return true;
}


function confirmLink(f,g)
{
		e = confirm(g);
		return e
		
}

function msgBox(){  

	myWidth	 = 400;
	myHeight = 40;
	myLeft = (window.screen.width / 2) - (myWidth / 2)
	myTop = (window.screen.height / 2) - (myHeight / 2)
	
	if (window.showModalDialog) {
		modal = window.showModalDialog("msgbox.php","name","dialogWidth: "+ myWidth +"px; dialogHeight:124px; center:yes; help:no; scroll:no; status:no");
	}else{
		modal = window.open("msgbox.php","name","width =" + myWidth + ", height =" + myHeight + ", left =" + myLeft + ", top =" + myTop +", toolbar=no, directories=no, status=no, linemenubar=no, scrollbars=no, resizable=no, modal=yes");
	}

}

/* Version 2.0 - 08/03/2005  */
function trim(str)
{
	if (typeof str != "string") return str;
	str = str.replace(/(^\s*)|(\s*$)/g,"");
	return str;
}

//popups emergentes
function emergentesAdm(params, name, myWidth, myHeight, isdialog)
{
	myLeft = (window.screen.width / 2) - (myWidth / 2)
	myTop = (window.screen.height / 2) - (myHeight / 2)
	
	scrollbars = 1;
	if (window.showModalDialog && isdialog != 1) {
		//myWindow = window.showModalDialog("msgbox.php","name","dialogWidth: "+ myWidth +"px; dialogHeight:124px; center:yes; help:no; scroll:no; status:no");
		myWindow = window.showModalDialog(SERVER_NAME+"index.php?emergente=1&dialog=1&"+params, name, "dialogWidth =" + myWidth + "px; dialogHeight =" + myHeight + "px ; center:yes; help:no; scroll:"+scrollbars+"; status:no");
		document.location.reload();
		
	}else{
		myWindow = window.open(SERVER_NAME+"index.php?emergente=1&dialog=0&"+params, name, "width =" + myWidth + ", height =" + myHeight + " , left =" + myLeft + ", top =" + myTop +", toolbar=0, resizable=0, scrollbars="+scrollbars+", status=no, menubar=no")
		myWindow.focus();
	}	
}



//popups
function windowsopen(url, name, myWidth, myHeight)
{
	myLeft = (window.screen.width / 2) - (myWidth / 2)
	myTop = (window.screen.height / 2) - (myHeight / 2)
	myWindow = window.open(url, name, "width =" + myWidth + ", height =" + myHeight + " , left =" + myLeft + ", top =" + myTop +", toolbar=0, resizable=1, scrollbars=yes, status=no, menubar=no")
	myWindow.focus();
}

function windowsImage(page,img,name){	
 img1 = new Image()
 img1.src = img
 //alert(img1.width+'-'+img1.height);
 url = page+"?img="+img
 //alert(url);
 myWindow = window.open(url,name,"width =" + (img1.width+20) + ", height =" + (img1.height+50) + " ,left =50, top =50, toolbar=no, resizable=no, scrollbars=yes, status=no, menubar=no")
// alert(10);
 myWindow.focus();
}


/*function view(url){
	windows(url, "catalogo", 330, 460);
}*/

function pd(url){
	windows(url, "pd", 300, 235);	
}

//Constructor del objeto XMLHttpRequest
function getHTTPObject() {
	try {
		objetus = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try { 
			objetus= new ActiveXObject ("Microsoft.XMLHTTP");
		} catch (E) {
			objetus= false; 
		} 
	}
	
	if (!objetus && typeof XMLHttpRequest!= 'undefined') {
		objetus = new XMLHttpRequest();
	} 
	
	return objetus
}

//Carga una pagina y la muestra
function view(url, inDIV) {
	var sec = getHTTPObject();
	sec.open("GET", url, true); 
	//alert(url);
	sec.onreadystatechange = function() {
		if(sec.readyState == 1)
		{
				document.getElementById(inDIV).innerHTML = "Cargando...";
		}
		if(sec.readyState == 4) 
		{
			if(sec.status == 200) { 
				document.getElementById(inDIV).innerHTML = sec.responseText;
			} else {
				switch(sec.status) {
					case 404:
						alert("404: " + sec.statusText);
						alert("No se encontró URL");
						break;						
					case 414:
						alert("414: " + sec.statusText);					
						alert("Los valores pasados por GET superan los 512");
						break;						
				}
			}
		}
	}
	 sec.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
	sec.send(null);
}

//Carga una pagina y la muestra
function ajaxPost(url, valores, inDIV,textoloadin) {
	var sec = getHTTPObject();
	sec.open("POST", url, true); 
	//alert(url);
	sec.onreadystatechange = function() {
		if(sec.readyState == 1)
		{
				if(!textoloadin)
				{
					textoloadin = "Cargando...";
				}
				
				//height="100%"
				document.getElementById(inDIV).innerHTML = '<table border="0" align="center" ><tr><td  style="color:#527fbf; font-size:11px"><img src="images/template/gallery/loading_ajax.gif" border="0" /><br>'+textoloadin+'</td></tr></table>';
				// = '<table border="0" align="center"><tr><td><img src="" border="0" /></td><td style="">'+textoloadin+'</td></tr></table>'
				//document.getElementById(inDIV).innerHTML = textoloadin;
				
		}
		if(sec.readyState == 4) 
		{
			if(sec.status == 200)
			{ 
			
				document.getElementById(inDIV).innerHTML = sec.responseText;
				
			} else {
				switch(sec.status) {
					case 404:
						alert("404: " + sec.statusText);
						alert("No se encontró URL");
						document.getElementById(inDIV).innerHTML = "No se encontró URL";
						break;						
					case 414:
						alert("414: " + sec.statusText);					
						alert("Los valores pasados por GET superan los 512");
						document.getElementById(inDIV).innerHTML = "Los valores pasados por GET superan los 512";
						break;						
				}
			}
		}
	}
	sec.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
	sec.send(valores);
}

function sendMailAjax(url, inDIV,isreolad) {
	var sec = getHTTPObject();
	sec.open("GET", url, true); 
	//alert(url);
	sec.onreadystatechange = function() {
		if(sec.readyState == 1)
		{			
			//document.getElementById(inDIV).innerHTML = "Enviando Correos...";
		}
		if(sec.readyState == 4) 
		{
			if(sec.status == 200) { 
				alert(sec.responseText);
				if(isreolad)
				{
					document.location.reload()
				}
			} else {
				switch(sec.status) {
					case 404:
						alert("404: " + sec.statusText);
						alert("No se encontró URL");
						break;						
					case 414:
						alert("414: " + sec.statusText);					
						alert("Los valores pasados por GET superan los 512");
						break;						
				}
			}
		}
	}
	   
	sec.send(null);
}

function viewValidEmail(url,inDIVt,inbtnnameideDIVt) {
	var sec = getHTTPObject();
	sec.open("GET", url, true); 
	//alert(url);
	sec.onreadystatechange = function() {
		if(sec.readyState == 1)
		{
				document.getElementById(inDIVt).innerHTML = "Validando correo electrónico...";
		}
		if(sec.readyState == 4) 
		{
			if(sec.status == 200) {
				respot = sec.responseText;
				if(respot == "1")
				{
					document.getElementById(inDIVt).innerHTML = "<font color=#006600>El Email no está registrado. puede continuar.</font>";
					document.getElementById(inbtnnameideDIVt).disabled = false;
					
				}else
				{
					document.getElementById(inDIVt).innerHTML = "<font color=#990000>"+respot+"</font>";				
					document.getElementById(inbtnnameideDIVt).disabled = true;
				}
			} else {
				switch(sec.status) {
					case 404:
						alert("404: " + sec.statusText);
						alert("No se encontró URL "+url);
						break;						
					case 414:
						alert("414: " + sec.statusText);					
						alert("Los valores pasados por GET superan los 512");
						break;						
				}
			}
		}
	}
	   
	sec.send(null);
}


function viewValidLogin(url,inDIVt,inbtnnameideDIVt) {
	var sec = getHTTPObject();
	sec.open("GET", url, true); 
	//alert(url);
	sec.onreadystatechange = function() {
		if(sec.readyState == 1)
		{
				document.getElementById(inDIVt).innerHTML = "Validando nombre de usuario...";
		}
		if(sec.readyState == 4) 
		{
			if(sec.status == 200) {
				respot = sec.responseText;
				if(respot == "1")
				{
					document.getElementById(inDIVt).innerHTML = "<font color=#006600>El nombre de usuario no está registrado. puede continuar.</font>";
					document.getElementById(inbtnnameideDIVt).disabled = false;
					
				}else
				{
					document.getElementById(inDIVt).innerHTML = "<font color=#990000>"+respot+"</font>";				
					document.getElementById(inbtnnameideDIVt).disabled = true;
				}
			} else {
				switch(sec.status) {
					case 404:
						alert("404: " + sec.statusText);
						alert("No se encontró URL "+url);
						break;						
					case 414:
						alert("414: " + sec.statusText);					
						alert("Los valores pasados por GET superan los 512");
						break;						
				}
			}
		}
	}
	   
	sec.send(null);
}


function viewValidCodePartToChange(url,inDIVt,inbtnnameideDIVt) {
	var sec = getHTTPObject();
	sec.open("GET", url, true); 
	//alert(url);
	sec.onreadystatechange = function() {
		if(sec.readyState == 1)
		{
				document.getElementById(inDIVt).innerHTML = "Validando...";
		}
		if(sec.readyState == 4) 
		{
			if(sec.status == 200) {
				respot = sec.responseText;
				if(respot != "1")
				{
					document.getElementById(inDIVt).innerHTML = "<font color=#990000>"+respot+"</font>";					
					document.getElementById(inbtnnameideDIVt).disabled = true;
					
				}else
				{
					document.getElementById(inDIVt).innerHTML = "<font color=#006600>Ok</font>";
					document.getElementById(inbtnnameideDIVt).disabled = false;
					
				}
			} else {
				switch(sec.status) {
					case 404:
						alert("404: " + sec.statusText);
						alert("No se encontró URL "+url);
						break;						
					case 414:
						alert("414: " + sec.statusText);					
						alert("Los valores pasados por GET superan los 512");
						break;						
				}
			}
		}
	}
	   
	sec.send(null);
}


/*requeridos*/

function cloneObj(obj){
	return get(obj).cloneNode(true);
}
function get(obj) {
  return document.getElementById(obj);
}

/**
 * Opens calendar window.
 *
 * @param   string      calendar.php parameters
 * @param   string      form name
 * @param   string      field name
 * @param   string      edit type - date/timestamp
 */
function openCalendar(params, form, field, type) {
    window.open("./calendar.php?" + params, "calendar", "width=400,height=200,status=yes");
    dateField = eval("document." + form + "." + field);
    dateType = type;
}

//Mas en: http://javascript.espaciolatino.com/
//Objeto oNumero
function oNumero(numero)
{
	//Propiedades
	this.valor = numero || 0
	this.dec = -1;
	//Métodos
	this.formato = numFormat;
	this.ponValor = ponValor;
	//Definición de los métodos
	
	function ponValor(cad)
	{
		if (cad =='-' || cad=='+') return
		if (cad.length ==0) return
		if (cad.indexOf('.') >=0)
			this.valor = parseFloat(cad);
		else
			this.valor = parseInt(cad);
	}

function numFormat(dec, miles)
{
	var num = this.valor, signo=3, expr;
	var cad = ""+this.valor;
	var ceros = "", pos, pdec, i;
	for (i=0; i < dec; i++)
		ceros += '0';
		pos = cad.indexOf('.')
		if (pos < 0)
	    	cad = cad+"."+ceros;
		else
    	{
		    pdec = cad.length - pos -1;
		    if (pdec <= dec)
        	{
		        for (i=0; i< (dec-pdec); i++)
        		    cad += '0';
		    }
		    else
        	{
				num = num*Math.pow(10, dec);
				num = Math.round(num);
				num = num/Math.pow(10, dec);
				cad = new String(num);
	        }
    	}
		pos = cad.indexOf('.')
		if (pos < 0) pos = cad.lentgh
		if (cad.substr(0,1)=='-' || cad.substr(0,1) == '+')
	       signo = 4;
		if (miles && pos > signo)
		    do{
        	expr = /([+-]?\d)(\d{3}[\.\,]\d*)/
	        cad.match(expr)
    	    cad=cad.replace(expr, RegExp.$1+','+RegExp.$2)
        	}
			while (cad.indexOf(',') > signo)
		    if (dec<0) cad = cad.replace(/\./,'')
        		return cad;
			}
	}//Fin del objeto oNumero:

function formateranumero(textfield)
{
	var numero = new oNumero(textfield.value);
	textfield.value = numero.formato(2, true);
}


function disabledAllElements(frm)
{
		if (frm.elements.length) 
		for (var i = 0; i < frm.elements.length; i++){

			var obj = frm.elements[i];			
			switch (obj.type){
				
				case 'text':									
				case 'file':										
				case 'password':									
				case 'textarea':				
				case 'radio':				
				case 'checkbox':
				case 'select-one':
					obj.disabled = true;
			}
		}

}


function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}

function printswftransparent(ruta, ancho, alto)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ancho+'" height="'+alto+'">');
	document.write('  <param name="movie" value="'+ruta+'" />');
	document.write('  <param name="quality" value="high" />');
	document.write('  <PARAM NAME=wmode VALUE=transparent />');
	document.write('  <PARAM NAME=bgcolor VALUE=#FFFFFF>');
	document.write('  <embed src="'+ruta+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode=transparent bgcolor=#FFFFF type="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" width="'+ancho+'" height="'+alto+'"></embed>');
	document.write('</object>');
}

function printswf(ruta, ancho, alto)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ancho+'" height="'+alto+'">');
	document.write('  <param name="movie" value="'+ruta+'" />');
	document.write('  <param name="quality" value="high" />');
	document.write('  <embed src="'+ruta+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ancho+'" height="'+alto+'"></embed>');
	document.write('</object>');
}


