// JavaScript Document
var ftc = {};
ftc.userAgent = navigator.userAgent;
$(document).ready(function(){
debugging=true;
	$(".emailLink").click(function () { 
      	mail_str = "mailto:?subject=Check out the " + document.title;
		mail_str += "&body=I thought you might be interested in the " + document.title + " page on the UCSF Fetal Treatment Center website.";
		mail_str += ".  You can view it at, " + location.href; 
		location.href = mail_str;
		return false;
    });
	$(".printLink").click(function () {
		window.print();
		return false;
	});
	$("#birthDefectsSelect").toggle(
		function () {
			$("#birthDefectsSubMenu").slideDown("slow");
			$(this).css({'background' : '#E6E1DA url(/global_images/defect_nav_arrow.gif) no-repeat 3px -17px'});
		},
		function () {
			$("#birthDefectsSubMenu").hide();
			$(this).css({'background' : '#E6E1DA url(/global_images/defect_nav_arrow.gif) no-repeat 3px 4px'});
		}
	);
	$(".watchvid").each(function (i) {
        var url = this.href;
		var vidId = url.split('v=')[1].split('&')[0];
		var vidthumb = $(this).children()[0];
		if( jQuery.browser.msie && (jQuery.browser.version <= 7) ) {
			$(vidthumb).replaceWith("<img src='http://i2.ytimg.com/vi/"+ vidId +"/default.jpg' alt='watchvideo' />");
			$(this).append("<span class='vidbtnIE'>Watch Video</span>");
		} else {
			$(vidthumb).replaceWith("<span class='outerwrapper'><span class='innerwrapper'><img src='http://i2.ytimg.com/vi/"+ vidId +"/default.jpg' alt='watch video' /></span></span>");
		}
      });
	$(".ceebox").ceebox({htmlWidth:860});
	$(".ajaxlink").ceebox({htmlWidth:500});
	$("#middleColumn, .relatedVideo, #relatedVideo").ceebox({videoWidth:700,videoRatio:"3:2",html:false});
	$('img.protect').shieldimage({image:"/images/blank.gif"});
	if (!(ftc.userAgent.match(/iPhone/i)) && !(ftc.userAgent.match(/iPod/i))) $(".watchvid").ceetip();
	
});



