
function confirmLink(theLink, theSqlQuery, mensaje)
{
    // Confirmation is not required in the configuration file
    // or browser is Opera (crappy js implementation)

	var is_confirmed = confirm(mensaje + ' :\n' + theSqlQuery);
	if(is_confirmed)
	{
		theLink.href += '&is_js_confirmed=1';
	}

    return is_confirmed;
} // end of the 'confirmLink()' function

function get_res() 
{
	var res='800';
	if (screen.width >= 1024)res='1024';
	if(screen.width >= 1280)res='1280';
	if(screen.width >= 1680)res='1680';
	return res;
}

function dump(arr,level)
{
	var dumped_text = "";
	if(!level) level = 0;
	
	//The padding given at the beginning of the line.
	var level_padding = "";
	for(var j=0;j<level+1;j++) level_padding += "    ";
	
	if(typeof(arr) == 'object')		//Array/Hashes/Objects
	{
		for(var item in arr)
		{
			var value = arr[item];
			
			if(typeof(value) == 'object')		//If it is an array,
			{
				dumped_text += level_padding + "'" + item + "' ...\n";
				dumped_text += dump(value,level+1);
			}
			else
			{
				dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
			}
		}
	}
	else
	{
		//Stings/Chars/Numbers etc.
		dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
	}
	return dumped_text;
}

function print_r(input, _indent)
{
	if(typeof(_indent) == 'string')
	{
		var indent = _indent + ' ';
		var paren_indent = _indent + ' ';
	}
	else
	{
		var indent = ' ';
		var paren_indent = '';
	}
	switch(typeof(input))
	{
		case 'boolean':
		var output = (input ? 'true' : 'false') + "\n";
		break;
		case 'object':
		if( input===null)
		{
			var output = "null\n";
			break;
		}
		var output = ((input.reverse) ? 'Array' : 'Object') + " (\n";
		for(var i in input)
		{
			output += indent + "[" + i + "] => " + print_r(input[i], indent);
		}
		output += paren_indent + ")\n";
		break;
			case 'number':
			case 'string':
			default:
				var output = "" + input + "\n";
	}
	return output;
}

function isString(a)
{
	return typeof a=='string';
}

function isUndefined(a)
{
	return typeof a=='undefined';
} 

function isNull(a)
{
	return typeof a=='object' && !a;
}

function isArray(a)
{
	return isObject(a) && a.constructor == Array;
}

function isBoolean(a)
{
	return typeof a == 'boolean';
}

function isEmpty(o)
{
	if (isObject(o))
	{
		for (var i in o)
   		{
			return false;
		}
	}
	return true;
}

function isFunction(a)
{
	return typeof a == 'function';
}

function isNumber(a)
{
	return typeof a == 'number' && isFinite(a);
}

function isNumeric(sText)

{
	var ValidChars="0123456789.";
	var IsNumber=true;
	var Char;

	for (i=0;i<sText.length && IsNumber==true;i++) 
	{ 
		Char = sText.charAt(i); 
		if(ValidChars.indexOf(Char)==-1)
		{
			IsNumber=false;
		}
	}
	return IsNumber;
}