$(document).ready(function() {

	// COLORBOX
	$("a[rel='red-cedar-physiotherapy']").colorbox({ speed:1000, slideshow:false, slideshowSpeed:5000 });

	// FONT REPLACEMENT (CUFON)
	$('h1').css('font-size', '26px');	
	Cufon.replace('h1');
	$('#nav ul li').css('font-size', '32px');	
	Cufon.replace('#nav ul li');
	$('#sidebar .phone').css('font-size', '18px');	
	Cufon.replace('#sidebar .phone');
	$('#text').css('font-size', '18px');	
	Cufon.replace('#text');

    // SIDEBAR FIXED POSITIONING
    var msie6 = $.browser == 'msie' && $.browser.version < 7;
    if (!msie6) {
	    var top = $('#sidebar-2').offset().top - 10;
	    
	    $(window).scroll(function() {
	    	var y = $(window).scrollTop();
	    	if (y >= top) {
	    		$('#sidebar-2').addClass('fixed');
	    	} else {
	    		$('#sidebar-2').removeClass('fixed');    	
	    	}
	    });    
    }
});

// MODAL WINDOW
function display_modal_window() {

	$(document).ready(function() {

		var id = '#dialog';
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		$('#mask').fadeIn(500);
		$('#mask').fadeTo("slow",0.8);	
		var winH = $(window).height();
		var winW = $(window).width();
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
		$(id).fadeIn(500); 	
	
		$('#close-icon').click(function (e) {
			e.preventDefault();		
			$('#mask').hide();
			$('.window').hide();
		});		
		
		$('#mask').click(function () {
			$(this).hide();
			$('.window').hide();
		});    
	     
    });	
}

// GOOGLE MAP
function initialize_google_map() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map_canvas"));
    map.setMapType(G_HYBRID_MAP);
    var marker = new GLatLng(51.00160, -118.199420);
    map.setCenter(marker, 14);
	map.addOverlay(new GMarker(marker));
    map.openInfoWindowHtml(map.getCenter(), document.getElementById("google-maps-info-window"));
    map.setUIToDefault();
  }
}

