$(document).ready(function(){
  $('a[href^=#]').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	&& location.hostname == this.hostname) {
	  var $target = $(this.hash);
	  $target = $target.length && $target
	  || $('[name=' + this.hash.slice(1) +']');
	  if ($target.length) {
		var targetOffset = $target.offset().top;
		$('html,body')
		.animate({scrollTop: targetOffset}, 1000);
	   return false;
	  }
	}
  });
});
function toggleSite(siteID)
{
	fadeElement('itViewer', 100, 0, 300);
	setTimeout
	(
		function()
		{
			document.getElementById('itViewer').innerHTML =  document.getElementById('view'+siteID).innerHTML;
			fadeElement('itViewer', 0, 100, 300);
		}
		,301);
}


function fadeElement(eID,fStart,fStop,fDur)
{
	var fSpeed = Math.round(fDur / 100);
	var fTimer = 0;
	if (fStart<fStop)
	{
		for(var i=fStart; i<=fStop; i++)
		{
			setTimeout("setOpacity('"+eID+"',"+i+")",fTimer*fSpeed);
			fTimer++;
		}
		return;
	}
	for(var i=fStart; i>=fStop; i--)
	{
		setTimeout("setOpacity('"+eID+"',"+i+")",fTimer*fSpeed);
		fTimer++;
	}
}

function setOpacity(eID, opac)
{
	var eStyle = document.getElementById(eID).style;
	eStyle.opacity = opac / 100;
	eStyle.filter = 'alpha(opacity='+opac+')';
	eStyle.MozOpacity = opac / 100;
}

$(function() {
    $('#s3').cycle({ 
    fx:     'scrollLeft', 
    timeout: 5000,  
    next:   '#s3', 
    pause:   1,
    before:  onBefore, 
    after:   onAfter 
 }).each(function() {
        eval($(this).text());
    });
});
function onBefore() { 
    $('#output').html("loading..."); 
} 
function onAfter() { 
    $('#output').html("Discription:<br>" + "<h3>" + this.alt + "</h3>");
}