//JQuery Setup
$(function(){
 


	

	
// Fancybox Videos =================== >
$("a.fancy-video").fancybox({
	'frameWidth': 320,
	'frameHeight': 180,
	'zoomSpeedIn': 0,
	'zoomSpeedOut': 0,
	'overlayShow': true
});

$("a.fancy-video2").fancybox({
	'frameWidth': 360,
	'frameHeight': 240,
	'zoomSpeedIn': 0,
	'zoomSpeedOut': 0,
	'overlayShow': true
});

$('#video-invisalign').flash(
	{ 
	  src: 'flvPlayer.swf',
		width: 360,
	  height: 240,
	  wmode: 'transparent',
	  flashvars: { 
		flvToPlay: 'video/invisalign.flv',
		autoStart: 'true',
		scaleMode: 'full',
		hiddenGui: 'true',
		showScaleModes: 'false'
	  }
	},
	{ version: 8 }
);

$('#video-suresmile').flash(
	{ 
	  src: 'flvPlayer.swf',
		width: 320,
	  height: 180,
	  wmode: 'transparent',
	  flashvars: { 
		flvToPlay: 'video/suresmile.flv',
		autoStart: 'true',
		scaleMode: 'full',
		hiddenGui: 'true',
		showScaleModes: 'false'
	  }
	},
	{ version: 8 }
);



//Toggle functions
//---------------------------------------------------------------------------------
	
	// Show only when javascript is available
	$('.toggle-link').css('display','block');

	//hide lists first!
	$('#toggle-content div').css('display','none');	

	//toggle
	function toggleInfoContent(id){
		if($('#' + id).css('display') != 'none'){
		  $('#' + id).hide();
		}else{
		  $("#toggle-content div").hide();
		  $('#' + id).show();
		}
	}
	$(".toggle-anatomy").click(function(){
	    toggleInfoContent('anatomy-of-a-tooth');
	    return false;
	});
	
	$(".toggle-teeth").click(function(){
	    toggleInfoContent('flash-know-your-teeth');
	    return false;
	});
	//------
	
	

//Basic HTML functions
//---------------------------------------------------------------------------------

	// add 'back to top' link when the content is taller than the window
	// this has to be done after flash replacement because the content height changes
	if ($('#content').height() > $(window).height()) {
		$('.back-to-top').removeClass('hide');
	}
	
	// Some effects rely on an element to be initially hidden,
	// but we only hide them if the user has javascript
	$('.jshide').addClass('hide');
	
	
	//clear form fields
	$('.clearme').one("focus", function() {
			$(this).val("");
	});

	// Open external links in new windows
	$('a[href^="http://"]').not('[href*="orthosesame.com"]').addClass('external').attr('target', '_blank');
	
	// Open pdf links in new windows
	$('a[href$=".pdf"]').addClass('pdf').attr('target', '_blank');





});//end document.ready