Cufon.replace('.header h2 ');

jQuery.fn.addEvent = jQuery.fn.bind;

function close_walk_on(){
	$('#walkOnContainer').html('');
	$.cookie("walk_on", "no");
}

function play_walk_on(){
	$.cookie("walk_on", "yes");
	window.location.reload(false);
}

jQuery(function($){
	$('.footer ul li:last-child span').remove();
	
	$('.blink').focus(function () {
		if ($(this).val() == $(this).attr('title')) {
			$(this).val('');
		}
	});
	
	$('.blink').blur(function () {
		if ($(this).val() == '') {
			$(this).val($(this).attr('title'));
		}
	});
	
	
	if($('#close_walk_on')){
		$('#close_walk_on').addEvent('click', function(){ close_walk_on(); });
	}
	
	if($('#walk_on_player')){
		$('#walk_on_player').addEvent('click', function(){ play_walk_on(); return false });
	}
	
	if($.cookie("walk_on") == "no") {
		$('#walkOnContainer').remove();	
	}
	else { 
		$('#walk_on').flash({
			swf: '/videos/walk_on.swf',
				width: 300,
				height: 400,		
			params: {
				wmode: "transparent",
				loop: false
			}
		});
	}
	
	$("ul#site_menu").superfish({ 
	    animation: {height:'show'},   // slide-down effect without fade-in 
	    delay:     1200,               // 1.2 second delay on mouseout
	    speed: 'fast',
	    autoArrows: true,
		dropShadows: true 
	});

	
	$('a[class~="external"]').click(function(){
		$(this).attr('target','_blank');
 	}); 
	
	$('a[rel~="external"]').click(function(){
		$(this).attr('target','_blank');
 	}); 
	
	if($("#dr-oogle").length > 0){
		$('head').append('<link rel="stylesheet" href="http://www.doctoroogle.com/getRatingStyles.css" type="text/css" />');
		$("#dr-oogle").append('<a href="http://www.doctoroogle.com"><img src="http://www.doctoroogle.com/images/medlogo.png" style="border:0" /></a>');
		$("#dr-oogle").append('<div id="getRating4_11840455" style="text-align:center;"></div><hr style="margin: 4px 0" />');
		$("#dr-oogle").append('<div id="getRating4_200544" style="text-align:center;"></div>');
		
		$("#dr-oogle").css({ backgroundColor: "#FFF", textAlign: "center", paddingLeft: "5px", border: "solid 1px #5AB5E7", marginBottom: "10px" });
	}
	

	// thumbnail scrollable
	$("#thumbnails").scrollable({size: 3, clickable: false, circular: true }).find("img").each(function(index) {
		// thumbnail images trigger the overlay
		$(this).overlay({
			effect: 'apple',
			target: '#box',
			mask: { maskId: 'mask' },

			// when box is opened, scroll to correct position (in 0 seconds)
			onLoad: function() {
				$("#images").data("scrollable").seekTo(index, 0);
			}
		});
	});

	// scrollable inside the box.
	$("#images").scrollable({ circular: true });

	// enable tooltips for the images
	/*
	$("#images img").tooltip({
		position: "bottom center",
		offset: [-75, -30],
		opacity: 0.8,
		effect: 'fade',

		// position tooltips relative to the parent scrollable
		relative: true
	});
	*/
	// enable reflections
	//$("#thumbnails img").reflect({height: 0.5, opacity: 0.6});

	

})
