destinationLoader = {
	nowTest:new Date(Date.UTC(2009,7,14,12,0,0,0)),
	now: new Date(),
	currentMap:"",
	init:function() {
		//var now = new Date();
		
		var displayDefault = true;
		for (var i=0; i < this.pairs.length; i++) {
			if ((this.now > this.pairs[i].arrival) && ((i+1)<this.pairs.length)) {
				var i2 = i+1;
				//alert(now.toUTCString()+" - "+this.pairs[i2].arrival.toUTCString());
				if (this.now < this.pairs[i2].arrival) {
					$("#destinationImage").css("background", "url("+this.pairs[i].myImage+") no-repeat top left");
					this.currentMap = this.pairs[i].bigMap;
					$("#destinationMap").css("background", "url("+this.pairs[i].myMap+") no-repeat top left").click(function(){
						tb_show("Current Delegation Location", destinationLoader.currentMap, "");								   						
					});
					displayDefault = false;
					break;
				}
			} 
		}
		
		if (displayDefault) {
			$("#destinationImage").css("background", "url("+this.defaultPair.myImage+") no-repeat top left");
			this.currentMap = this.defaultPair.bigMap
			$("#destinationMap").css("background", "url("+this.defaultPair.myMap+") no-repeat top left").click(function(){
				tb_show("Current Delegation Location", destinationLoader.currentMap, "");								   						
			});
		}
		
	},
	add:function(data) {
		this.pairs.push(data);	
	},
	
	pairs:new Array(),
	defaultPair: {
		
	}
	
	
}

function destinationDisplay(month,day,year,hours,offset,myImage,myMap,bigMap,prefix) {
	this.arrival = new Date();
	this.arrival.setUTCFullYear(year,month-1,day);
	this.arrival.setUTCHours(hours-offset,0,0);
	this.myImage = "http://www.discoverystudentadventures.com/media/images/"+prefix+"/"+myImage;
	this.myMap = "http://www.discoverystudentadventures.com/media/images/"+prefix+"/"+myMap;
	this.bigMap = "http://www.discoverystudentadventures.com/media/images/"+prefix+"/"+bigMap;	
	
}

