
function initialize(){
	(function($){
		//wait for html to load before running script
		$(document).ready(function(){
			//interstitial
			/*
			$("#loading-mask")
	   		setTimeout( function(){
	         $("#loading-mask").fadeOut("fast");
	      	}, 200);
			 */
	
			//search box text replace
			 $('input[type=text]').focus(function(){ 
	    		if($(this).val() == $(this).attr('defaultValue'))
	   			{
	      		$(this).css('color','#000').val('');
	    		}
	  		});
	  
	  		$('input[type=text]').blur(function(){
	    		if($(this).val() == '')
	    		{
	      		$(this).css('color','#000').val($(this).attr('defaultValue'));
	    		} 
	  		});
	  			//load lightbox effect, show <p> tags in there.
				/*
				$("a#show-panel").click(function(){ 
				$('#lightbox-panel p').show(); 
				$("#lightbox, #lightbox-panel").fadeIn(300);  
				})  
				$("a.close-panel").css('cursor', 'pointer').click(function(){  
				$("#lightbox, #lightbox-panel").fadeOut(300);  
				})
				*/  
			
			//load sidebar rotator
			$(document).ready(function() {		
			//Load the slideshow
			theRotator();
			$('.rotator').fadeIn(1000);
	    	$('.rotator ul li').fadeIn(1000); // tweek for IE
			});
			//load top rotator
			$(document).ready(function() {		
			//Load the slideshow
			thetopRotator();
			$('.toprotator').fadeIn(1000);
	    	$('.toprotator ul li').fadeIn(1000); // tweek for IE
			});
	
	$('.rotator').slideDown(500, function() {});

	});
	
	})(jQuery);
}




//////////////////////////////
//sidebar rotator stuff here//
//////////////////////////////

function theRotator() {
	//Set the opacity of all images to 0
	$('div.rotator ul li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div.rotator ul li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	
	setInterval('rotate()',5000);
	
}

function rotate() {	
	//Get the first image
	var current = ($('.rotator ul li.show')?  $('.rotator ul li.show') : $('.rotator ul li:first'));

    if ( current.length == 0 ) current = $('.rotator ul li:first');

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('.rotator ul li:first') :current.next()) : $('.rotator ul li:first'));
	
	//Un-comment the 3 lines below to get the images in random order
	
	//var sibs = current.siblings();
        //var rndNum = Math.floor(Math.random() * sibs.length );
        //var next = $( sibs[ rndNum ] );
			

	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
};


//////////////////////////////
//top rotator stuff here//////
//////////////////////////////

function thetopRotator() {
	//Set the opacity of all images to 0
	$('div.toprotator ul li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div.toprotator ul li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	
	setInterval('topRotate()',3000);
	
}

function topRotate() {	
	//Get the first image
	var current = ($('.toprotator ul li.show')?  $('.toprotator ul li.show') : $('.toprotator ul li:first'));

    if ( current.length == 0 ) current = $('.toprotator ul li:first');

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('.toprotator ul li:first') :current.next()) : $('.toprotator ul li:first'));
	
	//Un-comment the 3 lines below to get the images in random order
	
	//var sibs = current.siblings();
        //var rndNum = Math.floor(Math.random() * sibs.length );
        //var next = $( sibs[ rndNum ] );
			

	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
};

