function buttonFX(el)
{
	el.setOpacity(0.5);
	el.set('morph', {duration: 200});
	el.morph({opacity:1});
}

window.addEvent("domready",function(){
	$$('.moodBox_img').each(function(img) {
		img.onmouseover = function() { buttonFX(this); }
		img.onmousedown = function() { buttonFX(this); }
	});
});

function initScroller()
{
	var scroller = new Slider($('scrollArea'), $('scrollKnob'), {	
		steps: 100,
		mode: 'vertical',
		onChange: function(step){
			$('code').scrollTop = (step * ($('code').getScrollSize().y-$('code').offsetHeight))/100;
		}
	}).set(0);
	
	$('code').addEvent("mousewheel",function(e){
		if(e.wheel > 0) { scroller.set(scroller.step-4); }
		else { scroller.set(scroller.step+4); }
	});
	
	$('scrollerButtonTop').onclick = function() { scroller.set(scroller.step-10); }
	$('scrollerButtonBottom').onclick = function() { scroller.set(scroller.step+10); }
}

function loadProject(key)
{
	var project = new Request(
	{
		method: 'get',
		url: '/inc/projects/project.ajax.php',
		onSuccess: function(content)
		{
			$('detailBox').innerHTML = content;
			overlay.show($('detailBox'));
			initScroller();
		},
		onFailure: function() { alert("ERROR"); }
	});
	project.send("key="+key);
}

function loadAudio()
{
	var project = new Request(
	{
		method: 'get',
		url: '/inc/projects/audio.ajax.php',
		onSuccess: function(content)
		{
			$('detailBox').innerHTML = content;
			overlay.show($('detailBox'));
			var so = new SWFObject("/audioPlayer/webPod.swf", "webPod", "165", "265", "8", "#212121");   
			so.addParam("quality", "best");
			so.addParam("wmode", "transparent");
			so.addParam("flashvars", "xmlFile=/audioPlayer/tunes.xml&podColor=black");
			so.write("container_audioPlayer");
			var l = $('container_audioPlayer').getElements("a");
			l.destroy();
		},
		onFailure: function() { alert("ERROR"); }
	});
	project.send();
}

function loadContent(ctName)
{
	var ajax = new Request(
	{
		method: 'get',
		url: '/inc/projects/'+ctName+'.ajax.php',
		onSuccess: function(content)
		{
			$('detailBox').innerHTML = content;
			overlay.show($('detailBox'));
		},
		onFailure: function() { alert("ERROR"); }
	});
	ajax.send();
}

function hideDetailBox()
{
	overlay.hide();
	$('detailBox').innerHTML = "";
}


