// JavaScript Document
var sliding = false;
var showing = false;
Prototype.Browser.IE6 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) == 6;

/*function showSDfooter(){
	if(showing==false){
	setTimeout("fAparition()",1000);
	}
	//Effect.Appear('sd_footer', { duration:1	});
}

function showSDfooter2(){
	if(showing==false){
		setTimeout("fAparition()",1000);
	}
}
function fAparition()
{
	new Effect.toggle('sd_footer','appear');
	showing = true;
}*/
/*function skipIntro(e){
	Event.stop(e);
	
	new Effect.Fade('intro', { duration:0.5, from: 1, to: 0, 
											afterFinish: function(){
													//$('main').fade({ duration:0.8 });
													$('main').show();
											}
							});
}*/
function hideDocs(){
	$('docs1').hide();
	$('docs2').hide();
	$('docs3').hide();
	
	$('Ltab').removeClassName('sel');
	$('Mtab').removeClassName('sel');
	$('Rtab').removeClassName('sel_last');
}
function showDoc1(e){
	Event.stop(e);
	
	hideDocs();
	if ($('docs1') != null)	{$('docs1').show();}
	$('Ltab').addClassName('sel');
}
function showDoc2(e){
	Event.stop(e);
	
	hideDocs();
	if ($('docs2') != null)	{$('docs2').show();}
	$('Mtab').addClassName('sel');
}
function showDoc3(e){
	Event.stop(e);
	
	hideDocs();
	if ($('docs3') != null)	{$('docs3').show();}
	$('Rtab').addClassName('sel_last');
}
function showArchives(e){
	Event.stop(e);
	
	$('fade_layer').show();
	if ($('sd_archives') != null){$('sd_archives').show();}
}
function prevSlide(e){
	Event.stop(e);
	if (!sliding)
		{
			sliding = true;
			var scroller_pos = $('docsList').positionedOffset();
			if (scroller_pos[0] == 0)
			{
				$('docsList').setStyle({ 'left': (-(219*(totalSlides)))+'px' });
			}
			new Effect.Move('docsList', { x: 219, y: 0, duration: 0.4, afterFinish: function() {	sliding = false; } });
		}
}
function nextSlide(e){
	Event.stop(e);
	if (!sliding)
		{
			sliding = true;
			var scroller_pos = $('docsList').positionedOffset();
			if (scroller_pos[0] == (-(219*(totalSlides))))
			{
				$('docsList').setStyle({ 'left': '0px' });
			}
			new Effect.Move('docsList', { x: -219, y: 0, duration: 0.4, afterFinish: function() { 	sliding = false; } });
		}
}
function hideArchives(e){
	Event.stop(e);
	
	$('sd_archives').hide();
	$('fade_layer').hide();
}

function initialize(){
	totalSlides = $$('.slide').length;
	
	if ($('Ltab') != null) {Event.observe('Ltab', 'click', showDoc1, false)};
	if ($('Mtab') != null) {Event.observe('Mtab', 'click', showDoc2, false)};
	if ($('Rtab') != null) {Event.observe('Rtab', 'click', showDoc3, false)};
	if ($('see_archives') != null) {Event.observe('see_archives', 'click', showArchives, false)};
	if ($('fade_layer') != null) {Event.observe('fade_layer', 'click', hideArchives, false)};
	
	if ($('arcPrev') != null) {Event.observe('arcPrev', 'click', prevSlide, false)};
	if ($('arcNext') != null) {Event.observe('arcNext', 'click', nextSlide, false)};
	
	if($('scroller_item_flow1')!=null){$('scroller_item_flow1').innerHTML = $('scroller_item_1').innerHTML;};
	if($('scroller_item_flow2')!=null){$('scroller_item_flow2').innerHTML = $('scroller_item_2').innerHTML;};
	
	setTimeout("new Effect.Appear('sd_footer')",1000);
}
Event.observe(window, 'load', initialize, false);