window.addEvent('domready', function() {
									 
	if($('profile-tabs')) {
		var tabs = $('profile-tabs').getElements('a');
		for(var i = 0; i < tabs.length; i ++) {
			if($(tabs[i]) && ($(tabs[i]).getParent().className != 'selected')) {
				$(tabs[i]).addEvent('mouseenter', tab.up.bindWithEvent(tabs[i]));
				$(tabs[i]).addEvent('mouseleave', tab.down.bindWithEvent(tabs[i]));
			}
		}
	}
	
	if($('tab-videos') && $('tab-photos')) {
		$('tab-photos').addEvent('click', function(e) { 
			e = new Event(e).stop();
			$('image-pool').style.display = 'block';
			$('video-pool').style.display = 'none';
			$('tab-videos').removeClass('selected');
			this.addClass('selected');
			this.blur();
		});
		$('tab-videos').addEvent('click', function(e) {
			e = new Event(e).stop();
			$('image-pool').style.display = 'none';
			$('video-pool').style.display = 'block';
			$('tab-photos').removeClass('selected');
			this.addClass('selected');
			this.blur();
		});
	}


});

// tab effect

var tab = {
	up: function() {
		this.getParent().effect('marginTop', {duration: 200}).start(5, 0);
	},
	down: function() {
		this.getParent().effect('marginTop', {duration: 200}).start(0, 5);
	}
}


function getPhoto(p, c) {
	$('image-main').innerHTML = '<img src="/images/garage/photos/' + p + '" alt="" />';
	$('image-main').style.display = 'block';
	$('video-main').innerHTML = '';
	$('video-main').style.display = 'none';
	$('image-caption').innerHTML = c;
}

function getVideo(v, d, c) {
	$('video-main').innerHTML = '<embed src="/flash/ASVideo.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" play="true" loop="true" scale="showall" wmode="window" devicefont="false" bgcolor="#292C3A" name="video" swliveconnect="true" menu="false" allowfullscreen="true" allowscriptaccess="sameDomain" salign="" flashvars="v=/files/garage/videos/' + v + '&t=' + d + '" type="application/x-shockwave-flash" align="middle" height="236" width="283">';
	$('image-main').style.display = 'none';
	$('video-main').style.display = 'block';
	$('image-caption').innerHTML = c;
}
