// XHTML Strict External Links
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href")&&
       anchor.getAttribute("rel")=="external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

// Jquery Variables
$(document).ready(function(){	   
						   
// PNG Fix for IE
    $(document).pngFix();	 
	
// Flash Embedding

// Home Page Flash
	$('#flash-home').flash(
		{ 
		  src: 'swf/home.swf',
		  height: 275,
		  width: 224,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);

// Braces in Action
	$('#flash-braces-in-action').flash(
		{ 
		  src: 'swf/braces-in-action.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			autoPlay: 'false',
			thisColor: '0x' + '076968',
			crowding: 'true',
			openbite: 'true',
			deepOverbite: 'true',
			missing: 'true',
			underbite: 'true',
			spacing: 'true',
			overbite: 'true',
			nonBraces: 'true',
			phaseI: 'true'
		  }
		},
		{ version: 8 }
	);
	
// Braces Diagram
	$('#flash-braces-diagram').flash(
		{ 
		  src: 'swf/braces-diagram.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: {
			thisColor: '0x' + '076968'
		  }
		},
		{ version: 8 }
	);

// Oral Care Video
	$('#flash-oral-care-video').flash(
		{ 
		  src: 'swf/oral-care-video.swf',
		  width: 500,
		  height: 350,
		  wmode: 'transparent',
		  flashvars: { 
			thisColor: '0x' + '076968',
			wmode: 'transparent'
		  }
		},
		{ version: 8 }
	);
	
// Brace Painter
	$('#flash-brace-painter').flash(
	  { 
		src: 'swf/brace-painter.swf',
		width: 500,
		height: 430,
		wmode: 'transparent'
	  },
	  { version: 8 }
	);
	
// Emergency Care / First Aid
	$('#flash-emergency-care').flash(
		{ 
		  src: 'swf/emergency-care.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			autoPlay: 'false',
			thisColor: '0x' + '076968',
			pokingWire: 'true',
			bracket: 'true',
			looseWire: 'true',
			appliance: 'true',
			headgear: 'false',
			soreness: 'true'
		  }
		},
		{ version: 8 }
	);
// Flash Video functions
//-------------------------------------------------------------------------------

var flashVideos = {
	
		defaults: {
		  // Define the configuation values applied to each module.
		  // Each module in flashModules can override these values.
		  
		  src: 'video/flvPlayer.swf',
		  width: 320,
		  height: 266, // Must add 26px to height to accomodate for the UI controls
		  wmode: 'transparent',
		  menu: false,
		  allowFullScreen: true,
		  flashvars: {
		    autoStart: "false", // change value to true to play on start
		    showScaleModes: "false", //set to false to disable scale modes menu
		    smoothVideo: "true", //set to false to disable video smoothing 
		  	hiddenGui: "false"
			},
		  pluginOptions: {version: 9}
		},
	
		videos: [
			{name: 'the-damon-system',config:{width: 240, height: 206}},
			{name: 'the-damon-system-2',config:{width: 400, height: 330}},
			{name: 'in-ovation',config:{}},
			{name: 'invisalign',config:{height: 239}},
			{name: 'ibraces-1',config:{}},
			{name: 'ibraces-2', config: {width: 352}},
			{name: 'ibraces-3', config: {width: 352}},
			{name: 'opalescense', config: {width: 400, height: 251}},
			{name: 'suresmile', config: {height: 206}}
		]
	};
	for (var j=0; j < flashVideos.videos.length; j++) {
		var video = flashVideos.videos[j];
		// combine default config settings with module config settings
		var vidConfig = $.extend({}, flashVideos.defaults, video.config);
		// combine default flashvars with module flashvars
		vidConfig.flashvars = $.extend({}, flashVideos.defaults.flashvars, video.config.flashvars);
		vidConfig.flashvars.flvToPlay = video.name + '.flv';
		vidConfig.flashvars.startImage = 'video/' + video.name + '.jpg';
		$('#video-' + video.name).flash(vidConfig, flashVideos.defaults.pluginOptions);
	};


});//end document.ready
