function Favorites(){this.items=new Array();}
function favorites_addFavorite(item){
	for(var i=0;i<this.items.length;i++){
		if(this.items[i]==item){
			alert(item.label.toUpperCase()+" is already in your Favorite Art!");
			return false;
		}
	}
	if(this.items.length<5)this.items[this.items.length]=item;
	else{this.removeFavorite(0);this.items[this.items.length]=item;}
	return true;
}
function favorites_addFavoriteByName(label){
	for(var i=0;i<artList.getLength();i++){
		if(artList.getElementAt(i).label==label)return this.addFavorite(artList.getElementAt(i));
	}
	for(var i=0;i<archives.getLength();i++){
		if(archives.getElementAt(i).label==label)return this.addFavorite(archives.getElementAt(i));
	}
}
function favorites_getHtml(){
	if(this.items.length==0)return "<h3>No items have been added to your favorites...</h3>";
	var fh="<table cellspacing=4 cellpadding=10><tr>";
	for(var i=0;i<this.items.length;i++){
		fh+="<td style='border:2px solid "+LIGHT_COLOR+";' valign=top>"+
		"<div align=center><b>"+
		this.items[i].label+"</b><br>"+
		"<img src='"+tPath+this.items[i].thumbnail+"' class='gBorder' "+
		"vspace='10' "+
		"onclick='top.favorites.show("+i+")'></div>"+
		"Edition: "+this.items[i].edition+"<br>";
		if(this.items[i].price!=0)fh+="Price: $"+ShoppingCart.fix(this.items[i].price,"soft");
		fh+="</td>";
	}
	return fh+"</tr></table>";
}
function favorites_removeFavorite(index){
	var temp=new Array(this.items.length-1);
	var count=0;
	for(var i=0;i<this.items.length;i++){
		if(i==index)continue;
		else{temp[count] = this.items[i];count++;}
	}
	this.items=temp;
}
function favorites_show(index){
	currentItem=this.items[index];
	showFloatingPage("Image Panel");
}
Favorites.prototype.addFavorite=favorites_addFavorite;
Favorites.prototype.addFavoriteByName=favorites_addFavoriteByName;
Favorites.prototype.getHtml=favorites_getHtml;
Favorites.prototype.removeFavorite=favorites_removeFavorite;
Favorites.prototype.show=favorites_show;
