

jQuery(function($) {
$('body').css('display','block');
});


$(document).ready(function() {
/*
	var hash = window.location.hash.substr(1);
 
	var href = $('#special_link a').each(function(){
		var href = $(this).attr('href');
		if(hash==href.substr(0,href.length-5)){
			var toLoad = hash+'.html #content';           
			$('#content').load(toLoad)
		}
	});

*/
    
    startAnim();
	$('#special_link a').click(function(){
        
		var toLoad = $(this).attr('href')+' #content';
        //alert(toLoad);
		$('#content').fadeOut('slow',loadContent);
        $('#content').innerHTML = "Loading...";
        
		$('#load').remove();
        
		$('#special_link').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('normal');
		window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
		function loadContent() {
			$('#content').load(toLoad,showNewContent)
         
		}
		function showNewContent() {       
            $('#content').show('slow',hideLoader);
		}

		function hideLoader() {
			$('#load').fadeOut('normal');
            startAnim();
		}
		return false;

	});




});
    var images = new Array( 'iPhoneSmall.png','cloud.png', 'server.png' );
    var currImg = 0;
    var img = null;
    function startAnim() {
        img = document.getElementById('rotating_img');
        if ( img != null ) {
            setTimeout(hideImage, 3000);
            currImg = 0;
        }
    }
    function onReady() {
//        img.style.visibility = 'visible';
        $('#rotating_img').fadeIn('slow',goToSleep);
        //img.style.visibility = 'visible';
    }

    function goToSleep() {
        setTimeout(hideImage, 3000);
    }
    function hideImage() {
        $('#rotating_img').fadeOut('slow',nextImage);
        //img.style.visibility = 'hidden';
        //nextImage();
    }

    function nextImage() {
        
        currImg = (currImg+1)%3;
        nextImg = images[currImg];
        img.src =  'images/'+nextImg;

        //img.style.display = 'block';
        img.onload = onReady;

        //$('#rotating_img').fadeIn('slow',onReady);
        //setTimeout(onReady,1000);
    }
/*
$(document).ready(function() {
						   
	var hash = window.location.hash.substr(1);
	var href = $('#special_link a').each(function(){
		var href = $(this).attr('href');
		if(hash==href.substr(0,href.length-5)){
			var toLoad = hash+'.html #content';
			$('#content').load(toLoad)
		}											
	});


	$('#special_link a').click(function(){
								  
		var toLoad = $(this).attr('href')+' #content';
		$('#content').hide('fast',loadContent);
		$('#load').remove();
		$('#special_link').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('normal');
		window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
		function loadContent() {
			$('#content').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#content').show('normal',hideLoader());
		}
		function hideLoader() {
			$('#load').fadeOut('normal');
		}
		return false;
		
	});

        


});
*/
