

var page_switch = function(service){
	// If requesting service header and is not currently
	if (service == 'service' && $('#ph_sales').css('top') == "0px" ){
		// Phone Numbers
		$('#ph_sales').animate({top: '+=40px'});
		$('#ph_service').animate({top: '-=40px'});
		// Logos
		$('#logo_bcc').animate({top: '-=122px'});
		$('#logo_b2b').animate({top: '+=122px'});
		// Menus
		$('#bg_bcc').css({'z-index': '8'});
		$('#bg_b2b').css({'z-index': '9'});
		$('#bg_b2b').animate({top: '-=59px'},function(){ $('#bg_bcc').css({top: '59px'})});
	} else {
		// Only switch it needed
		if ( service != 'service' && $('#ph_sales').css('top') != "0px"){
			// Phone Numbers
			$('#ph_sales').animate({top: '-=40px'});
			$('#ph_service').animate({top: '+=40px'})
			// Logos
			$('#logo_bcc').animate({top: '+=122px'});
			$('#logo_b2b').animate({top: '-=122px'});
			// Menus
			$('#bg_b2b').css({'z-index': '8'});
			$('#bg_bcc').css({'z-index': '9'});
			$('#bg_bcc').animate({top: '-=59px'},function(){ $('#bg_b2b').css({top: '59px'})});
		}
	}
};

var page_refresh = function(){
	//Cufon.refresh('.rockwell')('h1'); 
	$('.rotator').cycle({ fx: 'fade', shuffle: { top: -220, left: 40}, timeout: 3000});
	$('.carousel').galleria({
		history : false,
		clickNext : true,
		insert : '#gallery_large',
		onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
				
				// fade in the image & caption
				caption.css('display','none')	//.fadeIn(1000);
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// add a title for the clickable image
				image.attr('title','Next image >>');
			}
	});
	// Solves AJAX Load issues
	if( $('.galleria').size() ){
		$.galleria.activate($('.galleria li:first img').attr('src'));
		$('.galleria li:first').addClass('active');
	}
	
}

$(document).ready(function(){
	page_refresh();
	
/*
	$('div.menu a').live('click',function(event){
		getPage($(this).attr('href'));
		// event.stopPropagation();
		event.preventDefault();
	});
	$('a.page').live('click',function(event){
		getPage($(this).attr('href'));
		event.stopPropagation();
		// event.preventDefault();
	});
*/
});

Cufon.replace('.rockwell',{hover:true})('h1');