public Gallery Connect ()
		{
			//System.Console.WriteLine ("GalleryAccount.Connect()");
			Gallery gal = null;

			if (version == GalleryVersion.VersionUnknown)
				this.version = Gallery.DetectGalleryVersion(Url);

			if (version == GalleryVersion.Version1) {
				gal = new Gallery1 (url, url);
			} else if (version == GalleryVersion.Version2) {
				gal = new Gallery2 (url, url);
			} else {
				throw new GalleryException (Catalog.GetString("Cannot connect to a Gallery for which the version is unknown.\nPlease check that you have Remote plugin 1.0.8 or later"));
			}

			System.Console.WriteLine ("Gallery created: " + gal);

			gal.Login (username, password);

			gallery = gal;
			connected = true;

			object val = Preferences.Get (LIGHTTPD_WORKAROUND_KEY);
			if (val != null)
				gallery.expect_continue = !(bool)val;

			return gallery;
		}
		public Gallery Connect ()
		{
			//System.Console.WriteLine ("GalleryAccount.Connect()");
			
			Gallery gal = null;

			if (version == GalleryVersion.VersionUnknown)
				this.version = Gallery.DetectGalleryVersion(Url);

			if (version == GalleryVersion.Version1) {
				gal = new Gallery1 (url, url);
			} else if (version == GalleryVersion.Version2) {
				gal = new Gallery2 (url, url);
			} else {
				throw new Exception ("Cannot connect to a Gallery for which the version is unknown");
			}

			System.Console.WriteLine ("Gallery created: " + gal);

			gal.Login (username, password);

			gallery = gal;
			connected = true;

			return gallery;
		}