/******************************************************************************
 *
 *  iDriver: A PHP library for developing database-oriented web applications
 *  Copyright (C) 2000-2001, Jared Davis
 *
 *  This program is free software; you can redistribute it and/or modify it 
 *  under the terms of the GNU General Public License as published by the Free 
 *  Software Foundation; either version 2 of the License, or (at your option) 
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful, but WITHOUT
 *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
 *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
 *  more details.
 *
 *  You should have received a copy of the GNU General Public License along 
 *  with this program; if not, write to the Free Software Foundation, Inc., 59
 *  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 *****************************************************************************/

//
// IDR_scripts.js
//
// This is a common JavaScript file that is included across all of iDriver.
// You can add your own functions if you want at the end of it.
//

function propertiesShow(obj)
    {
//       var result = "OBJECT "+obj.type+" "+obj.name+"<BR>\\n";
	   result= "OBJECT "
	   //if (obj.name) result+=obj.name;
//	   if (obj.type) result+=' '+obj.type;
	   result+="<BR>";
	   propertiesWindow=window.open("","propertiesShow");
	   propertiesWindow.document.writeln("<HTML><BODY>");
	   undefined= "<BR>UNDEFINED<BR>";
       for (var i in obj)
       {
	   		if (obj[i])
			{
				stringTemp= i + " = " + String(obj[i]);
	            stringTemp = stringTemp.replace(/\\n/g," | ") + "<BR>";
		   		propertiesWindow.document.writeln(stringTemp);
			}
			else undefined+= i +" | ";
	   }
  		propertiesWindow.document.writeln(undefined);
	   propertiesWindow.document.writeln("</BODY></HTML>");
	   propertiesWindow.document.close();
    }

///////////////////////////////////////////////////////////////////////////////
// iDriver Javascript Functions ///////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

// OpenLink(url):
// Opens a url in a new window named "PopUpWindow".
function OpenLink(url)
{
	Pop = window.open(url, "PopUpWindow",
			"toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=1,width=380,height=420");
	Pop.opener.location.href=Pop.opener.location.href;
	Pop.focus(); //Modificazione Emmanuel
}

// PrintEndLink()
// Prints a link at the end of the page.  Either says "close this window" if the
// window's name is PopUpWindow, or says "Return to previous page" if they're not
// in a popup window.
function PrintEndLink()
{
	if (window.name == "PopUpWindow")
	{
		document.write("<a href=\"javascript:window.close()\">Fermer la fenêtre</a>");
	}
	else
	{
		document.write("<a href=\"javascript:history.go(-1)\">Retour</a>");	
	}

}

// ConfirmDelete(name, url):
// Prints up a javascript yes/no box that asks the user if they're sure they
// want to delete a record.  If they are, it opens the delete url in a new
// window.  Otherwise it doesn't take any action because they said not to.
function ConfirmDelete(name, url)
{
    currentWindow=window;
	if (window.confirm("Sicuro di eliminare " + name + " ?"))
	{
		OpenLink(url);
	}
	//currentWindow.location.href=currentWindow.location.href; //lo fa dopo
}




///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Add your own GLOBALLY ACCESSIBLE javascript functions here if you need any
// for this particular idriver interface.
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
    function showpopup(file,feature,windowName)
   	{
    	var popwin = window.open(file, windowName,  'resizable=yes,status=no,menubar=no,' + feature );
    	popwin.focus();
    	//popwin.opener.location.href=popwin.opener.location.href;
    }

