/* create a timeOut function in jQuery */
    jQuery.fn.idle = function(time){
        return this.each(function(){
            var i = $(this);
            i.queue(function(){
                setTimeout(function(){
                i.dequeue();
                }, time);
            });
        });
    };

$(document).ready(function(){

	
	if (document.getElementById("intSubnav")){
		$("#intSubnav").slideDown('slow');
	 }
	
	for (i = 1; i < 10; i++){
		var pauseInc = 200; 
		pauseInc = pauseInc * i;
		if (document.getElementById(i)){
			$("#"+i).idle(pauseInc).fadeIn('fast');
		 }
	}
	// show/hide before/after when first come to page
	for (i = 1; i < 10; i++){
		if(!document.getElementById("after"+i)){
			$("#contentBefore").css('display', 'none');
			$("#contentAfter").css('display', 'none');
		}
	}
	
	//project slides
	if (document.getElementById("contentProject") || document.getElementById("contentProjectNB")){
		// home slider rotation
		$('#projectSlides').cycle({ 
			fx:    'fade', 
			timeout:  15000,
			pager: '#projectNav',
			pagerAnchorBuilder: function(index, el) {
					return '<a href="#"></a>'; // whatever markup you want
			},
			slideExpr: 'p img'
		
		});
	}

});

