/*
***********************************************************************************************
	funciones.js
	Objetivo: Funciones de javascript comunes
	Versión: 2.12
	Compatibilidad: webina 2.12
***********************************************************************************************	
*/

function pintar_fila(prefijo,nid,estado,color)
{
	if(!estado)
	{
		for(j=0;j<g_num_elementos;j++)
		{
			id=(prefijo+j)  
			eval("document.getElementById('"+id+"').style.background=color");
		}
		document.body.style.cursor="default";
	}
	else
	{
		id=(prefijo+nid)
		eval("document.getElementById('"+id+"').style.background=color");
		document.body.style.cursor="hand";
	}
}

function mostrar_imagen(imageName,title,bgcolor) {

	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	newWindow = window.open("","","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=0,height=0,left=50,top=50");
	newWindow.document.open();
	newWindow.document.write('<html><title>'+title+'</title><body bgcolor="'+bgcolor+'" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table border="0" cellspacing="0" cellpadding="0" align="center" ><tr><td>');
	newWindow.document.write('<img src="'+imageName+'" alt="'+imageName+'" name=imagen>'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function replaceAll( str, replacements ) {
    for ( i = 0; i < replacements.length; i++ ) {
        var idx = str.indexOf( replacements[i][0] );

        while ( idx > -1 ) {
            str = str.replace( replacements[i][0], replacements[i][1] );
            idx = str.indexOf( replacements[i][0] );
        }

    }

    return str;
}

function checknumber(x)
{
	x=replaceAll(x,[[",","."]]);
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (anum.test(x))
		testresult=true
	else
		testresult=false
	return (testresult)
}

