function SearchResult(target, shortTitle, id) {
	this.target = target;
	this.id = id;
	this.shortTitle = shortTitle;
	this.xaml = null;
	this.bookClickHandler = null;
	this.viewPagesClickHandler = null;
	this.pageResults = new Array();
	
	target.findName(this.id + "Image").addEventListener("mouseLeftButtonDown", delegate(this, this.handleBookClick));
	target.findName(this.id + "Pages").addEventListener("mouseLeftButtonDown", delegate(this, this.handlePagesClick));
}

SearchResult.prototype.handleBookClick = function(sender, eventArgs) {	
	if (this.bookClickHandler != null) {
	    this.bookClickHandler(this.id, false, null);
	}
}

SearchResult.prototype.handlePagesClick = function(sender, eventArgs) {	
	
	if (this.viewPagesClickHandler != null) {
	    this.viewPagesClickHandler(this);
	}
}

function PageResult(target, id, spreadID, verso, recto, text, position, title, rightToLeft, preRotationAngleY) {
	this.target = target;
	this.id = id;
	this.spreadID = spreadID;
	this.versoLo = verso;
	this.rectoLo = recto;
	this.text = text;
	this.position = position;
	this.title = title;
	this.rightToLeft = rightToLeft;
	this.preRotationAngleY = preRotationAngleY;
	this.xaml = null;
	this.pageClickHandler = null;
	
	target.addEventListener("mouseLeftButtonDown", delegate(this, this.handlePageClick));
}

PageResult.prototype.handlePageClick = function(sender, eventArgs) {	
	
	if (this.pageClickHandler != null) {
	    this.pageClickHandler(this);
	}
}
