/*
 * Copyright (C) 1995-2014 by 4system Polska Sp. z o.o.
 * All Rights Reserved. v4
 */
 
componentImage = function(name)
{
	this.__componentImage = __componentImage;
	this.__componentImage(name);
	this.howManyClicks = 0;
};

componentImage.prototype = new __componentImage();
componentImage.prototype.type = "componentImage";

componentImage.prototype.onCreate = function(obj)
{
	this.captureMouseEvents();
	this.toggleName = this.formatNames(this.toggleName);
	this.resourcesStatus = "online";
	this.resourcesURL = resourcesURL;
	if (PageInterface.GetValue("state") != psDesigning && lms && lms.name != "lmsOffline") {
		this.resourcesStatus = lms.resourcesStatus();
		if (this.disableOnlineOfflineMix) this.resourcesURL = resourcesURL;
		else this.resourcesURL = lms.resourcesURL();
	};
	this.resourcesURL = unescape(this.resourcesURL);
	this.imagesNameArr = [ this.src ];
	this.getPreloadImagesArr();
};

componentImage.prototype.componentImageBaseEventClick = componentImage.prototype.eventClick;
componentImage.prototype.eventClick = function(e)
{
	if (this.toggleName != "") {
		var o = pc[this.toggleName];
		if (o) {
			o.toggleVisible();
		};
	};

	if (this.howManyClicks == 0){
		if (this.onAfterFirstMouseClick) this.onAfterFirstMouseClick();
	}else if (this.howManyClicks == 1){
		if (this.onAfterSecondMouseClick) this.onAfterSecondMouseClick();
	};
	this.howManyClicks++;

	return this.componentImageBaseEventClick(e);
};
