var root = "/";

/****************************************************************************************
	Apre una finestra del browser
****************************************************************************************/
function OpenBrowserWindow(winURL, winName, winFeatures)
{
  window.open(winURL, winName, winFeatures);
}

/****************************************************************************************
	Apre una finestra di dialogo modale
	
	winUrl è l'url da caricare all'interno dell'iFrame della finestra di dialogo
	E' Fondamentale che la funziona chiamente o il chiamante utilizzino il metodo
	'encodeURIComponent(string)' per eseguire l'encoding della stringa e consentire
	di passare parametri anche alla finestra di destinazione all'interno dell'iFrame.
****************************************************************************************/
function OpenModalDialog(title, winUrl, winArguments, winFeatures)
{
	return showModalDialog(root + 'Utilities/ModalDialog.aspx?DialogUrl=' + encodeURIComponent(winUrl) + "&title=" + title, winArguments, winFeatures)
}

/****************************************************************************************
	In alcuni casi è necessario passare ad una modal dialog alcuni parametri.
	La funzione/oggetto che segue consente di specificare sia l'oggetto "finestra"
	che i parametri per la dialog.
****************************************************************************************/
function Arguments(_wnd, _args)
{
	this.wnd=_wnd;
	this.arguments=_args;
}

//Administrator
///////////////////////////////////////////////////////////////////////////////////////
function AdministratorAddUserTypeProjects(id)				{ OpenModalDialog("Giovanimprenditori.bg.it Amministratore :: Gestione Progetti per Tipologie di Utenti", root + 'UI/Administrator/UsersTypes/AddUserTypeProjects.aspx?id=' + id, window, 'dialogHeight:600px; dialogWidth: 800px; center: yes; scroll: no; status: no; help: no;resizable: yes;'); }
function AdministratorEditUserType(id)						{ OpenModalDialog("Giovanimprenditori.bg.it Amministratore :: Gestione Tipologie di Utenti", root + 'UI/Administrator/UsersTypes/EditUserType.aspx?id=' + id, window, 'dialogHeight:270px; dialogWidth: 440px; center: yes; scroll: no; status: no; help: no;resizable: yes;'); }
function AdministratorEditUser(id)							{ OpenModalDialog("Giovanimprenditori.bg.it Amministratore :: Gestione Utenti", root + 'UI/Administrator/Users/EditUser.aspx?id=' + id, window, 'dialogHeight:600px; dialogWidth: 480px; center: yes; scroll: no; status: no; help: no;resizable: yes;'); }
function AdministratorEditProject(id)						{ OpenModalDialog("Giovanimprenditori.bg.it Amministratore :: Gestione Progetti", root + 'UI/Administrator/Projects/EditProject.aspx?id=' + id, window, 'dialogHeight:270px; dialogWidth: 440px; center: yes; scroll: no; status: no; help: no;resizable: yes;'); }
function AdministratorEditPhotoGalleryCategory(id)			{ OpenModalDialog("Giovanimprenditori.bg.it Amministratore :: Gestione Categorie Photo Gallery", root + 'UI/Administrator/PhotoGalleryCategories/EditPhotoGalleryCategory.aspx?id=' + id, window, 'dialogHeight:200px; dialogWidth: 400px; center: yes; scroll: no; status: no; help: no;resizable: yes;'); }
function AdministratorEditPhotoGalleryType(id, idPhotoGalleryCategory)	{ OpenModalDialog("Giovanimprenditori.bg.it Amministratore :: Gestione Tipologie Photo Gallery", root + 'UI/Administrator/PhotoGalleryTypes/EditPhotoGalleryType.aspx?id=' + id + "&idPhotoGalleryCategory=" + idPhotoGalleryCategory, window, 'dialogHeight:300px; dialogWidth: 460px; center: yes; scroll: no; status: no; help: no;resizable: yes;'); }
function AdministratorEditPhotoGalleryPhoto(id, idPhotoGalleryType)	{ OpenModalDialog("Giovanimprenditori.bg.it Amministratore :: Gestione Foto Photo Gallery", root + 'UI/Administrator/PhotoGalleryPhotos/EditPhotoGalleryPhoto.aspx?id=' + id + "&idPhotoGalleryType=" + idPhotoGalleryType, window, 'dialogHeight:300px; dialogWidth: 460px; center: yes; scroll: no; status: no; help: no;resizable: yes;'); }
function AdministratorEditEventParticipant(id, idEvent)		{ OpenModalDialog("Giovanimprenditori.bg.it Amministratore :: Gestione Richieste di Partecipazione agli Eventi", root + 'UI/Administrator/EventsParticipants/EditEventParticipant.aspx?id=' + id + "&idEvent=" + idEvent, window, 'dialogHeight:350px; dialogWidth: 430px; center: yes; scroll: no; status: no; help: no;resizable: yes;'); }
///////////////////////////////////////////////////////////////////////////////////////
function ChangeUserAuthentication()							{ OpenModalDialog("Giovanimprenditori.bg.it :: Modifica Autenticazione", root + 'Utilities/ChangeUserAuthentication.aspx', window, 'dialogHeight:240px; dialogWidth: 410px; center: yes; scroll: no; status: no; help: no;resizable: yes;'); }
///////////////////////////////////////////////////////////////////////////////////////

//Mantenimento dello scroll
function ScrollIt()
{
	if(document.Form1.SetScroll.value == "1")
		window.scrollTo(document.Form1.PageX.value, document.Form1.PageY.value); 
}

function setcoords()
{ 
	var myPageX; 
	var myPageY; 
		
	if (document.all)
	{ 
		document.Form1.PageX.value = document.body.scrollLeft; 
		document.Form1.PageY.value = document.body.scrollTop; 
	}
	else
	{
		document.Form1.PageX.value = window.pageXOffset; 
		document.Form1.PageY.value = window.pageYOffset; 
	}
	
	document.Form1.SetScroll.value = "1";
}

function reloadParentWindow()
{
	var winOp = window.opener;
		
	if(winOp != null) 
		winOp.navigate(winOp.location.href);
}