// 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 Flashes
	$('#flash-home-1').flash(
		{ 
		  src: 'swf/home-1.swf',
		  width: 350,
		  height: 169,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);
	
	$('#flash-home-2').flash(
		{ 
		  src: 'swf/home-2.swf',
		  width: 199,
		  height: 169,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);
	
// Office Tour
	$('#flash-office-tour').flash(
		{ 
		  src: 'swf/office-tour.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: { 
		  	caption01: 'Caption 1',
			caption02: 'Caption 2',
			caption03: 'Caption 3',
			caption04: 'Caption 4'
		  }
		},
		{ version: 8 }
	);

//Orthodontic Treatments
	$('#flash-orthodontic-treatments').flash(
		{ 
		  src: 'swf/orthodontic-treatments.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			autoPlay: 'false',
			thisColor: '0x' + '652D89',
			crowding: 'true',
			openbite: 'true',
			deepOverbite: 'true',
			missing: 'true',
			underbite: 'true',
			spacing: 'true',
			overbite: 'true',
			nonBraces: 'true',
			phaseI: 'true'
		  }
		},
		{ version: 8 }
	);
	
// Types of Braces
	$('#flash-types-of-braces').flash(
		{ 
		  src: 'swf/types-of-braces.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			autoPlay: 'false',
			thisColor: '0x' + '652D89',
			metal: 'true',
			gold: 'false',
			ceramic: 'true',
			invisible: 'true',
			lingual: 'false'
		  }
		},
		{ version: 8 }
	);

// Brushing and Flossing Instructions
	$('#flash-brushing-and-flossing').flash(
		{ 
		  src: 'swf/brushing-and-flossing.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			autoPlay: 'false',
			thisColor: '0x' + '652D89',
			brushing: 'true',
			flossing: 'true'
		  }
		},
		{ version: 8 }
	);

//Braces Diagram
	$('#flash-braces-diagram').flash(
		{ 
		  src: 'swf/braces-diagram.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: { 
			//change hex color (default=639CCE)
			thisColor: '0x' + '652D89'
		  }
		},
		{ version: 8 }
	);

//Oral Care Video
	$('#flash-oral-care-video').flash(
		{ 
		  src: 'oral-care-video.swf',
		  width: 455,
		  height: 341,
		  wmode: 'transparent',
		  flashvars: { 
			thisColor: '0x' + '652D89',
			wmode: 'transparent'
		  }
		},
		{ version: 8 }
	);

//Emergency Care 
	$('#flash-emergency-care').flash(
		{ 
		  src: 'swf/emergency-care.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			autoPlay: 'false',
			thisColor: '0x' + '652D89',
			pokingWire: 'true',
			bracket: 'true',
			looseWire: 'true',
			appliance: 'true',
			headgear: 'true',
			soreness: 'true'
		  }
		},
		{ version: 8 }
	);

// Damon System Comparison
	$('#flash-the-damon-system-comparison').flash(
		{ 
		  src: 'swf/the-damon-system-comparison.swf',
		  width: 250,
		  height: 165,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);

// Damon System
	$('#flash-the-damon-system').flash(
	{ 
	  src: 'swf/flv-player.swf',
	  width: 360,
	  height: 295,
	  wmode: 'transparent',
	  flashvars: { 
		flvToPlay: '../video/the-damon-system.flv',
		autoStart: 'false',
		scaleMode: 'full',
		startImage: 'video/thumbnails/the-damon-system.jpg',
		showScaleModes: 'false'
	  }
	},
	{ version: 8 }
);

// The Game Room
	$(function() {
    // define which games to activate
    var games = Array('asteroids', 'frogger', 'pong', 'simon', 'snake', 'space-invaders', 'tetris', 'tic-tac-toe');
  
    // set the click behavior for a game link
    var setGameClick = function(game){
      $("a." + game).click(function(){
        $('#sesame-game').flash(
          {
          src: 'games/' + game + '.swf',
          width: 400,
          height: 420,
          wmode: 'transparent'
          },
          { version: 8 }
        );
      });
    };
    
    // set the click behavior for each game
    for (var j=0; j<games.length; j++){
      setGameClick(games[j]);
    };
  });
  
});//end document.ready
