$(document).ready(function() {
/*$('ul#animate').innerfade({
speed: 2000,
timeout: 6000,
type: 'sequence',
containerheight: '262px'
});*/
$jScroller.add("#accreditions","#accreditionscnt","up",1,true);
   // Start Scroller
 $jScroller.config.refresh = 60;
$jScroller.start();

});

/*  ================LIST NAVIGATION  ================*/
$(function(){
		$('#nav-list a')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({ marginLeft : 10 }, 250);
			$(this).css( {backgroundColor:""}, 100 )
			$(this).css({ color: "#f6993e" }, 10);
		})
		.mouseout(function(){
			$(this).stop().animate({ marginLeft : 0 }, 250);
			$(this).css( {backgroundColor:""}, 100 )
			$(this).css({ color: "#fcff82" }, 10);
		})
		
});

/* ================ TAB NAVIGATION ================ */    

//$(function() { $(".lavaLamp").lavaLamp({ fx: "backout", speed: 800 })});

/* ================ BACK TO TOP ================ */
$(document).ready(function() {
   
    $('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });

});

$(document).ready(function(){
						   
	$(".onewaylink").click(function(){
    	window.location=$(this).find("a").attr("href");return false;

	});
	

});


function SetOpacity(object,opacityPct)
{
  // IE.
  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
  // Old mozilla and firefox
  object.style.MozOpacity = opacityPct/100;
  // Everything else.
  object.style.opacity = opacityPct/100;
}
function ChangeOpacity(id,msDuration,msStart,fromO,toO)
{
  var element=document.getElementById(id);
  var opacity = element.style.opacity * 100;
  var msNow = (new Date()).getTime();
  opacity = fromO + (toO - fromO) * (msNow - msStart) / msDuration;
  if (opacity<0) 
    SetOpacity(element,0)
  else if (opacity>100)
    SetOpacity(element,100)
  else
  {
    SetOpacity(element,opacity);
    element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + ")",50);
  }
}
function FadeIn(id)
{
  var element=document.getElementById(id);
  if (element.timer) window.clearTimeout(element.timer); 
  var startMS = (new Date()).getTime();
  element.timer = window.setTimeout("ChangeOpacity('" + id + "',1500," + startMS + ",0,100)",50);
}
function FadeOut(id)
{
  var element=document.getElementById(id);
  if (element.timer) window.clearTimeout(element.timer); 
  var startMS = (new Date()).getTime();
  element.timer = window.setTimeout("ChangeOpacity('" + id + "',1500," + startMS + ",100,0)",500);
}
function FadeInImage(foregroundID,newImage,backgroundID)
{
  var foreground=document.getElementById(foregroundID);
  if (backgroundID)
  {
    var background=document.getElementById(backgroundID);
    if (background)
    {
      background.style.backgroundImage = 'url(' + foreground.src + ')';
      background.style.backgroundRepeat = 'no-repeat';
    }
  }
  SetOpacity(foreground,0);
  foreground.src = newImage;
  if (foreground.timer) window.clearTimeout(foreground.timer); 
  var startMS = (new Date()).getTime();
  foreground.timer = window.setTimeout("ChangeOpacity('" + foregroundID + "',1000," + startMS + ",0,100)",50);
}


function fadeBanner(x) {
	if (x==1){ 
		FadeInImage('activebanner','images/header_img_2.png','header_img');
		x=2;
	} else if (x==2){ 
		FadeInImage('activebanner','images/header_img_3.png','header_img');
		x=0;
	} else {
		FadeInImage('activebanner','images/header_img.png','header_img');
		x=1;
	}
	window.setTimeout(function(){FadeOut('activebanner');},4000);
	window.setTimeout(function(){fadeBanner(x);},6000);
}

window.onload=function() {
   fadeBanner(0);
}

