/*
 * Copyright (c) 2000, 2001 OutStart, Inc. All rights reserved.
 *
 * $Id: WaldoArea.js,v 1.4 2002/09/11 21:01:28 achase Exp $
 */
function WaldoArea( id, x, y, w, h, order, correct, feedback, weight ) 
{
	var a = arguments;
	this.id				= a[0]||0;
	this.x				= a[1]||0;
	this.y				= a[2]||0;
	this.w				= a[3]||108;
	this.h				= a[4]||91;
	this.order 		= a[5]||null;
	this.correct 	= false;
	if (a[6] != null) {
		this.correct 	= a[6];
	}
	this.feedback = a[7]||"";
	this.weight 	= a[8]||1;
	return this;
}
WaldoArea.prototype.getID = function() { 
	return this.id; 
}
WaldoArea.prototype.setID = function(id) { 
	this.id = id; 
}
WaldoArea.prototype.getX = function() { 
	return this.x; 
}
WaldoArea.prototype.setX = function(x) { 
	this.x = x; 
}
WaldoArea.prototype.getY = function() { 
	return this.y; 
}
WaldoArea.prototype.setY = function(y) { 
	this.y = y; 
}
WaldoArea.prototype.getWidth = function() { 
	return this.w; 
}
WaldoArea.prototype.setWidth = function(w) { 
	this.w = w; 
}
WaldoArea.prototype.getHeight = function() { 
	return this.h;
}
WaldoArea.prototype.setHeight = function(h) {
	this.h = h;
}
WaldoArea.prototype.getOrder = function() {
	return this.order;
}
WaldoArea.prototype.setOrder = function(o) {
	this.order = o;
}
WaldoArea.prototype.getCorrect = function() {
	return this.correct;
}
WaldoArea.prototype.setCorrect = function(c) {
	this.correct = c;
}
WaldoArea.prototype.getFeedback = function() {
	return this.feedback;
}
WaldoArea.prototype.setFeedback = function(fbk) {
	this.feedback = fbk;
}
WaldoArea.prototype.getWeight = function() {
	return parseInt(this.weight);
}
WaldoArea.prototype.setWeight = function(weight) {
	this.weight = parseInt(weight);
}
WaldoArea.prototype.toString = function(index)
{
	var i = (arguments[0] || 1);


	var cb = 	"[|X"+i+":"+this.getX()+"|]"+
				"[|Y"+i+":"+this.getY()+"|]"+
				"[|WIDTH"+i+":"+this.getWidth()+"|]"+
				"[|HEIGHT"+i+":"+this.getHeight()+"|]";

	var correctFlag = 0;
	if (this.getCorrect())
	{
		correctFlag = 1;
	}
	
	cb += 		"[|CORRECT_CB"+i+":"+correctFlag+"|]"+
				"[|WEIGHTED_VALUE"+i+":"+this.getWeight()+"|]"+
				"[|ORDER"+i+":"+this.getOrder()+"|]"+
				"[|FEEDBACK"+i+":"+unescape(this.getFeedback())+"|]";
			
	return cb;
}
