var Slot = new Class({
	slotDims     : { left: 0, top: 0, width: 100, height: 100 },
	scrollDims   : { left: 0, top: 0, width: 100, height: 100 },
	contentsDims : { left: 0, top: 0, width: 100 },
	
	initialize: function(cat, slotNum){
		this.id = cat + 'Slot' + slotNum;
		this.slotNum = slotNum;
		this.div         = new Element ('div', { 'id' : this.id              + '_div', 'class' : cat + 'Slot' });
		this.titleDiv    = new Element ('div', { 'id' : cat + 'SlotTitle'    + slotNum + '_div', 'class' : cat + 'SlotTitle' });
		this.scrollDiv   = new Element ('div', { 'id' : cat + 'SlotScroll'   + slotNum + '_div', 'class' : cat + 'SlotScroll' });
		this.contentsDiv = new Element ('div', { 'id' : cat + 'SlotContents' + slotNum + '_div', 'class' : cat + 'SlotContents' + slotNum });
		
		this.titleDiv   .inject (this.div);
		this.scrollDiv  .inject (this.div);
		this.contentsDiv.inject (this.scrollDiv);
		
		this.titleDiv.set('html', slotTitles[slotNum]);
	},
	
	ajaxFill: function() {
		ajaxOptions.whichFunction = 'getPortfolioSlot';
		ajaxOptions.whichSlot     = this.slotNum;
		ajaxOptions.projectType   = projectTypes[this.slotNum];
		ajaxOptions.target        = 'portfolioSlotContents' + this.slotNum + '_div';
		ajaxGetHTML (function(response) {
			$$('.portfolioImg' + this.slotNum + '_div').each(function(item) {
				var img = item.getElement('img');
				item.addEvent('mouseover', function() {
					$('portfolioSlotClient_span'     ).set('html', img.getAttribute('client'));
					$('portfolioSlotProjectName_span').set('html', img.getAttribute('project_name'));
					$('portfolioSlotAgency_span'     ).set('html', img.getAttribute('agency'));
					$('portfolioSlotInvolvement_span').set('html', img.getAttribute('involvement'));
				});
				if (false) {
					item.addEvent('mousedown', function() {
						var mediaIndDiv = item.getElement ('div');
						var currBio = current['aboutBio'];
						var loadDelay = 0;
						if (mediaIndDiv) { // If there is a media indicator div
							if (currBio != 'none') {
	//							alert (mediaIndDiv.get('source_filename') + ' and current aboutBio is ' + currBio);
								aObjs['aboutBio'][currBio].deselectDS();
								aObjs['aboutBio'][currBio].fadeOut();
								players['theater'].show();
								loadDelay = 250;
							}
							setTimeout (function() {
								$('theaterDetailsStatus_div').innerHTML = img.getAttribute('client') + '<br />' + img.getAttribute('project_name') + '<br />';
								
								ajaxOptions.whichFunction = 'getSections';
								ajaxOptions.media_id = mediaIndDiv.get('media_id');
								ajaxGetJSON (function(response) {
									var sections = response;
									for (var i=0; i<sections.length; i++) {
										$('theaterDetailsStatus_div').innerHTML += sections[i]['name'] +
										' ' + sections[i]['start_time'] + ' ' + sections[i]['end_time'] + '<br />';
									}												  
								});
								
								
								players['theater'].load (mediaIndDiv.get('media_type'), mediaIndDiv.get('source_path'), mediaIndDiv.get('source_filename'));
								},loadDelay);
						} else {
							alert ('No mediaIndDiv');
						}
					});
				}
			});
		}.bind(this));
	},
	
	resize: function (slotDims){
		this.slotDims = slotDims;
		this.scrollDims = { left: 10 , top: 50  , width: this.slotDims.width - 20, height: this.slotDims.height - 60 };
		this.contentsDims.width = this.scrollDims.width - 17;

		this.div.setStyles(slotDims);
		this.scrollDiv.setStyles(this.scrollDims);
		this.contentsDiv.setStyles(this.contentsDims);

	} 
	
}); 

