/* 
------------------------------------------------------------------------------------------------------
Name:			utilities.js
Description: 	Utilidades Javascript
Creator:		PBP - pbp@firedune.com.ar
Version History:
	v1		2004-10-25	PBP		Created	
	v2		2004-10-30	PBP		Agregue funcion

FUNCIONES:
	borra(id,nombrevariable)		Confirma Borrado
	miniReload()					Colocado en el body recarla la pagina onfocus
	OpenAdminWindow(url)			Abre una ventana nueva con parametos predefinidos
	AddFavorite(strName, strUrl)	Agrega la pagina a favoritos colocar en onclick de un boton
	SetAction(accion, formulario)	Realiza un submit del formulario previamente cargando el valor accion en el campo accion
	ChangeMedia(strUrl,strAlt)		Cambia imagen

HTML:
	<body onfocus="miniReload();">

MORE JAVASCRIPTS:
	document.title - title of the document (defined by the <title> tag)
 	document.referrer  - the page the visitor came from
 	document.lastModified - the date the page was last modified (sent from the server, so Javascript depends on server accuracy and support for this feature)
 	history.go()  - used for back and forward buttons, use history.go(-1) for back and history.go(1) for forward
 	location.pathname  - location of the window (the location in the address bar, ex. http://w3nation.com/)
 	document.location - location of the document (the location of the page)
 	parent.frames["nav"].window.location.reload(true);

------------------------------------------------------------------------------------------------------
*/

var objwindow;

function ChangeMedia(strUrl,strAlt){
	//alert(strurl);
	document.media.src = strUrl;
	document.media.alt = strAlt;
}


function Borrar(url) {
	var answer = confirm ("Esta seguro que desea borrar?");
	if (answer){
		//alert(url);
		window.location.href = url;	
	};
}


function ConfirmaIr(url,mensaje) {
	var answer = confirm (mensaje);
 	if (answer){
		location.href = url;	
	}
}


function miniReload() {
	if (objwindow) {
		objwindow.close;
		window.location.reload();
		objwindow = null;
	}
}


function OpenAdminWindow(url) {
	objwindow = window.open(url, 'adm','scrollbars=yes,width=600,height=500');
}


function AddFavorite(strName, strUrl) {
	if (!strUrl) {
		strUrl = location.href;
	}
	if (!strName) {
		strName = document.title;
	}
	if (document.all) {
		window.external.AddFavorite(strUrl, strName);
	}else{
		alert ("Para agregar " + strName + " al bookmark presione Ctrl+D");
	}
}


function SetAction(accion, formulario){
	if(!formulario){
		formulario = "form";
	w}
	formulario = eval("document." + formulario);
	formulario.action.value = accion;
	formulario.submit();
	return true;
}