// XHTML Strict External Links
sfHover = function() {
	var sfEls = document.getElementById("navigation").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

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;

//flash embed
$(document).ready(function(){

	// PNG Fixer Upper
	$(document).pngFix();

	//home page flash
	$('#flash-home').flash(
		{ 
		  src: 'home.swf',
		  width: 740,
		  height: 170,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);
	
	//brushing and flossing
	$('#flash-brushing-and-flossing').flash(
		{ 
		src: 'brushing-and-flossing.swf',
		width: 500,
		height: 300,
		wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change hex color (default=639CCE)
			thisColor: '0x' + '152B5E',
			//change item value to false to omit
			brushing: 'true',
			flossing: 'true'
		  }
		},
		{ version: 8 }
	);

	//color your retainer
	$('#flash-color-your-retainer').flash(
		{ 
		src: 'color-your-retainer.swf',
		width: 300,
		height: 300,
		wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change hex color (default=639CCE)
			thisColor: '0x' + '152B5E'
		  }
		},
		{ version: 8 }
	);

	//orthodontic treatments
	$('#flash-orthodontic-treatments').flash(
		{ 
		  src: 'orthodontic-treatments.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change hex color (default=639CCE)
			thisColor: '0x' + '152B5E',
			//change item value to false to omit
			crowding: 'true',
			openbite: 'true',
			deepOverbite: 'true',
			missing: 'true',
			underbite: 'true',
			spacing: 'true',
			overbite: 'true',
			nonBraces: 'true',
			phaseI: 'true'
		  }
		},
		{ version: 8 }
	);
	
	//Damon System 
	
	//comparison
	$('#flash-the-damon-system-comparison').flash(
		{ 
		  src: 'the-damon-system-comparison.swf',
		  width: 250,
		  height: 165,
		  wmode: 'transparent'
		},
		{ version: 7 }
	);
	
	//damon video
	$('#flash-the-damon-system').flash(
		{ 
		  src: 'video/flv-player.swf',
		  width: 300,
		  height: 275,
		  wmode: 'transparent',
		  flashvars: { FLVPath: 'the-damon-system.flv', SkinPath: 'video/SteelExternalAll.swf' }
		},
		{ version: 9 }
	);
	
	//for children slideshow 
	$('#flash-for-children').flash(
		{ 
		  src: 'for-children.swf',
		  width: 230,
		  height: 290,
		  wmode: 'transparent'
		},
		{ version: 9 }  
	);
	
	//for adults slideshow 
	$('#flash-for-adults').flash(
		{ 
		  src: 'for-adults.swf',
		  width: 230,
		  height: 290,
		  wmode: 'transparent'
		},
		{ version: 9 }
	);
	
	//token slideshow 
	$('#flash-token').flash(
		{ 
		  src: 'token.swf',
		  width: 230,
		  height: 290,
		  wmode: 'transparent'
		},
		{ version: 9 }
	);
	
	//for tmj slideshow 
	$('#flash-tmj').flash(
		{ 
		  src: 'tmj.swf',
		  width: 230,
		  height: 290,
		  wmode: 'transparent'
		},
		{ version: 9 }
	);
	
	//for appliances slideshow 
	$('#flash-appliances').flash(
		{ 
		  src: 'appliances.swf',
		  width: 230,
		  height: 290,
		  wmode: 'transparent'
		},
		{ version: 9 }
	);
	
	//for life slideshow 
	$('#flash-life').flash(
		{ 
		  src: 'life.swf',
		  width: 230,
		  height: 290,
		  wmode: 'transparent'
		},
		{ version: 9 }
	);
	
	//for links slideshow 
	$('#flash-links').flash(
		{ 
		  src: 'links.swf',
		  width: 230,
		  height: 290,
		  wmode: 'transparent'
		},
		{ version: 9 }
	);
	
	//for dictionary slideshow 
	$('#flash-dictionary').flash(
		{ 
		  src: 'dictionary.swf',
		  width: 230,
		  height: 290,
		  wmode: 'transparent'
		},
		{ version: 9 }
	);

	
	//the game room
	$("a.asteroids").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/asteroids.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	$("a.frogger").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/frogger.swf',
			  width: 400,
			  height: 432,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});	$("a.pong").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/pong.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	$("a.simon").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/simon.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	$("a.snake").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/snake.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	$("a.space-invaders").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/space-invaders.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	$("a.tetris").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/tetris.swf',
			  width: 400,
			  height: 398,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	$("a.tic-tac-toe").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/tic-tac-toe.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	
	
	
		// jQuery Cycle Plugin
	$('.slideshow').cycle({
	pause: true,
	wmode: 'transparent'
	});
	
	// Duplicate the following block of code to add extra office tours
	$('#cycle-office-tour') // Give this ID a unique name if more than one office tour is needed on a page
	.before('<div class="office-tour-nav" id="office-1">') // Ditto for this ID
	.cycle({
	cleartype: true, // true if clearType corrections should be applied (for IE)
	cleartypeNoBg: true, // Set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
	speed: 500, // This controls speed of transition
	timeout: 5000, // This controls delay between slides. Set to 0 if more than one office tour on a page, so they don't auto-play
	pager: '#office-1',
	before: function() {
	$('#caption span').fadeOut(); // Give this ID a unique name if more than one office tour is needed on a page
	},
	after: function(curr, next, opts) {
	var alt = $(next).find('img').attr('alt'); // This grabs the image alt text
	$('#caption span').html(alt).fadeIn(); // This puts alt text into the caption span
	}
	}); 
	
	
});