/*Auction class by Chazzz Fishburn (c) 2008 Pentad Systems,LLC*/
function Auction(id,title,kind,dateString,offset,time,path,link,hasEnded){this.id=id;this.title=title;this.kind=kind;this.dateString=dateString;this.offset=offset;this.time=getUTCAuctionTime(time,offset);this.path=path;this.link=link;this.hasEnded=hasEnded;var k=new String(this.kind.split(' ')[0]);this.isOngoing=(k.toLowerCase()=='ongoing');}
function getDetails(){return this.kind+"<br />\n"+((!this.hasEnded&&!this.isOngoing)?this.dateString+"<br />\n":'');}
function getImagePath(){return '/external/DFPL/Images/'+this.path+'/banner_'+this.id+'.jpg';}
function getTimeRemaining(){return Math.round((this.time-new Date())/60000,0);}
function setTimeRemaining(){if(this.hasEnded==0){var r=this.getTimeRemaining();if(r>0){return (r>7200)?'':'Starts in<br />'+getTimeRemainingString(r);}else{if(this.isOnGoing){return 'Going on<br />TODAY';}else{return 'Ongoing<br />Now';}}}else{return 'This Auction<br />Has Ended';}}
Auction.prototype.getDetails=getDetails;
Auction.prototype.getImagePath=getImagePath;
Auction.prototype.getTimeRemaining=getTimeRemaining;
Auction.prototype.setTimeRemaining=setTimeRemaining;
function getTimeRemainingString(r){var s='';if(r>2880){s+=getFuzzyTime(r/1440)+' days';}else{s+=(r>60)?getFuzzyTime(r/60)+' hours':getFuzzyTime(r)+' minutes';}return s;}
function getFuzzyTime(t){return (t%1>0.5)?Math.round(t,0):Math.floor(t)+'+';}
