// JavaScript Document

getURL = function(_url, _action, _params)
{
	switch(_action)
	{
		case "redirect":
			document.location.href = _url;
			break;
		case "confirm":
			if(showMessage(_params[0], "confirm"))
			{
				document.location.href = _url;
			}
			break;
	}
}

showMessage = function(_msg, _type)
{
	switch(_type)
	{
		case "alert":
				return alert(_msg);
			break;
		case "confirm":
				return confirm(_msg);
			break;
		case "prompt":
				return prompt(_msg, "");
			break;
	}
}

OpenNewWindow = function(_url, _params)
{
	window.open(_url,"edp_window",_params);	
}

SetPage = function(_frm, _field, _currentpage, _totalpage, _action)
{
	if(_action == "next")
	{
		if(_currentpage < _totalpage)
		{
			document.getElementById(_field).value = (_currentpage + 1);
			document.getElementById(_frm).submit();
		}
	}
	else
	{
		if(_currentpage > 1)
		{
			document.getElementById(_field).value = (_currentpage - 1);
			document.getElementById(_frm).submit();
		}
	}
	
}
//Abrir Ventana con imagen por Tunait
var ventana
var cont=0
var titulopordefecto = "Tu Titulo de la ventana"
function afoto(cual,titulo)
{
if(cont==1){ventana.close();ventana=null}
if(titulo==null){titulo=titulopordefecto}
ventana=window.open('','ventana','resizable=no,sc rollbars=no,width=50,height=50')
ventana.document.write('<html><head><title>' + titulo + '</title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no"  onUnload="opener.cont=0"><div align="center"><a href="javascript:this.close()"><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)" style="border:none"></a></div>')
ventana.document.close()
cont++
}
function redimensionar(ancho, alto)
{
ventana.resizeTo(ancho+5,alto+30)
ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2) //centra la ventana. Eliminar si no se quiere centrar el popup
}

