program breeze_program_part1;

uses 'breeze_program_variables.pas';

function ShowScriptOptions: string;
var
	s: string;
	i, posx, posy: integer;
	sl: TStringList;
	f: TForm;
	b, btnDefault: TButton;
	edPopularGenres: TEdit;
	labLineSpacing: TLabel;
	edLinesMovies: TEdit;
	labLinesMovies: TLabel;
	edLinesPeople: TEdit;
	labLinesPeople: TLabel;    
	edShots: TEdit;
	labShots, labCoverRows: TLabel;
	edPhotos, edCoverRows: TEdit;
	labPhotos, labRemoveAdult: TLabel;
	boxUseRating: TCheckBox;
	boxUseSiteRating: TCheckBox;
	boxUseLastUpdated: TCheckBox;
	boxShowEditions, boxShowEditionsOfTVSeries: TCheckBox;
	boxDummyCovers: TCheckBox;
	boxShowCoversInList: TCheckBox;
	boxHideNavi, boxHidePhotosCovers, boxShowFileNames: TCheckBox;
	boxShowAwards, boxShowSeasons, boxMinimaList, boxPersonStatsInCollection: TCheckBox;
	boxShotTab, boxPosterTab, boxAwardsTab, boxActorTab, boxParameterTab, boxLoanTab, boxSeasonTab, boxDescriptionTab, boxTrailerTab: TCheckBox;
	tabGroup, multiThumbGroup, filmographyGroup, MoviePageGroup, rightShotsGroup, iconsGroup, RatingInListGroup: TGroupBox;
	labMaxCoverSize, labCoverX, labThumbCellSize, labThumbCellX, labMaxPhotoSize, labThPhotoCellSize, labPhotoX, labThPhotoCellX, labCoverWidth, labFontSize: TLabel;
	edThCoverWidth, edThCoverHeight, edThumbCellWidth, edThumbCellHeight, edThPhotoWidth, edThPhotoHeight, edThPhotoCellWidth, edThPhotoCellHeight, edCoverWidth, edFontSize: TEdit;
	boxCutThumb, boxCutPhotoThumb, boxUseThumbs: TCheckBox;
	my_value: Integer;
	boxOnlyMoviesInCollection, boxShowInCollectionIcon, boxShowSeenIcon, boxShowWantedIcon, boxShowForSaleIcon, boxIconsOnTheRight, boxSortIcons, boxOnlyShots: TCheckBox;
	boxShowLinks, boxShowCodecLogos, boxShowEditionsOnMainTab, boxOnlyEditionName, boxFixedContentsWidth, boxSeenOnPlay, boxBackdropsOnTheRight, boxShotsOnTheRight, boxCoversOnTheRight, boxPostersOnTheRight, boxOnlyUnseenShots: TCheckBox;
	ThumbsSizeChanged, Thumbs2SizeChanged: Boolean;
	comboLineSpacing: TComboBox;
	boxShowCurrentRatingInList, boxShowIMDBRatingInList, boxShowKinopoiskRatingInList: TCheckBox;
	boxSeen, boxWanted, boxForSale, boxInCollection: TCheckBox;
	ByRatingGroup, RightPagePreviewRatingGroup: TGroupBox;
	curRatingRadio, myRatingRadio, imdbRatingRadio: TRadioButton;
	boxUCUserRating, boxUCIMDBRating, boxUCKinopoiskRating, boxShowDiscNrInList: TCheckBox;

procedure RemoveAdultClick(Sender: TLabel);

begin
	sl := TStringList.Create;
	with sl do begin
		Clear;
		Add('DELETE FROM partners');
		Add('WHERE url=''http://www.adultdvdempire.com/''');
	end;
	ExecuteSQL(sl.text);
	sl.Free;
	TLabel(Sender).Caption := GetLangStr(1460);
end;

procedure BtnDefaultClick(Sender: TButton);
begin
	ThumbsSizeChanged := True;
	Thumbs2SizeChanged := True;
	edShots.Text := '5';
	edPhotos.Text := '5';
	edThCoverWidth.Text := IntToStr(DefaultMultiCoverWidth);
	edThCoverHeight.Text := IntToStr(DefaultMultiCoverHeight);
	edThumbCellWidth.Text := IntToStr(DefaultMultiCellWidth);
	edThumbCellHeight.Text := IntToStr(DefaultMultiCellHeight);
	edCoverRows.Text := IntToStr(DefaultCoverRows);
	boxCutThumb.Checked := True;
	edThPhotoWidth.Text := IntToStr(DefaultMultiCoverWidth);
	edThPhotoHeight.Text := IntToStr(DefaultMultiCoverHeight);
	edFontSize.Text := IntToStr(DefaultBasicFontSize);
	boxCutPhotoThumb.Checked := True;
	boxUseRating.Checked := True;
	boxUseSiteRating.Checked := True;
	boxUseLastUpdated.Checked := False;
	boxShowEditions.Checked := False;
	boxDummyCovers.Checked := False;
	boxOnlyMoviesInCollection.Checked := False;
	boxHidePhotosCovers.Checked := False;
	boxShowFileNames.Checked := True;
	boxShowAwards.Checked := False;
	boxShowSeasons.Checked := False;
	boxShowCoversInList.Checked := True;
	boxMinimaList.Checked := False;
	boxPersonStatsInCollection.Checked := False;
	boxHideNavi.Checked := False;
	boxShotTab.Checked := True;
	boxPosterTab.Checked := True;
	boxAwardsTab.Checked := True;
	boxActorTab.Checked := True;
	boxParameterTab.Checked := True;
//	boxLoanTab.Checked := False;
	boxSeasonTab.Checked := True;
	boxTrailerTab.Checked := True;
	boxDescriptionTab.Checked := False;
	boxUseThumbs.Checked := True;
	boxIconsOnTheRight.Checked := False;
	boxShowInCollectionIcon.Checked := True;
	boxShowSeenIcon.Checked := False;
	boxShowWantedIcon.Checked := False;
	boxShowForSaleIcon.Checked := False;
	boxSortIcons.Checked := False;
//	boxOnlyShots.Checked := True;
	boxShowEditionsOnMainTab.Checked := True;
	boxOnlyEditionName.Checked := False;
	boxFixedContentsWidth.Checked := False;
	boxSeenOnPlay.Checked := True;
	boxBackdropsOnTheRight.Checked := True;
	boxShotsOnTheRight.Checked := True;
	boxCoversOnTheRight.Checked := True;
	boxPostersOnTheRight.Checked := False;
	boxShowEditionsOfTVSeries.Checked := False;
	edCoverWidth.Text := IntToStr(DefaultThumbWidth);
	comboLineSpacing.ItemIndex := DefaultLineSpacing;
	boxOnlyUnseenShots.Checked := False;
	boxShowCurrentRatingInList.Checked := True;
	boxShowIMDBRatingInList.Checked := False;
	boxShowKinopoiskRatingInList.Checked := False;
	curRatingRadio.Checked := False;
	imdbRatingRadio.Checked := False;
	myRatingRadio.Checked := True;
	boxInCollection.Checked := True;
	boxSeen.Checked := True;
	boxWanted.Checked := False;
	boxForSale.Checked := False;
	boxUCUserRating.Checked := True;
	boxUCIMDBRating.Checked := True;
	boxUCKinopoiskRating.Checked := False;
	boxShowDiscNrInList.Checked := False;
end;

procedure ThumbsChanged(Sender: TObject; var Key: Word);
begin
	ThumbsSizeChanged := True;
end;

procedure Thumbs2Changed(Sender: TObject; var Key: Word);
begin
	Thumbs2SizeChanged := True;
end;

procedure ButtonClick(Sender: TButton);
var
	zn: integer;
begin
	try
		zn:=StrToInt(edLinesMovies.Text);
		RegWriteInteger('BreezeLinesMovies', zn);
		zn:=StrToInt(edLinesPeople.Text);
		RegWriteInteger('BreezeLinesPeople', zn);
		zn:=StrToInt(edShots.Text);
		RegWriteInteger('ShotsCnt', zn);
		zn:=StrToInt(edPhotos.Text);
		RegWriteInteger('PhotosCnt', zn);
		zn:=StrToInt(edThCoverWidth.Text);
		RegWriteInteger('ThCoverWidth', zn);
		zn:=StrToInt(edThCoverHeight.Text);
		RegWriteInteger('ThCoverHeight', zn);
		zn:=StrToInt(edThumbCellWidth.Text);
		RegWriteInteger('ThumbCellWidth', zn);
		zn:=StrToInt(edThumbCellHeight.Text);
		RegWriteInteger('ThumbCellHeight', zn);
		zn:=StrToInt(edThPhotoWidth.Text);
		RegWriteInteger('ThPhotoWidth', zn);
		zn:=StrToInt(edThPhotoHeight.Text);
		RegWriteInteger('ThPhotoHeight', zn);
		zn:=StrToInt(edCoverWidth.Text);
		RegWriteInteger('ListCoverWidth', zn);
		zn:=StrToInt(edCoverRows.Text);
		RegWriteInteger('CoverRows', zn);
		zn:=StrToInt(edFontSize.Text);
		RegWriteInteger('BreezeFontSize', zn);
		if boxUseRating.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowRating', zn);	
		if boxUseSiteRating.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowSiteRating', zn);
		if boxUseLastUpdated.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowLastUpdated', zn);
		if boxShowEditions.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowEditions', zn);
		if boxDummyCovers.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowDummyCovers', zn);
		if boxShowCoversInList.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowCoversInList', zn);
		if boxOnlyMoviesInCollection.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowOnlyMoviesInCollection', zn);
		if boxHideNavi.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('HideNavigationMenu', zn);
		if boxHidePhotosCovers.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('HidePhotosCovers', zn);
		if boxShowFileNames.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowFileNames', zn);
		if boxShowAwards.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowAwardsOnGeneralTab', zn);
		if boxShowSeasons.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowSeasonsOnGeneralTab', zn);
		if boxMinimaList.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('MinimaList', zn);
		if boxPersonStatsInCollection.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('PersonStatsInCollection', zn);
		if boxShotTab.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowShotTab', zn);			
		if boxPosterTab.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowPosterTab', zn);
		if boxAwardsTab.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowAwardsTab', zn);
		if boxActorTab.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowActorTab', zn);
		if boxDescriptionTab.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowDescriptionTab', zn);
		if boxParameterTab.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowParameterTab', zn);
		if boxSeasonTab.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowSeasonTab', zn);
		if boxTrailerTab.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowTrailerTab', zn);
		if boxCutThumb.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('CutThumb', zn);
		if boxCutPhotoThumb.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('CutPhotoThumb', zn);
		if boxUseThumbs.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('UseThumbs', zn);
		if boxIconsOnTheRight.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('IconsOnTheRight', zn);
		if boxShowInCollectionIcon.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowInCollectionIcon', zn);
		if boxShowSeenIcon.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowSeenIcon', zn);
		if boxShowWantedIcon.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowWantedIcon', zn);
		if boxShowForSaleIcon.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowForSaleIcon', zn);
		if boxSortIcons.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('SortIcons', zn);
		if boxBackdropsOnTheRight.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowBackdropsOnTheRight', zn);
		if boxShotsOnTheRight.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowShotsOnTheRight', zn);
		if boxCoversOnTheRight.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowCoversOnTheRight', zn);
		if boxPostersOnTheRight.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowPostersOnTheRight', zn);
		if boxShowCodecLogos.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowCodecLogos', zn);
		if boxShowEditionsOnMainTab.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowEditionsOnMainTab', zn);
		if boxShowEditionsOfTVSeries.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowEditionsOfTVSeries', zn);
		if boxOnlyEditionName.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('OnlyEditionName', zn);
		if boxFixedContentsWidth.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('FixedContentsWidthOnMoviePage', zn);
		if boxSeenOnPlay.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('SeenOnPlay', zn);
		if boxOnlyUnseenShots.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('OnlyUnseenShots', zn);
		if boxShowCurrentRatingInList.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowCurrentRatingInList', zn);
		if boxShowIMDBRatingInList.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowIMDBRatingInList', zn);
		if boxShowKinopoiskRatingInList.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowKinopoiskRatingInList', zn);
		
		if boxInCollection.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowInCollectionStatusIcon', zn);
		if boxSeen.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowSeenStatusIcon', zn);
		if boxWanted.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowWantedStatusIcon', zn);
		if boxForSale.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowForSaleStatusIcon', zn);
		if boxUCUserRating.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowUserRatingUnderCovers', zn);
		if boxUCUserRating.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowUserRatingUnderCovers', zn);
		if boxUCIMDBRating.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowIMDBRatingUnderCovers', zn);
		if boxUCKinopoiskRating.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowKinopoiskRatingUnderCovers', zn);
		if boxShowDiscNrInList.Checked then
			zn := 1
		else
			zn := 0;
		RegWriteInteger('ShowDiscNrInList', zn);
		
		//rating for "my rating" tab
		zn := 1;
		if curRatingRadio.Checked then
			zn := 2
		else if imdbRatingRadio.Checked then
			zn := 3;
		RegWriteInteger('MyRatingTabRating', zn);

		RegWriteString('OriginalVersion', IntToStr(56));
		s:=GetLangStr(1334);
		
		RegWriteInteger('BreezeLineSpacing', comboLineSpacing.ItemIndex);
	except
	end;

	MultiShowRowHeight := RegReadInteger('ThumbCellHeight', DefaultMultiCellHeight);
	MultiShowImageWidth := RegReadInteger('ThumbCellWidth', DefaultMultiCellWidth);
	if Thumbs2SizeChanged then begin
		if ThumbsSizeChanged then
			ClearThumb(Thumbs2)
		else
			ClearThumb(Thumbs2, True);
	end;
	if ThumbsSizeChanged then begin
		ClearThumb(Thumbs, True);
	end;
	BasicFontSize := RegReadInteger('BreezeFontSize', 11);
	ListFontSize := BasicFontSize + ListModifier;
	f.ModalResult := mrOk;
end;

begin
	s:=GetLangStr(1335);
	f := TForm.Create(nil);
	f.Caption := GetLangStr(1333);
	f.BorderStyle := bsDialog;
	f.Position := poScreenCenter;
	f.Width:=700;
	f.Height:=720;
	f.AutoSize:=false;
	ThumbsSizeChanged := False;
	Thumbs2SizeChanged := False;
	
	MoviePageGroup := TGroupBox.Create(f);
	MoviePageGroup.Name := 'MoviePageGroup';
	MoviePageGroup.Parent := f;
	MoviePageGroup.SetBounds(10, 10, 675, 240);
	MoviePageGroup.Caption := GetLangStr(1495);
	
	boxUseRating := TCheckBox.Create(f);
	boxUseRating.Name := 'boxUseRating';
	boxUseRating.Parent := f;
	boxUseRating.SetBounds(20, 25, 300, 20);
	boxUseRating.Caption := GetLangStr(1420);
	my_value := RegReadInteger('ShowRating', 1);
	if my_value=1 then
		boxUseRating.Checked := True;
		
	boxUseSiteRating := TCheckBox.Create(f);
	boxUseSiteRating.Name := 'boxUseSiteRating';
	boxUseSiteRating.Parent := f;
	boxUseSiteRating.SetBounds(20, 45, 300, 20);
	boxUseSiteRating.Caption := GetLangStr(1533);
	my_value := RegReadInteger('ShowSiteRating', 1);
	if my_value=1 then
		boxUseSiteRating.Checked := True;
		
		
	labShots:=TLabel.Create(f);
	labShots.Name := 'labShots';
	labShots.Parent := f;
	labShots.SetBounds(340, 25, 110, 25);
	labShots.Caption := GetLangStr(1417);
	
	edShots := TEdit.Create(f);
	edShots.Name := 'edShots';
	edShots.Parent := f;
	edShots.SetBounds(660, 20, 20, 25);
	edShots.Text := IntToStr(RegReadInteger('ShotsCnt', 5));
	
	boxShowCodecLogos := TCheckBox.Create(f);
	boxShowCodecLogos.Name := 'ShowCodecLogos';
	boxShowCodecLogos.Parent := f;
	boxShowCodecLogos.SetBounds(20, 65, 250, 20);
	boxShowCodecLogos.Caption := GetLangStr(1494);
	my_value := RegReadInteger('ShowCodecLogos', 1);
	if my_value = 1 then
		boxShowCodecLogos.Checked := True;
		
	boxShowFileNames := TCheckBox.Create(f);
	boxShowFileNames.Name := 'boxShowFileNames';
	boxShowFileNames.Parent := f;
	boxShowFileNames.SetBounds(20, 85, 300, 20);
	boxShowFileNames.Caption := GetLangStr(1432);
	my_value := RegReadInteger('ShowFileNames', 1);
	if my_value=1 then
		boxShowFileNames.Checked := True;
		
	boxShowAwards := TCheckBox.Create(f);
	boxShowAwards.Name := 'boxShowAwards';
	boxShowAwards.Parent := f;
	boxShowAwards.SetBounds(20, 105, 300, 20);
	boxShowAwards.Caption := GetLangStr(1433);
	my_value := RegReadInteger('ShowAwardsOnGeneralTab', 0);
	if my_value=1 then
		boxShowAwards.Checked := True;
		
	boxShowSeasons := TCheckBox.Create(f);
	boxShowSeasons.Name := 'boxShowSeasons';
	boxShowSeasons.Parent := f;
	boxShowSeasons.SetBounds(20, 125, 300, 20);
	boxShowSeasons.Caption := GetLangStr(1434);
	my_value := RegReadInteger('ShowSeasonsOnGeneralTab', 0);
	if my_value=1 then
		boxShowSeasons.Checked := True;
		
	boxShowEditions := TCheckBox.Create(f);
	boxShowEditions.Name := 'boxShowEditions';
	boxShowEditions.Parent := f;
	boxShowEditions.SetBounds(20, 145, 300, 20);
	boxShowEditions.Caption := GetLangStr(1424);
	my_value := RegReadInteger('ShowEditions', 0);
	if my_value=1 then
		boxShowEditions.Checked := True;
		
	boxHideNavi := TCheckBox.Create(f);
	boxHideNavi.Name := 'boxHideNavi';
	boxHideNavi.Parent := f;
	boxHideNavi.SetBounds(340, 40, 300, 20);
	boxHideNavi.Caption := GetLangStr(1430);
	my_value := RegReadInteger('HideNavigationMenu', 0);
	if my_value=1 then
		boxHideNavi.Checked := True;
	
	tabGroup := TGroupBox.Create(f);
	tabGroup.Name := 'tabGroup';
	tabGroup.Parent := f;
	tabGroup.SetBounds(340, 60, 340, 80);
	tabGroup.Caption := GetLangStr(1457);
	
	boxShotTab := TCheckBox.Create(f);
	boxShotTab.Name := 'boxShotTab';
	boxShotTab.Parent := f;
	boxShotTab.SetBounds(350, 75, 80, 20);
	boxShotTab.Caption := GetLangStr(1429);
	my_value := RegReadInteger('ShowShotTab', 1);
	if my_value=1 then
		boxShotTab.Checked := True;
		
	boxPosterTab := TCheckBox.Create(f);
	boxPosterTab.Name := 'boxPosterTab';
	boxPosterTab.Parent := f;
	boxPosterTab.SetBounds(350, 95, 80, 20);
	boxPosterTab.Caption := GetLangStr(1425);
	my_value := RegReadInteger('ShowPosterTab', 1);
	if my_value=1 then
		boxPosterTab.Checked := True;
		
	boxAwardsTab := TCheckBox.Create(f);
	boxAwardsTab.Name := 'boxAwardsTab';
	boxAwardsTab.Parent := f;
	boxAwardsTab.SetBounds(350, 115, 80, 20);
	boxAwardsTab.Caption := GetLangStr(574);
	my_value := RegReadInteger('ShowAwardsTab', 1);
	if my_value=1 then
		boxAwardsTab.Checked := True;
		
	boxActorTab := TCheckBox.Create(f);
	boxActorTab.Name := 'boxActorTab';
	boxActorTab.Parent := f;
	boxActorTab.SetBounds(450, 75, 80, 20);
	boxActorTab.Caption := GetLangStr(68);
	my_value := RegReadInteger('ShowActorTab', 1);
	if my_value=1 then
		boxActorTab.Checked := True;
		
	boxParameterTab := TCheckBox.Create(f);
	boxParameterTab.Name := 'boxParameterTab';
	boxParameterTab.Parent := f;
	boxParameterTab.SetBounds(450, 95, 80, 20);
	boxParameterTab.Caption := GetLangStr(447);
	my_value := RegReadInteger('ShowParameterTab', 1);
	if my_value=1 then
		boxParameterTab.Checked := True;
		
(*	boxLoanTab := TCheckBox.Create(f);
	boxLoanTab.Name := 'boxLoanTab';
	boxLoanTab.Parent := f;
	boxLoanTab.SetBounds(450, 90, 80, 20);
	boxLoanTab.Caption := GetLangStr(1440);
	my_value := RegReadInteger('ShowLoanTab', 0);
	if my_value=1 then
		boxLoanTab.Checked := True;
*)		
	boxSeasonTab := TCheckBox.Create(f);
	boxSeasonTab.Name := 'boxSeasonTab';
	boxSeasonTab.Parent := f;
	boxSeasonTab.SetBounds(450, 115, 80, 20);
	boxSeasonTab.Caption := GetLangStr(521);
	my_value := RegReadInteger('ShowSeasonTab', 1);
	if my_value=1 then
		boxSeasonTab.Checked := True;
		
	boxTrailerTab := TCheckBox.Create(f);
	boxTrailerTab.Name := 'boxTrailerTab';
	boxTrailerTab.Parent := f;
	boxTrailerTab.SetBounds(550, 75, 80, 20);
	boxTrailerTab.Caption := GetLangStr(1458);
	my_value := RegReadInteger('ShowTrailerTab', 1);
	if my_value=1 then
		boxTrailerTab.Checked := True;		
		
	boxDescriptionTab := TCheckBox.Create(f);
	boxDescriptionTab.Name := 'boxDescriptionTab';
	boxDescriptionTab.Parent := f;
	boxDescriptionTab.SetBounds(550, 95, 80, 20);
	boxDescriptionTab.Caption := GetLangStr(162);
	my_value := RegReadInteger('ShowDescriptionTab', 0);
	if my_value=1 then
		boxDescriptionTab.Checked := True;
		
	rightShotsGroup := TGroupBox.Create(f);
	rightShotsGroup.Name := 'rightShotsGroup';
	rightShotsGroup.Parent := f;
	rightShotsGroup.SetBounds(340, 140, 340, 40);
	rightShotsGroup.Caption := GetLangStr(2969);
	
	boxBackdropsOnTheRight := TCheckBox.Create(f);
	boxBackdropsOnTheRight.Name := 'boxBackdropsOnTheRight';
	boxBackdropsOnTheRight.Parent := f;
	boxBackdropsOnTheRight.SetBounds(350, 155, 80, 20);
	boxBackdropsOnTheRight.Caption := GetLangStr(3215);
	my_value := RegReadInteger('ShowBackdropsOnTheRight', 1);
	if my_value=1 then
		boxBackdropsOnTheRight.Checked := True;
		
	boxShotsOnTheRight := TCheckBox.Create(f);
	boxShotsOnTheRight.Name := 'boxShotsOnTheRight';
	boxShotsOnTheRight.Parent := f;
	boxShotsOnTheRight.SetBounds(430, 155, 70, 20);
	boxShotsOnTheRight.Caption := GetLangStr(1429);
	my_value := RegReadInteger('ShowShotsOnTheRight', 1);
	if my_value=1 then
		boxShotsOnTheRight.Checked := True;
		
	boxPostersOnTheRight := TCheckBox.Create(f);
	boxPostersOnTheRight.Name := 'boxPostersOnTheRight';
	boxPostersOnTheRight.Parent := f;
	boxPostersOnTheRight.SetBounds(500, 155, 70, 20);
	boxPostersOnTheRight.Caption := GetLangStr(1425);
	my_value := RegReadInteger('ShowPostersOnTheRight', 0);
	if my_value=1 then
		boxPostersOnTheRight.Checked := True;
		
	boxCoversOnTheRight := TCheckBox.Create(f);
	boxCoversOnTheRight.Name := 'boxCoversOnTheRight';
	boxCoversOnTheRight.Parent := f;
	boxCoversOnTheRight.SetBounds(570, 155, 100, 20);
	boxCoversOnTheRight.Caption := GetLangStr(3202);
	my_value := RegReadInteger('ShowCoversOnTheRight', 1);
	if my_value=1 then
		boxCoversOnTheRight.Checked := True;
		
	iconsGroup := TGroupBox.Create(f);
	iconsGroup.Name := 'iconsGroup';
	iconsGroup.Parent := f;
	iconsGroup.SetBounds(340, 180, 340, 40);
	iconsGroup.Caption := GetLangStr(55);
	
	boxInCollection := TCheckBox.Create(f);
	boxInCollection.Name := 'boxInCollection';
	boxInCollection.Parent := f;
	boxInCollection.SetBounds(350, 195, 80, 20);
	boxInCollection.Caption := GetLangStr(174);
	my_value := RegReadInteger('ShowInCollectionStatusIcon', 1);
	if my_value=1 then
		boxInCollection.Checked := True;
		
	boxSeen := TCheckBox.Create(f);
	boxSeen.Name := 'boxSeen';
	boxSeen.Parent := f;
	boxSeen.SetBounds(430, 195, 70, 20);
	boxSeen.Caption := GetLangStr(175);
	my_value := RegReadInteger('ShowSeenStatusIcon', 1);
	if my_value=1 then
		boxSeen.Checked := True;
		
	boxWanted := TCheckBox.Create(f);
	boxWanted.Name := 'boxWanted';
	boxWanted.Parent := f;
	boxWanted.SetBounds(500, 195, 70, 20);
	boxWanted.Caption := GetLangStr(176);
	my_value := RegReadInteger('ShowWantedStatusIcon', 0);
	if my_value=1 then
		boxWanted.Checked := True;
		
	boxForSale := TCheckBox.Create(f);
	boxForSale.Name := 'boxForSale';
	boxForSale.Parent := f;
	boxForSale.SetBounds(570, 195, 100, 20);
	boxForSale.Caption := GetLangStr(177);
	my_value := RegReadInteger('ShowForSaleStatusIcon', 0);
	if my_value=1 then
		boxForSale.Checked := True;
		
	boxShowEditionsOnMainTab := TCheckBox.Create(f);
	boxShowEditionsOnMainTab.Name := 'boxShowEditionsOnMainTab';
	boxShowEditionsOnMainTab.Parent := f;
	boxShowEditionsOnMainTab.SetBounds(20, 165, 310, 20);
	boxShowEditionsOnMainTab.Caption := GetLangStr(2950);
	my_value := RegReadInteger('ShowEditionsOnMainTab', 1);
	if my_value=1 then
		boxShowEditionsOnMainTab.Checked := True;
		
	boxShowEditionsOfTVSeries := TCheckBox.Create(f);
	boxShowEditionsOfTVSeries.Name := 'boxShowEditionsOfTVSeries';
	boxShowEditionsOfTVSeries.Parent := f;
	boxShowEditionsOfTVSeries.SetBounds(20, 185, 300, 20);
	boxShowEditionsOfTVSeries.Caption := GetLangStr(2970);
	my_value := RegReadInteger('ShowEditionsOfTVSeries', 0);
	if my_value=1 then
		boxShowEditionsOfTVSeries.Checked := True;
		
	boxOnlyEditionName := TCheckBox.Create(f);
	boxOnlyEditionName.Name := 'boxOnlyEditionName';
	boxOnlyEditionName.Parent := f;
	boxOnlyEditionName.SetBounds(20, 205, 310, 20);
	boxOnlyEditionName.Caption := GetLangStr(2951);
	my_value := RegReadInteger('OnlyEditionName',  0);
	if my_value=1 then
		boxOnlyEditionName.Checked := True;
		
	boxSeenOnPlay := TCheckBox.Create(f);
	boxSeenOnPlay.Name := 'boxSeenOnPlay';
	boxSeenOnPlay.Parent := f;
	boxSeenOnPlay.SetBounds(340, 225, 340, 20);
	boxSeenOnPlay.Caption := GetLangStr(2968);
	my_value := RegReadInteger('SeenOnPlay', 1);
	if my_value=1 then
		boxSeenOnPlay.Checked := True;
	
	boxFixedContentsWidth := TCheckBox.Create(f);
	boxFixedContentsWidth.Name := 'boxFixedContentsWidth';
	boxFixedContentsWidth.Parent := f;
	boxFixedContentsWidth.SetBounds(20, 225, 310, 20);
	boxFixedContentsWidth.Caption := GetLangStr(2967);
	my_value := RegReadInteger('FixedContentsWidthOnMoviePage', 0);
	if my_value=1 then
		boxFixedContentsWidth.Checked := True;
		
	multiThumbGroup := TGroupBox.Create(f);
	multiThumbGroup.Name := 'multiThumbGroup';
	multiThumbGroup.Parent := f;
	multiThumbGroup.SetBounds(10, 250, 300, 145);
	multiThumbGroup.Caption := GetLangStr(1467);
	
	labMaxCoverSize := TLabel.Create(f);
	labMaxCoverSize.Name := 'labMaxCoverSize';
	labMaxCoverSize.Parent := f;
	labMaxCoverSize.SetBounds(20, 270, 100, 25);
	labMaxCoverSize.Caption := GetLangStr(1468);
	
	edThCoverWidth := TEdit.Create(f);
	edThCoverWidth.Name := 'edThCoverWidth';
	edThCoverWidth.Parent := f;
	edThCoverWidth.SetBounds(230, 265, 30, 25);
	edThCoverWidth.Text := IntToStr(RegReadInteger('ThCoverWidth', DefaultMultiCoverWidth));
	edThCoverWidth.OnKeyDown := @Thumbs2Changed;
	
	labCoverX := TLabel.Create(f);
	labCoverX.Name := 'labCoverX';
	labCoverX.Parent := f;
	labCoverX.SetBounds(265, 270, 10, 20);
	labCoverX.Caption := 'X';
	
	edThCoverHeight := TEdit.Create(f);
	edThCoverHeight.Name := 'edThCoverHeight';
	edThCoverHeight.Parent := f;
	edThCoverHeight.SetBounds(275, 265, 30, 25);
	edThCoverHeight.Text := IntToStr(RegReadInteger('ThCoverHeight', DefaultMultiCoverHeight));
	edThCoverHeight.OnKeyDown := @Thumbs2Changed;
	
	labThumbCellSize := TLabel.Create(f);
	labThumbCellSize.Name := 'labThumbCellSize';
	labThumbCellSize.Parent := f;
	labThumbCellSize.SetBounds(20, 295, 100, 25);
	labThumbCellSize.Caption := GetLangStr(1469);
	
	edThumbCellWidth := TEdit.Create(f);
	edThumbCellWidth.Name := 'edThumbCellWidth';
	edThumbCellWidth.Parent := f;
	edThumbCellWidth.SetBounds(230, 290, 30, 25);
	edThumbCellWidth.Text := IntToStr(RegReadInteger('ThumbCellWidth', DefaultMultiCellWidth));
	edThumbCellWidth.OnKeyDown := @Thumbs2Changed;
	
	labThumbCellX := TLabel.Create(f);
	labThumbCellX.Name := 'labThumbCellX';
	labThumbCellX.Parent := f;
	labThumbCellX.SetBounds(265, 295, 10, 20);
	labThumbCellX.Caption := 'X';
	
	edThumbCellHeight := TEdit.Create(f);
	edThumbCellHeight.Name := 'edThumbCellHeight';
	edThumbCellHeight.Parent := f;
	edThumbCellHeight.SetBounds(275, 290, 30, 25);
	edThumbCellHeight.Text := IntToStr(RegReadInteger('ThumbCellHeight', DefaultMultiCellHeight));
	edThumbCellHeight.OnKeyDown := @Thumbs2Changed;
		
	boxCutThumb := TCheckBox.Create(f);
	boxCutThumb.Name := 'boxCutThumb';
	boxCutThumb.Parent := f;
	boxCutThumb.SetBounds(20, 315, 280, 20);
	boxCutThumb.Caption := GetLangStr(1471);
	my_value := RegReadInteger('CutThumb', 1);
	if my_value = 1 then
		boxCutThumb.Checked := True;
	boxCutThumb.OnClick := @Thumbs2Changed;
		
	labMaxPhotoSize := TLabel.Create(f);
	labMaxPhotoSize.Name := 'labMaxPhotoSize';
	labMaxPhotoSize.Parent := f;
	labMaxPhotoSize.SetBounds(20, 350, 100, 20);
	labMaxPhotoSize.Caption := GetLangStr(1472);
	
	edThPhotoWidth := TEdit.Create(f);
	edThPhotoWidth.Name := 'edThPhotoWidth';
	edThPhotoWidth.Parent := f;
	edThPhotoWidth.SetBounds(230, 345, 30, 25);
	edThPhotoWidth.Text := IntToStr(RegReadInteger('ThPhotoWidth', DefaultMultiCoverWidth));
	edThPhotoWidth.OnKeyDown := @Thumbs2Changed;
	
	labPhotoX := TLabel.Create(f);
	labPhotoX.Name := 'labPhotoX';
	labPhotoX.Parent := f;
	labPhotoX.SetBounds(265, 350, 10, 20);
	labPhotoX.Caption := 'X';
	
	edThPhotoHeight := TEdit.Create(f);
	edThPhotoHeight.Name := 'edThPhotoHeight';
	edThPhotoHeight.Parent := f;
	edThPhotoHeight.SetBounds(275, 345, 30, 25);
	edThPhotoHeight.Text := IntToStr(RegReadInteger('ThPhotoHeight', DefaultMultiCoverHeight));
	edThPhotoHeight.OnKeyDown := @Thumbs2Changed;
		
	boxCutPhotoThumb := TCheckBox.Create(f);
	boxCutPhotoThumb.Name := 'boxCutPhotoThumb';
	boxCutPhotoThumb.Parent := f;
	boxCutPhotoThumb.SetBounds(20, 370, 280, 20);
	boxCutPhotoThumb.Caption := GetLangStr(1474);
	my_value := RegReadInteger('CutPhotoThumb', 1);
	if my_value = 1 then
		boxCutPhotoThumb.Checked := True;
	boxCutPhotoThumb.OnClick := @Thumbs2Changed;
		
	filmographyGroup := TGroupBox.Create(f);
	filmographyGroup.Name := 'filmographyGroup';
	filmographyGroup.Parent := f;
	filmographyGroup.SetBounds(340, 250, 345, 170);
	filmographyGroup.Caption := GetLangStr(1481);
	
	boxOnlyMoviesInCollection := TCheckBox.Create(f);
	boxOnlyMoviesInCollection.Name := 'boxOnlyMoviesInCollection';
	boxOnlyMoviesInCollection.Parent := f;
	boxOnlyMoviesInCollection.SetBounds(350, 270, 250, 20);
	boxOnlyMoviesInCollection.Caption := GetLangStr(1482);
	my_value := RegReadInteger('ShowOnlyMoviesInCollection', 0);
	if my_value = 1 then
		boxOnlyMoviesInCollection.Checked := True;
		
	boxShowInCollectionIcon := TCheckBox.Create(f);
	boxShowInCollectionIcon.Name := 'boxShowInCollectionIcon';
	boxShowInCollectionIcon.Parent := f;
	boxShowInCollectionIcon.SetBounds(350, 290, 250, 20);
	boxShowInCollectionIcon.Caption := GetLangStr(1483);
	my_value := RegReadInteger('ShowInCollectionIcon', 1);
	if my_value = 1 then
		boxShowInCollectionIcon.Checked := True;
		
	boxShowSeenIcon := TCheckBox.Create(f);
	boxShowSeenIcon.Name := 'boxShowSeenIcon';
	boxShowSeenIcon.Parent := f;
	boxShowSeenIcon.SetBounds(350, 310, 250, 20);
	boxShowSeenIcon.Caption := GetLangStr(1484);
	my_value := RegReadInteger('ShowSeenIcon', 0);
	if my_value = 1 then
		boxShowSeenIcon.Checked := True;
		
	boxShowWantedIcon := TCheckBox.Create(f);
	boxShowWantedIcon.Name := 'boxShowWantedIcon';
	boxShowWantedIcon.Parent := f;
	boxShowWantedIcon.SetBounds(350, 330, 250, 20);
	boxShowWantedIcon.Caption := GetLangStr(1485);
	my_value := RegReadInteger('ShowWantedIcon', 0);
	if my_value = 1 then
		boxShowWantedIcon.Checked := True;
		
	boxShowForSaleIcon := TCheckBox.Create(f);
	boxShowForSaleIcon.Name := 'boxShowForSaleIcon';
	boxShowForSaleIcon.Parent := f;
	boxShowForSaleIcon.SetBounds(350, 350, 250, 20);
	boxShowForSaleIcon.Caption := GetLangStr(1486);
	my_value := RegReadInteger('ShowForSaleIcon', 0);
	if my_value = 1 then
		boxShowForSaleIcon.Checked := True;
		
	boxIconsOnTheRight := TCheckBox.Create(f);
	boxIconsOnTheRight.Name := 'boxIconsOnTheRight';
	boxIconsOnTheRight.Parent := f;
	boxIconsOnTheRight.SetBounds(350, 370, 250, 20);
	boxIconsOnTheRight.Caption := GetLangStr(1487);
	my_value := RegReadInteger('IconsOnTheRight', 0);
	if my_value = 1 then
		boxIconsOnTheRight.Checked := True;
		
	boxSortIcons := TCheckBox.Create(f);
	boxSortIcons.Name := 'boxSortIcons';
	boxSortIcons.Parent := f;
	boxSortIcons.SetBounds(350, 390, 250, 20);
	boxSortIcons.Caption := GetLangStr(1488);
	my_value := RegReadInteger('SortIcons', 0);
	if my_value = 1 then
		boxSortIcons.Checked := True;
		
	(* End filmography options *)
	
	labLinesMovies:=TLabel.Create(f);
	labLinesMovies.Name := 'labLinesMovies';
	labLinesMovies.Parent := f;
	labLinesMovies.SetBounds(340, 430, 110, 25);
	labLinesMovies.Caption := GetLangStr(1414);
	
	edLinesMovies := TEdit.Create(f);
	edLinesMovies.Name := 'edLinesMovies';
	edLinesMovies.Parent := f;
	edLinesMovies.SetBounds(660, 425, 20, 25);
	edLinesMovies.Text := IntToStr(RegReadInteger('BreezeLinesMovies', DefaultLinesMovies));
	
	labLinesPeople:=TLabel.Create(f);
	labLinesPeople.Name := 'labLinesPeople';
	labLinesPeople.Parent := f;
	labLinesPeople.SetBounds(340, 455, 110, 25);
	labLinesPeople.Caption := GetLangStr(1415);
	
	edLinesPeople := TEdit.Create(f);
	edLinesPeople.Name := 'edLinesPeople';
	edLinesPeople.Parent := f;
	edLinesPeople.SetBounds(660, 450, 20, 25);
	edLinesPeople.Text := IntToStr(RegReadInteger('BreezeLinesPeople', DefaultLinesPeople));
	
	labPhotos:=TLabel.Create(f);
	labPhotos.Name := 'labPhotos';
	labPhotos.Parent := f;
	labPhotos.SetBounds(340, 480, 110, 25);
	labPhotos.Caption := GetLangStr(1418);
	
	edPhotos := TEdit.Create(f);
	edPhotos.Name := 'edPhotos';
	edPhotos.Parent := f;
	edPhotos.SetBounds(660, 475, 20, 25);
	edPhotos.Text := IntToStr(RegReadInteger('PhotosCnt', 5));	
	
	boxUseThumbs := TCheckBox.Create(f);
	boxUseThumbs.Name := 'boxUseThumbs';
	boxUseThumbs.Parent := f;
	boxUseThumbs.SetBounds(10, 395, 320, 20);
	boxUseThumbs.Caption := GetLangStr(1476);
	my_value := RegReadInteger('UseThumbs', 1);
	if my_value = 1 then
		boxUseThumbs.Checked := True;
		
	boxShowCoversInList := TCheckBox.Create(f);
	boxShowCoversInList.Name := 'boxShowCoversInList';
	boxShowCoversInList.Parent := f;
	boxShowCoversInList.SetBounds(10, 415, 320, 20);
	boxShowCoversInList.Caption := GetLangStr(1427);
	my_value := RegReadInteger('ShowCoversInList', 1);
	if my_value=1 then
		boxShowCoversInList.Checked := True;
		
	boxMinimaList := TCheckBox.Create(f);
	boxMinimaList.Name := 'boxMinimaList';
	boxMinimaList.Parent := f;
	boxMinimaList.SetBounds(10, 435, 320, 20);
	boxMinimaList.Caption := GetLangStr(1436);
	my_value := RegReadInteger('MinimaList', 0);
	if my_value=1 then
		boxMinimaList.Checked := True;

		
	boxUseLastUpdated := TCheckBox.Create(f);
	boxUseLastUpdated.Name := 'boxUseLastUpdated';
	boxUseLastUpdated.Parent := f;
	boxUseLastUpdated.SetBounds(10, 455, 320, 20);
	boxUseLastUpdated.Caption := GetLangStr(1423);
	my_value := RegReadInteger('ShowLastUpdated', 0);
	if my_value=1 then
		boxUseLastUpdated.Checked := True;
		
	boxPersonStatsInCollection := TCheckBox.Create(f);
	boxPersonStatsInCollection.Name := 'boxPersonStatsInCollection';
	boxPersonStatsInCollection.Parent := f;
	boxPersonStatsInCollection.SetBounds(10, 475, 320, 20);
	boxPersonStatsInCollection.Caption := GetLangStr(1451);
	my_value := RegReadInteger('PersonStatsInCollection', 0);
	if my_value=1 then
		boxPersonStatsInCollection.Checked := True;
		
	boxDummyCovers := TCheckBox.Create(f);
	boxDummyCovers.Name := 'boxDummyCovers';
	boxDummyCovers.Parent := f;
	boxDummyCovers.SetBounds(10, 495, 350, 20);
	boxDummyCovers.Caption := GetLangStr(1426);
	my_value := RegReadInteger('ShowDummyCovers', 0);
	if my_value=1 then
		boxDummyCovers.Checked := True;
	
		
	boxHidePhotosCovers := TCheckBox.Create(f);
	boxHidePhotosCovers.Name := 'boxHidePhotosCovers';
	boxHidePhotosCovers.Parent := f;
	boxHidePhotosCovers.SetBounds(10, 515, 380, 20);
	boxHidePhotosCovers.Caption := GetLangStr(1431);
	my_value := RegReadInteger('HidePhotosCovers', 0);
	if my_value=1 then
		boxHidePhotosCovers.Checked := True;
		
	boxOnlyUnseenShots := TCheckBox.Create(f);
	boxOnlyUnseenShots.Name := 'boxOnlyUnseenShots';
	boxOnlyUnseenShots.Parent := f;
	boxOnlyUnseenShots.SetBounds(10, 535, 380, 20);
	boxOnlyUnseenShots.Caption := GetLangStr(2977);
	my_value := RegReadInteger('OnlyUnseenShots', 0);
	if my_value=1 then
		boxOnlyUnseenShots.Checked := True;
		
	sl := TStringList.Create;
	with sl do begin
		Clear;
		Add('SELECT * FROM partners');
		Add('WHERE url=''http://www.adultdvdempire.com/''');
	end;
	my_value := ExecuteSQL(sl.text);
	sl.Free;
	if my_value > 0 then begin
		labRemoveAdult := TLabel.Create(f);
		labRemoveAdult.Name := 'labRemoveAdult';
		labRemoveAdult.Parent := f;
		labRemoveAdult.SetBounds(10, 552, 350, 20);
		labRemoveAdult.Caption := GetLangStr(1459);
		labRemoveAdult.Cursor := crHandPoint;
		labRemoveAdult.Font.Color := clHotlight;
		labRemoveAdult.OnClick := @RemoveAdultClick;
	end;
	
	labCoverWidth:=TLabel.Create(f);
	labCoverWidth.Name := 'labCoverWidth';
	labCoverWidth.Parent := f;
	labCoverWidth.SetBounds(440, 505, 110, 25);
	labCoverWidth.Caption := GetLangStr(1497);
	
	edCoverWidth := TEdit.Create(f);
	edCoverWidth.Name := 'edCoverWidth';
	edCoverWidth.Parent := f;
	edCoverWidth.SetBounds(660, 500, 20, 25);
	edCoverWidth.Text := IntToStr(RegReadInteger('ListCoverWidth', DefaultThumbWidth));	
	edCoverWidth.OnKeyDown := @ThumbsChanged;
	
	labCoverRows:=TLabel.Create(f);
	labCoverRows.Name := 'labCoverRows';
	labCoverRows.Parent := f;
	labCoverRows.SetBounds(440, 530, 110, 25);
	labCoverRows.Caption := GetLangStr(1499);
	
	edCoverRows := TEdit.Create(f);
	edCoverRows.Name := 'edCoverRows';
	edCoverRows.Parent := f;
	edCoverRows.SetBounds(660, 525, 20, 25);
	edCoverRows.Text := IntToStr(RegReadInteger('CoverRows', DefaultCoverRows));
	
	labLineSpacing := TLabel.Create(f);
	labLineSpacing.Name := 'labLineSpacing';
	labLineSpacing.Parent := f;
	labLineSpacing.SetBounds(440, 555, 110, 25);
	labLineSpacing.Caption := GetLangStr(2976);

	comboLineSpacing := TComboBox.Create(f);
	comboLineSpacing.Name := 'comboLineSpacing';
	comboLineSpacing.Parent := f;
	comboLineSpacing.SetBounds(640, 550, 40, 25);
	comboLineSpacing.Style := csDropDownList;
	for i := 0 to Length(LineSpacings) - 1 do begin
		comboLineSpacing.Items.Add(FloatToStr(LineSpacings[i]));
	end;
	comboLineSpacing.ItemIndex := RegReadInteger('BreezeLineSpacing', DefaultLineSpacing);
	
	labFontSize:=TLabel.Create(f);
	labFontSize.Name := 'labFontSize';
	labFontSize.Parent := f;
	labFontSize.SetBounds(440, 580, 110, 25);
	labFontSize.Caption := GetLangStr(2975);
	
	edFontSize := TEdit.Create(f);
	edFontSize.Name := 'edFontSize';
	edFontSize.Parent := f;
	edFontSize.SetBounds(660, 575, 20, 25);
	edFontSize.Text := IntToStr(RegReadInteger('BreezeFontSize', DefaultBasicFontSize));
	
	RatingInListGroup := TGroupBox.Create(f);
	RatingInListGroup.Name := 'RatingInListGroup';
	RatingInListGroup.Parent := f;
	RatingInListGroup.SetBounds(10, 600, 340, 40);
	RatingInListGroup.Caption := GetLangStr(2996);
	
	boxShowCurrentRatingInList := TCheckBox.Create(f);
	boxShowCurrentRatingInList.Name := 'boxShowCurrentRatingInList';
	boxShowCurrentRatingInList.Parent := f;
	boxShowCurrentRatingInList.SetBounds(20, 615, 100, 20);
	boxShowCurrentRatingInList.Caption := GetLangStr(2997);
	my_value := RegReadInteger('ShowCurrentRatingInList', 1);
	if my_value=1 then
		boxShowCurrentRatingInList.Checked := True;
		
	boxShowIMDBRatingInList := TCheckBox.Create(f);
	boxShowIMDBRatingInList.Name := 'boxShowIMDBRatingInList';
	boxShowIMDBRatingInList.Parent := f;
	boxShowIMDBRatingInList.SetBounds(140, 615, 80, 20);
	boxShowIMDBRatingInList.Caption := 'IMDb';
	my_value := RegReadInteger('ShowIMDBRatingInList', 0);
	if my_value=1 then
		boxShowIMDBRatingInList.Checked := True;
		
	boxShowKinopoiskRatingInList := TCheckBox.Create(f);
	boxShowKinopoiskRatingInList.Name := 'boxShowKinopoiskRatingInList';
	boxShowKinopoiskRatingInList.Parent := f;
	boxShowKinopoiskRatingInList.SetBounds(220, 615, 80, 20);
	boxShowKinopoiskRatingInList.Caption := 'КиноПоиск';
	my_value := RegReadInteger('ShowKinopoiskRatingInList', 0);
	if my_value=1 then
		boxShowKinopoiskRatingInList.Checked := True;
		
	RightPagePreviewRatingGroup := TGroupBox.Create(f);
	RightPagePreviewRatingGroup.Name := 'RightPagePreviewRatingGroup';
	RightPagePreviewRatingGroup.Parent := f;
	RightPagePreviewRatingGroup.SetBounds(10, 563, 340, 37);
	RightPagePreviewRatingGroup.Caption := GetLangStr(4401);
	
	boxUCUserRating := TCheckBox.Create(f);
	boxUCUserRating.Name := 'boxUCUserRating';
	boxUCUserRating.Parent := f;
	boxUCUserRating.SetBounds(20, 575, 100, 20);
	boxUCUserRating.Caption := GetLangStr(1824);
	my_value := RegReadInteger('ShowUserRatingUnderCovers', 1);
	if my_value=1 then
		boxUCUserRating.Checked := True;
		
	boxUCIMDBRating := TCheckBox.Create(f);
	boxUCIMDBRating.Name := 'boxUCIMDBRating';
	boxUCIMDBRating.Parent := f;
	boxUCIMDBRating.SetBounds(140, 575, 80, 20);
	boxUCIMDBRating.Caption := 'IMDb';
	my_value := RegReadInteger('ShowIMDBRatingUnderCovers', 1);
	if my_value=1 then
		boxUCIMDBRating.Checked := True;
		
	boxUCKinopoiskRating := TCheckBox.Create(f);
	boxUCKinopoiskRating.Name := 'boxUCKinopoiskRating';
	boxUCKinopoiskRating.Parent := f;
	boxUCKinopoiskRating.SetBounds(220, 575, 80, 20);
	boxUCKinopoiskRating.Caption := 'КиноПоиск';
	my_value := RegReadInteger('ShowKinopoiskRatingUnderCovers', 0);
	if my_value=1 then
		boxUCKinopoiskRating.Checked := True;
		
	ByRatingGroup := TGroupBox.Create(f);
	ByRatingGroup.Name := 'ByRatingGroup';
	ByRatingGroup.Parent := f;
	ByRatingGroup.SetBounds(360, 600, 325, 40);
	ByRatingGroup.Caption := GetLangStr(4400);
	
	my_value := RegReadInteger('MyRatingTabRating', 1);
	myRatingRadio := TRadioButton.Create(f);
	myRatingRadio.Name := 'myRatingRadio';
	myRatingRadio.Parent := ByRatingGroup;
	myRatingRadio.SetBounds(10, 15, 100, 20);
	myRatingRadio.Caption := GetLangStr(172);
	myRatingRadio.Checked := my_value = 1;
	
	curRatingRadio := TRadioButton.Create(f);
	curRatingRadio.Name := 'curRatingRadio';
	curRatingRadio.Parent := ByRatingGroup;
	curRatingRadio.SetBounds(110, 15, 100, 20);
	curRatingRadio.Caption := GetLangStr(2997);
	curRatingRadio.Checked := my_value = 2;
	
	imdbRatingRadio := TRadioButton.Create(f);
	imdbRatingRadio.Name := 'imdbRatingRadio';
	imdbRatingRadio.Parent := ByRatingGroup;
	imdbRatingRadio.SetBounds(210, 15, 100, 20);
	imdbRatingRadio.Caption := 'IMDb';
	imdbRatingRadio.Checked := my_value = 3;
	
	boxShowDiscNrInList := TCheckBox.Create(f);
	boxShowDiscNrInList.Name := 'boxShowDiscNrInList';
	boxShowDiscNrInList.Parent := f;
	boxShowDiscNrInList.SetBounds(10, 640, 300, 20);
	boxShowDiscNrInList.Caption := GetLangStr(4402);
	my_value := RegReadInteger('ShowDiscNrInList', 0);
	if my_value=1 then
		boxShowDiscNrInList.Checked := True;

	btnDefault := TButton.Create(f);
	btnDefault.Name := 'btnDefault';
	btnDefault.Parent := f;
	btnDefault.SetBounds(20, 660, 160, 25);
	btnDefault.Caption := GetLangStr(1475);
	btnDefault.OnClick := @BtnDefaultClick;
	
	b := TButton.Create(f);
	b.Name := 'btnOK';
	b.Parent := f;
	b.SetBounds(300, 660, 80, 25);
	b.Caption := '&OK';
	b.OnClick := @ButtonClick;

	f.ShowModal;
	f.Free;

	result:=s;
end;

function ShowLoanManagerMicro(EditionCode, MovieCode: Integer): string;
var
	sl: TStringList;
	i, RecordCount, dd, mm, yy, loc_code: Integer;
	s, loc_name, day, month, year, due_date, loan_date: String;
	f: TForm;
	b: TButton;
	labDueDate, labComment, labLocation: TLabel;
	comboLocation: TComboBox;
	edComment, edDueDate: TEdit;
	
procedure ButtonClick(Sender: TButton);
begin
	s := GetLangStr(1439);
	sl := TStringList.Create;
	with sl do begin
		Clear;
		Add('SELECT l.location from loans l');
		Add('JOIN manuals m on m.code=l.location');
		Add(format('WHERE m.name=''%s''', [comboLocation.Items[comboLocation.ItemIndex]]));
	end;
	RecordCount := ExecuteSQL(sl.text);
	loc_code := GetIntegerField('l.location');
	if (edDueDate.Text <> '') then begin
		year := copy(edDueDate.Text, 1, 2);
		month := copy(edDueDate.Text, 4, 2);
		day := copy(edDueDate.Text, 7, 2);
		try
			dd := StrToInt(day);
			mm := StrToInt(month);
			yy := StrToInt(year);
		except
			ShowMessage(GetLangStr(1444));
		end;
	end;
	if ((dd>0) and (mm>0) and (yy>0)) or (edDueDate.Text = '') then begin
		due_date := format('%d/%d/20%d', [mm, dd, yy]);
		DecodeDate(Date, yy, mm, dd);
		loan_date := format('%d/%d/%d', [mm, dd, yy]);
		if edDueDate.Text = '' then
			due_date := '';
		with sl do begin
			Clear;
			Add('INSERT INTO loans');
			Add('(movie, edition, loan_date, due_date, comment, location)');
			Add(Format('VALUES (%d, %d, ''%s'', ''%s'', ''%s'', %d)', [MovieCode, EditionCode, loan_date, due_date, edComment.text, loc_code]));
		end;
		RecordCount := ExecuteSQL(sl.text);
		f.ModalResult := mrOk;
	end;
	sl.Free;
end;

begin
	s:=GetLangStr(1335);
	f := TForm.Create(nil);
	f.Caption := GetLangStr(1439);
	f.BorderStyle := bsDialog;
	f.Position := poScreenCenter;
	f.Width:=180;
	f.Height:=200;
	f.AutoSize:=false;

	labLocation := TLabel.Create(f);
	labLocation.Name := 'labLocation';
	labLocation.Parent := f;
	labLocation.SetBounds(10, 10, 150, 20);
	labLocation.Caption := GetLangStr(178);

	comboLocation := TComboBox.Create(f);
	comboLocation.Name := 'comboLocation';
	comboLocation.Parent := f;
	comboLocation.SetBounds(10, 25, 150, 20);
	comboLocation.Style := csDropDownList;
	sl := TStringList.Create;
	with sl do begin
		Clear;
		Add('select distinct name from manuals');
		Add('where reference=10');
	end;
	RecordCount := ExecuteSQL(sl.text);
	for i:=1 to RecordCount do begin
		comboLocation.Items.Add(GetStringField('name'));
		GetNextRecord;
	end;

    with sl do begin
        Clear;
        Add('select m.name from loans l');
        Add('inner join manuals m on m.code=l.location');
        Add(format('where edition=%d', [EditionCode]));
	end;
	RecordCount := ExecuteSQL(sl.text);
	loc_name := '';
	if RecordCount > 0 then
		loc_name := GetStringField('m.name');
	if (loc_name <> '') then begin
		comboLocation.ItemIndex := comboLocation.Items.IndexOf(loc_name);
	end;

	sl.Free;

	labComment := TLabel.Create(f);
	labComment.Name := 'labComment';
	labComment.Parent := f;
	labComment.SetBounds(10, 55, 150, 20);
	labComment.Caption := GetLangStr(163);

	edComment := TEdit.Create(f);
	edComment.Name := 'edComment';
	edComment.Parent := f;
	edComment.SetBounds(10, 70, 150, 20);
	edComment.Text := '';

	labDueDate := TLabel.Create(f);
	labDueDate.Name := 'labDueDate';
	labDueDate.Parent := f;
	labDueDate.SetBounds(10, 95, 150, 20);
	labDueDate.Caption := GetLangStr(240) + format(' (%s)', [GetLangStr(1443)]);

	edDueDate := TEdit.Create(f);
	edDueDate.Name := 'edDueDate';
	edDueDate.Parent := f;
	edDueDate.SetBounds(10, 110, 150, 20);
	edDueDate.Text := '';

	b := TButton.Create(f);
	b.Name := 'btnOK';
	b.Parent := f;
	b.SetBounds(50, 140, 80, 25);
	b.Caption := '&OK';
	b.OnClick := @ButtonClick;

	f.ShowModal;
	f.Free;

	result:=s;
end;

function ProcessMovieReference(sl: TStringList; text: String; page: integer; header_img: String = ''): String;
var
  i, j, kol, RecordCount, rating, page_width, LastCode, my_i, my_code: integer;
  s, description, year, director, writer, actor, bio, character, movie, movie_top: string;
  all, FileName, img, rate, BackgroundMovieRef: string;
  IMDBRating, SiteRating: double;
  ii, TotalItems, PageItems, lines, PicWidth, PicHeight, page_width_copy: integer;
  fl: boolean;
  PreviousCodes: TStringList;
begin
	all := '';	

	CountedPages := 0;
	page_width:=GetHTMLWidth - WholePageBorder;
	
	RecordCount := ExecuteSQL(sl.text);	
	lines := RegReadInteger('BreezeLinesMovies', DefaultLinesMovies);
	//count how many items were listed on the previous pages
	TotalItems := CountItemsForPages(page_width, page, RecordCount, 1, lines, HomeCoverHeight, HomeCoverWidth);
	i := ProcessedRecords;
	
	LastCode:=0;
	fl:=true;
	PageItems := 0;
	page_width_copy := page_width;
	movie := '';
	PreviousCodes := TStringList.Create;
	//list movies on the current page
	while (i<=RecordCount) and fl do begin
		my_code:=GetIntegerField('code');
		if PreviousCodes.IndexOf(IntToStr(my_code)) < 0 then begin
			PreviousCodes.Add(IntToStr(my_code));
			LastCode:=my_code;
			rating:=GetIntegerField('m.rating');
			rate:='';
			PicHeight := HomeCoverHeight;
			PicWidth := HomeCoverWidth + NormalImageBorders;
			page_width_copy := page_width_copy - PicWidth;
			if (page_width_copy < 0) then begin
				all := all + movie + '<td></td></tr></table><table class="whole-page-images"><tr>';
				movie := '';
				lines := lines - 1;
				page_width_copy := page_width - PicWidth;
			end;
			if (page<>0) and (lines <= 0) then
				fl:=false
			else begin
				if rating > 0 then begin
					for my_i:=1 to 10 do begin
						if my_i mod 2=1 then begin
							if my_i<=rating then
						rate:=rate+format('<img src="%shalfstar-left.gif" align="absmiddle" border="0">',  [ImgPath])
							else
						rate:=rate+format('<img src="%snot-halfstar-left.gif" align="absmiddle" border="0">',  [ImgPath])
						end
						else begin
							if my_i<=rating then
						rate:=rate+format('<img src="%shalfstar-right.gif" align="absmiddle" border="0">',  [ImgPath])
							else
						rate:=rate+format('<img src="%snot-halfstar-right.gif" align="absmiddle" border="0">',  [ImgPath])
						end;
					end;
				end;
				IMDBRating := GetFloatField('m.imdb_rating');
				SiteRating := GetFloatField('SiteRating');

				FileName := GetImageFileName(GetStringField('i.path'), ThumbsHomeMovies, 'no-cover.jpg', HomeCoverWidth, HomeCoverHeight, True);
				movie:=movie+'<td style="background-color: white; border: 1px solid ' + WhiteAreaBorderColor + '; width: 100px; padding: 5px;"><a class="pic"'+format(' href="movie:%d"><img style="height: %dpx" src="', [my_code, HomeCoverHeight])+FileName+'"></a>';
				if SiteRating <> 0 then
					movie:=movie+'<div style="vertical-align: middle; font-weight: bold; margin-top: 5;">' + format('%s: %0.1f</div>', [GetLangStr(3419), SiteRating])
				else if IMDBRating <> 0 then
					movie:=movie + '<div style="vertical-align: middle; font-weight: bold; margin: 5 0">' + format('IMDB: %0.1f</div>', [IMDBRating]);
				if (rate<>'') and (RegReadInteger('ShowRating', 1) = 1) then
					movie:=movie + '<div style="vertical-align: bottom;">' + rate + '</div>';
				//sequence number
				if TempReference = 22 then
					movie:=movie + '<p style="margin: 5 0;">' + GetLangStr(529) + IntToStr(GetIntegerField('m.series_nom')) + ': </p>';
				movie := movie + format('<p style="margin: 5 0;"><a href="movie:%d">%s</a></p>', [my_code, GetStringField('m.title')]);
				movie := movie + '</td>';
				
				PageItems:=PageItems+1;
				GetNextRecord;
				i := i+1;
			end;
		end
		else begin
			GetNextRecord;
			i:=i+1;
		end;
	end;//while
	PreviousCodes.Free;
	TotalItems := TotalItems + PageItems;
	all := all + movie;
	if movie <> '' then
		//all := all + Format('<td style="width: %dpx"></td>', [page_width_copy - BigImageBorders]);
		all := all + '<td></td>';
	all := all + '<td></td></tr></table>';
	kol := 0;
	lines := RegReadInteger('BreezeLinesMovies', DefaultLinesMovies);
	if (page > 0) and (i < RecordCount) then begin
		//set the maximum number of pages to 2000
		TotalItems := TotalItems + CountItemsForPages(page_width, 2000, RecordCount, i, lines, HomeCoverHeight, HomeCoverWidth);
		kol := CountedPages;
	end;
	
	//get the top of the page (we need to know how many movies were there)	
	movie_top:=GetReferenceTop;
	if header_img <> '' then
		header_img := '<img border="0" style="float: left; margin-right: 10; vertical-align: middle;" src="' + header_img + '">';
	movie_top:=movie_top + Format('<p class="page-header" style="font-size: %dpt;">', [BasicFontSize + PageHeaderModifier]) + header_img + text + format(' (%d)', [TotalItems]);
	movie_top:=movie_top+'</p>'+ClosePatternTop;
	movie_top := movie_top + '<table class="whole-page-images"><tr>';

	case TempReference of
		1: s:='video_standard:'+IntToStr(TempReferenceCode);
		2: s:='media_format:'+IntToStr(TempReferenceCode);
		3: s:='media_type:'+IntToStr(TempReferenceCode);
		4: s:='aspect_ratio:'+IntToStr(TempReferenceCode);
		5: s:='resolution:'+IntToStr(TempReferenceCode);
		6: s:='subtitle:'+IntToStr(TempReferenceCode);
		7: s:='audio_track:'+IntToStr(TempReferenceCode);
		8: s:='genre:'+IntToStr(TempReferenceCode);
		9: s:='country:'+IntToStr(TempReferenceCode);
		10: s:='location:'+IntToStr(TempReferenceCode);
		11: s:='mpaa:'+IntToStr(TempReferenceCode);
		12: s:='studio:'+IntToStr(TempReferenceCode);
		13: s:='custom1:'+IntToStr(TempReferenceCode);
		14: s:='custom2:'+IntToStr(TempReferenceCode);
		15: s:='custom3:'+IntToStr(TempReferenceCode);
		16: s:='custom4:'+IntToStr(TempReferenceCode);
		17: s:='custom5:'+IntToStr(TempReferenceCode);
		18: s:='custom6:'+IntToStr(TempReferenceCode);
		19: s:='video_codec:'+IntToStr(TempReferenceCode);
		20: s:='disc_label:'+IntToStr(TempReferenceCode);
		22: s:='sequence:'+IntToStr(TempReferenceCode);
		1971: s:='year:'+IntToStr(TempReferenceCode);
    MY_RATING_REFERENCE: s := 'show_my_rating:' + IntToStr(TempReferenceCode);
		666: s:='userref:'+IntToStr(TempReferenceCode)+','+TempText;
		800: s:='userref:'+IntToStr(TempReferenceCode)+','+TempText;
	else
		s:='';
	end;
	if (page > 1) or (kol > 0) then begin
		all:=all+ Format('<center><hr><p>', [page_width div 3, page_width div 3]);
		if (page>1) or (kol > 0) then
			all:=all+format('<a href="%s,%d">%s</a>   ', [s, 0, GetLangStr(1330)]);
		if page>1 then
			all:=all+format('<a href="%s,%d">%s</a>   ', [s, page-1, GetLangStr(1328)]);
		for i:=1 to page do begin
			if page=i then
				all:=all+format(' <b class="search-active">%d</b> ', [i])
			else
				all:=all+format(' <a href="%s,%d">%d</a> ', [s, i, i]);
		end;
		for i:=(page+1) to (page+kol) do
			all:=all+format(' <a href="%s,%d">%d</a> ', [s, i, i]);
		if kol>0 then
			all:=all+format('   <a href="%s,%d">%s</a> ', [s, page+1, GetLangStr(1329)]);
		all:=all+'</p></center>';
	end;


	all:=movie_top+all;	
	Result := all;
end;

function MarkPreviousAsSeen: Boolean;
var
	btnSelected: Integer;
begin
	btnSelected := MessageDlg(GetLangStr(2953), mtConfirmation, mbYes + mbNo, 0);
	if btnSelected = mrYes then 
		Result := True
	else
		Result := False;
end;

begin

end.
