// ------- nadrazena trida dialogu -------
function photoDialog_crop(iIdentify) {
	this.inheritFrom = photoDialog;
	this.inheritFrom();

	this.identify = iIdentify;
	
	this.stuffA = null;
	this.stuffB = null;
	
	// -------- virtualni metody ---------
	this.inicialize = function() {
		this.beforeState = "dialog_state1";
		
		this.stuffA = document.getElementById(this.identify + "dialog_stuffA");
		this.stuffB = document.getElementById(this.identify + "dialog_stuffB");
	}

	this.execute = function() {
		this.commandName = "photo_addCart";
		var cmd = this.composeCommand();

		if (exec == null) alert("Chyba!");
		else this.execCmd(cmd);
	}

	this.finish = function(success) {
		if (this.finishFlag) {
			this.finishFlag = false;
		}
	}

	this.updateSelection = function(iRef) {
		if (dialogs.collection.length == 0) {
			this.setState("dialog_state1");
		} else {
			this.setState("dialog_state2");
		}
	}
	// -----------------------------------

	this.swap = function(title) {
        this.stuffA.style.display = title ? "block" : "none";
        this.stuffB.style.display = title ? "none" : "block";
    }

	this.crop = function() {
        if (cropHand == null && browseHand != null) {
            this.swap(false);

            var phRef = photos.indexes[ browseHand.photo_ID ];
            cropHand = new noteHandler( phRef.image, "writemodify", 0, "", phRef.photo_ID, "");
            cropHand.noTextArea = true;
            cropHand.displayArea = true;
            cropHand.infoResX = browseHand.resX;
            cropHand.infoResY = browseHand.resY;

            cropHand.cmd_add = "photo_crop";
            cropHand.cmd_rem = "photo_crop";
            cropHand.cmd_update = "#blank";

            noteHand.rightDependent = cropHand;
            cropHand.leftDependent = noteHand;

            noteHand.disable();
            cropHand.enable();
            var noteRef = cropHand.createDefaultNote();
        }
    }

	this.toCancel = function() {
        if (cropHand != null) {
            cropHand.destroy();
            delete cropHand;
            cropHand = null;
        }

		if (this.dialogMod != "nouncheck") photos.uncheck();
		else if (this.hideFunction != null) this.hideFunction(this.identify);

		this.swap(true);
    }
}

