function doSubmit(message, anchor, pag)
{
	try
	{
		descriptor = prepost(message); 
		params = new Array();
	  	params = descriptor.split(',');

	    post = 'http://' + location.hostname + '/index.php5?getPAG=' + params[0] + '&getNOD=' + params[1] + '&getLAN=' + params[2].substr(0,2);
	    if(pag != null) post += '&getNPG=' + pag;
		if(anchor != null) post += "#" + anchor; 
		window.location = post;
	}
	catch(err)
	{
	    alert("System error!");
	}
}

function doSubmitPOST (mensaje, anchor, pag)
{	
	 // Necesario para uploads (no hacemos peticion GET)
	 document.frm.msx.value=mensaje; 
   	 document.frm.action = 'http://' + location.hostname + '/';
	 if(anchor != null) document.frm.action = document.frm.action + "#" + anchor;
     document.frm.submit();
}

function doSubmitPOSTGET (mensaje, accion, texto)
{	
	 // Necesario para uploads (no hacemos peticion GET)
	 document.frm.msx.value=mensaje; 
   	 document.frm.action = 'http://' + location.hostname + accion;
     document.frm.submit();
}

function setParam (name, val)
{
	if (document.getElementById ("var" + name))
		document.getElementById ("var" + name).value = val;
	else if (document.getElementById ("par" + name))
		document.getElementById ("par" + name).value = val;
	else
		return false;

	return true;
}

function setParamAndSubmit (name, val, msg, anchor)
{ 
	if (setParam (name, val))
		doSubmit(msg, anchor);
	else
		alert (name);
}

function setParamAndSubmitPOST (name, val, msg, anchor)
{
	if (setParam (name, val))
		doSubmitPOST(msg, anchor);
	else
		alert (name);
}

function setParamAndReload (name, val, msg, comp)
{
	if (setParam (name, val))
		reload('.CM' + msg, comp);
	else
		alert (name);
}

function getValue (name)
{
	if (document.getElementById("var" + name))
		return document.getElementById("var" + name).value;
}